libptpmgmt  1.3
libptpmgmt library that provides the functionality of linuxptp pmc
Classes | Typedefs | Functions
msg.h File Reference

Create and parse PTP management messages. More...

#include "c/cfg.h"
#include "c/proc.h"
#include "c/sig.h"
Include dependency graph for msg.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ptpmgmt_msg_t
 

Typedefs

typedef struct ptpmgmt_msg_tptpmgmt_msg
 
typedef const struct ptpmgmt_msg_tconst_ptpmgmt_msg
 
typedef bool(* ptpmgmt_msg_sig_callback) (void *cookie, const_ptpmgmt_msg msg, enum ptpmgmt_tlvType_e tlvType, const void *tlv)
 

Functions

const char * ptpmgmt_msg_err2str (enum ptpmgmt_MNG_PARSE_ERROR_e err)
 
const char * ptpmgmt_msg_type2str (enum ptpmgmt_msgType_e type)
 
const char * ptpmgmt_msg_tlv2str (enum ptpmgmt_tlvType_e type)
 
const char * ptpmgmt_msg_act2str (enum ptpmgmt_actionField_e action)
 
const char * ptpmgmt_msg_mng2str (enum ptpmgmt_mng_vals_e id)
 
bool ptpmgmt_msg_findMngID (const char *str, enum ptpmgmt_mng_vals_e *id, bool exact)
 
const char * ptpmgmt_msg_errId2str (enum ptpmgmt_managementErrorId_e err)
 
const char * ptpmgmt_msg_clkType2str (enum ptpmgmt_clockType_e type)
 
const char * ptpmgmt_msg_netProt2str (enum ptpmgmt_networkProtocol_e protocol)
 
const char * ptpmgmt_msg_clockAcc2str (enum ptpmgmt_clockAccuracy_e value)
 
const char * ptpmgmt_msg_faultRec2str (enum ptpmgmt_faultRecord_e code)
 
const char * ptpmgmt_msg_timeSrc2str (enum ptpmgmt_timeSource_e type)
 
bool ptpmgmt_msg_findTimeSrc (const char *str, enum ptpmgmt_timeSource_e *type, bool exact)
 
const char * ptpmgmt_msg_portState2str (enum ptpmgmt_portState_e state)
 
bool ptpmgmt_msg_findPortState (const char *str, enum ptpmgmt_portState_e *state, bool caseSens)
 
const char * ptpmgmt_msg_delayMech2str (enum ptpmgmt_delayMechanism_e type)
 
bool ptpmgmt_msg_findDelayMech (const char *str, enum ptpmgmt_delayMechanism_e *type, bool exact)
 
const char * ptpmgmt_msg_smpteLck2str (enum ptpmgmt_SMPTEmasterLockingStatus_e state)
 
const char * ptpmgmt_msg_ts2str (enum ptpmgmt_linuxptpTimeStamp_e type)
 
const char * ptpmgmt_msg_pwr2str (enum ptpmgmt_linuxptpPowerProfileVersion_e ver)
 
const char * ptpmgmt_msg_us2str (enum ptpmgmt_linuxptpUnicastState_e state)
 
bool ptpmgmt_msg_is_LI_61 (uint8_t flags)
 
bool ptpmgmt_msg_is_LI_59 (uint8_t flags)
 
bool ptpmgmt_msg_is_UTCV (uint8_t flags)
 
bool ptpmgmt_msg_is_PTP (uint8_t flags)
 
bool ptpmgmt_msg_is_TTRA (uint8_t flags)
 
bool ptpmgmt_msg_is_FTRA (uint8_t flags)
 
bool ptpmgmt_msg_isEmpty (enum ptpmgmt_mng_vals_e id)
 
ptpmgmt_msg ptpmgmt_msg_alloc ()
 
ptpmgmt_msg ptpmgmt_msg_alloc_prms (ptpmgmt_cpMsgParams prms)
 

Detailed Description

Create and parse PTP management messages.

Author
Erez Geva <ErezGeva2@gmail.com>

Created following "IEEE Std 1588-2008", PTP version 2 with some updates from "IEEE Std 1588-2019"

Typedef Documentation

◆ const_ptpmgmt_msg

typedef const struct ptpmgmt_msg_t* const_ptpmgmt_msg

