31 #ifndef PLUGINS_E131_E131_TCPTRANSPORT_H_
32 #define PLUGINS_E131_E131_TCPTRANSPORT_H_
35 #include "ola/io/OutputBuffer.h"
36 #include "ola/io/OutputStream.h"
37 #include "ola/io/Descriptor.h"
38 #include "ola/network/TCPSocket.h"
39 #include "plugins/e131/e131/PDU.h"
40 #include "plugins/e131/e131/Transport.h"
64 WAITING_FOR_PDU_FLAGS,
65 WAITING_FOR_PDU_LENGTH,
79 uint8_t *m_buffer_start, *m_buffer_end, *m_data_end;
81 unsigned int m_outstanding_data;
84 unsigned int m_block_size;
85 unsigned int m_consumed_block_size;
87 PDULengthSize m_pdu_length_size;
88 unsigned int m_pdu_size;
90 void HandlePreamble();
91 void HandlePDUFlags();
92 void HandlePDULength();
95 void IncreaseBufferSize(
unsigned int new_size);
96 void ReadRequiredData();
97 void EnterWaitingForPreamble();
98 void EnterWaitingForPDU();
103 inline unsigned int FreeSpace()
const {
104 return m_buffer_start ?
105 static_cast<unsigned int>(m_buffer_end - m_data_end) : 0u;
111 inline unsigned int DataLength()
const {
112 return m_buffer_start ?
113 static_cast<unsigned int>(m_data_end - m_buffer_start) : 0u;
119 inline unsigned int BufferSize()
const {
120 return static_cast<unsigned int>(m_buffer_end - m_buffer_start);
123 static const unsigned int INITIAL_SIZE;
124 static const unsigned int PDU_BLOCK_SIZE = 4;
137 bool Receive() {
return m_transport->Receive(); }
140 std::auto_ptr<IncomingStreamTransport> m_transport;
145 #endif // PLUGINS_E131_E131_TCPTRANSPORT_H_