Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(612)

Unified Diff: webrtc/base/socket.h

Issue 2877023002: Move webrtc/{base => rtc_base} (Closed)
Patch Set: update presubmit.py and DEPS include rules Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/base/sigslottester_unittest.cc ('k') | webrtc/base/socket_unittest.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/socket.h
diff --git a/webrtc/base/socket.h b/webrtc/base/socket.h
index 38a51f828eb50f9392a79e460f3f56b23cbb8ba3..19ea7a032ff63a09a5197775e75226f3eeecba50 100644
--- a/webrtc/base/socket.h
+++ b/webrtc/base/socket.h
@@ -8,190 +8,12 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef WEBRTC_BASE_SOCKET_H__
-#define WEBRTC_BASE_SOCKET_H__
+#ifndef WEBRTC_BASE_SOCKET_H_
+#define WEBRTC_BASE_SOCKET_H_
-#include <errno.h>
-#if defined(WEBRTC_POSIX)
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <arpa/inet.h>
-#include <netinet/in.h>
-#define SOCKET_EACCES EACCES
-#endif
+// This header is deprecated and is just left here temporarily during
+// refactoring. See https://bugs.webrtc.org/7634 for more details.
+#include "webrtc/rtc_base/socket.h"
-#if defined(WEBRTC_WIN)
-#include "webrtc/base/win32.h"
-#endif
-
-#include "webrtc/base/basictypes.h"
-#include "webrtc/base/constructormagic.h"
-#include "webrtc/base/socketaddress.h"
-
-// Rather than converting errors into a private namespace,
-// Reuse the POSIX socket api errors. Note this depends on
-// Win32 compatibility.
-
-#if defined(WEBRTC_WIN)
-#undef EWOULDBLOCK // Remove errno.h's definition for each macro below.
-#define EWOULDBLOCK WSAEWOULDBLOCK
-#undef EINPROGRESS
-#define EINPROGRESS WSAEINPROGRESS
-#undef EALREADY
-#define EALREADY WSAEALREADY
-#undef ENOTSOCK
-#define ENOTSOCK WSAENOTSOCK
-#undef EDESTADDRREQ
-#define EDESTADDRREQ WSAEDESTADDRREQ
-#undef EMSGSIZE
-#define EMSGSIZE WSAEMSGSIZE
-#undef EPROTOTYPE
-#define EPROTOTYPE WSAEPROTOTYPE
-#undef ENOPROTOOPT
-#define ENOPROTOOPT WSAENOPROTOOPT
-#undef EPROTONOSUPPORT
-#define EPROTONOSUPPORT WSAEPROTONOSUPPORT
-#undef ESOCKTNOSUPPORT
-#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
-#undef EOPNOTSUPP
-#define EOPNOTSUPP WSAEOPNOTSUPP
-#undef EPFNOSUPPORT
-#define EPFNOSUPPORT WSAEPFNOSUPPORT
-#undef EAFNOSUPPORT
-#define EAFNOSUPPORT WSAEAFNOSUPPORT
-#undef EADDRINUSE
-#define EADDRINUSE WSAEADDRINUSE
-#undef EADDRNOTAVAIL
-#define EADDRNOTAVAIL WSAEADDRNOTAVAIL
-#undef ENETDOWN
-#define ENETDOWN WSAENETDOWN
-#undef ENETUNREACH
-#define ENETUNREACH WSAENETUNREACH
-#undef ENETRESET
-#define ENETRESET WSAENETRESET
-#undef ECONNABORTED
-#define ECONNABORTED WSAECONNABORTED
-#undef ECONNRESET
-#define ECONNRESET WSAECONNRESET
-#undef ENOBUFS
-#define ENOBUFS WSAENOBUFS
-#undef EISCONN
-#define EISCONN WSAEISCONN
-#undef ENOTCONN
-#define ENOTCONN WSAENOTCONN
-#undef ESHUTDOWN
-#define ESHUTDOWN WSAESHUTDOWN
-#undef ETOOMANYREFS
-#define ETOOMANYREFS WSAETOOMANYREFS
-#undef ETIMEDOUT
-#define ETIMEDOUT WSAETIMEDOUT
-#undef ECONNREFUSED
-#define ECONNREFUSED WSAECONNREFUSED
-#undef ELOOP
-#define ELOOP WSAELOOP
-#undef ENAMETOOLONG
-#define ENAMETOOLONG WSAENAMETOOLONG
-#undef EHOSTDOWN
-#define EHOSTDOWN WSAEHOSTDOWN
-#undef EHOSTUNREACH
-#define EHOSTUNREACH WSAEHOSTUNREACH
-#undef ENOTEMPTY
-#define ENOTEMPTY WSAENOTEMPTY
-#undef EPROCLIM
-#define EPROCLIM WSAEPROCLIM
-#undef EUSERS
-#define EUSERS WSAEUSERS
-#undef EDQUOT
-#define EDQUOT WSAEDQUOT
-#undef ESTALE
-#define ESTALE WSAESTALE
-#undef EREMOTE
-#define EREMOTE WSAEREMOTE
-#undef EACCES
-#define SOCKET_EACCES WSAEACCES
-#endif // WEBRTC_WIN
-
-#if defined(WEBRTC_POSIX)
-#define INVALID_SOCKET (-1)
-#define SOCKET_ERROR (-1)
-#define closesocket(s) close(s)
-#endif // WEBRTC_POSIX
-
-namespace rtc {
-
-inline bool IsBlockingError(int e) {
- return (e == EWOULDBLOCK) || (e == EAGAIN) || (e == EINPROGRESS);
-}
-
-struct SentPacket {
- SentPacket() : packet_id(-1), send_time_ms(-1) {}
- SentPacket(int packet_id, int64_t send_time_ms)
- : packet_id(packet_id), send_time_ms(send_time_ms) {}
-
- int packet_id;
- int64_t send_time_ms;
-};
-
-// General interface for the socket implementations of various networks. The
-// methods match those of normal UNIX sockets very closely.
-class Socket {
- public:
- virtual ~Socket() {}
-
- // Returns the address to which the socket is bound. If the socket is not
- // bound, then the any-address is returned.
- virtual SocketAddress GetLocalAddress() const = 0;
-
- // Returns the address to which the socket is connected. If the socket is
- // not connected, then the any-address is returned.
- virtual SocketAddress GetRemoteAddress() const = 0;
-
- virtual int Bind(const SocketAddress& addr) = 0;
- virtual int Connect(const SocketAddress& addr) = 0;
- virtual int Send(const void *pv, size_t cb) = 0;
- virtual int SendTo(const void *pv, size_t cb, const SocketAddress& addr) = 0;
- // |timestamp| is in units of microseconds.
- virtual int Recv(void* pv, size_t cb, int64_t* timestamp) = 0;
- virtual int RecvFrom(void* pv,
- size_t cb,
- SocketAddress* paddr,
- int64_t* timestamp) = 0;
- virtual int Listen(int backlog) = 0;
- virtual Socket *Accept(SocketAddress *paddr) = 0;
- virtual int Close() = 0;
- virtual int GetError() const = 0;
- virtual void SetError(int error) = 0;
- inline bool IsBlocking() const { return IsBlockingError(GetError()); }
-
- enum ConnState {
- CS_CLOSED,
- CS_CONNECTING,
- CS_CONNECTED
- };
- virtual ConnState GetState() const = 0;
-
- enum Option {
- OPT_DONTFRAGMENT,
- OPT_RCVBUF, // receive buffer size
- OPT_SNDBUF, // send buffer size
- OPT_NODELAY, // whether Nagle algorithm is enabled
- OPT_IPV6_V6ONLY, // Whether the socket is IPv6 only.
- OPT_DSCP, // DSCP code
- OPT_RTP_SENDTIME_EXTN_ID, // This is a non-traditional socket option param.
- // This is specific to libjingle and will be used
- // if SendTime option is needed at socket level.
- };
- virtual int GetOption(Option opt, int* value) = 0;
- virtual int SetOption(Option opt, int value) = 0;
-
- protected:
- Socket() {}
-
- private:
- RTC_DISALLOW_COPY_AND_ASSIGN(Socket);
-};
-
-} // namespace rtc
-
-#endif // WEBRTC_BASE_SOCKET_H__
+#endif // WEBRTC_BASE_SOCKET_H_
« no previous file with comments | « webrtc/base/sigslottester_unittest.cc ('k') | webrtc/base/socket_unittest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698