OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Some socket related helper methods for quic. | 5 // Some socket related helper methods for quic. |
6 | 6 |
7 #ifndef NET_TOOLS_QUIC_QUIC_SOCKET_UTILS_H_ | 7 #ifndef NET_TOOLS_QUIC_QUIC_SOCKET_UTILS_H_ |
8 #define NET_TOOLS_QUIC_QUIC_SOCKET_UTILS_H_ | 8 #define NET_TOOLS_QUIC_QUIC_SOCKET_UTILS_H_ |
9 | 9 |
10 #include <stddef.h> | 10 #include <stddef.h> |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 IPEndPoint* peer_address); | 56 IPEndPoint* peer_address); |
57 | 57 |
58 // Writes buf_len to the socket. If writing is successful, sets the result's | 58 // Writes buf_len to the socket. If writing is successful, sets the result's |
59 // status to WRITE_STATUS_OK and sets bytes_written. Otherwise sets the | 59 // status to WRITE_STATUS_OK and sets bytes_written. Otherwise sets the |
60 // result's status to WRITE_STATUS_BLOCKED or WRITE_STATUS_ERROR and sets | 60 // result's status to WRITE_STATUS_BLOCKED or WRITE_STATUS_ERROR and sets |
61 // error_code to errno. | 61 // error_code to errno. |
62 static WriteResult WritePacket(int fd, const char* buffer, size_t buf_len, | 62 static WriteResult WritePacket(int fd, const char* buffer, size_t buf_len, |
63 const IPAddressNumber& self_address, | 63 const IPAddressNumber& self_address, |
64 const IPEndPoint& peer_address); | 64 const IPEndPoint& peer_address); |
65 | 65 |
| 66 // A helper for WritePacket which fills in the cmsg with the supplied self |
| 67 // address. |
| 68 static void SetIpInfoInCmsg(const IPAddressNumber& self_address, |
| 69 cmsghdr* cmsg); |
| 70 |
66 private: | 71 private: |
67 DISALLOW_COPY_AND_ASSIGN(QuicSocketUtils); | 72 DISALLOW_COPY_AND_ASSIGN(QuicSocketUtils); |
68 }; | 73 }; |
69 | 74 |
70 } // namespace tools | 75 } // namespace tools |
71 } // namespace net | 76 } // namespace net |
72 | 77 |
73 #endif // NET_TOOLS_QUIC_QUIC_SOCKET_UTILS_H_ | 78 #endif // NET_TOOLS_QUIC_QUIC_SOCKET_UTILS_H_ |
OLD | NEW |