147be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org/*
247be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org *  Copyright 2012 The WebRTC Project Authors. All rights reserved.
347be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org *
447be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org *  Use of this source code is governed by a BSD-style license
547be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org *  that can be found in the LICENSE file in the root of the source
647be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org *  tree. An additional intellectual property rights grant can be found
747be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org *  in the file PATENTS.  All contributing project authors may
847be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org *  be found in the AUTHORS file in the root of the source tree.
947be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org */
1047be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org
1147be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org#ifndef WEBRTC_BASE_NULLSOCKETSERVER_H_
1247be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org#define WEBRTC_BASE_NULLSOCKETSERVER_H_
1347be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org
1447be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org#include "webrtc/base/event.h"
1547be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org#include "webrtc/base/physicalsocketserver.h"
1647be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org
1747be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.orgnamespace rtc {
1847be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org
1947be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org// NullSocketServer
2047be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org
2147be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.orgclass NullSocketServer : public rtc::SocketServer {
2247be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org public:
2347be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org  NullSocketServer() : event_(false, false) {}
2447be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org
2547be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org  virtual bool Wait(int cms, bool process_io) {
2647be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org    event_.Wait(cms);
2747be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org    return true;
2847be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org  }
2947be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org
3047be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org  virtual void WakeUp() {
3147be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org    event_.Set();
3247be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org  }
3347be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org
3447be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org  virtual rtc::Socket* CreateSocket(int type) {
3547be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org    ASSERT(false);
3647be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org    return NULL;
3747be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org  }
3847be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org
3947be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org  virtual rtc::Socket* CreateSocket(int family, int type) {
4047be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org    ASSERT(false);
4147be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org    return NULL;
4247be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org  }
4347be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org
4447be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org  virtual rtc::AsyncSocket* CreateAsyncSocket(int type) {
4547be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org    ASSERT(false);
4647be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org    return NULL;
4747be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org  }
4847be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org
4947be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org  virtual rtc::AsyncSocket* CreateAsyncSocket(int family, int type) {
5047be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org    ASSERT(false);
5147be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org    return NULL;
5247be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org  }
5347be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org
5447be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org
5547be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org private:
5647be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org  rtc::Event event_;
5747be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org};
5847be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org
5947be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org}  // namespace rtc
6047be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org
6147be73b8629244d6bb63a28198f97f040ce53d21henrike@webrtc.org#endif  // WEBRTC_BASE_NULLSOCKETSERVER_H_
62