OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef LIBRARIES_NACL_IO_EVENT_EMITTER_UDP_H_ | 5 #ifndef LIBRARIES_NACL_IO_EVENT_EMITTER_UDP_H_ |
6 #define LIBRARIES_NACL_IO_EVENT_EMITTER_UDP_H_ | 6 #define LIBRARIES_NACL_IO_EVENT_EMITTER_UDP_H_ |
7 | 7 |
8 #include "nacl_io/event_emitter_stream.h" | 8 #include "nacl_io/event_emitter_stream.h" |
9 #include "nacl_io/fifo_packet.h" | 9 #include "nacl_io/fifo_packet.h" |
10 | 10 |
11 #include "sdk_util/macros.h" | 11 #include "sdk_util/macros.h" |
12 #include "sdk_util/scoped_ref.h" | 12 #include "sdk_util/scoped_ref.h" |
13 | 13 |
14 namespace nacl_io { | 14 namespace nacl_io { |
15 | 15 |
16 class EventEmitterUDP; | 16 class EventEmitterUDP; |
17 typedef sdk_util::ScopedRef<EventEmitterUDP> ScopedEventEmitterUDP; | 17 typedef sdk_util::ScopedRef<EventEmitterUDP> ScopedEventEmitterUDP; |
18 | 18 |
19 class EventEmitterUDP : public EventEmitterStream { | 19 class EventEmitterUDP : public EventEmitterStream { |
20 public: | 20 public: |
21 EventEmitterUDP(size_t rsize, size_t wsize); | 21 EventEmitterUDP(size_t rsize, size_t wsize); |
22 | 22 |
23 // Takes or gives away ownership of the packet. | 23 // Takes or gives away ownership of the packet. |
24 Packet* ReadRXPacket_Locked(); | 24 Packet* ReadRXPacket_Locked(); |
25 void WriteRXPacket_Locked(Packet* packet); | 25 void WriteRXPacket_Locked(Packet* packet); |
26 | 26 |
27 Packet* ReadTXPacket_Locked(); | 27 Packet* ReadTXPacket_Locked(); |
28 void WriteTXPacket_Locked(Packet* packet); | 28 void WriteTXPacket_Locked(Packet* packet); |
29 | 29 |
| 30 protected: |
30 virtual FIFOPacket* in_fifo() { return &in_fifo_; } | 31 virtual FIFOPacket* in_fifo() { return &in_fifo_; } |
31 virtual FIFOPacket* out_fifo() { return &out_fifo_; } | 32 virtual FIFOPacket* out_fifo() { return &out_fifo_; } |
32 | 33 |
33 protected: | 34 private: |
34 FIFOPacket in_fifo_; | 35 FIFOPacket in_fifo_; |
35 FIFOPacket out_fifo_; | 36 FIFOPacket out_fifo_; |
36 DISALLOW_COPY_AND_ASSIGN(EventEmitterUDP); | 37 DISALLOW_COPY_AND_ASSIGN(EventEmitterUDP); |
37 }; | 38 }; |
38 | 39 |
39 } // namespace nacl_io | 40 } // namespace nacl_io |
40 | 41 |
41 #endif // LIBRARIES_NACL_IO_EVENT_EMITTER_UDP_H_ | 42 #endif // LIBRARIES_NACL_IO_EVENT_EMITTER_UDP_H_ |
42 | 43 |
OLD | NEW |