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

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

Issue 2403193003: Landing Recent QUIC changes until 9:41 AM, Oct 10, 2016 UTC-7 (Closed)
Patch Set: git cl format Created 4 years, 2 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_printer_bin.cc ('k') | net/tools/quic/quic_packet_reader.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 // A class to read incoming QUIC packets from the UDP socket. 5 // A class to read incoming QUIC packets from the UDP socket.
6 6
7 #ifndef NET_TOOLS_QUIC_QUIC_PACKET_READER_H_ 7 #ifndef NET_TOOLS_QUIC_QUIC_PACKET_READER_H_
8 #define NET_TOOLS_QUIC_QUIC_PACKET_READER_H_ 8 #define NET_TOOLS_QUIC_QUIC_PACKET_READER_H_
9 9
10 #include <netinet/in.h> 10 #include <netinet/in.h>
(...skipping 26 matching lines...) Expand all
37 37
38 virtual ~QuicPacketReader(); 38 virtual ~QuicPacketReader();
39 39
40 // Reads a number of packets from the given fd, and then passes them off to 40 // Reads a number of packets from the given fd, and then passes them off to
41 // the PacketProcessInterface. Returns true if there may be additional 41 // the PacketProcessInterface. Returns true if there may be additional
42 // packets available on the socket. 42 // packets available on the socket.
43 // Populates |packets_dropped| if it is non-null and the socket is configured 43 // Populates |packets_dropped| if it is non-null and the socket is configured
44 // to track dropped packets and some packets are read. 44 // to track dropped packets and some packets are read.
45 // If the socket has timestamping enabled, the per packet timestamps will be 45 // If the socket has timestamping enabled, the per packet timestamps will be
46 // passed to the processor. Otherwise, |clock| will be used. 46 // passed to the processor. Otherwise, |clock| will be used.
47 // If |potentially_small_mtu| is set, the incoming packets have been
48 // identified as potentially having an unusually small MTU.
49 virtual bool ReadAndDispatchPackets(int fd, 47 virtual bool ReadAndDispatchPackets(int fd,
50 int port, 48 int port,
51 bool potentially_small_mtu,
52 const QuicClock& clock, 49 const QuicClock& clock,
53 ProcessPacketInterface* processor, 50 ProcessPacketInterface* processor,
54 QuicPacketCount* packets_dropped); 51 QuicPacketCount* packets_dropped);
55 52
56 private: 53 private:
57 // Initialize the internal state of the reader. 54 // Initialize the internal state of the reader.
58 void Initialize(); 55 void Initialize();
59 56
60 // Reads and dispatches many packets using recvmmsg. 57 // Reads and dispatches many packets using recvmmsg.
61 bool ReadAndDispatchManyPackets(int fd, 58 bool ReadAndDispatchManyPackets(int fd,
62 int port, 59 int port,
63 bool potentially_small_mtu,
64 const QuicClock& clock, 60 const QuicClock& clock,
65 ProcessPacketInterface* processor, 61 ProcessPacketInterface* processor,
66 QuicPacketCount* packets_dropped); 62 QuicPacketCount* packets_dropped);
67 63
68 // Reads and dispatches a single packet using recvmsg. 64 // Reads and dispatches a single packet using recvmsg.
69 static bool ReadAndDispatchSinglePacket(int fd, 65 static bool ReadAndDispatchSinglePacket(int fd,
70 int port, 66 int port,
71 bool potentially_small_mtu,
72 const QuicClock& clock, 67 const QuicClock& clock,
73 ProcessPacketInterface* processor, 68 ProcessPacketInterface* processor,
74 QuicPacketCount* packets_dropped); 69 QuicPacketCount* packets_dropped);
75 70
76 // Storage only used when recvmmsg is available. 71 // Storage only used when recvmmsg is available.
77 72
78 #if MMSG_MORE 73 #if MMSG_MORE
79 // TODO(danzh): change it to be a pointer to avoid the allocation on the stack 74 // TODO(danzh): change it to be a pointer to avoid the allocation on the stack
80 // from exceeding maximum allowed frame size. 75 // from exceeding maximum allowed frame size.
81 // packets_ and mmsg_hdr_ are used to supply cbuf and buf to the recvmmsg 76 // packets_ and mmsg_hdr_ are used to supply cbuf and buf to the recvmmsg
(...skipping 12 matching lines...) Expand all
94 PacketData packets_[kNumPacketsPerReadMmsgCall]; 89 PacketData packets_[kNumPacketsPerReadMmsgCall];
95 mmsghdr mmsg_hdr_[kNumPacketsPerReadMmsgCall]; 90 mmsghdr mmsg_hdr_[kNumPacketsPerReadMmsgCall];
96 #endif 91 #endif
97 92
98 DISALLOW_COPY_AND_ASSIGN(QuicPacketReader); 93 DISALLOW_COPY_AND_ASSIGN(QuicPacketReader);
99 }; 94 };
100 95
101 } // namespace net 96 } // namespace net
102 97
103 #endif // NET_TOOLS_QUIC_QUIC_PACKET_READER_H_ 98 #endif // NET_TOOLS_QUIC_QUIC_PACKET_READER_H_
OLDNEW
« no previous file with comments | « net/tools/quic/quic_packet_printer_bin.cc ('k') | net/tools/quic/quic_packet_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698