| 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 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 enum SocketRequest { | 29 enum SocketRequest { |
| 30 kLookupRequest = 0, | 30 kLookupRequest = 0, |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 static bool Initialize(); | 33 static bool Initialize(); |
| 34 static intptr_t Available(intptr_t fd); | 34 static intptr_t Available(intptr_t fd); |
| 35 static int Read(intptr_t fd, void* buffer, intptr_t num_bytes); | 35 static int Read(intptr_t fd, void* buffer, intptr_t num_bytes); |
| 36 static int Write(intptr_t fd, const void* buffer, intptr_t num_bytes); | 36 static int Write(intptr_t fd, const void* buffer, intptr_t num_bytes); |
| 37 static intptr_t CreateConnect(const char* host, const intptr_t port); | 37 static intptr_t CreateConnect(const char* host, const intptr_t port); |
| 38 static intptr_t GetPort(intptr_t fd); | 38 static intptr_t GetPort(intptr_t fd); |
| 39 static bool GetRemotePeer(intptr_t fd, char *host, intptr_t *port); | 39 static bool GetRemotePeer(intptr_t fd, char* host, intptr_t* port); |
| 40 static void GetError(intptr_t fd, OSError* os_error); | 40 static void GetError(intptr_t fd, OSError* os_error); |
| 41 static intptr_t GetStdioHandle(int num); | 41 static intptr_t GetStdioHandle(int num); |
| 42 | 42 |
| 43 // Perform a IPv4 hostname lookup. Returns the hostname string in | 43 // Perform a IPv4 hostname lookup. Returns the hostname string in |
| 44 // IPv4 dotted-decimal format. | 44 // IPv4 dotted-decimal format. |
| 45 static const char* LookupIPv4Address(char* host, OSError** os_error); | 45 static const char* LookupIPv4Address(char* host, OSError** os_error); |
| 46 | 46 |
| 47 static Dart_Port GetServicePort(); | 47 static Dart_Port GetServicePort(); |
| 48 | 48 |
| 49 static Dart_Handle SetSocketIdNativeField(Dart_Handle socket, intptr_t id); |
| 50 static Dart_Handle GetSocketIdNativeField(Dart_Handle socket, intptr_t* id); |
| 51 |
| 49 private: | 52 private: |
| 50 static dart::Mutex mutex_; | 53 static dart::Mutex mutex_; |
| 51 static int service_ports_size_; | 54 static int service_ports_size_; |
| 52 static Dart_Port* service_ports_; | 55 static Dart_Port* service_ports_; |
| 53 static int service_ports_index_; | 56 static int service_ports_index_; |
| 54 | 57 |
| 55 DISALLOW_ALLOCATION(); | 58 DISALLOW_ALLOCATION(); |
| 56 DISALLOW_IMPLICIT_CONSTRUCTORS(Socket); | 59 DISALLOW_IMPLICIT_CONSTRUCTORS(Socket); |
| 57 }; | 60 }; |
| 58 | 61 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 70 // -5: invalid bindAddress | 73 // -5: invalid bindAddress |
| 71 static intptr_t CreateBindListen(const char* bindAddress, | 74 static intptr_t CreateBindListen(const char* bindAddress, |
| 72 intptr_t port, | 75 intptr_t port, |
| 73 intptr_t backlog); | 76 intptr_t backlog); |
| 74 | 77 |
| 75 DISALLOW_ALLOCATION(); | 78 DISALLOW_ALLOCATION(); |
| 76 DISALLOW_IMPLICIT_CONSTRUCTORS(ServerSocket); | 79 DISALLOW_IMPLICIT_CONSTRUCTORS(ServerSocket); |
| 77 }; | 80 }; |
| 78 | 81 |
| 79 #endif // BIN_SOCKET_H_ | 82 #endif // BIN_SOCKET_H_ |
| OLD | NEW |