Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / net / tools / quic / quic_default_packet_writer.h
1 // Copyright 2013 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 #ifndef NET_TOOLS_QUIC_QUIC_DEFAULT_PACKET_WRITER_H_
6 #define NET_TOOLS_QUIC_QUIC_DEFAULT_PACKET_WRITER_H_
7
8 #include "base/basictypes.h"
9 #include "net/base/ip_endpoint.h"
10 #include "net/quic/quic_packet_writer.h"
11
12 namespace net {
13
14 struct WriteResult;
15
16 namespace tools {
17
18 // Default packet writer which wraps QuicSocketUtils WritePacket.
19 class QuicDefaultPacketWriter : public QuicPacketWriter {
20  public:
21   explicit QuicDefaultPacketWriter(int fd);
22   virtual ~QuicDefaultPacketWriter();
23
24   // QuicPacketWriter
25   virtual WriteResult WritePacket(
26       const char* buffer, size_t buf_len,
27       const net::IPAddressNumber& self_address,
28       const net::IPEndPoint& peer_address) OVERRIDE;
29   virtual bool IsWriteBlockedDataBuffered() const OVERRIDE;
30   virtual bool IsWriteBlocked() const OVERRIDE;
31   virtual void SetWritable() OVERRIDE;
32
33  private:
34   int fd_;
35   bool write_blocked_;
36 };
37
38 }  // namespace tools
39 }  // namespace net
40
41 #endif  // NET_TOOLS_QUIC_QUIC_DEFAULT_PACKET_WRITER_H_