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); |
281 // Creates a datagram socket which is bound. The port to bind | 284 // Creates a datagram socket which is bound. The port to bind |
282 // to is specified as the port component of the RawAddr structure. | 285 // to is specified as the port component of the RawAddr structure. |
283 static intptr_t CreateBindDatagram(const RawAddr& addr, bool reuseAddress); | 286 static intptr_t CreateBindDatagram(const RawAddr& addr, bool reuseAddress); |
284 static intptr_t GetPort(intptr_t fd); | 287 static intptr_t GetPort(intptr_t fd); |
285 static SocketAddress* GetRemotePeer(intptr_t fd, intptr_t* port); | 288 static SocketAddress* GetRemotePeer(intptr_t fd, intptr_t* port); |
286 static void GetError(intptr_t fd, OSError* os_error); | 289 static void GetError(intptr_t fd, OSError* os_error); |
287 static int GetType(intptr_t fd); | 290 static int GetType(intptr_t fd); |
288 static intptr_t GetStdioHandle(intptr_t num); | 291 static intptr_t GetStdioHandle(intptr_t num); |
289 static void Close(intptr_t fd); | 292 static void Close(intptr_t fd); |
290 static bool GetNoDelay(intptr_t fd, bool* enabled); | 293 static bool GetNoDelay(intptr_t fd, bool* enabled); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 typedef std::map<intptr_t, OSSocket*>::iterator SocketsIterator; | 444 typedef std::map<intptr_t, OSSocket*>::iterator SocketsIterator; |
442 | 445 |
443 private: | 446 private: |
444 DISALLOW_COPY_AND_ASSIGN(ListeningSocketRegistry); | 447 DISALLOW_COPY_AND_ASSIGN(ListeningSocketRegistry); |
445 }; | 448 }; |
446 | 449 |
447 } // namespace bin | 450 } // namespace bin |
448 } // namespace dart | 451 } // namespace dart |
449 | 452 |
450 #endif // BIN_SOCKET_H_ | 453 #endif // BIN_SOCKET_H_ |
OLD | NEW |