15 #ifndef __PTPMGMT_IF_H
16 #define __PTPMGMT_IF_H
23 #include <linux/ethtool.h>
26 __PTPMGMT_NAMESPACE_BEGIN
46 bool m_isInit =
false;
51 bool initPtp(
int fd,
struct ifreq &m_ifr);
70 bool isInit()
const {
return m_isInit; }
80 const std::string &
ifName()
const {
return m_ifName; }
85 const char *
ifName_c()
const {
return m_ifName.c_str(); }
95 const uint8_t *
mac_c()
const {
return m_mac.
get(); }
233 BaseClock(clockid_t clkId,
bool freq) : m_clkId(clkId), m_isInit(
true),
298 int m_fd, m_ptpIndex;
299 std::string m_device;
300 bool init(
const char *
device,
bool readonly);
335 clockid_t
clkId()
const {
return m_clkId; }
356 const std::string &
device()
const {
return m_device; }
361 const char *
device_c()
const {
return m_device.c_str(); }
435 bool readEvents(std::vector<PtpEvent_t> &events,
size_t max = 0)
const;
446 uint8_t flags = 0)
const;
462 bool samplePtpSys(
size_t count, std::vector<PtpSample_t> &samples)
const;
482 __PTPMGMT_NAMESPACE_END
C interface to network and PHC classes.
Types, enumerators, and structers used by C interface to PTP management messages.
Timestamp_t getTime() const
bool setPhase(int64_t offset) const
bool setFreq(float_freq freq) const
float_freq getFreq() const
bool offsetClock(int64_t offset) const
bool setTime(const Timestamp_t &ts) const
Hold octets.
Definition: bin.h:28
size_t length() const
Definition: bin.h:69
const uint8_t * get() const
Definition: bin.h:84
Network interface information.
Definition: ptp.h:44
int ptpIndex() const
Definition: ptp.h:108
bool isInit() const
Definition: ptp.h:70
const uint8_t * mac_c() const
Definition: ptp.h:95
size_t mac_size() const
Definition: ptp.h:100
const Binary & mac() const
Definition: ptp.h:90
bool initUsingName(const std::string &ifName)
int ifIndex() const
Definition: ptp.h:75
const std::string & ifName() const
Definition: ptp.h:80
bool initUsingIndex(int ifIndex)
const char * ifName_c() const
Definition: ptp.h:85
POSIX dynamic clock id generator.
Definition: ptp.h:296
clockid_t clkId() const
Definition: ptp.h:335
bool MaskClearAll() const
bool initUsingDevice(const std::string &device, bool readonly=false)
static bool isCharFile(const std::string &file)
int getFd() const
Definition: ptp.h:340
bool ExternTSDisable(unsigned int index) const
bool setTimeFromSys() const
const char * device_c() const
Definition: ptp.h:361
bool writePin(PtpPin_t &pin) const
bool fetchCaps(PtpCaps_t &caps) const
const std::string & device() const
Definition: ptp.h:356
bool initUsingIndex(int ptpIndex, bool readonly=false)
bool setTimeToSys() const
bool readEvents(std::vector< PtpEvent_t > &events, size_t max=0) const
bool ExternTSEbable(unsigned int index, uint8_t flags) const
bool readEvent(PtpEvent_t &event) const
bool preciseSamplePtpSys(PtpSamplePrecise_t &sample) const
bool MaskEnable(unsigned int index) const
bool setPinPeriod(unsigned int index, PtpPinPeriodDef_t times, uint8_t flags=0) const
int ptpIndex() const
Definition: ptp.h:351
int fileno() const
Definition: ptp.h:345
bool setPtpPpsEvent(bool enable) const
bool isInit() const
Definition: ptp.h:330
bool samplePtpSys(size_t count, std::vector< PtpSample_t > &samples) const
bool extSamplePtpSys(size_t count, std::vector< PtpSampleExt_t > &samples) const
bool readPin(unsigned int index, PtpPin_t &pin) const
const uint8_t PTP_PERIOD_ONE_SHOT
Definition: ptp.h:166
const uint8_t PTP_EXTERN_TS_FALLING_EDGE
Definition: ptp.h:156
long double float_freq
Definition: ptp.h:38
const int NO_SUCH_IF
Definition: ptp.h:34
const uint8_t PTP_EXTERN_TS_RISING_EDGE
Definition: ptp.h:151
const uint8_t PTP_PERIOD_WIDTH
Definition: ptp.h:171
const uint8_t PTP_EXTERN_TS_STRICT
Definition: ptp.h:161
__PTPMGMT_NAMESPACE_BEGIN const clockid_t CLOCK_INVALID
Definition: ptp.h:31
const int NO_SUCH_PTP
Definition: ptp.h:36
PtpPinFunc_e
Definition: ptp.h:128
@ PTP_PIN_EXTERNAL_TS
Definition: ptp.h:130
@ PTP_PIN_PERIODIC_OUT
Definition: ptp.h:131
@ PTP_PIN_PHY_SYNC
Definition: ptp.h:132
@ PTP_PIN_UNUSED
Definition: ptp.h:129
const uint8_t PTP_PERIOD_PHASE
Definition: ptp.h:176
bool adjust_phase
Definition: ptp.h:122
int num_alarm
Definition: ptp.h:115
int num_periodic_sig
Definition: ptp.h:117
int64_t max_ppb
Definition: ptp.h:114
int num_pins
Definition: ptp.h:119
bool cross_timestamping
Definition: ptp.h:121
int64_t max_phase_adj
Definition: ptp.h:123
int num_external_channels
Definition: ptp.h:116
bool pps
Definition: ptp.h:118
unsigned int index
Definition: ptp.h:182
Timestamp_t time
Definition: ptp.h:183
Timestamp_t width
Definition: ptp.h:213
Timestamp_t phase
Definition: ptp.h:214
Timestamp_t period
Definition: ptp.h:212
PtpPinFunc_e functional
Definition: ptp.h:144
unsigned int index
Definition: ptp.h:138
std::string description
Definition: ptp.h:143
unsigned int channel
Definition: ptp.h:145
Timestamp_t before
Definition: ptp.h:196
Timestamp_t phcClk
Definition: ptp.h:197
Timestamp_t after
Definition: ptp.h:198
Timestamp_t sysClk
Definition: ptp.h:205
Timestamp_t phcClk
Definition: ptp.h:204
Timestamp_t monoClk
Definition: ptp.h:206
Timestamp_t phcClk
Definition: ptp.h:190
Timestamp_t sysClk
Definition: ptp.h:189