MessagePackage¶
-
class
kanzi::connect
::
MessagePackage
¶ Subclassed by GenericRPCReplyMessage, P2PLinkEstablishedMessage, SessionRunningMessage, SessionStartMessage, SessionStopMessage, SessionStoppedMessage, StreamNewBlobEvent, StreamReceiveEncoderParameterEvent, StreamReceiveStreamInfoEvent, StreamRemoveSubscriptionMethod, StreamRequestEncoderParameterMethod, StreamRequestStreamInfoMethod, StreamRestartEncoderMethod, StreamSetEncoderParameterMethod, StreamSetStreamContentMethod, StreamSubscribeBlobsMethod, StreamSubscriptionResultEvent
Public Types
-
enum
AttributeType
¶ Values:
-
enumerator
ATTRIBUTE_VALUE_TYPE_UNKNOWN
¶
-
enumerator
ATTRIBUTE_VALUE_TYPE_INTEGER
¶
-
enumerator
ATTRIBUTE_VALUE_TYPE_FLOAT
¶
-
enumerator
ATTRIBUTE_VALUE_TYPE_BOOL
¶
-
enumerator
ATTRIBUTE_VALUE_TYPE_STRING
¶
-
enumerator
ATTRIBUTE_VALUE_TYPE_BINARY
¶
-
enumerator
ATTRIBUTE_VALUE_TYPE_PACKAGE
¶
-
enumerator
ATTRIBUTE_VALUE_TYPE_INTEGER64
¶
-
enumerator
ATTRIBUTE_VALUE_TYPE_DOUBLE
¶
-
enumerator
ATTRIBUTE_VALUE_TYPE_UNSIGNED_INTEGER
¶
-
enumerator
ATTRIBUTE_VALUE_TYPE_UNSIGNED_INTEGER64
¶
-
enumerator
-
enum
CongestionControl
¶ Values:
-
enumerator
CONGESTION_CONTROL_NONE
¶
-
enumerator
CONGESTION_CONTROL_KEEP_LAST
¶
-
enumerator
CONGESTION_CONTROL_ARRAY_ATTRIBUTES
¶
-
enumerator
-
enum
FixedAttributeKeys
¶ Values:
-
enumerator
ATTRIBUTE_KEY_UNKNOWN
¶
-
enumerator
ATTRIBUTE_KEY_NAME
¶
-
enumerator
ATTRIBUTE_KEY_EXPECTED_RETURNVALUE_TYPE
¶
-
enumerator
ATTRIBUTE_KEY_RETURNVALUE
¶
-
enumerator
ATTRIBUTE_KEY_ARGUMENT_COUNT
¶
-
enumerator
ATTRIBUTE_KEY_CLIENTID
¶
-
enumerator
ATTRIBUTE_KEY_SESSIONID
¶
-
enumerator
ATTRIBUTE_KEY_INTERFACEID
¶
-
enumerator
ATTRIBUTE_KEY_TO_JSON
¶
-
enumerator
ATTRIBUTE_KEY_MESSAGETYPE
¶
-
enumerator
ATTRIBUTE_KEY_VERSION
¶
-
enumerator
ATTRIBUTE_KEY_WRAPPED_MESSAGE
¶
-
enumerator
ATTRIBUTE_KEY_P2P_CLIENT_ID
¶
-
enumerator
ATTRIBUTE_KEY_REMOTESERVICE_CLIENT_PROTOCOL
¶
-
enumerator
ATTRIBUTE_KEY_REMOTESERVICE_CLIENT_ADDRESS
¶
-
enumerator
ATTRIBUTE_KEY_REMOTESERVICE_CLIENT_NAME
¶
-
enumerator
ATTRIBUTE_KEY_REMOTESERVICE_CLIENT_IDENTIFIER
¶
-
enumerator
ATTRIBUTE_KEY_P2P_SERVER_CLIENT_ID
¶ Specifies the client identifier number as its seen by the server.
-
enumerator
ATTRIBUTE_KEY_CONGESTION_CONTROL
¶
-
enumerator
ATTRIBUTE_KEY_ARGUMENT_1
¶
-
enumerator
ATTRIBUTE_KEY_ARGUMENT_101
¶
-
enumerator
ATTRIBUTE_KEY_LAST_RESERVED
¶
-
enumerator
ATTRIBUTE_KEY_RPC_CALL_HANDLE
¶
-
enumerator
ATTRIBUTE_KEY_RPC_STATUS
¶
-
enumerator
-
enum
MessageType
¶ Values:
-
enumerator
MESSAGETYPE_UNSPECIFIED
¶
-
enumerator
MESSAGETYPE_METHOD
¶
-
enumerator
MESSAGETYPE_ROUTED_METHOD
¶
-
enumerator
MESSAGETYPE_EVENT
¶
-
enumerator
MESSAGETYPE_ROUTED_EVENT
¶
-
enumerator
MESSAGETYPE_METHOD_RETURN
¶
-
enumerator
MESSAGETYPE_ROUTED_METHOD_RETURN
¶
-
enumerator
MESSAGETYPE_INVALID_ARGUMENTS_RESPONSE
¶
-
enumerator
Public Functions
-
MessagePackage
()¶
-
MessagePackage
(const MessagePackage &package)¶
-
MessagePackage
(MessagePackage &&package)¶
-
virtual
~MessagePackage
()¶
-
bool
addBinaryAttribute
(int key, const string &value)¶ Add a binary string value to an attribute.
- Parameters
key – Key identifying the attribute.
value – New value for the attribute.
- Returns
True on success.
-
bool
addBinaryAttributeEx
(int key, const unsigned char *blob, size_t size)¶ Add a binary data t to an attribute.
- Parameters
key – the identifier for binary data
blob – the binary content
size – the size of the binary data.
-
bool
addBoolAttribute
(int key, bool value)¶ Add a boolean value to an attribute.
- Parameters
key – Key identifying the attribute.
value – New value for the attribute.
- Returns
True on success.
-
bool
addDoubleAttribute
(int key, double value)¶ Add a double value to an attribute.
- Parameters
key – Key identifying the attribute.
value – New value for the attribute.
- Returns
True on success.
-
bool
addFloatAttribute
(int key, float value)¶ Add a floating point value to an attribute.
- Parameters
key – Key identifying the attribute.
value – New value for the attribute.
- Returns
True on success.
-
bool
addInt64Attribute
(int key, int64_t value)¶ Add 64bit integer value to an attribute.
- Parameters
key – the key identifying the attribute.
value – the new value
- Returns
true on success.
-
bool
addIntAttribute
(int key, int value)¶ Add a integer value to an attribute.
- Parameters
key – Key identifying the attribute.
value – New value for the attribute.
- Returns
True on success.
-
bool
addPackageAttribute
(int key, const MessagePackage &value)¶ Add a child message package to an attribute.
- Parameters
key – Key identifying the attribute.
value – New value for the attribute.
- Returns
True on success.
-
bool
addStringAttribute
(int key, const string &value)¶ Add a string value to an attribute.
- Parameters
key – Key identifying the attribute.
value – New value for the attribute.
- Returns
True on success.
-
bool
addUInt64Attribute
(int key, uint64_t value)¶ Add 64-bit integer value to an attribute.
- Parameters
key – the key identifying the attribute.
value – the new value
- Returns
true on success.
-
bool
addUIntAttribute
(int key, unsigned int value)¶ Add a integer value to an attribute.
- Parameters
key – Key identifying the attribute.
value – New value for the attribute.
- Returns
True on success.
-
unsigned int
byteSize
() const¶ Get binary size for the message.
- Returns
The byte size of package.
-
virtual void
clear
()¶ Purge the contents of the package.
-
void
eraseAttribute
(int key)¶ Erase attribute array i.e.
clear all values for the given identifier.
- Parameters
key – Key identifying the attribute.
-
string
getAttributeKeyString
(int key) const¶ Get attribute key string for an attribute.
See setAttributeKeyString().
- Parameters
key – Key identifying the attribute.
- Returns
Attribute key string for the given attribute. Empty if the attribute is not found.
-
AttributeType
getAttributeType
(int key) const¶ Get the type of an attribute.
- Parameters
key – Key identifying the attribute.
- Returns
The type of the attribute. See MessagePackage::AttributeType. MessagePackage::ATTRIBUTE_VALUE_TYPE_UNKNOWN if attribute was not found.
-
size_t
getAttributeValuesCount
(int key) const¶ Get the size of values array for an .
key Key of the attribute index.
- Returns
The count of the message attribute array items.
-
string
getBinaryAttribute
(int key, size_t index) const¶ Get the binary string value of an attribute.
- Parameters
key – Key identifying the attribute.
- Returns
The integer value of the attribute. 0 if attribute was not found.
-
bool
getBoolAttribute
(int key, size_t index) const¶ Get the boolean value of an attribute.
- Parameters
key – Key identifying the attribute.
- Returns
The integer value of the attribute. 0 if attribute was not found.
-
int
getClientIdentifier
() const¶ Get client identifier.
For convenience mostly, a client identifier can be accessed directly using getIntAttribute with key ATTRIBUTE_KEY_CLIENTID
- Returns
Identifier of the client bound to the message package.
-
double
getDoubleAttribute
(int key, size_t index) const¶ Get the double value of an attribute.
- Parameters
key – Key identifying the attribute.
- Returns
The integer value of the attribute. 0 if attribute was not found.
-
float
getFloatAttribute
(int key, size_t index) const¶ Get the floating point value of an attribute.
- Parameters
key – Key identifying the attribute.
- Returns
The integer value of the attribute. 0 if attribute was not found.
-
uint32_t
getHandle
() const¶
-
int64_t
getInt64Attribute
(int key, size_t index) const¶ Get the integer value of an attribute.
- Parameters
key – Key identifying the attribute.
index – Index of the attribute value. See getAttributeValuesCount().
- Returns
The 64bit integer value of the attribute. 0 if attribute was not found.
-
int
getIntAttribute
(int key, size_t index) const¶ Get the integer value of an attribute.
- Parameters
key – Key identifying the attribute.
index – Index of the attribute value. See getAttributeValuesCount().
- Returns
The integer value of the attribute. 0 if attribute was not found.
-
string
getInterfaceIdentifier
() const¶ Get interface identifier.
For convenience mostly, an interface identifier can be accessed directly using getIntAttribute with key ATTRIBUTE_KEY_INTERFACEID
- Returns
Identifier of the interface bound to the message package.
-
MessageType
getMessageType
() const¶ Get message type.
- Returns
The type of the message package. See MessagePackage::MessageType.
-
MessagePackage
getPackageAttribute
(int key, size_t index) const¶ Get the child message package of an attribute.
- Parameters
key – Key identifying the attribute.
- Returns
The integer value of the attribute. 0 if attribute was not found.
-
bool
getPackageAttributeTo
(int key, size_t index, MessagePackage *to) const¶ Get the child message package of an attribute.
- Parameters
key – Key identifying the attribute.
index – the index of the package in case multiple.
to – target package where to store the package from attribute.
- Returns
true if success, false otherwise.
-
int
getSessionIdentifier
() const¶ Get session identifier.
For convenience mostly, a session identifier can be accessed directly using getIntAttribute with key ATTRIBUTE_KEY_SESSIONID
- Returns
Identifier of the session bound to the message package.
-
string
getSourceClientAddress
() const¶ Retrieve configured client address.
Used with remote services.
- Returns
client address
-
int
getSourceClientIdentifier
() const¶ Retrieve source client identifier.
Used with remote services.
- Returns
client identifier.
-
string
getSourceClientName
() const¶ Retrieve configure client name.
Used with remote services.
- Returns
client name
-
string
getSourceClientProtocol
() const¶ Retrieve configured client protocol.
Used with remote services.
- Returns
client protocol
-
string
getStringAttribute
(int key, size_t index) const¶ Get the string value of an attribute.
- Parameters
key – Key identifying the attribute.
- Returns
The integer value of the attribute. 0 if attribute was not found.
-
virtual string
getType
() const¶ Get identity of this message.
ToDo: To be renamed to getName() or alike
- Returns
Type name for the message.
-
uint64_t
getUInt64Attribute
(int key, size_t index) const¶ Get the 64-bit unsigned integer value of an attribute.
- Parameters
key – Key identifying the attribute.
index – Index of the attribute value. See getAttributeValuesCount().
- Returns
The 64bit integer value of the attribute. 0 if attribute was not found.
-
unsigned int
getUIntAttribute
(int key, size_t index) const¶ Get the unsigned integer value of an attribute.
- Parameters
key – Key identifying the attribute.
index – Index of the attribute value. See getAttributeValuesCount().
- Returns
The integer value of the attribute. 0 if attribute was not found.
-
virtual bool
initialize
(const string &buffer, bool isBinary)¶
-
MessagePackage &
operator=
(const MessagePackage &package)¶
-
virtual string
serializeAsString
() const¶ Serialize message container to a string.
If attribute array contains boolean attribute ATTRIBUTE_KEY_TO_JSON with value true, the output string is to be produced as JSON, binary otherwise.
- Returns
Contents of the message container serialized as a string.
-
bool
setAttributeKeyString
(int key, const string &keyString)¶ Set attribute key string for an attribute.
Attribute setting and reading is based currently only the numeric value of the key so the key string is just additional information for the other peer.
- Parameters
key – Key identifying the attribute.
keyString – The string to be attached to key.
- Returns
True on success.
-
bool
setClientIdentifier
(int identifier)¶ Set client identifier for the message package.
For convenience mostly, client identifier can be modified directly using setIntAttribute with key ATTRIBUTE_KEY_CLIENTID
- Parameters
identifier – Identifier of a client.
- Returns
True on success.
-
bool
setHandle
(uint32_t handle)¶
-
bool
setInterfaceIdentifier
(string identifier)¶ Set interface identifier for the message package.
For convenience mostly, client identifier can be modified directly using setIntAttribute with key ATTRIBUTE_KEY_INTERFACEID
- Parameters
identifier – Identifier of the client.
- Returns
True on success.
-
bool
setMessageType
(MessageType type)¶ Set message type.
- Parameters
type – The type of the message package. See MessagePackage::MessageType.
- Returns
True on success.
-
bool
setSessionIdentifier
(int identifier)¶ Set session identifier for the message package.
For convenience mostly, a session identifier can be modified directly using setIntAttribute with key ATTRIBUTE_KEY_SESSIONID
- Parameters
identifier – Identifier of a client.
- Returns
True on success.
-
bool
setSourceClientAddress
(const string &address)¶ Sets a client address.
Used in remote service communication to hold the address of the client that originally contacted server.
- Parameters
address – the address (IP usually, but can be anything) to set.
- Returns
true if ok
-
bool
setSourceClientIdentifier
(int identifier)¶ Sets a client identifier.
Used in remote service communication to hold the client identifier at the server.
- Parameters
identifier – the identifier number.
- Returns
true if ok
-
bool
setSourceClientName
(const string &name)¶ Sets a client name.
Used in remote service communication to hold the name of the client that contacted the server.
- Parameters
name – the client name.
- Returns
true if ok
-
bool
setSourceClientProtocol
(const string &protocol)¶ Sets a client protocol.
Used in remote service communication to hold the protocol used when client contacted server.
- Parameters
protocol – the communications protocol used.
- Returns
true if ok
-
virtual bool
setType
(const string &type)¶ Set identity for this message.
ToDo: To be renamed to setName() or alike
- Parameters
type – Type name for the message.
- Returns
True on success.
Public Members
-
unique_ptr<MessagePackageData>
m_data
¶
-
enum