OLD | NEW |
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 19 matching lines...) Expand all Loading... |
30 class ProcessPacketInterface; | 30 class ProcessPacketInterface; |
31 class QuicDispatcher; | 31 class QuicDispatcher; |
32 | 32 |
33 class QuicPacketReader { | 33 class QuicPacketReader { |
34 public: | 34 public: |
35 QuicPacketReader(); | 35 QuicPacketReader(); |
36 | 36 |
37 virtual ~QuicPacketReader(); | 37 virtual ~QuicPacketReader(); |
38 | 38 |
39 // Reads a number of packets from the given fd, and then passes them off to | 39 // Reads a number of packets from the given fd, and then passes them off to |
40 // the PacketProcessInterface. Returns true if at least 1 packet is read, | 40 // the PacketProcessInterface. Returns true if there may be additional |
41 // false otherwise. | 41 // packets available on the socket. |
42 // Populates |packets_dropped| if it is non-null and the socket is configured | 42 // Populates |packets_dropped| if it is non-null and the socket is configured |
43 // to track dropped packets and some packets are read. | 43 // to track dropped packets and some packets are read. |
44 virtual bool ReadAndDispatchPackets(int fd, | 44 virtual bool ReadAndDispatchPackets(int fd, |
45 int port, | 45 int port, |
46 ProcessPacketInterface* processor, | 46 ProcessPacketInterface* processor, |
47 QuicPacketCount* packets_dropped); | 47 QuicPacketCount* packets_dropped); |
48 | 48 |
49 // Same as ReadAndDispatchPackets, only does one packet at a time. | 49 // Same as ReadAndDispatchPackets, only does one packet at a time. |
50 static bool ReadAndDispatchSinglePacket(int fd, | 50 static bool ReadAndDispatchSinglePacket(int fd, |
51 int port, | 51 int port, |
(...skipping 17 matching lines...) Expand all Loading... |
69 // call on the packets. | 69 // call on the packets. |
70 struct sockaddr_storage raw_address_[kNumPacketsPerReadMmsgCall]; | 70 struct sockaddr_storage raw_address_[kNumPacketsPerReadMmsgCall]; |
71 | 71 |
72 DISALLOW_COPY_AND_ASSIGN(QuicPacketReader); | 72 DISALLOW_COPY_AND_ASSIGN(QuicPacketReader); |
73 }; | 73 }; |
74 | 74 |
75 } // namespace tools | 75 } // namespace tools |
76 } // namespace net | 76 } // namespace net |
77 | 77 |
78 #endif // NET_TOOLS_QUIC_QUIC_PACKET_READER_H_ | 78 #endif // NET_TOOLS_QUIC_QUIC_PACKET_READER_H_ |
OLD | NEW |