If there are no local credentials for a locked profile, show sign in button
[chromium-blink-merge.git] / net / quic / quic_packet_reader.h
blobabd3e80838b35948ee35127a1a8558cb3d678539
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 //
6 #ifndef NET_QUIC_QUIC_PACKET_READER_H_
7 #define NET_QUIC_QUIC_PACKET_READER_H_
9 #include "base/memory/weak_ptr.h"
10 #include "net/base/io_buffer.h"
11 #include "net/base/net_export.h"
12 #include "net/log/net_log.h"
13 #include "net/quic/quic_protocol.h"
14 #include "net/udp/datagram_client_socket.h"
16 namespace net {
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;
29 QuicPacketReader(DatagramClientSocket* socket,
30 Visitor* visitor,
31 const BoundNetLog& net_log);
32 virtual ~QuicPacketReader();
34 // Causes the QuicConnectionHelper to start reading from the socket
35 // and passing the data along to the QuicConnection.
36 void StartReading();
38 private:
39 // A completion callback invoked when a read completes.
40 void OnReadComplete(int result);
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_;
49 base::WeakPtrFactory<QuicPacketReader> weak_factory_;
51 DISALLOW_COPY_AND_ASSIGN(QuicPacketReader);
54 } // namespace net
56 #endif // NET_QUIC_QUIC_PACKET_READER_H_