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_STREAM_STREAM_NODE_H_
6 #define LIBRARIES_NACL_IO_STREAM_STREAM_NODE_H_
11 #include "nacl_io/node.h"
12 #include "nacl_io/pipe/pipe_event_emitter.h"
13 #include "sdk_util/atomicops.h"
20 typedef sdk_util::ScopedRef
<StreamNode
> ScopedStreamNode
;
22 enum StreamStateFlags
{
23 SSF_CONNECTING
= 0x0001,
27 SSF_LISTENING
= 0x000f,
28 SSF_CAN_SEND
= 0x0020,
29 SSF_CAN_RECV
= 0x0040,
30 SSF_CAN_ACCEPT
= 0x0080,
31 SSF_CAN_CONNECT
= 0x00f0,
32 SSF_NON_BLOCK
= 0x1000,
35 SSF_RECV_ENDOFSTREAM
= 0x10000,
38 class StreamNode
: public Node
{
40 explicit StreamNode(Filesystem
* fs
);
42 virtual Error
Init(int open_flags
);
44 // Attempts to pump input and output
45 virtual void QueueInput();
46 virtual void QueueOutput();
48 void SetStreamFlags(uint32_t bits
);
49 void ClearStreamFlags(uint32_t bits
);
50 uint32_t GetStreamFlags();
51 bool TestStreamFlags(uint32_t bits
);
60 sdk_util::Atomic32 stream_state_flags_
;
63 } // namespace nacl_io
65 #endif // LIBRARIES_NACL_IO_STREAM_STREAM_NODE_H_