Library: RemotingNG/TCP
Package: TCP
Header: Poco/RemotingNG/TCP/Frame.h
This class represents a network frame used by the TCP transport connection.
A frame consists of a header, followed by payload. Header format is as follows:
All integers are in network byte order. Payload sizes are 16 bit, although practically only payloads up to a size of 1012 bytes are used.
Direct Base Classes: Poco::RefCountedObject
All Base Classes: Poco::RefCountedObject
Member Functions: bufferBegin, bufferEnd, bufferSize, channel, flags, frameSize, getPayloadSize, maxPayloadSize, payloadBegin, payloadEnd, setPayloadSize, type, updateFlags
Inherited Functions: duplicate, referenceCount, release
typedef Poco::AutoPtr < Frame > Ptr;
CAPA_REMOTING_PROTOCOL_1_0 = 0x524D0100
The endpoint understands the Remoting NG binary protocol, version 1.0
FRAME_FLAG_EOM = 0x0001
End Of Message - the last frame of a message.
FRAME_FLAG_CONT = 0x0002
Continuation frame - set on all frames except the first one in a multi-frame message.
FRAME_FLAG_ONEWAY = 0x0004
One Way Message - no reply expected.
FRAME_FLAG_DEFLATE = 0x0008
Frame/message payload is compressed using zlib deflate algorithm.
FRAME_FLAG_EXTHDR = 0x8000
Extended header - reserved for future use.
FRAME_HEADER_SIZE = 12
Size of frame header.
FRAME_MAX_SIZE = 1024
Maximum frame size (header + payload) currently used by protocol.
FRAME_MAX_PAYLOAD_SIZE = FRAME_MAX_SIZE - FRAME_HEADER_SIZE
Maximum frame payload size currently used by protocol.
FRAME_TYPE_HELO = 0x48454C4F
"HELO" - first frame to be sent over channel 0 after connection has been established. Sent by both parties. Payload is protocol major version (8 bit unsigned), followed by protocol minor version (8 bit unsigned), followed by flags (8 bit unsigned, currently unused), followed by number of capabilities (8 bit unsigned), followed by list of capabilities as 32 bit integers.
FRAME_TYPE_BYE = 0x42594521
"BYE!" - last frame to be sent over channel. The endpoint wishing to close the connection sends a BYE! frame, and the other side acknowledges by responding also with a BYE! frame. After acknowledgement, the underlying TCP connection is closed.
The frame has no payload.
FRAME_TYPE_REQU = 0x52455155
"REQU" - A Remoting NG request message. Payload is serialized request (see Poco::RemotingNG::BinarySerializer).
FRAME_TYPE_REPL = 0x5245504C
"RESP" - A Remoting NG reply message. Payload is serialized reply (see Poco::RemotingNG::BinarySerializer).
FRAME_TYPE_EVNT = 0x45564E54
"EVNT" - A Remoting NG event message. Payload is serialized event (see Poco::RemotingNG::BinarySerializer).
FRAME_TYPE_EVNR = 0x45564E52
"EVNR" - A Remoting NG event reply message. Payload is serialized event reply (see Poco::RemotingNG::BinarySerializer).
FRAME_TYPE_EVSU = 0x45565355
"EVSU" - A Remoting NG event subscribe/renewal message.
FRAME_TYPE_EVUN = 0x4556554E
"EVUN" - A Remoting NG event unsubscribe message.
Frame(
Poco::UInt32 type,
Poco::UInt32 channel,
Poco::UInt16 flags,
Poco::UInt16 bufferSize
);
Creates a frame with the given type, flags and buffer size.
Buffer size must be sufficient for both header and payload. Minimum buffer size is the size of the header, which is 12 bytes.
The initial payload size is 0.
~Frame();
Destroys the frame.
char * bufferBegin();
Returns a pointer to the begin of the buffer.
const char * bufferBegin() const;
Returns a pointer to the begin of the buffer.
char * bufferEnd();
Returns a pointer to the end (one past last byte) of the buffer.
const char * bufferEnd() const;
Returns a pointer to the end (one past last byte) of the buffer.
Poco::UInt16 bufferSize() const;
Returns the buffer size.
Poco::UInt32 channel() const;
Returns the channel.
Poco::UInt16 flags() const;
Returns the flags.
Poco::UInt16 frameSize() const;
Returns the frame size, which is header size plus payload size.
Poco::UInt16 getPayloadSize() const;
Returns the payload size.
Poco::UInt16 maxPayloadSize() const;
Returns the maximum payload size, which is buffer size minus header size.
char * payloadBegin();
Returns a pointer to the begin of the payload in the buffer.
const char * payloadBegin() const;
Returns a pointer to the begin of the payload in the buffer.
char * payloadEnd();
Returns a pointer to the end (one past last byte) of the payload in the buffer.
const char * payloadEnd() const;
Returns a pointer to the end (one past last byte) of the payload in the buffer.
void setPayloadSize(
Poco::UInt16 size
);
Sets the payload size, which must not exceed the buffer size minus header size.
Poco::UInt32 type() const;
Returns the frame type.
void updateFlags(
Poco::UInt16 flags
);
Updates the flags.