34#ifndef _OPENLCB_STREAM_HXX_
35#define _OPENLCB_STREAM_HXX_
37#include "openlcb/NMRAnetIf.hxx"
140 DISCOVER_1 = 0x0600000000000000,
141 DISCOVER_2 = 0x0500000000000000,
142 DISCOVER_3 = 0x0400000000000000,
143 DISCOVER_4 = 0x0300000000000000,
144 DISCOVER_5 = 0x0200000000000000,
145 DISCOVER_6 = 0x0100000000000000,
146 DISCOVERED = 0x0000000000000000,
147 DISCOVERED_DEC = 0x0100000000000000,
148 DISCOVER_MASK = 0xFF00000000000000,
Base class for all QMember types that hold data in an expandable format.
This class provides a counting semaphore API.
Implements a vanilla ring buffer.
Base service for OpenLCB streaming protocol.
void initiate_reply(NodeHandle src, Buffer *buffer)
Handle incoming stream initiate reply messages.
void sclose(StreamHandle handle)
Close a stream.
~Stream()
Default destructor.
void * StreamHandle
Stream handle type.
ssize_t sread(StreamHandle handle, void *buf, size_t size)
Read data from a stream.
Flag
possible flag values.
@ ACCEPT
initiate request accepted
@ PERMINATE_ERROR
a perminate error occured
void initiate_request(NodeHandle src, Buffer *buffer)
Handle incoming stream initiate request messages.
Stream()
Default constructor.
virtual int write(Defs::MTI mti, NodeHandle dst, Buffer *data)=0
Write a message from a node.
RBTree< uint8_t, Metadata * > inboundTree
tree for keeping track of inbound streams
void packet(Defs::MTI mti, NodeHandle src, Buffer *data)
Handle incoming stream messages.
OSSem sem
wait for completion semaphore
ssize_t swrite(StreamHandle handle, const void *buf, size_t size)
Write data to a stream.
static const uint16_t MAX_BUFFER_SIZE
Max buffer size for stream transmission segments.
RBTree< uint8_t, Metadata * > outboundTree
tree for keeping track of outbound streams
void handle_data(NodeHandle src, Buffer *buffer)
Handle incoming stream data messages.
virtual BufferQueueWait * rx_queue()=0
Get handle to the receive queue for incoming NMRAnet messages.
size_t count
number of active streams for this node
void proceed(NodeHandle src, Buffer *buffer)
Handle incoming stream proceed messages.
void complete(NodeHandle src, Buffer *buffer)
Handle incoming stream complete messages.
StreamHandle sopen(NodeHandle dst, long long timeout)
Open a stream.
static const size_t CHANNELS_PER_NODE
number of simultaneous open streams per virtual node instance
State
Possible stream states.
@ WAITING_I
waiting on a pending connection, inbound
@ CONNECTED_I
connection made, inbound
@ CLOSED_I
connection closed, inbound
@ CONNECTED_O
connection made, outbound
@ PENDING_O
connection pending, outbound
@ WAITING_O
waiting on a pending connection, outbound
@ CLOSED_O
connection closed, outbound
@ PENDING_I
connection pending, inbound
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Removes default copy-constructor and assignment added by C++.
MTI
Known Message type indicators.
Container of both a NodeID and NodeAlias.