Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(310)

Side by Side Diff: net/tools/quic/quic_socket_utils.h

Issue 2229553003: Deprecate --quic_socket_walltimestamps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@128998762
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/tools/quic/quic_packet_reader.cc ('k') | net/tools/quic/quic_socket_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <netinet/in.h> 10 #include <netinet/in.h>
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // The final int is a sentinel so the msg_controllen feedback 42 // The final int is a sentinel so the msg_controllen feedback
43 // can be used to detect larger control messages than there is space for. 43 // can be used to detect larger control messages than there is space for.
44 static const int kSpaceForCmsg = 44 static const int kSpaceForCmsg =
45 CMSG_SPACE(CMSG_LEN(sizeof(int)) + CMSG_LEN(sizeof(in6_pktinfo)) + 45 CMSG_SPACE(CMSG_LEN(sizeof(int)) + CMSG_LEN(sizeof(in6_pktinfo)) +
46 CMSG_LEN(sizeof(LinuxTimestamping)) + 46 CMSG_LEN(sizeof(LinuxTimestamping)) +
47 CMSG_LEN(sizeof(int))); 47 CMSG_LEN(sizeof(int)));
48 48
49 // Fills in |address| if |hdr| contains IP_PKTINFO or IPV6_PKTINFO. Fills in 49 // Fills in |address| if |hdr| contains IP_PKTINFO or IPV6_PKTINFO. Fills in
50 // |timestamp| if |hdr| contains |SO_TIMESTAMPING|. |address| and |timestamp| 50 // |timestamp| if |hdr| contains |SO_TIMESTAMPING|. |address| and |timestamp|
51 // must not be null. 51 // must not be null.
52 // TODO(rjshade): Delete the |timestamp| argument when removing
53 // FLAGS_quic_socket_timestamps_walltime
54 static void GetAddressAndTimestampFromMsghdr(struct msghdr* hdr, 52 static void GetAddressAndTimestampFromMsghdr(struct msghdr* hdr,
55 IPAddress* address, 53 IPAddress* address,
56 QuicTime* timestamp, 54 QuicWallTime* walltimestamp);
57 QuicWallTime* walltimestamp,
58 bool latched_walltimestamps);
59 55
60 // If the msghdr contains an SO_RXQ_OVFL entry, this will set dropped_packets 56 // If the msghdr contains an SO_RXQ_OVFL entry, this will set dropped_packets
61 // to the correct value and return true. Otherwise it will return false. 57 // to the correct value and return true. Otherwise it will return false.
62 static bool GetOverflowFromMsghdr(struct msghdr* hdr, 58 static bool GetOverflowFromMsghdr(struct msghdr* hdr,
63 QuicPacketCount* dropped_packets); 59 QuicPacketCount* dropped_packets);
64 60
65 // Sets either IP_PKTINFO or IPV6_PKTINFO on the socket, based on 61 // Sets either IP_PKTINFO or IPV6_PKTINFO on the socket, based on
66 // address_family. Returns the return code from setsockopt. 62 // address_family. Returns the return code from setsockopt.
67 static int SetGetAddressInfo(int fd, int address_family); 63 static int SetGetAddressInfo(int fd, int address_family);
68 64
(...skipping 14 matching lines...) Expand all
83 // dropped on the socket since the socket was created, assuming the kernel 79 // dropped on the socket since the socket was created, assuming the kernel
84 // supports this feature. 80 // supports this feature.
85 // 81 //
86 // If self_address is non-null, it will be set to the address the peer sent 82 // If self_address is non-null, it will be set to the address the peer sent
87 // packets to, assuming a packet was read. 83 // packets to, assuming a packet was read.
88 // 84 //
89 // If timestamp is non-null, it will be filled with the timestamp of the 85 // If timestamp is non-null, it will be filled with the timestamp of the
90 // received packet, assuming a packet was read and the platform supports 86 // received packet, assuming a packet was read and the platform supports
91 // packet receipt timestamping. If the platform does not support packet 87 // packet receipt timestamping. If the platform does not support packet
92 // receipt timestamping, timestamp will not be changed. 88 // receipt timestamping, timestamp will not be changed.
93 // TODO(rjshade): Delete the |timestamp| argument when removing
94 // FLAGS_quic_socket_timestamps_walltime
95 static int ReadPacket(int fd, 89 static int ReadPacket(int fd,
96 char* buffer, 90 char* buffer,
97 size_t buf_len, 91 size_t buf_len,
98 QuicPacketCount* dropped_packets, 92 QuicPacketCount* dropped_packets,
99 IPAddress* self_address, 93 IPAddress* self_address,
100 QuicTime* timestamp,
101 QuicWallTime* walltimestamp, 94 QuicWallTime* walltimestamp,
102 bool latched_walltimestamps,
103 IPEndPoint* peer_address); 95 IPEndPoint* peer_address);
104 96
105 // Writes buf_len to the socket. If writing is successful, sets the result's 97 // Writes buf_len to the socket. If writing is successful, sets the result's
106 // status to WRITE_STATUS_OK and sets bytes_written. Otherwise sets the 98 // status to WRITE_STATUS_OK and sets bytes_written. Otherwise sets the
107 // result's status to WRITE_STATUS_BLOCKED or WRITE_STATUS_ERROR and sets 99 // result's status to WRITE_STATUS_BLOCKED or WRITE_STATUS_ERROR and sets
108 // error_code to errno. 100 // error_code to errno.
109 static WriteResult WritePacket(int fd, 101 static WriteResult WritePacket(int fd,
110 const char* buffer, 102 const char* buffer,
111 size_t buf_len, 103 size_t buf_len,
112 const IPAddress& self_address, 104 const IPAddress& self_address,
(...skipping 10 matching lines...) Expand all
123 static int CreateUDPSocket(const IPEndPoint& address, 115 static int CreateUDPSocket(const IPEndPoint& address,
124 bool* overflow_supported); 116 bool* overflow_supported);
125 117
126 private: 118 private:
127 DISALLOW_COPY_AND_ASSIGN(QuicSocketUtils); 119 DISALLOW_COPY_AND_ASSIGN(QuicSocketUtils);
128 }; 120 };
129 121
130 } // namespace net 122 } // namespace net
131 123
132 #endif // NET_TOOLS_QUIC_QUIC_SOCKET_UTILS_H_ 124 #endif // NET_TOOLS_QUIC_QUIC_SOCKET_UTILS_H_
OLDNEW
« no previous file with comments | « net/tools/quic/quic_packet_reader.cc ('k') | net/tools/quic/quic_socket_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698