OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef BIN_SOCKET_H_ | 5 #ifndef BIN_SOCKET_H_ |
6 #define BIN_SOCKET_H_ | 6 #define BIN_SOCKET_H_ |
7 | 7 |
8 #if defined(DART_IO_DISABLED) | 8 #if defined(DART_IO_DISABLED) |
9 #error "socket.h can only be included on builds with IO enabled" | 9 #error "socket.h can only be included on builds with IO enabled" |
10 #endif | 10 #endif |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 intptr_t fd, const void* buffer, intptr_t num_bytes, const RawAddr& addr); | 271 intptr_t fd, const void* buffer, intptr_t num_bytes, const RawAddr& addr); |
272 static intptr_t RecvFrom( | 272 static intptr_t RecvFrom( |
273 intptr_t fd, void* buffer, intptr_t num_bytes, RawAddr* addr); | 273 intptr_t fd, void* buffer, intptr_t num_bytes, RawAddr* addr); |
274 // Creates a socket which is bound and connected. The port to connect to is | 274 // Creates a socket which is bound and connected. The port to connect to is |
275 // specified as the port component of the passed RawAddr structure. | 275 // specified as the port component of the passed RawAddr structure. |
276 static intptr_t CreateConnect(const RawAddr& addr); | 276 static intptr_t CreateConnect(const RawAddr& addr); |
277 // Creates a socket which is bound and connected. The port to connect to is | 277 // Creates a socket which is bound and connected. The port to connect to is |
278 // specified as the port component of the passed RawAddr structure. | 278 // specified as the port component of the passed RawAddr structure. |
279 static intptr_t CreateBindConnect(const RawAddr& addr, | 279 static intptr_t CreateBindConnect(const RawAddr& addr, |
280 const RawAddr& source_addr); | 280 const RawAddr& source_addr); |
281 // Returns true if the given error-number is because the system was not able | |
282 // to bind the socket to a specific IP. | |
283 static bool IsBindError(intptr_t error_number); | |
284 // Creates a datagram socket which is bound. The port to bind | 281 // Creates a datagram socket which is bound. The port to bind |
285 // to is specified as the port component of the RawAddr structure. | 282 // to is specified as the port component of the RawAddr structure. |
286 static intptr_t CreateBindDatagram(const RawAddr& addr, bool reuseAddress); | 283 static intptr_t CreateBindDatagram(const RawAddr& addr, bool reuseAddress); |
287 static intptr_t GetPort(intptr_t fd); | 284 static intptr_t GetPort(intptr_t fd); |
288 static SocketAddress* GetRemotePeer(intptr_t fd, intptr_t* port); | 285 static SocketAddress* GetRemotePeer(intptr_t fd, intptr_t* port); |
289 static void GetError(intptr_t fd, OSError* os_error); | 286 static void GetError(intptr_t fd, OSError* os_error); |
290 static int GetType(intptr_t fd); | 287 static int GetType(intptr_t fd); |
291 static intptr_t GetStdioHandle(intptr_t num); | 288 static intptr_t GetStdioHandle(intptr_t num); |
292 static void Close(intptr_t fd); | 289 static void Close(intptr_t fd); |
293 static bool GetNoDelay(intptr_t fd, bool* enabled); | 290 static bool GetNoDelay(intptr_t fd, bool* enabled); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 typedef std::map<intptr_t, OSSocket*>::iterator SocketsIterator; | 441 typedef std::map<intptr_t, OSSocket*>::iterator SocketsIterator; |
445 | 442 |
446 private: | 443 private: |
447 DISALLOW_COPY_AND_ASSIGN(ListeningSocketRegistry); | 444 DISALLOW_COPY_AND_ASSIGN(ListeningSocketRegistry); |
448 }; | 445 }; |
449 | 446 |
450 } // namespace bin | 447 } // namespace bin |
451 } // namespace dart | 448 } // namespace dart |
452 | 449 |
453 #endif // BIN_SOCKET_H_ | 450 #endif // BIN_SOCKET_H_ |
OLD | NEW |