pointer to constant ptpmgmt message structure

◆ ptpmgmt_msg

typedef struct ptpmgmt_msg_t* ptpmgmt_msg

pointer to ptpmgmt message structure

◆ ptpmgmt_msg_sig_callback

typedef bool(* ptpmgmt_msg_sig_callback) (void *cookie, const_ptpmgmt_msg msg, enum ptpmgmt_tlvType_e tlvType, const void *tlv)

pointer to callback traverse sig TLVs

Parameters
[in]cookiepointer to a user cookie
[in]msgobject
[in]tlvTypeSignalling TLV type
[in]tlvSignalling TLV
Returns
true to stop traverse
Note
user should cast the tlv to the proper Signalling TLV type structure

Function Documentation

◆ ptpmgmt_msg_act2str()

const char* ptpmgmt_msg_act2str ( enum ptpmgmt_actionField_e  action)

Convert action to string

Parameters
[in]action
Returns
string with the action in a string

◆ ptpmgmt_msg_alloc()

ptpmgmt_msg ptpmgmt_msg_alloc ( )

Alocate new message structure

Returns
new message structure or null in case of error

◆ ptpmgmt_msg_alloc_prms()

ptpmgmt_msg ptpmgmt_msg_alloc_prms ( ptpmgmt_cpMsgParams  prms)

Alocate new message structure with parameters

Parameters
[in]prmsptpmgmt_MsgParams
Returns
new message structure or null in case of error

◆ ptpmgmt_msg_clkType2str()

const char* ptpmgmt_msg_clkType2str ( enum ptpmgmt_clockType_e  type)

Convert clock type to string

Parameters
[in]typeclock type
Returns
string with the clock type

◆ ptpmgmt_msg_clockAcc2str()

const char* ptpmgmt_msg_clockAcc2str ( enum ptpmgmt_clockAccuracy_e  value)

Convert clock accuracy to string

Parameters
[in]valueclock accuracy
Returns
string with the clock accuracy

◆ ptpmgmt_msg_delayMech2str()

const char* ptpmgmt_msg_delayMech2str ( enum ptpmgmt_delayMechanism_e  type)

Convert delay mechanism to string

Parameters
[in]typedelay mechanism
Returns
string with a delay mechanism type

◆ ptpmgmt_msg_err2str()

const char* ptpmgmt_msg_err2str ( enum ptpmgmt_MNG_PARSE_ERROR_e  err)

Convert parse error code to string

Parameters
[in]errparse code
Returns
string with the error message

◆ ptpmgmt_msg_errId2str()

const char* ptpmgmt_msg_errId2str ( enum ptpmgmt_managementErrorId_e  err)

Convert management error to string

Parameters
[in]errID
Returns
string with the error message

◆ ptpmgmt_msg_faultRec2str()

const char* ptpmgmt_msg_faultRec2str ( enum ptpmgmt_faultRecord_e  code)

Convert fault record severity code to string

Parameters
[in]codeseverity code
Returns
string with the severity code

◆ ptpmgmt_msg_findDelayMech()

bool ptpmgmt_msg_findDelayMech ( const char *  str,
enum ptpmgmt_delayMechanism_e type,
bool  exact 
)

Convert string to delay mechanism

Parameters
[in]strstring to search
[out]typedelay mechanism
[in]exactperform an exact match
Returns
true if found

◆ ptpmgmt_msg_findMngID()

bool ptpmgmt_msg_findMngID ( const char *  str,
enum ptpmgmt_mng_vals_e id,
bool  exact 
)

Convert string to management id

Parameters
[in]strstring to search
[out]idparse code
[in]exactperform an exact match
Returns
true if found

◆ ptpmgmt_msg_findPortState()

bool ptpmgmt_msg_findPortState ( const char *  str,
enum ptpmgmt_portState_e state,
bool  caseSens 
)

Convert string to port state

Parameters
[in]strstring to search
[out]stateport state
[in]caseSensperform case sensetive match
Returns
true if found

◆ ptpmgmt_msg_findTimeSrc()

bool ptpmgmt_msg_findTimeSrc ( const char *  str,
enum ptpmgmt_timeSource_e type,
bool  exact 
)

Convert string to time source type

Parameters
[in]strstring to search
[out]typetime source
[in]exactperform an exact match
Returns
true if found

