| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 private: | 55 private: |
| 56 // Initialize the internal state of the reader. | 56 // Initialize the internal state of the reader. |
| 57 void Initialize(); | 57 void Initialize(); |
| 58 | 58 |
| 59 // Storage only used when recvmmsg is available. | 59 // Storage only used when recvmmsg is available. |
| 60 | 60 |
| 61 // cbuf_ is used for ancillary data from the kernel on recvmmsg. | 61 // cbuf_ is used for ancillary data from the kernel on recvmmsg. |
| 62 char cbuf_[kSpaceForOverflowAndIp * kNumPacketsPerReadMmsgCall]; | 62 char cbuf_[kSpaceForOverflowAndIp * kNumPacketsPerReadMmsgCall]; |
| 63 // buf_ is used for the data read from the kernel on recvmmsg. | 63 // buf_ is used for the data read from the kernel on recvmmsg. |
| 64 char buf_[2 * kMaxPacketSize * kNumPacketsPerReadMmsgCall]; | 64 // TODO(danzh): change it to be a pointer to avoid the allocation on the stack |
| 65 // from exceeding maximum allowed frame size. |
| 66 char buf_[kMaxPacketSize * kNumPacketsPerReadMmsgCall]; |
| 65 // iov_ and mmsg_hdr_ are used to supply cbuf and buf to the recvmmsg call. | 67 // iov_ and mmsg_hdr_ are used to supply cbuf and buf to the recvmmsg call. |
| 66 iovec iov_[kNumPacketsPerReadMmsgCall]; | 68 iovec iov_[kNumPacketsPerReadMmsgCall]; |
| 67 mmsghdr mmsg_hdr_[kNumPacketsPerReadMmsgCall]; | 69 mmsghdr mmsg_hdr_[kNumPacketsPerReadMmsgCall]; |
| 68 // raw_address_ is used for address information provided by the recvmmsg | 70 // raw_address_ is used for address information provided by the recvmmsg |
| 69 // call on the packets. | 71 // call on the packets. |
| 70 struct sockaddr_storage raw_address_[kNumPacketsPerReadMmsgCall]; | 72 struct sockaddr_storage raw_address_[kNumPacketsPerReadMmsgCall]; |
| 71 | 73 |
| 72 DISALLOW_COPY_AND_ASSIGN(QuicPacketReader); | 74 DISALLOW_COPY_AND_ASSIGN(QuicPacketReader); |
| 73 }; | 75 }; |
| 74 | 76 |
| 75 } // namespace tools | 77 } // namespace tools |
| 76 } // namespace net | 78 } // namespace net |
| 77 | 79 |
| 78 #endif // NET_TOOLS_QUIC_QUIC_PACKET_READER_H_ | 80 #endif // NET_TOOLS_QUIC_QUIC_PACKET_READER_H_ |
| OLD | NEW |