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/quic_protocol.h" | 14 #include "net/quic/quic_protocol.h" |
| 15 #include "net/tools/quic/quic_process_packet_interface.h" |
15 | 16 |
16 namespace net { | 17 namespace net { |
17 | 18 |
18 namespace tools { | 19 namespace tools { |
19 | 20 |
20 // Read in larger batches to minimize recvmmsg overhead. | 21 // Read in larger batches to minimize recvmmsg overhead. |
21 const int kNumPacketsPerReadMmsgCall = 16; | 22 const int kNumPacketsPerReadMmsgCall = 16; |
22 // Allocate space for in6_pktinfo as it's larger than in_pktinfo | 23 // Allocate space for in6_pktinfo as it's larger than in_pktinfo |
23 const int kSpaceForOverflowAndIp = | 24 const int kSpaceForOverflowAndIp = |
24 CMSG_SPACE(sizeof(int)) + CMSG_SPACE(sizeof(in6_pktinfo)); | 25 CMSG_SPACE(sizeof(int)) + CMSG_SPACE(sizeof(in6_pktinfo)); |
25 | 26 |
26 namespace test { | 27 namespace test { |
27 class QuicServerPeer; | 28 class QuicServerPeer; |
28 } // namespace test | 29 } // namespace test |
29 | 30 |
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 there may be additional | 40 // the PacketProcessInterface. Returns true if there may be additional |
(...skipping 30 matching lines...) Expand all Loading... |
71 // call on the packets. | 71 // call on the packets. |
72 struct sockaddr_storage raw_address_[kNumPacketsPerReadMmsgCall]; | 72 struct sockaddr_storage raw_address_[kNumPacketsPerReadMmsgCall]; |
73 | 73 |
74 DISALLOW_COPY_AND_ASSIGN(QuicPacketReader); | 74 DISALLOW_COPY_AND_ASSIGN(QuicPacketReader); |
75 }; | 75 }; |
76 | 76 |
77 } // namespace tools | 77 } // namespace tools |
78 } // namespace net | 78 } // namespace net |
79 | 79 |
80 #endif // NET_TOOLS_QUIC_QUIC_PACKET_READER_H_ | 80 #endif // NET_TOOLS_QUIC_QUIC_PACKET_READER_H_ |
OLD | NEW |