|
libptpmgmt 2.0
libptpmgmt library that provides the functionality of linuxptp pmc
|
Handle PTP management message. More...
#include <msg.h>
Public Member Functions | |
| Message (const MsgParams &prms) | |
| const MsgParams & | getParams () const |
| bool | updateParams (const MsgParams &prms) |
| bool | useAuth (const ConfigFile &cfg, const std::string §ion="") |
| bool | useAuth (const SaFile &sa, uint8_t spp, uint32_t key) |
| bool | changeAuth (uint8_t spp, uint32_t key) |
| bool | changeAuth (uint32_t key) |
| bool | disableAuth () |
| int | usedAuthSppID () const |
| uint32_t | usedAuthKeyID () const |
| const SaFile & | getSa () const |
| bool | haveAuth () const |
| mng_vals_e | getTlvId () const |
| mng_vals_e | getBuildTlvId () const |
| void | setAllClocks () |
| bool | isAllClocks () const |
| bool | useConfig (const ConfigFile &cfg, const std::string §ion="") |
| bool | isValidId (mng_vals_e id) const |
| bool | setAction (actionField_e actionField, mng_vals_e tlv_id, const BaseMngTlv *dataSend=nullptr) |
| void | clearData () |
| MNG_PARSE_ERROR_e | build (void *buf, size_t bufSize, uint16_t sequence) |
| MNG_PARSE_ERROR_e | build (Buf &buf, uint16_t sequence) |
| actionField_e | getSendAction () const |
| size_t | getMsgLen () const |
| ssize_t | getMsgPlanedLen () const |
| MNG_PARSE_ERROR_e | parse (const void *buf, ssize_t msgSize) |
| MNG_PARSE_ERROR_e | parse (const Buf &buf, ssize_t msgSize) |
| actionField_e | getReplyAction () const |
| bool | isUnicast () const |
| uint8_t | getPTPProfileSpecific () const |
| uint16_t | getSequence () const |
| const PortIdentity_t & | getPeer () const |
| const PortIdentity_t & | getTarget () const |
| uint32_t | getSdoId () const |
| uint8_t | getDomainNumber () const |
| uint8_t | getVersionPTP () const |
| uint8_t | getMinorVersionPTP () const |
| const BaseMngTlv * | getData () const |
| const BaseMngTlv * | getSendData () const |
| managementErrorId_e | getErrId () const |
| const std::string & | getErrDisplay () const |
| const char * | getErrDisplay_c () const |
| bool | isLastMsgSig () const |
| bool | isLastMsgSMPTE () const |
| msgType_e | getType () const |
| tlvType_e | getMngType () const |
| bool | traversSigTlvs (const std::function< bool(const Message &msg, tlvType_e tlvType, const BaseSigTlv *tlv)> callback) const |
| bool | traversSigTlvsCl (MessageSigTlvCallback &callback) const |
| size_t | getSigTlvsCount () const |
| const BaseSigTlv * | getSigTlv (size_t position) const |
| tlvType_e | getSigTlvType (size_t position) const |
| mng_vals_e | getSigMngTlvType (size_t position) const |
| const BaseMngTlv * | getSigMngTlv (size_t position) const |
| const MessageSigTlvs & | getSigTlvs () const |
Static Public Member Functions | |
| static const char * | err2str_c (MNG_PARSE_ERROR_e err) |
| static const char * | type2str_c (msgType_e type) |
| static const char * | tlv2str_c (tlvType_e type) |
| static const char * | act2str_c (actionField_e action) |
| static const char * | mng2str_c (mng_vals_e id) |
| static const bool | findMngID (const std::string &str, mng_vals_e &id, bool exact=true) |
| static const char * | errId2str_c (managementErrorId_e err) |
| static const char * | clkType2str_c (clockType_e type) |
| static const char * | netProt2str_c (networkProtocol_e protocol) |
| static const char * | clockAcc2str_c (clockAccuracy_e value) |
| static const char * | faultRec2str_c (faultRecord_e code) |
| static const char * | timeSrc2str_c (timeSource_e type) |
| static const bool | findTimeSrc (const std::string &str, timeSource_e &type, bool exact=true) |
| static const char * | portState2str_c (portState_e state) |
| static const bool | findPortState (const std::string &str, portState_e &state, bool caseSens=true) |
| static const char * | delayMech2str_c (delayMechanism_e type) |
| static const bool | findDelayMech (const std::string &str, delayMechanism_e &type, bool exact=true) |
| static const char * | smpteLck2str_c (SMPTEmasterLockingStatus_e state) |
| static const char * | ts2str_c (linuxptpTimeStamp_e type) |
| static const char * | pwr2str_c (linuxptpPowerProfileVersion_e ver) |
| static const char * | us2str_c (linuxptpUnicastState_e state) |
| static bool | is_LI_61 (uint8_t flags) |
| static bool | is_LI_59 (uint8_t flags) |
| static bool | is_UTCV (uint8_t flags) |
| static bool | is_PTP (uint8_t flags) |
| static bool | is_TTRA (uint8_t flags) |
| static bool | is_FTRA (uint8_t flags) |
| static bool | isEmpty (mng_vals_e id) |
Handle PTP management message.
Handle parse and build of a PTP management massage. Handle TLV specific dataField by calling a specific call-back per TLV id
| Message::Message | ( | const MsgParams & | prms | ) |
|
static |
Convert action to string
| [in] | action |
| MNG_PARSE_ERROR_e Message::build | ( | Buf & | buf, |
| uint16_t | sequence | ||
| ) |
Build a raw message for send based on last setAction call
| [in,out] | buf | object with memory buffer to fill with raw PTP Message |
| [in] | sequence | message sequence |
| MNG_PARSE_ERROR_e Message::build | ( | void * | buf, |
| size_t | bufSize, | ||
| uint16_t | sequence | ||
| ) |
Build a raw message for send using setAction setting
| [in,out] | buf | memory buffer to fill with raw PTP Message |
| [in] | bufSize | buffer size |
| [in] | sequence | message sequence |
| bool Message::changeAuth | ( | uint32_t | key | ) |
Change the send key used in the AUTHENTICATION TLVs
| [in] | key | ID to use to send |
| bool Message::changeAuth | ( | uint8_t | spp, |
| uint32_t | key | ||
| ) |
Change the spp and send key used in the AUTHENTICATION TLVs
| [in] | spp | ID to use to send |
| [in] | key | ID to use to send |
| void Message::clearData | ( | ) |
Clear data for send, prevent accidentally use, in case it is freed
|
static |
Convert clock type to string
| [in] | type | clock type |
|
static |
Convert clock accuracy to string
| [in] | value | clock accuracy |
|
static |
Convert delay mechanism to string
| [in] | type | delay mechanism |
| bool Message::disableAuth | ( | ) |
Disable the use of AUTHENTICATION TLV
|
static |
Convert parse error code to string
| [in] | err | parse code |
|
static |
Convert management error to string
| [in] | err | ID |
|
static |
Convert fault record severity code to string
| [in] | code | severity code |
|
static |
Convert string to delay mechanism
| [in] | str | string to search |
| [out] | type | delay mechanism |
| [in] | exact | perform an exact match |
|
static |
Convert string to management id
| [in] | str | string to search |
| [out] | id | parse code |
| [in] | exact | perform an exact match |
|
static |
Convert string to port state
| [in] | str | string to search |
| [out] | state | port state |
| [in] | caseSens | perform case sensetive match |
|
static |
Convert string to time source type
| [in] | str | string to search |
| [out] | type | time source |
| [in] | exact | perform an exact match |
| mng_vals_e Message::getBuildTlvId | ( | ) | const |
Get the current build TLV id
| const BaseMngTlv * Message::getData | ( | ) | const |
Get last parsed message dataField
| uint8_t Message::getDomainNumber | ( | ) | const |
Get last parsed message domainNumber
| const std::string & Message::getErrDisplay | ( | ) | const |
Get management error message Relevant only when parsed message return MNG_PARSE_ERROR_MSG
| const char * Message::getErrDisplay_c | ( | ) | const |
Get management error message Relevant only when parsed message return MNG_PARSE_ERROR_MSG
| managementErrorId_e Message::getErrId | ( | ) | const |
Get management error code ID Relevant only when parsed message return MNG_PARSE_ERROR_MSG
| uint8_t Message::getMinorVersionPTP | ( | ) | const |
Get last parsed message minor PTP version
| tlvType_e Message::getMngType | ( | ) | const |
Get management message type
| size_t Message::getMsgLen | ( | ) | const |
Get last build message size
| ssize_t Message::getMsgPlanedLen | ( | ) | const |
Get planned message to build size
| const MsgParams & Message::getParams | ( | ) | const |
Get the current msgparams parameters
| const PortIdentity_t & Message::getPeer | ( | ) | const |
Get last parsed message peer port ID
| uint8_t Message::getPTPProfileSpecific | ( | ) | const |
Get last reply PTP Profile Specific
| actionField_e Message::getReplyAction | ( | ) | const |
Get last reply management action
| const SaFile & Message::getSa | ( | ) | const |
Get authentication security association pool
| uint32_t Message::getSdoId | ( | ) | const |
Get last parsed message sdoId
| actionField_e Message::getSendAction | ( | ) | const |
Get build management action
| const BaseMngTlv * Message::getSendData | ( | ) | const |
Get send message dataField
| uint16_t Message::getSequence | ( | ) | const |
Get last parsed message sequence number
| const BaseMngTlv * Message::getSigMngTlv | ( | size_t | position | ) | const |
Get a management TLV from the last signalling message TLVs by position
| [in] | position | of TLV |
| mng_vals_e Message::getSigMngTlvType | ( | size_t | position | ) | const |
Get the management TLV ID of a management TLV from the last signalling message TLVs by position
| [in] | position | of TLV |
| const BaseSigTlv * Message::getSigTlv | ( | size_t | position | ) | const |
Get a TLV from the last signalling message TLVs by position
| [in] | position | of TLV |
| const MessageSigTlvs & Message::getSigTlvs | ( | ) | const |
Get reference to the last signalling message TLVs
| size_t Message::getSigTlvsCount | ( | ) | const |
Get number of the last signalling message TLVs
| tlvType_e Message::getSigTlvType | ( | size_t | position | ) | const |
Get a type of TLV from the last signalling message TLVs by position
| [in] | position | of TLV |
| const PortIdentity_t & Message::getTarget | ( | ) | const |
Get last parsed message target port ID
| mng_vals_e Message::getTlvId | ( | ) | const |
Get the current parsed TLV id
| msgType_e Message::getType | ( | ) | const |
Get message type
| uint8_t Message::getVersionPTP | ( | ) | const |
Get last parsed message PTP version
| bool Message::haveAuth | ( | ) | const |
Get if AUTHENTICATION TLV with authentication parameters are used
|
static |
Check if frequency is traceable flag is enabled
| [in] | flags |
|
static |
Check if leap 59 seconds flag is enabled
| [in] | flags |
|
static |
Check if leap 61 seconds flag is enabled
| [in] | flags |
|
static |
Check if is PTP instance flag is enabled
| [in] | flags |
|
static |
Check if timescale is traceable flag is enabled
| [in] | flags |
|
static |
Check if UTC offset is valid flag is enabled
| [in] | flags |
| bool Message::isAllClocks | ( | ) | const |
Query if target clock ID is using all clocks.
|
static |
Check management TLV id uses empty dataField
| [in] | id | management TLV id |
| bool Message::isLastMsgSig | ( | ) | const |
query if last message is a signalling message
| bool Message::isLastMsgSMPTE | ( | ) | const |
query if last message is a SMPTE message
| bool Message::isUnicast | ( | ) | const |
Is last parsed message a unicast or not
| bool Message::isValidId | ( | mng_vals_e | id | ) | const |
Check if management TLV is valid for use
| [in] | id | management TLV id |
|
static |
Convert management id to string
| [in] | id | parse code |
|
static |
Convert network protocol to string
| [in] | protocol | network protocol |
| MNG_PARSE_ERROR_e Message::parse | ( | const Buf & | buf, |
| ssize_t | msgSize | ||
| ) |
| MNG_PARSE_ERROR_e Message::parse | ( | const void * | buf, |
| ssize_t | msgSize | ||
| ) |
|
static |
Convert port state to string
| [in] | state | port state |
|
static |
Convert linuxptp power profile version to string
| [in] | ver | version |
| bool Message::setAction | ( | actionField_e | actionField, |
| mng_vals_e | tlv_id, | ||
| const BaseMngTlv * | dataSend = nullptr |
||
| ) |
Set message object management TLV id, action and data for dataField
| [in] | actionField | for sending |
| [in] | tlv_id | management TLV id |
| [in] | dataSend | pointer to TLV object |
| void Message::setAllClocks | ( | ) |
Set target clock ID to use all clocks.
|
static |
Convert SMPTE clock locking state to string
| [in] | state | SMPTE clock locking state |
|
static |
Convert time source to string
| [in] | type | time source |
|
static |
Convert TLV type to string
| [in] | type |
| bool Message::traversSigTlvs | ( | const std::function< bool(const Message &msg, tlvType_e tlvType, const BaseSigTlv *tlv)> | callback | ) | const |
Traverse all last signalling message TLVs
| [in] | callback | function to call with each TLV |
| bool Message::traversSigTlvsCl | ( | MessageSigTlvCallback & | callback | ) | const |
Traverse all last signalling message TLVs
| [in] | callback | object with callback to be called with each TLV |
|
static |
Convert linuxptp time stamp type to string
| [in] | type | time stamp type |
|
static |
Convert message type to string
| [in] | type |
| bool Message::updateParams | ( | const MsgParams & | prms | ) |
|
static |
Convert linuxptp master unicasy state to string
| [in] | state |
| bool Message::useAuth | ( | const ConfigFile & | cfg, |
| const std::string & | section = "" |
||
| ) |
Use the AUTHENTICATION TLV on send and receive read parameters from configuration file.
| [in] | cfg | reference to configuration file object |
| [in] | section | in configuration file |
| bool Message::useAuth | ( | const SaFile & | sa, |
| uint8_t | spp, | ||
| uint32_t | key | ||
| ) |
Use the AUTHENTICATION TLV on send and receive, read SA file.
| [in] | sa | reference to SA file object |
| [in] | spp | ID to use to send |
| [in] | key | ID to use to send |
| bool Message::useConfig | ( | const ConfigFile & | cfg, |
| const std::string & | section = "" |
||
| ) |
Fetch MsgParams parameters from configuration file
| [in] | cfg | reference to configuration file object |
| [in] | section | in configuration file |
| uint32_t Message::usedAuthKeyID | ( | ) | const |
Get used AUTHENTICATION TLV key ID used for send
| int Message::usedAuthSppID | ( | ) | const |