Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / native_client_sdk / src / libraries / nacl_io / socket / packet.h
blobce199e65d5e9310b8ce8ffacf028f99bd0b949a4
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.
5 #ifndef LIBRARIES_NACL_IO_SOCKET_PACKET_H_
6 #define LIBRARIES_NACL_IO_SOCKET_PACKET_H_
8 #include "nacl_io/fifo_interface.h"
9 #include "ppapi/c/pp_resource.h"
11 #include "sdk_util/macros.h"
13 namespace nacl_io {
15 class PepperInterface;
17 // NOTE: The Packet class always owns the buffer and address.
18 class Packet {
19 public:
20 explicit Packet(PepperInterface* ppapi);
21 ~Packet();
23 // Copy the buffer, and address reference
24 void Copy(const void* buffer, size_t len, PP_Resource addr);
26 char* buffer() { return buffer_; }
27 PP_Resource addr() { return addr_; }
28 size_t len() { return len_; }
30 private:
31 PepperInterface* ppapi_;
32 PP_Resource addr_;
33 char* buffer_;
34 size_t len_;
36 DISALLOW_COPY_AND_ASSIGN(Packet);
39 } // namespace nacl_io
41 #endif // LIBRARIES_NACL_IO_SOCKET_PACKET_H_