OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "nacl_io/socket/socket_node.h" | 5 #include "nacl_io/socket/socket_node.h" |
6 | 6 |
7 #include "nacl_io/ossocket.h" | 7 #include "nacl_io/ossocket.h" |
8 #ifdef PROVIDES_SOCKET_API | 8 #ifdef PROVIDES_SOCKET_API |
9 | 9 |
10 #include <errno.h> | 10 #include <errno.h> |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 socklen_t len) { | 208 socklen_t len) { |
209 if (len < 1) | 209 if (len < 1) |
210 return EINVAL; | 210 return EINVAL; |
211 | 211 |
212 if (NULL == addr) | 212 if (NULL == addr) |
213 return EFAULT; | 213 return EFAULT; |
214 | 214 |
215 return EOPNOTSUPP; | 215 return EOPNOTSUPP; |
216 } | 216 } |
217 | 217 |
218 Error SocketNode::Listen(int backlog) { return EOPNOTSUPP; } | 218 Error SocketNode::Listen(int backlog) { |
| 219 return EOPNOTSUPP; |
| 220 } |
219 | 221 |
220 Error SocketNode::GetSockOpt(int lvl, | 222 Error SocketNode::GetSockOpt(int lvl, |
221 int optname, | 223 int optname, |
222 void* optval, | 224 void* optval, |
223 socklen_t* len) { | 225 socklen_t* len) { |
224 if (lvl != SOL_SOCKET) | 226 if (lvl != SOL_SOCKET) |
225 return ENOPROTOOPT; | 227 return ENOPROTOOPT; |
226 | 228 |
227 AUTO_LOCK(node_lock_); | 229 AUTO_LOCK(node_lock_); |
228 | 230 |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 QueueOutput(); | 437 QueueOutput(); |
436 return err; | 438 return err; |
437 } | 439 } |
438 | 440 |
439 void SocketNode::SetError_Locked(int pp_error_num) { | 441 void SocketNode::SetError_Locked(int pp_error_num) { |
440 SetStreamFlags(SSF_ERROR | SSF_CLOSED); | 442 SetStreamFlags(SSF_ERROR | SSF_CLOSED); |
441 ClearStreamFlags(SSF_CAN_SEND | SSF_CAN_RECV); | 443 ClearStreamFlags(SSF_CAN_SEND | SSF_CAN_RECV); |
442 last_errno_ = PPErrorToErrno(pp_error_num); | 444 last_errno_ = PPErrorToErrno(pp_error_num); |
443 } | 445 } |
444 | 446 |
445 Error SocketNode::Shutdown(int how) { return EOPNOTSUPP; } | 447 Error SocketNode::Shutdown(int how) { |
| 448 return EOPNOTSUPP; |
| 449 } |
446 | 450 |
447 Error SocketNode::GetPeerName(struct sockaddr* addr, socklen_t* len) { | 451 Error SocketNode::GetPeerName(struct sockaddr* addr, socklen_t* len) { |
448 if (NULL == addr || NULL == len) | 452 if (NULL == addr || NULL == len) |
449 return EFAULT; | 453 return EFAULT; |
450 | 454 |
451 AUTO_LOCK(node_lock_); | 455 AUTO_LOCK(node_lock_); |
452 if (remote_addr_ != 0) { | 456 if (remote_addr_ != 0) { |
453 *len = ResourceToSockAddr(remote_addr_, *len, addr); | 457 *len = ResourceToSockAddr(remote_addr_, *len, addr); |
454 return 0; | 458 return 0; |
455 } | 459 } |
(...skipping 13 matching lines...) Expand all Loading... |
469 return 0; | 473 return 0; |
470 } | 474 } |
471 | 475 |
472 *len = ResourceToSockAddr(local_addr_, *len, addr); | 476 *len = ResourceToSockAddr(local_addr_, *len, addr); |
473 return 0; | 477 return 0; |
474 } | 478 } |
475 | 479 |
476 } // namespace nacl_io | 480 } // namespace nacl_io |
477 | 481 |
478 #endif // PROVIDES_SOCKET_API | 482 #endif // PROVIDES_SOCKET_API |
OLD | NEW |