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"
38 #include "ola/network/TCPSocket.h"
39 #include "plugins/e131/e131/PDU.h"
40 #include "plugins/e131/e131/Transport.h"
41 #include "plugins/e131/e131/TransportHeader.h"
65 WAITING_FOR_PDU_FLAGS,
66 WAITING_FOR_PDU_LENGTH,
80 uint8_t *m_buffer_start, *m_buffer_end, *m_data_end;
82 unsigned int m_outstanding_data;
85 unsigned int m_block_size;
86 unsigned int m_consumed_block_size;
88 PDULengthSize m_pdu_length_size;
89 unsigned int m_pdu_size;
91 void HandlePreamble();
92 void HandlePDUFlags();
93 void HandlePDULength();
96 void IncreaseBufferSize(
unsigned int new_size);
97 void ReadRequiredData();
98 void EnterWaitingForPreamble();
99 void EnterWaitingForPDU();
104 inline unsigned int FreeSpace()
const {
105 return m_buffer_start ?
106 static_cast<unsigned int>(m_buffer_end - m_data_end) : 0u;
112 inline unsigned int DataLength()
const {
113 return m_buffer_start ?
114 static_cast<unsigned int>(m_data_end - m_buffer_start) : 0u;
120 inline unsigned int BufferSize()
const {
121 return static_cast<unsigned int>(m_buffer_end - m_buffer_start);
124 static const unsigned int INITIAL_SIZE;
125 static const unsigned int PDU_BLOCK_SIZE = 4;
138 bool Receive() {
return m_transport->Receive(); }
141 std::auto_ptr<IncomingStreamTransport> m_transport;
146 #endif // PLUGINS_E131_E131_TCPTRANSPORT_H_