| 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 #include "bin/builtin.h" | 8 #include "bin/builtin.h" |
| 9 #include "bin/utils.h" | 9 #include "bin/utils.h" |
| 10 | 10 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 T** addresses_; | 143 T** addresses_; |
| 144 | 144 |
| 145 DISALLOW_COPY_AND_ASSIGN(AddressList); | 145 DISALLOW_COPY_AND_ASSIGN(AddressList); |
| 146 }; | 146 }; |
| 147 | 147 |
| 148 class Socket { | 148 class Socket { |
| 149 public: | 149 public: |
| 150 enum SocketRequest { | 150 enum SocketRequest { |
| 151 kLookupRequest = 0, | 151 kLookupRequest = 0, |
| 152 kListInterfacesRequest = 1, | 152 kListInterfacesRequest = 1, |
| 153 kReverseLookupRequest = 2, |
| 153 }; | 154 }; |
| 154 | 155 |
| 155 static bool Initialize(); | 156 static bool Initialize(); |
| 156 static intptr_t Available(intptr_t fd); | 157 static intptr_t Available(intptr_t fd); |
| 157 static int Read(intptr_t fd, void* buffer, intptr_t num_bytes); | 158 static int Read(intptr_t fd, void* buffer, intptr_t num_bytes); |
| 158 static int Write(intptr_t fd, const void* buffer, intptr_t num_bytes); | 159 static int Write(intptr_t fd, const void* buffer, intptr_t num_bytes); |
| 159 static intptr_t Create(RawAddr addr); | 160 static intptr_t Create(RawAddr addr); |
| 160 static intptr_t Connect(intptr_t fd, RawAddr addr, const intptr_t port); | 161 static intptr_t Connect(intptr_t fd, RawAddr addr, const intptr_t port); |
| 161 static intptr_t CreateConnect(RawAddr addr, | 162 static intptr_t CreateConnect(RawAddr addr, |
| 162 const intptr_t port); | 163 const intptr_t port); |
| 163 static intptr_t GetPort(intptr_t fd); | 164 static intptr_t GetPort(intptr_t fd); |
| 164 static bool GetRemotePeer(intptr_t fd, char* host, intptr_t* port); | 165 static bool GetRemotePeer(intptr_t fd, char* host, intptr_t* port); |
| 165 static void GetError(intptr_t fd, OSError* os_error); | 166 static void GetError(intptr_t fd, OSError* os_error); |
| 166 static int GetType(intptr_t fd); | 167 static int GetType(intptr_t fd); |
| 167 static intptr_t GetStdioHandle(int num); | 168 static intptr_t GetStdioHandle(int num); |
| 168 static void Close(intptr_t fd); | 169 static void Close(intptr_t fd); |
| 169 static bool SetNonBlocking(intptr_t fd); | 170 static bool SetNonBlocking(intptr_t fd); |
| 170 static bool SetBlocking(intptr_t fd); | 171 static bool SetBlocking(intptr_t fd); |
| 171 static bool SetNoDelay(intptr_t fd, bool enabled); | 172 static bool SetNoDelay(intptr_t fd, bool enabled); |
| 172 | 173 |
| 173 // Perform a hostname lookup. Returns a AddressList of SocketAddress's. | 174 // Perform a hostname lookup. Returns a AddressList of SocketAddress's. |
| 174 static AddressList<SocketAddress>* LookupAddress(const char* host, | 175 static AddressList<SocketAddress>* LookupAddress(const char* host, |
| 175 int type, | 176 int type, |
| 176 OSError** os_error); | 177 OSError** os_error); |
| 178 static bool ReverseLookup(RawAddr addr, |
| 179 char* host, |
| 180 intptr_t host_len, |
| 181 OSError** os_error); |
| 177 | 182 |
| 178 // List interfaces. Returns a AddressList of InterfaceSocketAddress's. | 183 // List interfaces. Returns a AddressList of InterfaceSocketAddress's. |
| 179 static AddressList<InterfaceSocketAddress>* ListInterfaces( | 184 static AddressList<InterfaceSocketAddress>* ListInterfaces( |
| 180 int type, | 185 int type, |
| 181 OSError** os_error); | 186 OSError** os_error); |
| 182 | 187 |
| 183 static Dart_Port GetServicePort(); | 188 static Dart_Port GetServicePort(); |
| 184 | 189 |
| 185 static Dart_Handle SetSocketIdNativeField(Dart_Handle socket, intptr_t id); | 190 static Dart_Handle SetSocketIdNativeField(Dart_Handle socket, intptr_t id); |
| 186 static Dart_Handle GetSocketIdNativeField(Dart_Handle socket, intptr_t* id); | 191 static Dart_Handle GetSocketIdNativeField(Dart_Handle socket, intptr_t* id); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 214 | 219 |
| 215 private: | 220 private: |
| 216 DISALLOW_ALLOCATION(); | 221 DISALLOW_ALLOCATION(); |
| 217 DISALLOW_IMPLICIT_CONSTRUCTORS(ServerSocket); | 222 DISALLOW_IMPLICIT_CONSTRUCTORS(ServerSocket); |
| 218 }; | 223 }; |
| 219 | 224 |
| 220 } // namespace bin | 225 } // namespace bin |
| 221 } // namespace dart | 226 } // namespace dart |
| 222 | 227 |
| 223 #endif // BIN_SOCKET_H_ | 228 #endif // BIN_SOCKET_H_ |
| OLD | NEW |