◆ ptpmgmt_msg_is_FTRA()

bool ptpmgmt_msg_is_FTRA ( uint8_t  flags)

Check if frequency is traceable flag is enabled

Parameters
[in]flags
Returns
true if flag on

◆ ptpmgmt_msg_is_LI_59()

bool ptpmgmt_msg_is_LI_59 ( uint8_t  flags)

Check if leap 59 seconds flag is enabled

Parameters
[in]flags
Returns
true if flag on

◆ ptpmgmt_msg_is_LI_61()

bool ptpmgmt_msg_is_LI_61 ( uint8_t  flags)

Check if leap 61 seconds flag is enabled

Parameters
[in]flags
Returns
true if flag on

◆ ptpmgmt_msg_is_PTP()

bool ptpmgmt_msg_is_PTP ( uint8_t  flags)

Check if is PTP instance flag is enabled

Parameters
[in]flags
Returns
true if flag on

◆ ptpmgmt_msg_is_TTRA()

bool ptpmgmt_msg_is_TTRA ( uint8_t  flags)

Check if is PTP instance flag is enabled

Parameters
[in]flags
Returns
true if flag on

◆ ptpmgmt_msg_is_UTCV()

bool ptpmgmt_msg_is_UTCV ( uint8_t  flags)

Check if UTC offset is valid flag is enabled

Parameters
[in]flags
Returns
true if flag on

◆ ptpmgmt_msg_isEmpty()

bool ptpmgmt_msg_isEmpty ( enum ptpmgmt_mng_vals_e  id)

Check management TLV id uses empty dataField

Parameters
[in]idmanagement TLV id
Returns
true if dataField is empty

◆ ptpmgmt_msg_mng2str()

const char* ptpmgmt_msg_mng2str ( enum ptpmgmt_mng_vals_e  id)

Convert management id to string

Parameters
[in]idparse code
Returns
string with ID name

◆ ptpmgmt_msg_netProt2str()

const char* ptpmgmt_msg_netProt2str ( enum ptpmgmt_networkProtocol_e  protocol)

Convert network protocol to string

Parameters
[in]protocolnetwork protocol
Returns
string with the network protocol

◆ ptpmgmt_msg_portState2str()

const char* ptpmgmt_msg_portState2str ( enum ptpmgmt_portState_e  state)

Convert port state to string

Parameters
[in]stateport state
Returns
string with the port state

◆ ptpmgmt_msg_pwr2str()

const char* ptpmgmt_msg_pwr2str ( enum ptpmgmt_linuxptpPowerProfileVersion_e  ver)

Convert linuxptp power profile version to string

Parameters
[in]verversion
Returns
string with the Linux power profile version

◆ ptpmgmt_msg_smpteLck2str()

const char* ptpmgmt_msg_smpteLck2str ( enum ptpmgmt_SMPTEmasterLockingStatus_e  state)

Convert SMPTE clock locking state to string

Parameters
[in]stateSMPTE clock locking state
Returns
string with the SMPTE clock locking state

◆ ptpmgmt_msg_timeSrc2str()

const char* ptpmgmt_msg_timeSrc2str ( enum ptpmgmt_timeSource_e  type)

Convert time source to string

Parameters
[in]typetime source
Returns
string with the time source

◆ ptpmgmt_msg_tlv2str()

const char* ptpmgmt_msg_tlv2str ( enum ptpmgmt_tlvType_e  type)

Convert TLV type to string

Parameters
[in]type
Returns
string with the TLV type

◆ ptpmgmt_msg_ts2str()

const char* ptpmgmt_msg_ts2str ( enum ptpmgmt_linuxptpTimeStamp_e  type)

Convert linuxptp time stamp type to string

Parameters
[in]typetime stamp type
Returns
string with the Linux time stamp type

◆ ptpmgmt_msg_type2str()

const char* ptpmgmt_msg_type2str ( enum ptpmgmt_msgType_e  type)

Convert message type to string

Parameters
[in]type
Returns
string with the TLV type

◆ ptpmgmt_msg_us2str()

const char* ptpmgmt_msg_us2str ( enum ptpmgmt_linuxptpUnicastState_e  state)

Convert linuxptp master unicasy state to string

Parameters
[in]state
Returns
string with the master state in the unicast master table