| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 // |
| 5 |
| 6 #ifndef NET_QUIC_QUIC_PACKET_READER_H_ |
| 7 #define NET_QUIC_QUIC_PACKET_READER_H_ |
| 8 |
| 9 #include "base/memory/weak_ptr.h" |
| 10 #include "net/base/io_buffer.h" |
| 11 #include "net/base/net_export.h" |
| 12 #include "net/base/net_log.h" |
| 13 #include "net/quic/quic_protocol.h" |
| 14 #include "net/udp/datagram_client_socket.h" |
| 15 |
| 16 namespace net { |
| 17 |
| 18 class NET_EXPORT_PRIVATE QuicPacketReader { |
| 19 public: |
| 20 class NET_EXPORT_PRIVATE Visitor { |
| 21 public: |
| 22 virtual ~Visitor() {}; |
| 23 virtual void OnReadError(int result) = 0; |
| 24 virtual bool OnPacket(const QuicEncryptedPacket& packet, |
| 25 IPEndPoint local_address, |
| 26 IPEndPoint peer_address) = 0; |
| 27 }; |
| 28 |
| 29 QuicPacketReader(DatagramClientSocket* socket, |
| 30 Visitor* visitor, |
| 31 const BoundNetLog& net_log); |
| 32 ~QuicPacketReader(); |
| 33 |
| 34 // Causes the QuicConnectionHelper to start reading from the socket |
| 35 // and passing the data along to the QuicConnection. |
| 36 void StartReading(); |
| 37 |
| 38 private: |
| 39 // A completion callback invoked when a read completes. |
| 40 void OnReadComplete(int result); |
| 41 |
| 42 DatagramClientSocket* socket_; |
| 43 Visitor* visitor_; |
| 44 bool read_pending_; |
| 45 int num_packets_read_; |
| 46 scoped_refptr<IOBufferWithSize> read_buffer_; |
| 47 BoundNetLog net_log_; |
| 48 |
| 49 base::WeakPtrFactory<QuicPacketReader> weak_factory_; |
| 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(QuicPacketReader); |
| 52 }; |
| 53 |
| 54 } // namespace net |
| 55 |
| 56 #endif // NET_QUIC_QUIC_PACKET_READER_H_ |
| OLD | NEW |