Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: net/quic/quic_packet_reader.h

Issue 1009803003: Factor out the QUIC socket reading code into a stand alone QuicPacketReader (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more export Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/quic_client_session.cc ('k') | net/quic/quic_packet_reader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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_
OLDNEW
« no previous file with comments | « net/quic/quic_client_session.cc ('k') | net/quic/quic_packet_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698