diff --git a/clock.c b/clock.c index e9449dc..98e91d3 100644 --- a/clock.c +++ b/clock.c @@ -79,6 +79,7 @@ struct clock { tmv_t c2; tmv_t t1; tmv_t t2; + struct clock_description desc; }; struct clock the_clock; @@ -430,6 +431,7 @@ struct clock *clock_create(int phc_index, struct interface *iface, int count, c->free_running = dds->free_running; c->freq_est_interval = dds->freq_est_interval; + c->desc = dds->clock_desc; if (c->free_running) { c->clkid = CLOCK_INVALID; @@ -951,3 +953,8 @@ static void handle_state_decision_event(struct clock *c) port_dispatch(c->port[i], event, fresh_best); } } + +struct clock_description *clock_description(struct clock *c) +{ + return &c->desc; +} diff --git a/clock.h b/clock.h index e815a49..581fa14 100644 --- a/clock.h +++ b/clock.h @@ -215,4 +215,11 @@ void clock_sync_interval(struct clock *c, int n); */ struct timePropertiesDS *clock_time_properties(struct clock *c); +/** + * Obtain a clock's description. + * @param c The clock instance. + * @return A pointer to the clock_description of the clock. + */ +struct clock_description *clock_description(struct clock *c); + #endif diff --git a/ds.h b/ds.h index 27f9ab7..06b22f4 100644 --- a/ds.h +++ b/ds.h @@ -39,10 +39,19 @@ struct defaultDS { UInteger8 reserved2; } PACKED; +#define OUI_LEN 3 +struct clock_description { + struct static_ptp_text productDescription; + struct static_ptp_text revisionData; + struct static_ptp_text userDescription; + Octet manufacturerIdentity[OUI_LEN]; +}; + struct default_ds { struct defaultDS dds; int free_running; int freq_est_interval; /*log seconds*/ + struct clock_description clock_desc; }; struct dataset { diff --git a/ptp4l.c b/ptp4l.c index 345fa4f..3da3388 100644 --- a/ptp4l.c +++ b/ptp4l.c @@ -52,6 +52,18 @@ static struct config cfg_settings = { }, .free_running = 0, .freq_est_interval = 1, + .clock_desc = { + .productDescription = { + .max_symbols = 64, + .text = ";;" + }, + .revisionData = { + .max_symbols = 32, + .text = ";;" + }, + .userDescription = { .max_symbols = 128 }, + .manufacturerIdentity = { 0, 0, 0 }, + }, }, .pod = {