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> |
11 #include <sys/socket.h> | 11 #include <sys/socket.h> |
12 | 12 |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "net/quic/core/quic_clock.h" | 14 #include "net/quic/core/quic_clock.h" |
15 #include "net/quic/core/quic_protocol.h" | 15 #include "net/quic/core/quic_protocol.h" |
16 #include "net/quic/platform/api/quic_socket_address.h" | 16 #include "net/quic/platform/api/quic_socket_address.h" |
17 #include "net/tools/quic/quic_process_packet_interface.h" | 17 #include "net/tools/quic/quic_process_packet_interface.h" |
18 #include "net/tools/quic/quic_socket_utils.h" | 18 #include "net/tools/quic/quic_socket_utils.h" |
19 | 19 |
20 #define MMSG_MORE 0 | 20 #define MMSG_MORE 0 |
21 | 21 |
22 namespace net { | 22 namespace net { |
23 | 23 |
24 #if MMSG_MORE | 24 #if MMSG_MORE |
25 // Read in larger batches to minimize recvmmsg overhead. | 25 // Read in larger batches to minimize recvmmsg overhead. |
26 const int kNumPacketsPerReadMmsgCall = 16; | 26 const int kNumPacketsPerReadMmsgCall = 16; |
27 #endif | 27 #endif |
28 | 28 |
29 namespace test { | |
30 class QuicServerPeer; | |
31 } // namespace test | |
32 | |
33 class QuicDispatcher; | |
34 | |
35 class QuicPacketReader { | 29 class QuicPacketReader { |
36 public: | 30 public: |
37 QuicPacketReader(); | 31 QuicPacketReader(); |
38 | 32 |
39 virtual ~QuicPacketReader(); | 33 virtual ~QuicPacketReader(); |
40 | 34 |
41 // Reads a number of packets from the given fd, and then passes them off to | 35 // Reads a number of packets from the given fd, and then passes them off to |
42 // the PacketProcessInterface. Returns true if there may be additional | 36 // the PacketProcessInterface. Returns true if there may be additional |
43 // packets available on the socket. | 37 // packets available on the socket. |
44 // Populates |packets_dropped| if it is non-null and the socket is configured | 38 // Populates |packets_dropped| if it is non-null and the socket is configured |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 PacketData packets_[kNumPacketsPerReadMmsgCall]; | 84 PacketData packets_[kNumPacketsPerReadMmsgCall]; |
91 mmsghdr mmsg_hdr_[kNumPacketsPerReadMmsgCall]; | 85 mmsghdr mmsg_hdr_[kNumPacketsPerReadMmsgCall]; |
92 #endif | 86 #endif |
93 | 87 |
94 DISALLOW_COPY_AND_ASSIGN(QuicPacketReader); | 88 DISALLOW_COPY_AND_ASSIGN(QuicPacketReader); |
95 }; | 89 }; |
96 | 90 |
97 } // namespace net | 91 } // namespace net |
98 | 92 |
99 #endif // NET_TOOLS_QUIC_QUIC_PACKET_READER_H_ | 93 #endif // NET_TOOLS_QUIC_QUIC_PACKET_READER_H_ |
OLD | NEW |