| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #include "bin/builtin.h" | 8 #include "bin/builtin.h" |
| 9 #include "bin/utils.h" | 9 #include "bin/utils.h" |
| 10 #include "platform/globals.h" | 10 #include "platform/globals.h" |
| 11 #include "platform/thread.h" | 11 #include "platform/thread.h" |
| 12 | 12 |
| 13 | 13 |
| 14 class Socket { | 14 class Socket { |
| 15 public: | 15 public: |
| 16 enum SocketRequest { | 16 enum SocketRequest { |
| 17 kLookupRequest = 0, | 17 kLookupRequest = 0, |
| 18 }; | 18 }; |
| 19 | 19 |
| 20 static bool Initialize(); | 20 static bool Initialize(); |
| 21 static intptr_t Available(intptr_t fd); | 21 static intptr_t Available(intptr_t fd); |
| 22 static int Read(intptr_t fd, void* buffer, intptr_t num_bytes); | 22 static int Read(intptr_t fd, void* buffer, intptr_t num_bytes); |
| 23 static int Write(intptr_t fd, const void* buffer, intptr_t num_bytes); | 23 static int Write(intptr_t fd, const void* buffer, intptr_t num_bytes); |
| 24 static intptr_t CreateConnect(const char* host, const intptr_t port); | 24 static intptr_t CreateConnect(const char* host, const intptr_t port); |
| 25 static intptr_t GetPort(intptr_t fd); | 25 static intptr_t GetPort(intptr_t fd); |
| 26 static intptr_t GetRemotePort(intptr_t fd); | 26 static bool GetRemotePeer(intptr_t fd, const char **host, int *port); |
| 27 static void GetError(intptr_t fd, OSError* os_error); | 27 static void GetError(intptr_t fd, OSError* os_error); |
| 28 static intptr_t GetStdioHandle(int num); | 28 static intptr_t GetStdioHandle(int num); |
| 29 | 29 |
| 30 // Perform a IPv4 hostname lookup. Returns the hostname string in | 30 // Perform a IPv4 hostname lookup. Returns the hostname string in |
| 31 // IPv4 dotted-decimal format. | 31 // IPv4 dotted-decimal format. |
| 32 static const char* LookupIPv4Address(char* host, OSError** os_error); | 32 static const char* LookupIPv4Address(char* host, OSError** os_error); |
| 33 | 33 |
| 34 static Dart_Port GetServicePort(); | 34 static Dart_Port GetServicePort(); |
| 35 | 35 |
| 36 private: | 36 private: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 51 static intptr_t Accept(intptr_t fd); | 51 static intptr_t Accept(intptr_t fd); |
| 52 static intptr_t CreateBindListen(const char* bindAddress, | 52 static intptr_t CreateBindListen(const char* bindAddress, |
| 53 intptr_t port, | 53 intptr_t port, |
| 54 intptr_t backlog); | 54 intptr_t backlog); |
| 55 | 55 |
| 56 DISALLOW_ALLOCATION(); | 56 DISALLOW_ALLOCATION(); |
| 57 DISALLOW_IMPLICIT_CONSTRUCTORS(ServerSocket); | 57 DISALLOW_IMPLICIT_CONSTRUCTORS(ServerSocket); |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 #endif // BIN_SOCKET_H_ | 60 #endif // BIN_SOCKET_H_ |
| OLD | NEW |