| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 const char* buffer, | 65 const char* buffer, |
| 66 size_t buf_len, | 66 size_t buf_len, |
| 67 const IPAddress& self_address, | 67 const IPAddress& self_address, |
| 68 const IPEndPoint& peer_address); | 68 const IPEndPoint& peer_address); |
| 69 | 69 |
| 70 // A helper for WritePacket which fills in the cmsg with the supplied self | 70 // A helper for WritePacket which fills in the cmsg with the supplied self |
| 71 // address. | 71 // address. |
| 72 // Returns the length of the packet info structure used. | 72 // Returns the length of the packet info structure used. |
| 73 static size_t SetIpInfoInCmsg(const IPAddress& self_address, cmsghdr* cmsg); | 73 static size_t SetIpInfoInCmsg(const IPAddress& self_address, cmsghdr* cmsg); |
| 74 | 74 |
| 75 // Creates a UDP socket and sets appropriate socket options for QUIC. |
| 76 // Returns the created FD if successful, -1 otherwise. |
| 77 // |overflow_supported| is set to true if the socket supports it. |
| 78 static int CreateUDPSocket(const IPEndPoint& address, |
| 79 bool* overflow_supported); |
| 80 |
| 75 private: | 81 private: |
| 76 DISALLOW_COPY_AND_ASSIGN(QuicSocketUtils); | 82 DISALLOW_COPY_AND_ASSIGN(QuicSocketUtils); |
| 77 }; | 83 }; |
| 78 | 84 |
| 79 } // namespace net | 85 } // namespace net |
| 80 | 86 |
| 81 #endif // NET_TOOLS_QUIC_QUIC_SOCKET_UTILS_H_ | 87 #endif // NET_TOOLS_QUIC_QUIC_SOCKET_UTILS_H_ |
| OLD | NEW |