libptpmgmt  1.4
libptpmgmt library that provides the functionality of linuxptp pmc
Protected Member Functions | List of all members
SockRaw Class Reference

Raw socket that uses PTP over Ethernet. More...

#include <sock.h>

Inheritance diagram for SockRaw:
Inheritance graph
[legend]
Collaboration diagram for SockRaw:
Collaboration graph
[legend]

Protected Member Functions

bool setPtpDstMacStr (const std::string &string)
 
bool setPtpDstMac (const Binary &ptp_dst_mac)
 
bool setPtpDstMac (const void *ptp_dst_mac, size_t len)
 
bool setPtpDstMac (const uint8_t *ptp_dst_mac, size_t len)
 
bool setPtpDstMac (const ConfigFile &cfg, const std::string &section="")
 
bool setSocketPriority (uint8_t socket_priority)
 
bool setSocketPriority (const ConfigFile &cfg, const std::string &section="")
 
- Protected Member Functions inherited from SockBase
void close ()
 
bool init ()
 
bool send (const void *msg, size_t len)
 
bool send (Buf &buf, size_t len)
 
bool sendBuf (Buf &buf, size_t len)
 
ssize_t rcv (void *buf, size_t bufSize, bool block=false)
 
ssize_t rcv (Buf &buf, bool block=false)
 
ssize_t rcvBuf (Buf &buf, bool block=false)
 
int getFd () const
 
int fileno () const
 
bool poll (uint64_t timeout_ms=0) const
 
bool tpoll (uint64_t &timeout_ms) const
 

Additional Inherited Members

- Public Member Functions inherited from SockBaseIf
bool setIfUsingName (const std::string &ifName)
 
bool setIfUsingIndex (int ifIndex)
 
bool setIf (const IfInfo &ifObj)
 
bool setAll (const IfInfo &ifObj, const ConfigFile &cfg, const std::string &section="")
 
bool setAllInit (const IfInfo &ifObj, const ConfigFile &cfg, const std::string &section="")
 

Detailed Description

Raw socket that uses PTP over Ethernet.

Note
The class does NOT support VLAN tags!

Member Function Documentation

◆ setPtpDstMac() [1/4]

bool SockRaw::setPtpDstMac ( const Binary ptp_dst_mac)
protected

Set PTP multicast address using binary from

Parameters
[in]ptp_dst_macaddress in binary string object
Returns
true if PTP multicast address is updated
Note
PTP multicast address can not be changed after initializing. User can close the socket, change this value, and initialize a new socket.

◆ setPtpDstMac() [2/4]

bool SockRaw::setPtpDstMac ( const ConfigFile cfg,
const std::string &  section = "" 
)
protected

Set PTP multicast address using configuration file

Parameters
[in]cfgreference to configuration file object
[in]sectionin configuration file
Returns
true if PTP multicast address is updated
Note
PTP multicast address can not be changed after initializing. User can close the socket, change this value, and initialize a new socket.
calling without section will fetch value from "global" section

◆ setPtpDstMac() [3/4]

bool SockRaw::setPtpDstMac ( const uint8_t *  ptp_dst_mac,
size_t  len 
)
protected

Set PTP multicast address using binary from

Parameters
[in]ptp_dst_macaddress in binary form
[in]lenaddress length
Returns
true if PTP multicast address is updated
Note
PTP multicast address can not be changed after initializing. User can close the socket, change this value, and initialize a new socket.
Remarks
keep for ABI backward compatibility.

◆ setPtpDstMac() [4/4]

bool SockRaw::setPtpDstMac ( const void *  ptp_dst_mac,
size_t  len 
)
protected

Set PTP multicast address using binary from

Parameters
[in]ptp_dst_macaddress in binary form
[in]lenaddress length
Returns
true if PTP multicast address is updated
Note
PTP multicast address can not be changed after initializing. User can close the socket, change this value, and initialize a new socket.

◆ setPtpDstMacStr()

bool SockRaw::setPtpDstMacStr ( const std::string &  string)
protected

< Set PTP multicast address using string from

Parameters
[in]stringaddress in a string object
Returns
true if PTP multicast address is updated
Note
PTP multicast address can not be changed after initializing. User can close the socket, change this value, and initialize a new socket.
function convert address to binary form and return false if conversion fail (address is using wrong format).

◆ setSocketPriority() [1/2]

bool SockRaw::setSocketPriority ( const ConfigFile cfg,
const std::string &  section = "" 
)
protected

Set socket priority using configuration file

Parameters
[in]cfgreference to configuration file object
[in]sectionin configuration file
Returns
true if socket priority is updated
Note
socket priority can not be changed after initializing. User can close the socket, change this value, and initialize a new socket.
calling without section will fetch value from "global" section

◆ setSocketPriority() [2/2]

bool SockRaw::setSocketPriority ( uint8_t  socket_priority)
protected

Set socket priority

Parameters
[in]socket_prioritysocket priority value
Returns
true if socket priority is updated
Note
socket priority can not be changed after initializing. User can close the socket, change this value, and initialize a new socket.
the priority is used by network layer, it is not part of the packet

The documentation for this class was generated from the following file: