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 #include "bin/dartutils.h" | 10 #include "bin/dartutils.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 private: | 103 private: |
104 char as_string_[INET6_ADDRSTRLEN]; | 104 char as_string_[INET6_ADDRSTRLEN]; |
105 RawAddr addr_; | 105 RawAddr addr_; |
106 | 106 |
107 DISALLOW_COPY_AND_ASSIGN(SocketAddress); | 107 DISALLOW_COPY_AND_ASSIGN(SocketAddress); |
108 }; | 108 }; |
109 | 109 |
110 class InterfaceSocketAddress { | 110 class InterfaceSocketAddress { |
111 public: | 111 public: |
112 explicit InterfaceSocketAddress(struct sockaddr* sa, | 112 explicit InterfaceSocketAddress(struct sockaddr* sa, |
113 const char* interface_name) | 113 const char* interface_name, |
| 114 intptr_t interface_index) |
114 : socket_address_(new SocketAddress(sa)), | 115 : socket_address_(new SocketAddress(sa)), |
115 interface_name_(interface_name) {} | 116 interface_name_(interface_name), |
| 117 interface_index_(interface_index) {} |
116 | 118 |
117 ~InterfaceSocketAddress() { | 119 ~InterfaceSocketAddress() { |
118 delete socket_address_; | 120 delete socket_address_; |
119 free(const_cast<char*>(interface_name_)); | 121 free(const_cast<char*>(interface_name_)); |
120 } | 122 } |
121 | 123 |
122 SocketAddress* socket_address() const { return socket_address_; } | 124 SocketAddress* socket_address() const { return socket_address_; } |
123 const char* interface_name() const { return interface_name_; } | 125 const char* interface_name() const { return interface_name_; } |
| 126 int interface_index() const { return interface_index_; } |
124 | 127 |
125 private: | 128 private: |
126 SocketAddress* socket_address_; | 129 SocketAddress* socket_address_; |
127 const char* interface_name_; | 130 const char* interface_name_; |
| 131 intptr_t interface_index_; |
128 | 132 |
129 DISALLOW_COPY_AND_ASSIGN(InterfaceSocketAddress); | 133 DISALLOW_COPY_AND_ASSIGN(InterfaceSocketAddress); |
130 }; | 134 }; |
131 | 135 |
132 template<typename T> | 136 template<typename T> |
133 class AddressList { | 137 class AddressList { |
134 public: | 138 public: |
135 explicit AddressList(intptr_t count) | 139 explicit AddressList(intptr_t count) |
136 : count_(count), | 140 : count_(count), |
137 addresses_(new T*[count_]) {} | 141 addresses_(new T*[count_]) {} |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 | 238 |
235 private: | 239 private: |
236 DISALLOW_ALLOCATION(); | 240 DISALLOW_ALLOCATION(); |
237 DISALLOW_IMPLICIT_CONSTRUCTORS(ServerSocket); | 241 DISALLOW_IMPLICIT_CONSTRUCTORS(ServerSocket); |
238 }; | 242 }; |
239 | 243 |
240 } // namespace bin | 244 } // namespace bin |
241 } // namespace dart | 245 } // namespace dart |
242 | 246 |
243 #endif // BIN_SOCKET_H_ | 247 #endif // BIN_SOCKET_H_ |
OLD | NEW |