libptpmgmt
1.4
libptpmgmt library that provides the functionality of linuxptp pmc
|
Unix socket. More...
#include <sock.h>
Public Member Functions | |
SockUnix () | |
const std::string & | getPeerAddress () const |
const char * | getPeerAddress_c () const |
bool | isPeerAddressAbstract () const |
bool | setPeerAddress (const std::string &string, bool useAbstract=false) |
bool | setPeerAddress (const ConfigFile &cfg, const std::string §ion="") |
const std::string & | getSelfAddress () const |
const char * | getSelfAddress_c () const |
bool | isSelfAddressAbstract () const |
bool | setSelfAddress (const std::string &string) |
bool | setSelfAddress (const std::string &string, bool useAbstract) |
bool | setDefSelfAddress (const std::string &rootBase="", const std::string &useDef="") |
const std::string & | getHomeDir () |
const char * | getHomeDir_c () |
bool | sendTo (const void *msg, size_t len, const std::string &addrStr) const |
bool | sendTo (const void *msg, size_t len, const std::string &addrStr, bool useAbstract) const |
bool | sendTo (Buf &buf, size_t len, const std::string &addrStr, bool useAbstract=false) const |
ssize_t | rcvFrom (void *buf, size_t bufSize, std::string &from, bool block=false) const |
ssize_t | rcvFrom (Buf &buf, std::string &from, bool block=false) const |
ssize_t | rcvFrom (void *buf, size_t bufSize, bool block=false) |
ssize_t | rcvFrom (Buf &buf, bool block=false) |
ssize_t | rcvBufFrom (Buf &buf, bool block=false) |
const std::string & | getLastFrom () const |
const char * | getLastFrom_c () const |
bool | isLastFromAbstract () const |
Static Public Member Functions | |
static bool | isAddressAbstract (const std::string &addr) |
Additional Inherited Members | |
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 |
Unix socket.
provide Unix socket that can be used to communicate with linuxptp daemon, ptp4l.
|
inline |
<
const std::string& SockUnix::getHomeDir | ( | ) |
Get user home directory
const char* SockUnix::getHomeDir_c | ( | ) |
Get user home directory
|
inline |
|
inline |
|
inline |
Get peer address
|
inline |
Get peer address
|
inline |
Get self address
|
inline |
Get self address
|
inlinestatic |
Is address abstract?
[in] | addr | socket address |
|
inline |
Is last from address abstract?
|
inline |
Is peer address abstract?
|
inline |
Is self address abstract?
|
inline |
Receive a message using the socket from any address
[in] | buf | object with message memory buffer |
[in] | block | true, wait till a packet arrives. false, do not wait, return error if no packet available |
|
inline |
Receive a message using the socket from any address
[in] | buf | object with message memory buffer |
[in] | block | true, wait till a packet arrives. false, do not wait, return error if no packet available |
|
inline |
Receive a message using the socket from any address
[in] | buf | object with message memory buffer |
[out] | from | Unix socket address (socket file) |
[in] | block | true, wait till a packet arrives. false, do not wait, return error if no packet available |
|
inline |
Receive a message using the socket from any address
[in,out] | buf | pointer to a memory buffer |
[in] | bufSize | memory buffer size |
[in] | block | true, wait till a packet arrives. false, do not wait, return error if no packet available |
ssize_t SockUnix::rcvFrom | ( | void * | buf, |
size_t | bufSize, | ||
std::string & | from, | ||
bool | block = false |
||
) | const |
Receive a message using the socket from any address
[in,out] | buf | pointer to a memory buffer |
[in] | bufSize | memory buffer size |
[out] | from | Unix socket address (socket file) |
[in] | block | true, wait till a packet arrives. false, do not wait, return error if no packet available |
|
inline |
Send the message using the socket to a specific address
[in] | buf | object with message memory buffer |
[in] | len | message length |
[in] | addrStr | Unix socket address (socket file) |
[in] | useAbstract | use Abstract socket address |
bool SockUnix::sendTo | ( | const void * | msg, |
size_t | len, | ||
const std::string & | addrStr | ||
) | const |
Send the message using the socket to a specific address
[in] | msg | pointer to message memory buffer |
[in] | len | message length |
[in] | addrStr | Unix socket address (socket file) |
bool SockUnix::sendTo | ( | const void * | msg, |
size_t | len, | ||
const std::string & | addrStr, | ||
bool | useAbstract | ||
) | const |
Send the message using the socket to a specific address
[in] | msg | pointer to message memory buffer |
[in] | len | message length |
[in] | addrStr | Unix socket address (socket file) |
[in] | useAbstract | use Abstract socket address |
bool SockUnix::setDefSelfAddress | ( | const std::string & | rootBase = "" , |
const std::string & | useDef = "" |
||
) |
Set self address using predefined algorithm
[in] | rootBase | base used for root user |
[in] | useDef | base used for non root user |
|
inline |
Set peer address using configuration file
[in] | cfg | reference to configuration file object |
[in] | section | in configuration file |
|
inline |
Set peer address
[in] | string | object with peer address |
[in] | useAbstract | use Abstract socket address |
bool SockUnix::setSelfAddress | ( | const std::string & | string | ) |
Set self address
[in] | string | object with self address |
bool SockUnix::setSelfAddress | ( | const std::string & | string, |
bool | useAbstract | ||
) |
Set self address
[in] | string | object with self address |
[in] | useAbstract | use Abstract socket address |