Prefix TLV IDs.
To avoid conflicts in generic names add TLV_ prefix to all TLV IDs defined in tlv.h. Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>master
parent
93b7807aad
commit
70dd682349
116
clock.c
116
clock.c
|
@ -336,76 +336,76 @@ static int clock_management_fill_response(struct clock *c, struct port *p,
|
||||||
tlv->id = id;
|
tlv->id = id;
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case USER_DESCRIPTION:
|
case TLV_USER_DESCRIPTION:
|
||||||
text = (struct PTPText *) tlv->data;
|
text = (struct PTPText *) tlv->data;
|
||||||
text->length = c->desc.userDescription.length;
|
text->length = c->desc.userDescription.length;
|
||||||
memcpy(text->text, c->desc.userDescription.text, text->length);
|
memcpy(text->text, c->desc.userDescription.text, text->length);
|
||||||
datalen = 1 + text->length;
|
datalen = 1 + text->length;
|
||||||
respond = 1;
|
respond = 1;
|
||||||
break;
|
break;
|
||||||
case DEFAULT_DATA_SET:
|
case TLV_DEFAULT_DATA_SET:
|
||||||
memcpy(tlv->data, &c->dds, sizeof(c->dds));
|
memcpy(tlv->data, &c->dds, sizeof(c->dds));
|
||||||
datalen = sizeof(c->dds);
|
datalen = sizeof(c->dds);
|
||||||
respond = 1;
|
respond = 1;
|
||||||
break;
|
break;
|
||||||
case CURRENT_DATA_SET:
|
case TLV_CURRENT_DATA_SET:
|
||||||
memcpy(tlv->data, &c->cur, sizeof(c->cur));
|
memcpy(tlv->data, &c->cur, sizeof(c->cur));
|
||||||
datalen = sizeof(c->cur);
|
datalen = sizeof(c->cur);
|
||||||
respond = 1;
|
respond = 1;
|
||||||
break;
|
break;
|
||||||
case PARENT_DATA_SET:
|
case TLV_PARENT_DATA_SET:
|
||||||
memcpy(tlv->data, &c->dad.pds, sizeof(c->dad.pds));
|
memcpy(tlv->data, &c->dad.pds, sizeof(c->dad.pds));
|
||||||
datalen = sizeof(c->dad.pds);
|
datalen = sizeof(c->dad.pds);
|
||||||
respond = 1;
|
respond = 1;
|
||||||
break;
|
break;
|
||||||
case TIME_PROPERTIES_DATA_SET:
|
case TLV_TIME_PROPERTIES_DATA_SET:
|
||||||
memcpy(tlv->data, &c->tds, sizeof(c->tds));
|
memcpy(tlv->data, &c->tds, sizeof(c->tds));
|
||||||
datalen = sizeof(c->tds);
|
datalen = sizeof(c->tds);
|
||||||
respond = 1;
|
respond = 1;
|
||||||
break;
|
break;
|
||||||
case PRIORITY1:
|
case TLV_PRIORITY1:
|
||||||
mtd = (struct management_tlv_datum *) tlv->data;
|
mtd = (struct management_tlv_datum *) tlv->data;
|
||||||
mtd->val = c->dds.priority1;
|
mtd->val = c->dds.priority1;
|
||||||
datalen = sizeof(*mtd);
|
datalen = sizeof(*mtd);
|
||||||
respond = 1;
|
respond = 1;
|
||||||
break;
|
break;
|
||||||
case PRIORITY2:
|
case TLV_PRIORITY2:
|
||||||
mtd = (struct management_tlv_datum *) tlv->data;
|
mtd = (struct management_tlv_datum *) tlv->data;
|
||||||
mtd->val = c->dds.priority2;
|
mtd->val = c->dds.priority2;
|
||||||
datalen = sizeof(*mtd);
|
datalen = sizeof(*mtd);
|
||||||
respond = 1;
|
respond = 1;
|
||||||
break;
|
break;
|
||||||
case DOMAIN:
|
case TLV_DOMAIN:
|
||||||
mtd = (struct management_tlv_datum *) tlv->data;
|
mtd = (struct management_tlv_datum *) tlv->data;
|
||||||
mtd->val = c->dds.domainNumber;
|
mtd->val = c->dds.domainNumber;
|
||||||
datalen = sizeof(*mtd);
|
datalen = sizeof(*mtd);
|
||||||
respond = 1;
|
respond = 1;
|
||||||
break;
|
break;
|
||||||
case SLAVE_ONLY:
|
case TLV_SLAVE_ONLY:
|
||||||
mtd = (struct management_tlv_datum *) tlv->data;
|
mtd = (struct management_tlv_datum *) tlv->data;
|
||||||
mtd->val = c->dds.flags & DDS_SLAVE_ONLY;
|
mtd->val = c->dds.flags & DDS_SLAVE_ONLY;
|
||||||
datalen = sizeof(*mtd);
|
datalen = sizeof(*mtd);
|
||||||
respond = 1;
|
respond = 1;
|
||||||
break;
|
break;
|
||||||
case CLOCK_ACCURACY:
|
case TLV_CLOCK_ACCURACY:
|
||||||
mtd = (struct management_tlv_datum *) tlv->data;
|
mtd = (struct management_tlv_datum *) tlv->data;
|
||||||
mtd->val = c->dds.clockQuality.clockAccuracy;
|
mtd->val = c->dds.clockQuality.clockAccuracy;
|
||||||
datalen = sizeof(*mtd);
|
datalen = sizeof(*mtd);
|
||||||
respond = 1;
|
respond = 1;
|
||||||
break;
|
break;
|
||||||
case TRACEABILITY_PROPERTIES:
|
case TLV_TRACEABILITY_PROPERTIES:
|
||||||
mtd = (struct management_tlv_datum *) tlv->data;
|
mtd = (struct management_tlv_datum *) tlv->data;
|
||||||
mtd->val = c->tds.flags & (TIME_TRACEABLE|FREQ_TRACEABLE);
|
mtd->val = c->tds.flags & (TIME_TRACEABLE|FREQ_TRACEABLE);
|
||||||
datalen = sizeof(*mtd);
|
datalen = sizeof(*mtd);
|
||||||
respond = 1;
|
respond = 1;
|
||||||
break;
|
break;
|
||||||
case TIMESCALE_PROPERTIES:
|
case TLV_TIMESCALE_PROPERTIES:
|
||||||
mtd = (struct management_tlv_datum *) tlv->data;
|
mtd = (struct management_tlv_datum *) tlv->data;
|
||||||
mtd->val = c->tds.flags & PTP_TIMESCALE;
|
mtd->val = c->tds.flags & PTP_TIMESCALE;
|
||||||
datalen = sizeof(*mtd);
|
datalen = sizeof(*mtd);
|
||||||
respond = 1;
|
respond = 1;
|
||||||
break;
|
break;
|
||||||
case TIME_STATUS_NP:
|
case TLV_TIME_STATUS_NP:
|
||||||
tsn = (struct time_status_np *) tlv->data;
|
tsn = (struct time_status_np *) tlv->data;
|
||||||
tsn->master_offset = c->master_offset;
|
tsn->master_offset = c->master_offset;
|
||||||
tsn->ingress_time = tmv_to_nanoseconds(c->t2);
|
tsn->ingress_time = tmv_to_nanoseconds(c->t2);
|
||||||
|
@ -423,7 +423,7 @@ static int clock_management_fill_response(struct clock *c, struct port *p,
|
||||||
datalen = sizeof(*tsn);
|
datalen = sizeof(*tsn);
|
||||||
respond = 1;
|
respond = 1;
|
||||||
break;
|
break;
|
||||||
case GRANDMASTER_SETTINGS_NP:
|
case TLV_GRANDMASTER_SETTINGS_NP:
|
||||||
gsn = (struct grandmaster_settings_np *) tlv->data;
|
gsn = (struct grandmaster_settings_np *) tlv->data;
|
||||||
gsn->clockQuality = c->dds.clockQuality;
|
gsn->clockQuality = c->dds.clockQuality;
|
||||||
gsn->utc_offset = c->utc_offset;
|
gsn->utc_offset = c->utc_offset;
|
||||||
|
@ -432,7 +432,7 @@ static int clock_management_fill_response(struct clock *c, struct port *p,
|
||||||
datalen = sizeof(*gsn);
|
datalen = sizeof(*gsn);
|
||||||
respond = 1;
|
respond = 1;
|
||||||
break;
|
break;
|
||||||
case SUBSCRIBE_EVENTS_NP:
|
case TLV_SUBSCRIBE_EVENTS_NP:
|
||||||
if (p != c->port[c->nports]) {
|
if (p != c->port[c->nports]) {
|
||||||
/* Only the UDS port allowed. */
|
/* Only the UDS port allowed. */
|
||||||
break;
|
break;
|
||||||
|
@ -483,7 +483,7 @@ static int clock_management_set(struct clock *c, struct port *p,
|
||||||
tlv = (struct management_tlv *) req->management.suffix;
|
tlv = (struct management_tlv *) req->management.suffix;
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case GRANDMASTER_SETTINGS_NP:
|
case TLV_GRANDMASTER_SETTINGS_NP:
|
||||||
gsn = (struct grandmaster_settings_np *) tlv->data;
|
gsn = (struct grandmaster_settings_np *) tlv->data;
|
||||||
c->dds.clockQuality = gsn->clockQuality;
|
c->dds.clockQuality = gsn->clockQuality;
|
||||||
c->utc_offset = gsn->utc_offset;
|
c->utc_offset = gsn->utc_offset;
|
||||||
|
@ -492,7 +492,7 @@ static int clock_management_set(struct clock *c, struct port *p,
|
||||||
*changed = 1;
|
*changed = 1;
|
||||||
respond = 1;
|
respond = 1;
|
||||||
break;
|
break;
|
||||||
case SUBSCRIBE_EVENTS_NP:
|
case TLV_SUBSCRIBE_EVENTS_NP:
|
||||||
sen = (struct subscribe_events_np *)tlv->data;
|
sen = (struct subscribe_events_np *)tlv->data;
|
||||||
clock_update_subscription(c, req, sen->bitmask,
|
clock_update_subscription(c, req, sen->bitmask,
|
||||||
sen->duration);
|
sen->duration);
|
||||||
|
@ -1017,13 +1017,13 @@ int clock_manage(struct clock *c, struct port *p, struct ptp_message *msg)
|
||||||
return changed;
|
return changed;
|
||||||
break;
|
break;
|
||||||
case SET:
|
case SET:
|
||||||
if (mgt->length == 2 && mgt->id != NULL_MANAGEMENT) {
|
if (mgt->length == 2 && mgt->id != TLV_NULL_MANAGEMENT) {
|
||||||
clock_management_send_error(p, msg, WRONG_LENGTH);
|
clock_management_send_error(p, msg, TLV_WRONG_LENGTH);
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
if (p != c->port[c->nports]) {
|
if (p != c->port[c->nports]) {
|
||||||
/* Sorry, only allowed on the UDS port. */
|
/* Sorry, only allowed on the UDS port. */
|
||||||
clock_management_send_error(p, msg, NOT_SUPPORTED);
|
clock_management_send_error(p, msg, TLV_NOT_SUPPORTED);
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
if (clock_management_set(c, p, mgt->id, msg, &changed))
|
if (clock_management_set(c, p, mgt->id, msg, &changed))
|
||||||
|
@ -1036,49 +1036,49 @@ int clock_manage(struct clock *c, struct port *p, struct ptp_message *msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (mgt->id) {
|
switch (mgt->id) {
|
||||||
case PORT_PROPERTIES_NP:
|
case TLV_PORT_PROPERTIES_NP:
|
||||||
if (p != c->port[c->nports]) {
|
if (p != c->port[c->nports]) {
|
||||||
/* Only the UDS port allowed. */
|
/* Only the UDS port allowed. */
|
||||||
clock_management_send_error(p, msg, NOT_SUPPORTED);
|
clock_management_send_error(p, msg, TLV_NOT_SUPPORTED);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (mgt->id) {
|
switch (mgt->id) {
|
||||||
case USER_DESCRIPTION:
|
case TLV_USER_DESCRIPTION:
|
||||||
case SAVE_IN_NON_VOLATILE_STORAGE:
|
case TLV_SAVE_IN_NON_VOLATILE_STORAGE:
|
||||||
case RESET_NON_VOLATILE_STORAGE:
|
case TLV_RESET_NON_VOLATILE_STORAGE:
|
||||||
case INITIALIZE:
|
case TLV_INITIALIZE:
|
||||||
case FAULT_LOG:
|
case TLV_FAULT_LOG:
|
||||||
case FAULT_LOG_RESET:
|
case TLV_FAULT_LOG_RESET:
|
||||||
case DEFAULT_DATA_SET:
|
case TLV_DEFAULT_DATA_SET:
|
||||||
case CURRENT_DATA_SET:
|
case TLV_CURRENT_DATA_SET:
|
||||||
case PARENT_DATA_SET:
|
case TLV_PARENT_DATA_SET:
|
||||||
case TIME_PROPERTIES_DATA_SET:
|
case TLV_TIME_PROPERTIES_DATA_SET:
|
||||||
case PRIORITY1:
|
case TLV_PRIORITY1:
|
||||||
case PRIORITY2:
|
case TLV_PRIORITY2:
|
||||||
case DOMAIN:
|
case TLV_DOMAIN:
|
||||||
case SLAVE_ONLY:
|
case TLV_SLAVE_ONLY:
|
||||||
case TIME:
|
case TLV_TIME:
|
||||||
case CLOCK_ACCURACY:
|
case TLV_CLOCK_ACCURACY:
|
||||||
case UTC_PROPERTIES:
|
case TLV_UTC_PROPERTIES:
|
||||||
case TRACEABILITY_PROPERTIES:
|
case TLV_TRACEABILITY_PROPERTIES:
|
||||||
case TIMESCALE_PROPERTIES:
|
case TLV_TIMESCALE_PROPERTIES:
|
||||||
case PATH_TRACE_LIST:
|
case TLV_PATH_TRACE_LIST:
|
||||||
case PATH_TRACE_ENABLE:
|
case TLV_PATH_TRACE_ENABLE:
|
||||||
case GRANDMASTER_CLUSTER_TABLE:
|
case TLV_GRANDMASTER_CLUSTER_TABLE:
|
||||||
case ACCEPTABLE_MASTER_TABLE:
|
case TLV_ACCEPTABLE_MASTER_TABLE:
|
||||||
case ACCEPTABLE_MASTER_MAX_TABLE_SIZE:
|
case TLV_ACCEPTABLE_MASTER_MAX_TABLE_SIZE:
|
||||||
case ALTERNATE_TIME_OFFSET_ENABLE:
|
case TLV_ALTERNATE_TIME_OFFSET_ENABLE:
|
||||||
case ALTERNATE_TIME_OFFSET_NAME:
|
case TLV_ALTERNATE_TIME_OFFSET_NAME:
|
||||||
case ALTERNATE_TIME_OFFSET_MAX_KEY:
|
case TLV_ALTERNATE_TIME_OFFSET_MAX_KEY:
|
||||||
case ALTERNATE_TIME_OFFSET_PROPERTIES:
|
case TLV_ALTERNATE_TIME_OFFSET_PROPERTIES:
|
||||||
case TRANSPARENT_CLOCK_DEFAULT_DATA_SET:
|
case TLV_TRANSPARENT_CLOCK_DEFAULT_DATA_SET:
|
||||||
case PRIMARY_DOMAIN:
|
case TLV_PRIMARY_DOMAIN:
|
||||||
case TIME_STATUS_NP:
|
case TLV_TIME_STATUS_NP:
|
||||||
case GRANDMASTER_SETTINGS_NP:
|
case TLV_GRANDMASTER_SETTINGS_NP:
|
||||||
case SUBSCRIBE_EVENTS_NP:
|
case TLV_SUBSCRIBE_EVENTS_NP:
|
||||||
clock_management_send_error(p, msg, NOT_SUPPORTED);
|
clock_management_send_error(p, msg, TLV_NOT_SUPPORTED);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
answers = 0;
|
answers = 0;
|
||||||
|
@ -1091,8 +1091,8 @@ int clock_manage(struct clock *c, struct port *p, struct ptp_message *msg)
|
||||||
}
|
}
|
||||||
if (!answers) {
|
if (!answers) {
|
||||||
/* IEEE 1588 Interpretation #21 suggests to use
|
/* IEEE 1588 Interpretation #21 suggests to use
|
||||||
* WRONG_VALUE for ports that do not exist */
|
* TLV_WRONG_VALUE for ports that do not exist */
|
||||||
clock_management_send_error(p, msg, WRONG_VALUE);
|
clock_management_send_error(p, msg, TLV_WRONG_VALUE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
18
phc2sys.c
18
phc2sys.c
|
@ -700,7 +700,7 @@ static int recv_subscribed(struct node *node, struct ptp_message *msg,
|
||||||
if (mgt_id == excluded)
|
if (mgt_id == excluded)
|
||||||
return 0;
|
return 0;
|
||||||
switch (mgt_id) {
|
switch (mgt_id) {
|
||||||
case PORT_DATA_SET:
|
case TLV_PORT_DATA_SET:
|
||||||
pds = get_mgt_data(msg);
|
pds = get_mgt_data(msg);
|
||||||
port = port_get(node, pds->portIdentity.portNumber);
|
port = port_get(node, pds->portIdentity.portNumber);
|
||||||
if (!port) {
|
if (!port) {
|
||||||
|
@ -732,7 +732,7 @@ static void send_subscription(struct node *node)
|
||||||
memset(&sen, 0, sizeof(sen));
|
memset(&sen, 0, sizeof(sen));
|
||||||
sen.duration = PMC_SUBSCRIBE_DURATION;
|
sen.duration = PMC_SUBSCRIBE_DURATION;
|
||||||
sen.bitmask[0] = 1 << NOTIFY_PORT_STATE;
|
sen.bitmask[0] = 1 << NOTIFY_PORT_STATE;
|
||||||
pmc_send_set_action(node->pmc, SUBSCRIBE_EVENTS_NP, &sen, sizeof(sen));
|
pmc_send_set_action(node->pmc, TLV_SUBSCRIBE_EVENTS_NP, &sen, sizeof(sen));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int init_pmc(struct node *node, int domain_number)
|
static int init_pmc(struct node *node, int domain_number)
|
||||||
|
@ -781,7 +781,7 @@ static int run_pmc(struct node *node, int timeout, int ds_id,
|
||||||
if ((pollfd[0].revents & POLLOUT) &&
|
if ((pollfd[0].revents & POLLOUT) &&
|
||||||
!(pollfd[0].revents & (POLLIN|POLLPRI))) {
|
!(pollfd[0].revents & (POLLIN|POLLPRI))) {
|
||||||
switch (ds_id) {
|
switch (ds_id) {
|
||||||
case SUBSCRIBE_EVENTS_NP:
|
case TLV_SUBSCRIBE_EVENTS_NP:
|
||||||
send_subscription(node);
|
send_subscription(node);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -829,7 +829,7 @@ static int run_pmc_wait_sync(struct node *node, int timeout)
|
||||||
Enumeration8 portState;
|
Enumeration8 portState;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
res = run_pmc(node, timeout, PORT_DATA_SET, &msg);
|
res = run_pmc(node, timeout, TLV_PORT_DATA_SET, &msg);
|
||||||
if (res <= 0)
|
if (res <= 0)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
|
@ -853,7 +853,7 @@ static int run_pmc_get_utc_offset(struct node *node, int timeout)
|
||||||
int res;
|
int res;
|
||||||
struct timePropertiesDS *tds;
|
struct timePropertiesDS *tds;
|
||||||
|
|
||||||
res = run_pmc(node, timeout, TIME_PROPERTIES_DATA_SET, &msg);
|
res = run_pmc(node, timeout, TLV_TIME_PROPERTIES_DATA_SET, &msg);
|
||||||
if (res <= 0)
|
if (res <= 0)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
|
@ -883,7 +883,7 @@ static int run_pmc_get_number_ports(struct node *node, int timeout)
|
||||||
int res;
|
int res;
|
||||||
struct defaultDS *dds;
|
struct defaultDS *dds;
|
||||||
|
|
||||||
res = run_pmc(node, timeout, DEFAULT_DATA_SET, &msg);
|
res = run_pmc(node, timeout, TLV_DEFAULT_DATA_SET, &msg);
|
||||||
if (res <= 0)
|
if (res <= 0)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
|
@ -898,7 +898,7 @@ static int run_pmc_subscribe(struct node *node, int timeout)
|
||||||
struct ptp_message *msg;
|
struct ptp_message *msg;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
res = run_pmc(node, timeout, SUBSCRIBE_EVENTS_NP, &msg);
|
res = run_pmc(node, timeout, TLV_SUBSCRIBE_EVENTS_NP, &msg);
|
||||||
if (res <= 0)
|
if (res <= 0)
|
||||||
return res;
|
return res;
|
||||||
msg_put(msg);
|
msg_put(msg);
|
||||||
|
@ -922,7 +922,7 @@ static int run_pmc_port_properties(struct node *node, int timeout,
|
||||||
|
|
||||||
pmc_target_port(node->pmc, port);
|
pmc_target_port(node->pmc, port);
|
||||||
while (1) {
|
while (1) {
|
||||||
res = run_pmc(node, timeout, PORT_PROPERTIES_NP, &msg);
|
res = run_pmc(node, timeout, TLV_PORT_PROPERTIES_NP, &msg);
|
||||||
if (res <= 0)
|
if (res <= 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
@ -955,7 +955,7 @@ static int run_pmc_clock_identity(struct node *node, int timeout)
|
||||||
struct defaultDS *dds;
|
struct defaultDS *dds;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
res = run_pmc(node, timeout, DEFAULT_DATA_SET, &msg);
|
res = run_pmc(node, timeout, TLV_DEFAULT_DATA_SET, &msg);
|
||||||
if (res <= 0)
|
if (res <= 0)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
|
|
152
pmc.c
152
pmc.c
|
@ -56,57 +56,57 @@ struct management_id {
|
||||||
|
|
||||||
struct management_id idtab[] = {
|
struct management_id idtab[] = {
|
||||||
/* Clock management ID values */
|
/* Clock management ID values */
|
||||||
{ "USER_DESCRIPTION", USER_DESCRIPTION, do_get_action },
|
{ "USER_DESCRIPTION", TLV_USER_DESCRIPTION, do_get_action },
|
||||||
{ "SAVE_IN_NON_VOLATILE_STORAGE", SAVE_IN_NON_VOLATILE_STORAGE, not_supported },
|
{ "SAVE_IN_NON_VOLATILE_STORAGE", TLV_SAVE_IN_NON_VOLATILE_STORAGE, not_supported },
|
||||||
{ "RESET_NON_VOLATILE_STORAGE", RESET_NON_VOLATILE_STORAGE, not_supported },
|
{ "RESET_NON_VOLATILE_STORAGE", TLV_RESET_NON_VOLATILE_STORAGE, not_supported },
|
||||||
{ "INITIALIZE", INITIALIZE, not_supported },
|
{ "INITIALIZE", TLV_INITIALIZE, not_supported },
|
||||||
{ "FAULT_LOG", FAULT_LOG, not_supported },
|
{ "FAULT_LOG", TLV_FAULT_LOG, not_supported },
|
||||||
{ "FAULT_LOG_RESET", FAULT_LOG_RESET, not_supported },
|
{ "FAULT_LOG_RESET", TLV_FAULT_LOG_RESET, not_supported },
|
||||||
{ "DEFAULT_DATA_SET", DEFAULT_DATA_SET, do_get_action },
|
{ "DEFAULT_DATA_SET", TLV_DEFAULT_DATA_SET, do_get_action },
|
||||||
{ "CURRENT_DATA_SET", CURRENT_DATA_SET, do_get_action },
|
{ "CURRENT_DATA_SET", TLV_CURRENT_DATA_SET, do_get_action },
|
||||||
{ "PARENT_DATA_SET", PARENT_DATA_SET, do_get_action },
|
{ "PARENT_DATA_SET", TLV_PARENT_DATA_SET, do_get_action },
|
||||||
{ "TIME_PROPERTIES_DATA_SET", TIME_PROPERTIES_DATA_SET, do_get_action },
|
{ "TIME_PROPERTIES_DATA_SET", TLV_TIME_PROPERTIES_DATA_SET, do_get_action },
|
||||||
{ "PRIORITY1", PRIORITY1, do_get_action },
|
{ "PRIORITY1", TLV_PRIORITY1, do_get_action },
|
||||||
{ "PRIORITY2", PRIORITY2, do_get_action },
|
{ "PRIORITY2", TLV_PRIORITY2, do_get_action },
|
||||||
{ "DOMAIN", DOMAIN, do_get_action },
|
{ "DOMAIN", TLV_DOMAIN, do_get_action },
|
||||||
{ "SLAVE_ONLY", SLAVE_ONLY, do_get_action },
|
{ "SLAVE_ONLY", TLV_SLAVE_ONLY, do_get_action },
|
||||||
{ "TIME", TIME, not_supported },
|
{ "TIME", TLV_TIME, not_supported },
|
||||||
{ "CLOCK_ACCURACY", CLOCK_ACCURACY, do_get_action },
|
{ "CLOCK_ACCURACY", TLV_CLOCK_ACCURACY, do_get_action },
|
||||||
{ "UTC_PROPERTIES", UTC_PROPERTIES, not_supported },
|
{ "UTC_PROPERTIES", TLV_UTC_PROPERTIES, not_supported },
|
||||||
{ "TRACEABILITY_PROPERTIES", TRACEABILITY_PROPERTIES, do_get_action },
|
{ "TRACEABILITY_PROPERTIES", TLV_TRACEABILITY_PROPERTIES, do_get_action },
|
||||||
{ "TIMESCALE_PROPERTIES", TIMESCALE_PROPERTIES, do_get_action },
|
{ "TIMESCALE_PROPERTIES", TLV_TIMESCALE_PROPERTIES, do_get_action },
|
||||||
{ "PATH_TRACE_LIST", PATH_TRACE_LIST, not_supported },
|
{ "PATH_TRACE_LIST", TLV_PATH_TRACE_LIST, not_supported },
|
||||||
{ "PATH_TRACE_ENABLE", PATH_TRACE_ENABLE, not_supported },
|
{ "PATH_TRACE_ENABLE", TLV_PATH_TRACE_ENABLE, not_supported },
|
||||||
{ "GRANDMASTER_CLUSTER_TABLE", GRANDMASTER_CLUSTER_TABLE, not_supported },
|
{ "GRANDMASTER_CLUSTER_TABLE", TLV_GRANDMASTER_CLUSTER_TABLE, not_supported },
|
||||||
{ "ACCEPTABLE_MASTER_TABLE", ACCEPTABLE_MASTER_TABLE, not_supported },
|
{ "ACCEPTABLE_MASTER_TABLE", TLV_ACCEPTABLE_MASTER_TABLE, not_supported },
|
||||||
{ "ACCEPTABLE_MASTER_MAX_TABLE_SIZE", ACCEPTABLE_MASTER_MAX_TABLE_SIZE, not_supported },
|
{ "ACCEPTABLE_MASTER_MAX_TABLE_SIZE", TLV_ACCEPTABLE_MASTER_MAX_TABLE_SIZE, not_supported },
|
||||||
{ "ALTERNATE_TIME_OFFSET_ENABLE", ALTERNATE_TIME_OFFSET_ENABLE, not_supported },
|
{ "ALTERNATE_TIME_OFFSET_ENABLE", TLV_ALTERNATE_TIME_OFFSET_ENABLE, not_supported },
|
||||||
{ "ALTERNATE_TIME_OFFSET_NAME", ALTERNATE_TIME_OFFSET_NAME, not_supported },
|
{ "ALTERNATE_TIME_OFFSET_NAME", TLV_ALTERNATE_TIME_OFFSET_NAME, not_supported },
|
||||||
{ "ALTERNATE_TIME_OFFSET_MAX_KEY", ALTERNATE_TIME_OFFSET_MAX_KEY, not_supported },
|
{ "ALTERNATE_TIME_OFFSET_MAX_KEY", TLV_ALTERNATE_TIME_OFFSET_MAX_KEY, not_supported },
|
||||||
{ "ALTERNATE_TIME_OFFSET_PROPERTIES", ALTERNATE_TIME_OFFSET_PROPERTIES, not_supported },
|
{ "ALTERNATE_TIME_OFFSET_PROPERTIES", TLV_ALTERNATE_TIME_OFFSET_PROPERTIES, not_supported },
|
||||||
{ "TRANSPARENT_CLOCK_DEFAULT_DATA_SET", TRANSPARENT_CLOCK_DEFAULT_DATA_SET, not_supported },
|
{ "TRANSPARENT_CLOCK_DEFAULT_DATA_SET", TLV_TRANSPARENT_CLOCK_DEFAULT_DATA_SET, not_supported },
|
||||||
{ "PRIMARY_DOMAIN", PRIMARY_DOMAIN, not_supported },
|
{ "PRIMARY_DOMAIN", TLV_PRIMARY_DOMAIN, not_supported },
|
||||||
{ "TIME_STATUS_NP", TIME_STATUS_NP, do_get_action },
|
{ "TIME_STATUS_NP", TLV_TIME_STATUS_NP, do_get_action },
|
||||||
{ "GRANDMASTER_SETTINGS_NP", GRANDMASTER_SETTINGS_NP, do_set_action },
|
{ "GRANDMASTER_SETTINGS_NP", TLV_GRANDMASTER_SETTINGS_NP, do_set_action },
|
||||||
/* Port management ID values */
|
/* Port management ID values */
|
||||||
{ "NULL_MANAGEMENT", NULL_MANAGEMENT, null_management },
|
{ "NULL_MANAGEMENT", TLV_NULL_MANAGEMENT, null_management },
|
||||||
{ "CLOCK_DESCRIPTION", CLOCK_DESCRIPTION, do_get_action },
|
{ "CLOCK_DESCRIPTION", TLV_CLOCK_DESCRIPTION, do_get_action },
|
||||||
{ "PORT_DATA_SET", PORT_DATA_SET, do_get_action },
|
{ "PORT_DATA_SET", TLV_PORT_DATA_SET, do_get_action },
|
||||||
{ "LOG_ANNOUNCE_INTERVAL", LOG_ANNOUNCE_INTERVAL, do_get_action },
|
{ "LOG_ANNOUNCE_INTERVAL", TLV_LOG_ANNOUNCE_INTERVAL, do_get_action },
|
||||||
{ "ANNOUNCE_RECEIPT_TIMEOUT", ANNOUNCE_RECEIPT_TIMEOUT, do_get_action },
|
{ "ANNOUNCE_RECEIPT_TIMEOUT", TLV_ANNOUNCE_RECEIPT_TIMEOUT, do_get_action },
|
||||||
{ "LOG_SYNC_INTERVAL", LOG_SYNC_INTERVAL, do_get_action },
|
{ "LOG_SYNC_INTERVAL", TLV_LOG_SYNC_INTERVAL, do_get_action },
|
||||||
{ "VERSION_NUMBER", VERSION_NUMBER, do_get_action },
|
{ "VERSION_NUMBER", TLV_VERSION_NUMBER, do_get_action },
|
||||||
{ "ENABLE_PORT", ENABLE_PORT, not_supported },
|
{ "ENABLE_PORT", TLV_ENABLE_PORT, not_supported },
|
||||||
{ "DISABLE_PORT", DISABLE_PORT, not_supported },
|
{ "DISABLE_PORT", TLV_DISABLE_PORT, not_supported },
|
||||||
{ "UNICAST_NEGOTIATION_ENABLE", UNICAST_NEGOTIATION_ENABLE, not_supported },
|
{ "UNICAST_NEGOTIATION_ENABLE", TLV_UNICAST_NEGOTIATION_ENABLE, not_supported },
|
||||||
{ "UNICAST_MASTER_TABLE", UNICAST_MASTER_TABLE, not_supported },
|
{ "UNICAST_MASTER_TABLE", TLV_UNICAST_MASTER_TABLE, not_supported },
|
||||||
{ "UNICAST_MASTER_MAX_TABLE_SIZE", UNICAST_MASTER_MAX_TABLE_SIZE, not_supported },
|
{ "UNICAST_MASTER_MAX_TABLE_SIZE", TLV_UNICAST_MASTER_MAX_TABLE_SIZE, not_supported },
|
||||||
{ "ACCEPTABLE_MASTER_TABLE_ENABLED", ACCEPTABLE_MASTER_TABLE_ENABLED, not_supported },
|
{ "ACCEPTABLE_MASTER_TABLE_ENABLED", TLV_ACCEPTABLE_MASTER_TABLE_ENABLED, not_supported },
|
||||||
{ "ALTERNATE_MASTER", ALTERNATE_MASTER, not_supported },
|
{ "ALTERNATE_MASTER", TLV_ALTERNATE_MASTER, not_supported },
|
||||||
{ "TRANSPARENT_CLOCK_PORT_DATA_SET", TRANSPARENT_CLOCK_PORT_DATA_SET, not_supported },
|
{ "TRANSPARENT_CLOCK_PORT_DATA_SET", TLV_TRANSPARENT_CLOCK_PORT_DATA_SET, not_supported },
|
||||||
{ "DELAY_MECHANISM", DELAY_MECHANISM, do_get_action },
|
{ "DELAY_MECHANISM", TLV_DELAY_MECHANISM, do_get_action },
|
||||||
{ "LOG_MIN_PDELAY_REQ_INTERVAL", LOG_MIN_PDELAY_REQ_INTERVAL, do_get_action },
|
{ "LOG_MIN_PDELAY_REQ_INTERVAL", TLV_LOG_MIN_PDELAY_REQ_INTERVAL, do_get_action },
|
||||||
{ "PORT_DATA_SET_NP", PORT_DATA_SET_NP, do_set_action },
|
{ "PORT_DATA_SET_NP", TLV_PORT_DATA_SET_NP, do_set_action },
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *action_string[] = {
|
static const char *action_string[] = {
|
||||||
|
@ -219,12 +219,12 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
|
||||||
fprintf(fp, "unknown-tlv ");
|
fprintf(fp, "unknown-tlv ");
|
||||||
}
|
}
|
||||||
mgt = (struct management_tlv *) msg->management.suffix;
|
mgt = (struct management_tlv *) msg->management.suffix;
|
||||||
if (mgt->length == 2 && mgt->id != NULL_MANAGEMENT) {
|
if (mgt->length == 2 && mgt->id != TLV_NULL_MANAGEMENT) {
|
||||||
fprintf(fp, "empty-tlv ");
|
fprintf(fp, "empty-tlv ");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
switch (mgt->id) {
|
switch (mgt->id) {
|
||||||
case CLOCK_DESCRIPTION:
|
case TLV_CLOCK_DESCRIPTION:
|
||||||
cd = &msg->last_tlv.cd;
|
cd = &msg->last_tlv.cd;
|
||||||
fprintf(fp, "CLOCK_DESCRIPTION "
|
fprintf(fp, "CLOCK_DESCRIPTION "
|
||||||
IFMT "clockType 0x%hx"
|
IFMT "clockType 0x%hx"
|
||||||
|
@ -248,12 +248,12 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
|
||||||
text2str(cd->userDescription),
|
text2str(cd->userDescription),
|
||||||
bin2str(cd->profileIdentity, PROFILE_ID_LEN));
|
bin2str(cd->profileIdentity, PROFILE_ID_LEN));
|
||||||
break;
|
break;
|
||||||
case USER_DESCRIPTION:
|
case TLV_USER_DESCRIPTION:
|
||||||
fprintf(fp, "USER_DESCRIPTION "
|
fprintf(fp, "USER_DESCRIPTION "
|
||||||
IFMT "userDescription %s",
|
IFMT "userDescription %s",
|
||||||
text2str(msg->last_tlv.cd.userDescription));
|
text2str(msg->last_tlv.cd.userDescription));
|
||||||
break;
|
break;
|
||||||
case DEFAULT_DATA_SET:
|
case TLV_DEFAULT_DATA_SET:
|
||||||
dds = (struct defaultDS *) mgt->data;
|
dds = (struct defaultDS *) mgt->data;
|
||||||
fprintf(fp, "DEFAULT_DATA_SET "
|
fprintf(fp, "DEFAULT_DATA_SET "
|
||||||
IFMT "twoStepFlag %d"
|
IFMT "twoStepFlag %d"
|
||||||
|
@ -277,7 +277,7 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
|
||||||
cid2str(&dds->clockIdentity),
|
cid2str(&dds->clockIdentity),
|
||||||
dds->domainNumber);
|
dds->domainNumber);
|
||||||
break;
|
break;
|
||||||
case CURRENT_DATA_SET:
|
case TLV_CURRENT_DATA_SET:
|
||||||
cds = (struct currentDS *) mgt->data;
|
cds = (struct currentDS *) mgt->data;
|
||||||
fprintf(fp, "CURRENT_DATA_SET "
|
fprintf(fp, "CURRENT_DATA_SET "
|
||||||
IFMT "stepsRemoved %hd"
|
IFMT "stepsRemoved %hd"
|
||||||
|
@ -286,7 +286,7 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
|
||||||
cds->stepsRemoved, cds->offsetFromMaster / 65536.0,
|
cds->stepsRemoved, cds->offsetFromMaster / 65536.0,
|
||||||
cds->meanPathDelay / 65536.0);
|
cds->meanPathDelay / 65536.0);
|
||||||
break;
|
break;
|
||||||
case PARENT_DATA_SET:
|
case TLV_PARENT_DATA_SET:
|
||||||
pds = (struct parentDS *) mgt->data;
|
pds = (struct parentDS *) mgt->data;
|
||||||
fprintf(fp, "PARENT_DATA_SET "
|
fprintf(fp, "PARENT_DATA_SET "
|
||||||
IFMT "parentPortIdentity %s"
|
IFMT "parentPortIdentity %s"
|
||||||
|
@ -310,7 +310,7 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
|
||||||
pds->grandmasterPriority2,
|
pds->grandmasterPriority2,
|
||||||
cid2str(&pds->grandmasterIdentity));
|
cid2str(&pds->grandmasterIdentity));
|
||||||
break;
|
break;
|
||||||
case TIME_PROPERTIES_DATA_SET:
|
case TLV_TIME_PROPERTIES_DATA_SET:
|
||||||
tp = (struct timePropertiesDS *) mgt->data;
|
tp = (struct timePropertiesDS *) mgt->data;
|
||||||
fprintf(fp, "TIME_PROPERTIES_DATA_SET "
|
fprintf(fp, "TIME_PROPERTIES_DATA_SET "
|
||||||
IFMT "currentUtcOffset %hd"
|
IFMT "currentUtcOffset %hd"
|
||||||
|
@ -330,32 +330,32 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
|
||||||
tp->flags & FREQ_TRACEABLE ? 1 : 0,
|
tp->flags & FREQ_TRACEABLE ? 1 : 0,
|
||||||
tp->timeSource);
|
tp->timeSource);
|
||||||
break;
|
break;
|
||||||
case PRIORITY1:
|
case TLV_PRIORITY1:
|
||||||
mtd = (struct management_tlv_datum *) mgt->data;
|
mtd = (struct management_tlv_datum *) mgt->data;
|
||||||
fprintf(fp, "PRIORITY1 "
|
fprintf(fp, "PRIORITY1 "
|
||||||
IFMT "priority1 %hhu", mtd->val);
|
IFMT "priority1 %hhu", mtd->val);
|
||||||
break;
|
break;
|
||||||
case PRIORITY2:
|
case TLV_PRIORITY2:
|
||||||
mtd = (struct management_tlv_datum *) mgt->data;
|
mtd = (struct management_tlv_datum *) mgt->data;
|
||||||
fprintf(fp, "PRIORITY2 "
|
fprintf(fp, "PRIORITY2 "
|
||||||
IFMT "priority2 %hhu", mtd->val);
|
IFMT "priority2 %hhu", mtd->val);
|
||||||
break;
|
break;
|
||||||
case DOMAIN:
|
case TLV_DOMAIN:
|
||||||
mtd = (struct management_tlv_datum *) mgt->data;
|
mtd = (struct management_tlv_datum *) mgt->data;
|
||||||
fprintf(fp, "DOMAIN "
|
fprintf(fp, "DOMAIN "
|
||||||
IFMT "domainNumber %hhu", mtd->val);
|
IFMT "domainNumber %hhu", mtd->val);
|
||||||
break;
|
break;
|
||||||
case SLAVE_ONLY:
|
case TLV_SLAVE_ONLY:
|
||||||
mtd = (struct management_tlv_datum *) mgt->data;
|
mtd = (struct management_tlv_datum *) mgt->data;
|
||||||
fprintf(fp, "SLAVE_ONLY "
|
fprintf(fp, "SLAVE_ONLY "
|
||||||
IFMT "slaveOnly %d", mtd->val & DDS_SLAVE_ONLY ? 1 : 0);
|
IFMT "slaveOnly %d", mtd->val & DDS_SLAVE_ONLY ? 1 : 0);
|
||||||
break;
|
break;
|
||||||
case CLOCK_ACCURACY:
|
case TLV_CLOCK_ACCURACY:
|
||||||
mtd = (struct management_tlv_datum *) mgt->data;
|
mtd = (struct management_tlv_datum *) mgt->data;
|
||||||
fprintf(fp, "CLOCK_ACCURACY "
|
fprintf(fp, "CLOCK_ACCURACY "
|
||||||
IFMT "clockAccuracy 0x%02hhx", mtd->val);
|
IFMT "clockAccuracy 0x%02hhx", mtd->val);
|
||||||
break;
|
break;
|
||||||
case TRACEABILITY_PROPERTIES:
|
case TLV_TRACEABILITY_PROPERTIES:
|
||||||
mtd = (struct management_tlv_datum *) mgt->data;
|
mtd = (struct management_tlv_datum *) mgt->data;
|
||||||
fprintf(fp, "TRACEABILITY_PROPERTIES "
|
fprintf(fp, "TRACEABILITY_PROPERTIES "
|
||||||
IFMT "timeTraceable %d"
|
IFMT "timeTraceable %d"
|
||||||
|
@ -363,12 +363,12 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
|
||||||
mtd->val & TIME_TRACEABLE ? 1 : 0,
|
mtd->val & TIME_TRACEABLE ? 1 : 0,
|
||||||
mtd->val & FREQ_TRACEABLE ? 1 : 0);
|
mtd->val & FREQ_TRACEABLE ? 1 : 0);
|
||||||
break;
|
break;
|
||||||
case TIMESCALE_PROPERTIES:
|
case TLV_TIMESCALE_PROPERTIES:
|
||||||
mtd = (struct management_tlv_datum *) mgt->data;
|
mtd = (struct management_tlv_datum *) mgt->data;
|
||||||
fprintf(fp, "TIMESCALE_PROPERTIES "
|
fprintf(fp, "TIMESCALE_PROPERTIES "
|
||||||
IFMT "ptpTimescale %d", mtd->val & PTP_TIMESCALE ? 1 : 0);
|
IFMT "ptpTimescale %d", mtd->val & PTP_TIMESCALE ? 1 : 0);
|
||||||
break;
|
break;
|
||||||
case TIME_STATUS_NP:
|
case TLV_TIME_STATUS_NP:
|
||||||
tsn = (struct time_status_np *) mgt->data;
|
tsn = (struct time_status_np *) mgt->data;
|
||||||
fprintf(fp, "TIME_STATUS_NP "
|
fprintf(fp, "TIME_STATUS_NP "
|
||||||
IFMT "master_offset %" PRId64
|
IFMT "master_offset %" PRId64
|
||||||
|
@ -390,7 +390,7 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
|
||||||
tsn->gmPresent ? "true" : "false",
|
tsn->gmPresent ? "true" : "false",
|
||||||
cid2str(&tsn->gmIdentity));
|
cid2str(&tsn->gmIdentity));
|
||||||
break;
|
break;
|
||||||
case GRANDMASTER_SETTINGS_NP:
|
case TLV_GRANDMASTER_SETTINGS_NP:
|
||||||
gsn = (struct grandmaster_settings_np *) mgt->data;
|
gsn = (struct grandmaster_settings_np *) mgt->data;
|
||||||
fprintf(fp, "GRANDMASTER_SETTINGS_NP "
|
fprintf(fp, "GRANDMASTER_SETTINGS_NP "
|
||||||
IFMT "clockClass %hhu"
|
IFMT "clockClass %hhu"
|
||||||
|
@ -416,7 +416,7 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
|
||||||
gsn->time_flags & FREQ_TRACEABLE ? 1 : 0,
|
gsn->time_flags & FREQ_TRACEABLE ? 1 : 0,
|
||||||
gsn->time_source);
|
gsn->time_source);
|
||||||
break;
|
break;
|
||||||
case PORT_DATA_SET:
|
case TLV_PORT_DATA_SET:
|
||||||
p = (struct portDS *) mgt->data;
|
p = (struct portDS *) mgt->data;
|
||||||
if (p->portState > PS_SLAVE) {
|
if (p->portState > PS_SLAVE) {
|
||||||
p->portState = 0;
|
p->portState = 0;
|
||||||
|
@ -438,7 +438,7 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
|
||||||
p->logSyncInterval, p->delayMechanism,
|
p->logSyncInterval, p->delayMechanism,
|
||||||
p->logMinPdelayReqInterval, p->versionNumber);
|
p->logMinPdelayReqInterval, p->versionNumber);
|
||||||
break;
|
break;
|
||||||
case PORT_DATA_SET_NP:
|
case TLV_PORT_DATA_SET_NP:
|
||||||
pnp = (struct port_ds_np *) mgt->data;
|
pnp = (struct port_ds_np *) mgt->data;
|
||||||
fprintf(fp, "PORT_DATA_SET_NP "
|
fprintf(fp, "PORT_DATA_SET_NP "
|
||||||
IFMT "neighborPropDelayThresh %u"
|
IFMT "neighborPropDelayThresh %u"
|
||||||
|
@ -446,32 +446,32 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
|
||||||
pnp->neighborPropDelayThresh,
|
pnp->neighborPropDelayThresh,
|
||||||
pnp->asCapable ? 1 : 0);
|
pnp->asCapable ? 1 : 0);
|
||||||
break;
|
break;
|
||||||
case LOG_ANNOUNCE_INTERVAL:
|
case TLV_LOG_ANNOUNCE_INTERVAL:
|
||||||
mtd = (struct management_tlv_datum *) mgt->data;
|
mtd = (struct management_tlv_datum *) mgt->data;
|
||||||
fprintf(fp, "LOG_ANNOUNCE_INTERVAL "
|
fprintf(fp, "LOG_ANNOUNCE_INTERVAL "
|
||||||
IFMT "logAnnounceInterval %hhd", mtd->val);
|
IFMT "logAnnounceInterval %hhd", mtd->val);
|
||||||
break;
|
break;
|
||||||
case ANNOUNCE_RECEIPT_TIMEOUT:
|
case TLV_ANNOUNCE_RECEIPT_TIMEOUT:
|
||||||
mtd = (struct management_tlv_datum *) mgt->data;
|
mtd = (struct management_tlv_datum *) mgt->data;
|
||||||
fprintf(fp, "ANNOUNCE_RECEIPT_TIMEOUT "
|
fprintf(fp, "ANNOUNCE_RECEIPT_TIMEOUT "
|
||||||
IFMT "announceReceiptTimeout %hhu", mtd->val);
|
IFMT "announceReceiptTimeout %hhu", mtd->val);
|
||||||
break;
|
break;
|
||||||
case LOG_SYNC_INTERVAL:
|
case TLV_LOG_SYNC_INTERVAL:
|
||||||
mtd = (struct management_tlv_datum *) mgt->data;
|
mtd = (struct management_tlv_datum *) mgt->data;
|
||||||
fprintf(fp, "ANNOUNCE_RECEIPT_TIMEOUT "
|
fprintf(fp, "ANNOUNCE_RECEIPT_TIMEOUT "
|
||||||
IFMT "logSyncInterval %hhd", mtd->val);
|
IFMT "logSyncInterval %hhd", mtd->val);
|
||||||
break;
|
break;
|
||||||
case VERSION_NUMBER:
|
case TLV_VERSION_NUMBER:
|
||||||
mtd = (struct management_tlv_datum *) mgt->data;
|
mtd = (struct management_tlv_datum *) mgt->data;
|
||||||
fprintf(fp, "VERSION_NUMBER "
|
fprintf(fp, "VERSION_NUMBER "
|
||||||
IFMT "versionNumber %hhu", mtd->val);
|
IFMT "versionNumber %hhu", mtd->val);
|
||||||
break;
|
break;
|
||||||
case DELAY_MECHANISM:
|
case TLV_DELAY_MECHANISM:
|
||||||
mtd = (struct management_tlv_datum *) mgt->data;
|
mtd = (struct management_tlv_datum *) mgt->data;
|
||||||
fprintf(fp, "DELAY_MECHANISM "
|
fprintf(fp, "DELAY_MECHANISM "
|
||||||
IFMT "delayMechanism %hhu", mtd->val);
|
IFMT "delayMechanism %hhu", mtd->val);
|
||||||
break;
|
break;
|
||||||
case LOG_MIN_PDELAY_REQ_INTERVAL:
|
case TLV_LOG_MIN_PDELAY_REQ_INTERVAL:
|
||||||
mtd = (struct management_tlv_datum *) mgt->data;
|
mtd = (struct management_tlv_datum *) mgt->data;
|
||||||
fprintf(fp, "LOG_MIN_PDELAY_REQ_INTERVAL "
|
fprintf(fp, "LOG_MIN_PDELAY_REQ_INTERVAL "
|
||||||
IFMT "logMinPdelayReqInterval %hhd", mtd->val);
|
IFMT "logMinPdelayReqInterval %hhd", mtd->val);
|
||||||
|
@ -513,7 +513,7 @@ static void do_set_action(int action, int index, char *str)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case GRANDMASTER_SETTINGS_NP:
|
case TLV_GRANDMASTER_SETTINGS_NP:
|
||||||
cnt = sscanf(str, " %*s %*s "
|
cnt = sscanf(str, " %*s %*s "
|
||||||
"clockClass %hhu "
|
"clockClass %hhu "
|
||||||
"clockAccuracy %hhx "
|
"clockAccuracy %hhx "
|
||||||
|
@ -557,7 +557,7 @@ static void do_set_action(int action, int index, char *str)
|
||||||
gsn.time_flags |= FREQ_TRACEABLE;
|
gsn.time_flags |= FREQ_TRACEABLE;
|
||||||
pmc_send_set_action(pmc, code, &gsn, sizeof(gsn));
|
pmc_send_set_action(pmc, code, &gsn, sizeof(gsn));
|
||||||
break;
|
break;
|
||||||
case PORT_DATA_SET_NP:
|
case TLV_PORT_DATA_SET_NP:
|
||||||
cnt = sscanf(str, " %*s %*s "
|
cnt = sscanf(str, " %*s %*s "
|
||||||
"neighborPropDelayThresh %u "
|
"neighborPropDelayThresh %u "
|
||||||
"asCapable %d ",
|
"asCapable %d ",
|
||||||
|
|
50
pmc_common.c
50
pmc_common.c
|
@ -161,53 +161,53 @@ static int pmc_tlv_datalen(struct pmc *pmc, int id)
|
||||||
return len;
|
return len;
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case USER_DESCRIPTION:
|
case TLV_USER_DESCRIPTION:
|
||||||
len += EMPTY_PTP_TEXT;
|
len += EMPTY_PTP_TEXT;
|
||||||
break;
|
break;
|
||||||
case DEFAULT_DATA_SET:
|
case TLV_DEFAULT_DATA_SET:
|
||||||
len += sizeof(struct defaultDS);
|
len += sizeof(struct defaultDS);
|
||||||
break;
|
break;
|
||||||
case CURRENT_DATA_SET:
|
case TLV_CURRENT_DATA_SET:
|
||||||
len += sizeof(struct currentDS);
|
len += sizeof(struct currentDS);
|
||||||
break;
|
break;
|
||||||
case PARENT_DATA_SET:
|
case TLV_PARENT_DATA_SET:
|
||||||
len += sizeof(struct parentDS);
|
len += sizeof(struct parentDS);
|
||||||
break;
|
break;
|
||||||
case TIME_PROPERTIES_DATA_SET:
|
case TLV_TIME_PROPERTIES_DATA_SET:
|
||||||
len += sizeof(struct timePropertiesDS);
|
len += sizeof(struct timePropertiesDS);
|
||||||
break;
|
break;
|
||||||
case PRIORITY1:
|
case TLV_PRIORITY1:
|
||||||
case PRIORITY2:
|
case TLV_PRIORITY2:
|
||||||
case DOMAIN:
|
case TLV_DOMAIN:
|
||||||
case SLAVE_ONLY:
|
case TLV_SLAVE_ONLY:
|
||||||
case CLOCK_ACCURACY:
|
case TLV_CLOCK_ACCURACY:
|
||||||
case TRACEABILITY_PROPERTIES:
|
case TLV_TRACEABILITY_PROPERTIES:
|
||||||
case TIMESCALE_PROPERTIES:
|
case TLV_TIMESCALE_PROPERTIES:
|
||||||
len += sizeof(struct management_tlv_datum);
|
len += sizeof(struct management_tlv_datum);
|
||||||
break;
|
break;
|
||||||
case TIME_STATUS_NP:
|
case TLV_TIME_STATUS_NP:
|
||||||
len += sizeof(struct time_status_np);
|
len += sizeof(struct time_status_np);
|
||||||
break;
|
break;
|
||||||
case GRANDMASTER_SETTINGS_NP:
|
case TLV_GRANDMASTER_SETTINGS_NP:
|
||||||
len += sizeof(struct grandmaster_settings_np);
|
len += sizeof(struct grandmaster_settings_np);
|
||||||
break;
|
break;
|
||||||
case NULL_MANAGEMENT:
|
case TLV_NULL_MANAGEMENT:
|
||||||
break;
|
break;
|
||||||
case CLOCK_DESCRIPTION:
|
case TLV_CLOCK_DESCRIPTION:
|
||||||
len += EMPTY_CLOCK_DESCRIPTION;
|
len += EMPTY_CLOCK_DESCRIPTION;
|
||||||
break;
|
break;
|
||||||
case PORT_DATA_SET:
|
case TLV_PORT_DATA_SET:
|
||||||
len += sizeof(struct portDS);
|
len += sizeof(struct portDS);
|
||||||
break;
|
break;
|
||||||
case PORT_DATA_SET_NP:
|
case TLV_PORT_DATA_SET_NP:
|
||||||
len += sizeof(struct port_ds_np);
|
len += sizeof(struct port_ds_np);
|
||||||
break;
|
break;
|
||||||
case LOG_ANNOUNCE_INTERVAL:
|
case TLV_LOG_ANNOUNCE_INTERVAL:
|
||||||
case ANNOUNCE_RECEIPT_TIMEOUT:
|
case TLV_ANNOUNCE_RECEIPT_TIMEOUT:
|
||||||
case LOG_SYNC_INTERVAL:
|
case TLV_LOG_SYNC_INTERVAL:
|
||||||
case VERSION_NUMBER:
|
case TLV_VERSION_NUMBER:
|
||||||
case DELAY_MECHANISM:
|
case TLV_DELAY_MECHANISM:
|
||||||
case LOG_MIN_PDELAY_REQ_INTERVAL:
|
case TLV_LOG_MIN_PDELAY_REQ_INTERVAL:
|
||||||
len += sizeof(struct management_tlv_datum);
|
len += sizeof(struct management_tlv_datum);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -237,7 +237,7 @@ int pmc_send_get_action(struct pmc *pmc, int id)
|
||||||
msg->header.messageLength = pdulen;
|
msg->header.messageLength = pdulen;
|
||||||
msg->tlv_count = 1;
|
msg->tlv_count = 1;
|
||||||
|
|
||||||
if (id == CLOCK_DESCRIPTION && !pmc->zero_length_gets) {
|
if (id == TLV_CLOCK_DESCRIPTION && !pmc->zero_length_gets) {
|
||||||
/*
|
/*
|
||||||
* Make sure the tlv_extra pointers dereferenced in
|
* Make sure the tlv_extra pointers dereferenced in
|
||||||
* mgt_pre_send() do point to something.
|
* mgt_pre_send() do point to something.
|
||||||
|
|
64
port.c
64
port.c
|
@ -622,11 +622,11 @@ static int port_management_fill_response(struct port *target,
|
||||||
tlv->id = id;
|
tlv->id = id;
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case NULL_MANAGEMENT:
|
case TLV_NULL_MANAGEMENT:
|
||||||
datalen = 0;
|
datalen = 0;
|
||||||
respond = 1;
|
respond = 1;
|
||||||
break;
|
break;
|
||||||
case CLOCK_DESCRIPTION:
|
case TLV_CLOCK_DESCRIPTION:
|
||||||
cd = &rsp->last_tlv.cd;
|
cd = &rsp->last_tlv.cd;
|
||||||
buf = tlv->data;
|
buf = tlv->data;
|
||||||
cd->clockType = (UInteger16 *) buf;
|
cd->clockType = (UInteger16 *) buf;
|
||||||
|
@ -692,7 +692,7 @@ static int port_management_fill_response(struct port *target,
|
||||||
datalen = buf - tlv->data;
|
datalen = buf - tlv->data;
|
||||||
respond = 1;
|
respond = 1;
|
||||||
break;
|
break;
|
||||||
case PORT_DATA_SET:
|
case TLV_PORT_DATA_SET:
|
||||||
pds = (struct portDS *) tlv->data;
|
pds = (struct portDS *) tlv->data;
|
||||||
pds->portIdentity = target->portIdentity;
|
pds->portIdentity = target->portIdentity;
|
||||||
if (target->state == PS_GRAND_MASTER) {
|
if (target->state == PS_GRAND_MASTER) {
|
||||||
|
@ -715,31 +715,31 @@ static int port_management_fill_response(struct port *target,
|
||||||
datalen = sizeof(*pds);
|
datalen = sizeof(*pds);
|
||||||
respond = 1;
|
respond = 1;
|
||||||
break;
|
break;
|
||||||
case LOG_ANNOUNCE_INTERVAL:
|
case TLV_LOG_ANNOUNCE_INTERVAL:
|
||||||
mtd = (struct management_tlv_datum *) tlv->data;
|
mtd = (struct management_tlv_datum *) tlv->data;
|
||||||
mtd->val = target->logAnnounceInterval;
|
mtd->val = target->logAnnounceInterval;
|
||||||
datalen = sizeof(*mtd);
|
datalen = sizeof(*mtd);
|
||||||
respond = 1;
|
respond = 1;
|
||||||
break;
|
break;
|
||||||
case ANNOUNCE_RECEIPT_TIMEOUT:
|
case TLV_ANNOUNCE_RECEIPT_TIMEOUT:
|
||||||
mtd = (struct management_tlv_datum *) tlv->data;
|
mtd = (struct management_tlv_datum *) tlv->data;
|
||||||
mtd->val = target->announceReceiptTimeout;
|
mtd->val = target->announceReceiptTimeout;
|
||||||
datalen = sizeof(*mtd);
|
datalen = sizeof(*mtd);
|
||||||
respond = 1;
|
respond = 1;
|
||||||
break;
|
break;
|
||||||
case LOG_SYNC_INTERVAL:
|
case TLV_LOG_SYNC_INTERVAL:
|
||||||
mtd = (struct management_tlv_datum *) tlv->data;
|
mtd = (struct management_tlv_datum *) tlv->data;
|
||||||
mtd->val = target->logSyncInterval;
|
mtd->val = target->logSyncInterval;
|
||||||
datalen = sizeof(*mtd);
|
datalen = sizeof(*mtd);
|
||||||
respond = 1;
|
respond = 1;
|
||||||
break;
|
break;
|
||||||
case VERSION_NUMBER:
|
case TLV_VERSION_NUMBER:
|
||||||
mtd = (struct management_tlv_datum *) tlv->data;
|
mtd = (struct management_tlv_datum *) tlv->data;
|
||||||
mtd->val = target->versionNumber;
|
mtd->val = target->versionNumber;
|
||||||
datalen = sizeof(*mtd);
|
datalen = sizeof(*mtd);
|
||||||
respond = 1;
|
respond = 1;
|
||||||
break;
|
break;
|
||||||
case DELAY_MECHANISM:
|
case TLV_DELAY_MECHANISM:
|
||||||
mtd = (struct management_tlv_datum *) tlv->data;
|
mtd = (struct management_tlv_datum *) tlv->data;
|
||||||
if (target->delayMechanism)
|
if (target->delayMechanism)
|
||||||
mtd->val = target->delayMechanism;
|
mtd->val = target->delayMechanism;
|
||||||
|
@ -748,20 +748,20 @@ static int port_management_fill_response(struct port *target,
|
||||||
datalen = sizeof(*mtd);
|
datalen = sizeof(*mtd);
|
||||||
respond = 1;
|
respond = 1;
|
||||||
break;
|
break;
|
||||||
case LOG_MIN_PDELAY_REQ_INTERVAL:
|
case TLV_LOG_MIN_PDELAY_REQ_INTERVAL:
|
||||||
mtd = (struct management_tlv_datum *) tlv->data;
|
mtd = (struct management_tlv_datum *) tlv->data;
|
||||||
mtd->val = target->logMinPdelayReqInterval;
|
mtd->val = target->logMinPdelayReqInterval;
|
||||||
datalen = sizeof(*mtd);
|
datalen = sizeof(*mtd);
|
||||||
respond = 1;
|
respond = 1;
|
||||||
break;
|
break;
|
||||||
case PORT_DATA_SET_NP:
|
case TLV_PORT_DATA_SET_NP:
|
||||||
pdsnp = (struct port_ds_np *) tlv->data;
|
pdsnp = (struct port_ds_np *) tlv->data;
|
||||||
pdsnp->neighborPropDelayThresh = target->neighborPropDelayThresh;
|
pdsnp->neighborPropDelayThresh = target->neighborPropDelayThresh;
|
||||||
pdsnp->asCapable = target->asCapable;
|
pdsnp->asCapable = target->asCapable;
|
||||||
datalen = sizeof(*pdsnp);
|
datalen = sizeof(*pdsnp);
|
||||||
respond = 1;
|
respond = 1;
|
||||||
break;
|
break;
|
||||||
case PORT_PROPERTIES_NP:
|
case TLV_PORT_PROPERTIES_NP:
|
||||||
ppn = (struct port_properties_np *)tlv->data;
|
ppn = (struct port_properties_np *)tlv->data;
|
||||||
ppn->portIdentity = target->portIdentity;
|
ppn->portIdentity = target->portIdentity;
|
||||||
if (target->state == PS_GRAND_MASTER)
|
if (target->state == PS_GRAND_MASTER)
|
||||||
|
@ -816,7 +816,7 @@ static int port_management_set(struct port *target,
|
||||||
tlv = (struct management_tlv *) req->management.suffix;
|
tlv = (struct management_tlv *) req->management.suffix;
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case PORT_DATA_SET_NP:
|
case TLV_PORT_DATA_SET_NP:
|
||||||
pdsnp = (struct port_ds_np *) tlv->data;
|
pdsnp = (struct port_ds_np *) tlv->data;
|
||||||
target->neighborPropDelayThresh = pdsnp->neighborPropDelayThresh;
|
target->neighborPropDelayThresh = pdsnp->neighborPropDelayThresh;
|
||||||
respond = 1;
|
respond = 1;
|
||||||
|
@ -2243,27 +2243,27 @@ int port_manage(struct port *p, struct port *ingress, struct ptp_message *msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (mgt->id) {
|
switch (mgt->id) {
|
||||||
case NULL_MANAGEMENT:
|
case TLV_NULL_MANAGEMENT:
|
||||||
case CLOCK_DESCRIPTION:
|
case TLV_CLOCK_DESCRIPTION:
|
||||||
case PORT_DATA_SET:
|
case TLV_PORT_DATA_SET:
|
||||||
case LOG_ANNOUNCE_INTERVAL:
|
case TLV_LOG_ANNOUNCE_INTERVAL:
|
||||||
case ANNOUNCE_RECEIPT_TIMEOUT:
|
case TLV_ANNOUNCE_RECEIPT_TIMEOUT:
|
||||||
case LOG_SYNC_INTERVAL:
|
case TLV_LOG_SYNC_INTERVAL:
|
||||||
case VERSION_NUMBER:
|
case TLV_VERSION_NUMBER:
|
||||||
case ENABLE_PORT:
|
case TLV_ENABLE_PORT:
|
||||||
case DISABLE_PORT:
|
case TLV_DISABLE_PORT:
|
||||||
case UNICAST_NEGOTIATION_ENABLE:
|
case TLV_UNICAST_NEGOTIATION_ENABLE:
|
||||||
case UNICAST_MASTER_TABLE:
|
case TLV_UNICAST_MASTER_TABLE:
|
||||||
case UNICAST_MASTER_MAX_TABLE_SIZE:
|
case TLV_UNICAST_MASTER_MAX_TABLE_SIZE:
|
||||||
case ACCEPTABLE_MASTER_TABLE_ENABLED:
|
case TLV_ACCEPTABLE_MASTER_TABLE_ENABLED:
|
||||||
case ALTERNATE_MASTER:
|
case TLV_ALTERNATE_MASTER:
|
||||||
case TRANSPARENT_CLOCK_PORT_DATA_SET:
|
case TLV_TRANSPARENT_CLOCK_PORT_DATA_SET:
|
||||||
case DELAY_MECHANISM:
|
case TLV_DELAY_MECHANISM:
|
||||||
case LOG_MIN_PDELAY_REQ_INTERVAL:
|
case TLV_LOG_MIN_PDELAY_REQ_INTERVAL:
|
||||||
port_management_send_error(p, ingress, msg, NOT_SUPPORTED);
|
port_management_send_error(p, ingress, msg, TLV_NOT_SUPPORTED);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
port_management_send_error(p, ingress, msg, NO_SUCH_ID);
|
port_management_send_error(p, ingress, msg, TLV_NO_SUCH_ID);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -2367,7 +2367,7 @@ void port_notify_event(struct port *p, enum notification event)
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case NOTIFY_PORT_STATE:
|
case NOTIFY_PORT_STATE:
|
||||||
id = PORT_DATA_SET;
|
id = TLV_PORT_DATA_SET;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
|
|
58
tlv.c
58
tlv.c
|
@ -69,7 +69,7 @@ static int mgt_post_recv(struct management_tlv *m, uint16_t data_len,
|
||||||
uint8_t *buf;
|
uint8_t *buf;
|
||||||
uint16_t u16;
|
uint16_t u16;
|
||||||
switch (m->id) {
|
switch (m->id) {
|
||||||
case CLOCK_DESCRIPTION:
|
case TLV_CLOCK_DESCRIPTION:
|
||||||
cd = &extra->cd;
|
cd = &extra->cd;
|
||||||
buf = m->data;
|
buf = m->data;
|
||||||
len = data_len;
|
len = data_len;
|
||||||
|
@ -168,14 +168,14 @@ static int mgt_post_recv(struct management_tlv *m, uint16_t data_len,
|
||||||
|
|
||||||
extra_len = buf - m->data;
|
extra_len = buf - m->data;
|
||||||
break;
|
break;
|
||||||
case USER_DESCRIPTION:
|
case TLV_USER_DESCRIPTION:
|
||||||
if (data_len < sizeof(struct PTPText))
|
if (data_len < sizeof(struct PTPText))
|
||||||
goto bad_length;
|
goto bad_length;
|
||||||
extra->cd.userDescription = (struct PTPText *) m->data;
|
extra->cd.userDescription = (struct PTPText *) m->data;
|
||||||
extra_len = sizeof(struct PTPText);
|
extra_len = sizeof(struct PTPText);
|
||||||
extra_len += extra->cd.userDescription->length;
|
extra_len += extra->cd.userDescription->length;
|
||||||
break;
|
break;
|
||||||
case DEFAULT_DATA_SET:
|
case TLV_DEFAULT_DATA_SET:
|
||||||
if (data_len != sizeof(struct defaultDS))
|
if (data_len != sizeof(struct defaultDS))
|
||||||
goto bad_length;
|
goto bad_length;
|
||||||
dds = (struct defaultDS *) m->data;
|
dds = (struct defaultDS *) m->data;
|
||||||
|
@ -183,7 +183,7 @@ static int mgt_post_recv(struct management_tlv *m, uint16_t data_len,
|
||||||
dds->clockQuality.offsetScaledLogVariance =
|
dds->clockQuality.offsetScaledLogVariance =
|
||||||
ntohs(dds->clockQuality.offsetScaledLogVariance);
|
ntohs(dds->clockQuality.offsetScaledLogVariance);
|
||||||
break;
|
break;
|
||||||
case CURRENT_DATA_SET:
|
case TLV_CURRENT_DATA_SET:
|
||||||
if (data_len != sizeof(struct currentDS))
|
if (data_len != sizeof(struct currentDS))
|
||||||
goto bad_length;
|
goto bad_length;
|
||||||
cds = (struct currentDS *) m->data;
|
cds = (struct currentDS *) m->data;
|
||||||
|
@ -191,7 +191,7 @@ static int mgt_post_recv(struct management_tlv *m, uint16_t data_len,
|
||||||
cds->offsetFromMaster = net2host64(cds->offsetFromMaster);
|
cds->offsetFromMaster = net2host64(cds->offsetFromMaster);
|
||||||
cds->meanPathDelay = net2host64(cds->meanPathDelay);
|
cds->meanPathDelay = net2host64(cds->meanPathDelay);
|
||||||
break;
|
break;
|
||||||
case PARENT_DATA_SET:
|
case TLV_PARENT_DATA_SET:
|
||||||
if (data_len != sizeof(struct parentDS))
|
if (data_len != sizeof(struct parentDS))
|
||||||
goto bad_length;
|
goto bad_length;
|
||||||
pds = (struct parentDS *) m->data;
|
pds = (struct parentDS *) m->data;
|
||||||
|
@ -204,20 +204,20 @@ static int mgt_post_recv(struct management_tlv *m, uint16_t data_len,
|
||||||
pds->grandmasterClockQuality.offsetScaledLogVariance =
|
pds->grandmasterClockQuality.offsetScaledLogVariance =
|
||||||
ntohs(pds->grandmasterClockQuality.offsetScaledLogVariance);
|
ntohs(pds->grandmasterClockQuality.offsetScaledLogVariance);
|
||||||
break;
|
break;
|
||||||
case TIME_PROPERTIES_DATA_SET:
|
case TLV_TIME_PROPERTIES_DATA_SET:
|
||||||
if (data_len != sizeof(struct timePropertiesDS))
|
if (data_len != sizeof(struct timePropertiesDS))
|
||||||
goto bad_length;
|
goto bad_length;
|
||||||
tp = (struct timePropertiesDS *) m->data;
|
tp = (struct timePropertiesDS *) m->data;
|
||||||
tp->currentUtcOffset = ntohs(tp->currentUtcOffset);
|
tp->currentUtcOffset = ntohs(tp->currentUtcOffset);
|
||||||
break;
|
break;
|
||||||
case PORT_DATA_SET:
|
case TLV_PORT_DATA_SET:
|
||||||
if (data_len != sizeof(struct portDS))
|
if (data_len != sizeof(struct portDS))
|
||||||
goto bad_length;
|
goto bad_length;
|
||||||
p = (struct portDS *) m->data;
|
p = (struct portDS *) m->data;
|
||||||
p->portIdentity.portNumber = ntohs(p->portIdentity.portNumber);
|
p->portIdentity.portNumber = ntohs(p->portIdentity.portNumber);
|
||||||
p->peerMeanPathDelay = net2host64(p->peerMeanPathDelay);
|
p->peerMeanPathDelay = net2host64(p->peerMeanPathDelay);
|
||||||
break;
|
break;
|
||||||
case TIME_STATUS_NP:
|
case TLV_TIME_STATUS_NP:
|
||||||
if (data_len != sizeof(struct time_status_np))
|
if (data_len != sizeof(struct time_status_np))
|
||||||
goto bad_length;
|
goto bad_length;
|
||||||
tsn = (struct time_status_np *) m->data;
|
tsn = (struct time_status_np *) m->data;
|
||||||
|
@ -229,7 +229,7 @@ static int mgt_post_recv(struct management_tlv *m, uint16_t data_len,
|
||||||
scaled_ns_n2h(&tsn->lastGmPhaseChange);
|
scaled_ns_n2h(&tsn->lastGmPhaseChange);
|
||||||
tsn->gmPresent = ntohl(tsn->gmPresent);
|
tsn->gmPresent = ntohl(tsn->gmPresent);
|
||||||
break;
|
break;
|
||||||
case GRANDMASTER_SETTINGS_NP:
|
case TLV_GRANDMASTER_SETTINGS_NP:
|
||||||
if (data_len != sizeof(struct grandmaster_settings_np))
|
if (data_len != sizeof(struct grandmaster_settings_np))
|
||||||
goto bad_length;
|
goto bad_length;
|
||||||
gsn = (struct grandmaster_settings_np *) m->data;
|
gsn = (struct grandmaster_settings_np *) m->data;
|
||||||
|
@ -237,20 +237,20 @@ static int mgt_post_recv(struct management_tlv *m, uint16_t data_len,
|
||||||
ntohs(gsn->clockQuality.offsetScaledLogVariance);
|
ntohs(gsn->clockQuality.offsetScaledLogVariance);
|
||||||
gsn->utc_offset = ntohs(gsn->utc_offset);
|
gsn->utc_offset = ntohs(gsn->utc_offset);
|
||||||
break;
|
break;
|
||||||
case PORT_DATA_SET_NP:
|
case TLV_PORT_DATA_SET_NP:
|
||||||
if (data_len != sizeof(struct port_ds_np))
|
if (data_len != sizeof(struct port_ds_np))
|
||||||
goto bad_length;
|
goto bad_length;
|
||||||
pdsnp = (struct port_ds_np *) m->data;
|
pdsnp = (struct port_ds_np *) m->data;
|
||||||
pdsnp->neighborPropDelayThresh = ntohl(pdsnp->neighborPropDelayThresh);
|
pdsnp->neighborPropDelayThresh = ntohl(pdsnp->neighborPropDelayThresh);
|
||||||
pdsnp->asCapable = ntohl(pdsnp->asCapable);
|
pdsnp->asCapable = ntohl(pdsnp->asCapable);
|
||||||
break;
|
break;
|
||||||
case SUBSCRIBE_EVENTS_NP:
|
case TLV_SUBSCRIBE_EVENTS_NP:
|
||||||
if (data_len != sizeof(struct subscribe_events_np))
|
if (data_len != sizeof(struct subscribe_events_np))
|
||||||
goto bad_length;
|
goto bad_length;
|
||||||
sen = (struct subscribe_events_np *)m->data;
|
sen = (struct subscribe_events_np *)m->data;
|
||||||
sen->duration = ntohs(sen->duration);
|
sen->duration = ntohs(sen->duration);
|
||||||
break;
|
break;
|
||||||
case PORT_PROPERTIES_NP:
|
case TLV_PORT_PROPERTIES_NP:
|
||||||
if (data_len < sizeof(struct port_properties_np))
|
if (data_len < sizeof(struct port_properties_np))
|
||||||
goto bad_length;
|
goto bad_length;
|
||||||
ppn = (struct port_properties_np *)m->data;
|
ppn = (struct port_properties_np *)m->data;
|
||||||
|
@ -258,12 +258,12 @@ static int mgt_post_recv(struct management_tlv *m, uint16_t data_len,
|
||||||
extra_len = sizeof(struct port_properties_np);
|
extra_len = sizeof(struct port_properties_np);
|
||||||
extra_len += ppn->interface.length;
|
extra_len += ppn->interface.length;
|
||||||
break;
|
break;
|
||||||
case SAVE_IN_NON_VOLATILE_STORAGE:
|
case TLV_SAVE_IN_NON_VOLATILE_STORAGE:
|
||||||
case RESET_NON_VOLATILE_STORAGE:
|
case TLV_RESET_NON_VOLATILE_STORAGE:
|
||||||
case INITIALIZE:
|
case TLV_INITIALIZE:
|
||||||
case FAULT_LOG_RESET:
|
case TLV_FAULT_LOG_RESET:
|
||||||
case ENABLE_PORT:
|
case TLV_ENABLE_PORT:
|
||||||
case DISABLE_PORT:
|
case TLV_DISABLE_PORT:
|
||||||
if (data_len != 0)
|
if (data_len != 0)
|
||||||
goto bad_length;
|
goto bad_length;
|
||||||
break;
|
break;
|
||||||
|
@ -293,7 +293,7 @@ static void mgt_pre_send(struct management_tlv *m, struct tlv_extra *extra)
|
||||||
struct port_properties_np *ppn;
|
struct port_properties_np *ppn;
|
||||||
struct mgmt_clock_description *cd;
|
struct mgmt_clock_description *cd;
|
||||||
switch (m->id) {
|
switch (m->id) {
|
||||||
case CLOCK_DESCRIPTION:
|
case TLV_CLOCK_DESCRIPTION:
|
||||||
if (extra) {
|
if (extra) {
|
||||||
cd = &extra->cd;
|
cd = &extra->cd;
|
||||||
flip16(cd->clockType);
|
flip16(cd->clockType);
|
||||||
|
@ -302,19 +302,19 @@ static void mgt_pre_send(struct management_tlv *m, struct tlv_extra *extra)
|
||||||
flip16(&cd->protocolAddress->addressLength);
|
flip16(&cd->protocolAddress->addressLength);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DEFAULT_DATA_SET:
|
case TLV_DEFAULT_DATA_SET:
|
||||||
dds = (struct defaultDS *) m->data;
|
dds = (struct defaultDS *) m->data;
|
||||||
dds->numberPorts = htons(dds->numberPorts);
|
dds->numberPorts = htons(dds->numberPorts);
|
||||||
dds->clockQuality.offsetScaledLogVariance =
|
dds->clockQuality.offsetScaledLogVariance =
|
||||||
htons(dds->clockQuality.offsetScaledLogVariance);
|
htons(dds->clockQuality.offsetScaledLogVariance);
|
||||||
break;
|
break;
|
||||||
case CURRENT_DATA_SET:
|
case TLV_CURRENT_DATA_SET:
|
||||||
cds = (struct currentDS *) m->data;
|
cds = (struct currentDS *) m->data;
|
||||||
cds->stepsRemoved = htons(cds->stepsRemoved);
|
cds->stepsRemoved = htons(cds->stepsRemoved);
|
||||||
cds->offsetFromMaster = host2net64(cds->offsetFromMaster);
|
cds->offsetFromMaster = host2net64(cds->offsetFromMaster);
|
||||||
cds->meanPathDelay = host2net64(cds->meanPathDelay);
|
cds->meanPathDelay = host2net64(cds->meanPathDelay);
|
||||||
break;
|
break;
|
||||||
case PARENT_DATA_SET:
|
case TLV_PARENT_DATA_SET:
|
||||||
pds = (struct parentDS *) m->data;
|
pds = (struct parentDS *) m->data;
|
||||||
pds->parentPortIdentity.portNumber =
|
pds->parentPortIdentity.portNumber =
|
||||||
htons(pds->parentPortIdentity.portNumber);
|
htons(pds->parentPortIdentity.portNumber);
|
||||||
|
@ -325,16 +325,16 @@ static void mgt_pre_send(struct management_tlv *m, struct tlv_extra *extra)
|
||||||
pds->grandmasterClockQuality.offsetScaledLogVariance =
|
pds->grandmasterClockQuality.offsetScaledLogVariance =
|
||||||
htons(pds->grandmasterClockQuality.offsetScaledLogVariance);
|
htons(pds->grandmasterClockQuality.offsetScaledLogVariance);
|
||||||
break;
|
break;
|
||||||
case TIME_PROPERTIES_DATA_SET:
|
case TLV_TIME_PROPERTIES_DATA_SET:
|
||||||
tp = (struct timePropertiesDS *) m->data;
|
tp = (struct timePropertiesDS *) m->data;
|
||||||
tp->currentUtcOffset = htons(tp->currentUtcOffset);
|
tp->currentUtcOffset = htons(tp->currentUtcOffset);
|
||||||
break;
|
break;
|
||||||
case PORT_DATA_SET:
|
case TLV_PORT_DATA_SET:
|
||||||
p = (struct portDS *) m->data;
|
p = (struct portDS *) m->data;
|
||||||
p->portIdentity.portNumber = htons(p->portIdentity.portNumber);
|
p->portIdentity.portNumber = htons(p->portIdentity.portNumber);
|
||||||
p->peerMeanPathDelay = host2net64(p->peerMeanPathDelay);
|
p->peerMeanPathDelay = host2net64(p->peerMeanPathDelay);
|
||||||
break;
|
break;
|
||||||
case TIME_STATUS_NP:
|
case TLV_TIME_STATUS_NP:
|
||||||
tsn = (struct time_status_np *) m->data;
|
tsn = (struct time_status_np *) m->data;
|
||||||
tsn->master_offset = host2net64(tsn->master_offset);
|
tsn->master_offset = host2net64(tsn->master_offset);
|
||||||
tsn->ingress_time = host2net64(tsn->ingress_time);
|
tsn->ingress_time = host2net64(tsn->ingress_time);
|
||||||
|
@ -344,22 +344,22 @@ static void mgt_pre_send(struct management_tlv *m, struct tlv_extra *extra)
|
||||||
scaled_ns_h2n(&tsn->lastGmPhaseChange);
|
scaled_ns_h2n(&tsn->lastGmPhaseChange);
|
||||||
tsn->gmPresent = htonl(tsn->gmPresent);
|
tsn->gmPresent = htonl(tsn->gmPresent);
|
||||||
break;
|
break;
|
||||||
case GRANDMASTER_SETTINGS_NP:
|
case TLV_GRANDMASTER_SETTINGS_NP:
|
||||||
gsn = (struct grandmaster_settings_np *) m->data;
|
gsn = (struct grandmaster_settings_np *) m->data;
|
||||||
gsn->clockQuality.offsetScaledLogVariance =
|
gsn->clockQuality.offsetScaledLogVariance =
|
||||||
htons(gsn->clockQuality.offsetScaledLogVariance);
|
htons(gsn->clockQuality.offsetScaledLogVariance);
|
||||||
gsn->utc_offset = htons(gsn->utc_offset);
|
gsn->utc_offset = htons(gsn->utc_offset);
|
||||||
break;
|
break;
|
||||||
case PORT_DATA_SET_NP:
|
case TLV_PORT_DATA_SET_NP:
|
||||||
pdsnp = (struct port_ds_np *) m->data;
|
pdsnp = (struct port_ds_np *) m->data;
|
||||||
pdsnp->neighborPropDelayThresh = htonl(pdsnp->neighborPropDelayThresh);
|
pdsnp->neighborPropDelayThresh = htonl(pdsnp->neighborPropDelayThresh);
|
||||||
pdsnp->asCapable = htonl(pdsnp->asCapable);
|
pdsnp->asCapable = htonl(pdsnp->asCapable);
|
||||||
break;
|
break;
|
||||||
case SUBSCRIBE_EVENTS_NP:
|
case TLV_SUBSCRIBE_EVENTS_NP:
|
||||||
sen = (struct subscribe_events_np *)m->data;
|
sen = (struct subscribe_events_np *)m->data;
|
||||||
sen->duration = htons(sen->duration);
|
sen->duration = htons(sen->duration);
|
||||||
break;
|
break;
|
||||||
case PORT_PROPERTIES_NP:
|
case TLV_PORT_PROPERTIES_NP:
|
||||||
ppn = (struct port_properties_np *)m->data;
|
ppn = (struct port_properties_np *)m->data;
|
||||||
ppn->portIdentity.portNumber = htons(ppn->portIdentity.portNumber);
|
ppn->portIdentity.portNumber = htons(ppn->portIdentity.portNumber);
|
||||||
break;
|
break;
|
||||||
|
|
118
tlv.h
118
tlv.h
|
@ -47,69 +47,69 @@ enum management_action {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Clock management ID values */
|
/* Clock management ID values */
|
||||||
#define USER_DESCRIPTION 0x0002
|
#define TLV_USER_DESCRIPTION 0x0002
|
||||||
#define SAVE_IN_NON_VOLATILE_STORAGE 0x0003
|
#define TLV_SAVE_IN_NON_VOLATILE_STORAGE 0x0003
|
||||||
#define RESET_NON_VOLATILE_STORAGE 0x0004
|
#define TLV_RESET_NON_VOLATILE_STORAGE 0x0004
|
||||||
#define INITIALIZE 0x0005
|
#define TLV_INITIALIZE 0x0005
|
||||||
#define FAULT_LOG 0x0006
|
#define TLV_FAULT_LOG 0x0006
|
||||||
#define FAULT_LOG_RESET 0x0007
|
#define TLV_FAULT_LOG_RESET 0x0007
|
||||||
#define DEFAULT_DATA_SET 0x2000
|
#define TLV_DEFAULT_DATA_SET 0x2000
|
||||||
#define CURRENT_DATA_SET 0x2001
|
#define TLV_CURRENT_DATA_SET 0x2001
|
||||||
#define PARENT_DATA_SET 0x2002
|
#define TLV_PARENT_DATA_SET 0x2002
|
||||||
#define TIME_PROPERTIES_DATA_SET 0x2003
|
#define TLV_TIME_PROPERTIES_DATA_SET 0x2003
|
||||||
#define PRIORITY1 0x2005
|
#define TLV_PRIORITY1 0x2005
|
||||||
#define PRIORITY2 0x2006
|
#define TLV_PRIORITY2 0x2006
|
||||||
#define DOMAIN 0x2007
|
#define TLV_DOMAIN 0x2007
|
||||||
#define SLAVE_ONLY 0x2008
|
#define TLV_SLAVE_ONLY 0x2008
|
||||||
#define TIME 0x200F
|
#define TLV_TIME 0x200F
|
||||||
#define CLOCK_ACCURACY 0x2010
|
#define TLV_CLOCK_ACCURACY 0x2010
|
||||||
#define UTC_PROPERTIES 0x2011
|
#define TLV_UTC_PROPERTIES 0x2011
|
||||||
#define TRACEABILITY_PROPERTIES 0x2012
|
#define TLV_TRACEABILITY_PROPERTIES 0x2012
|
||||||
#define TIMESCALE_PROPERTIES 0x2013
|
#define TLV_TIMESCALE_PROPERTIES 0x2013
|
||||||
#define PATH_TRACE_LIST 0x2015
|
#define TLV_PATH_TRACE_LIST 0x2015
|
||||||
#define PATH_TRACE_ENABLE 0x2016
|
#define TLV_PATH_TRACE_ENABLE 0x2016
|
||||||
#define GRANDMASTER_CLUSTER_TABLE 0x2017
|
#define TLV_GRANDMASTER_CLUSTER_TABLE 0x2017
|
||||||
#define ACCEPTABLE_MASTER_TABLE 0x201A
|
#define TLV_ACCEPTABLE_MASTER_TABLE 0x201A
|
||||||
#define ACCEPTABLE_MASTER_MAX_TABLE_SIZE 0x201C
|
#define TLV_ACCEPTABLE_MASTER_MAX_TABLE_SIZE 0x201C
|
||||||
#define ALTERNATE_TIME_OFFSET_ENABLE 0x201E
|
#define TLV_ALTERNATE_TIME_OFFSET_ENABLE 0x201E
|
||||||
#define ALTERNATE_TIME_OFFSET_NAME 0x201F
|
#define TLV_ALTERNATE_TIME_OFFSET_NAME 0x201F
|
||||||
#define ALTERNATE_TIME_OFFSET_MAX_KEY 0x2020
|
#define TLV_ALTERNATE_TIME_OFFSET_MAX_KEY 0x2020
|
||||||
#define ALTERNATE_TIME_OFFSET_PROPERTIES 0x2021
|
#define TLV_ALTERNATE_TIME_OFFSET_PROPERTIES 0x2021
|
||||||
#define TRANSPARENT_CLOCK_DEFAULT_DATA_SET 0x4000
|
#define TLV_TRANSPARENT_CLOCK_DEFAULT_DATA_SET 0x4000
|
||||||
#define PRIMARY_DOMAIN 0x4002
|
#define TLV_PRIMARY_DOMAIN 0x4002
|
||||||
#define TIME_STATUS_NP 0xC000
|
#define TLV_TIME_STATUS_NP 0xC000
|
||||||
#define GRANDMASTER_SETTINGS_NP 0xC001
|
#define TLV_GRANDMASTER_SETTINGS_NP 0xC001
|
||||||
#define SUBSCRIBE_EVENTS_NP 0xC003
|
#define TLV_SUBSCRIBE_EVENTS_NP 0xC003
|
||||||
|
|
||||||
/* Port management ID values */
|
/* Port management ID values */
|
||||||
#define NULL_MANAGEMENT 0x0000
|
#define TLV_NULL_MANAGEMENT 0x0000
|
||||||
#define CLOCK_DESCRIPTION 0x0001
|
#define TLV_CLOCK_DESCRIPTION 0x0001
|
||||||
#define PORT_DATA_SET 0x2004
|
#define TLV_PORT_DATA_SET 0x2004
|
||||||
#define LOG_ANNOUNCE_INTERVAL 0x2009
|
#define TLV_LOG_ANNOUNCE_INTERVAL 0x2009
|
||||||
#define ANNOUNCE_RECEIPT_TIMEOUT 0x200A
|
#define TLV_ANNOUNCE_RECEIPT_TIMEOUT 0x200A
|
||||||
#define LOG_SYNC_INTERVAL 0x200B
|
#define TLV_LOG_SYNC_INTERVAL 0x200B
|
||||||
#define VERSION_NUMBER 0x200C
|
#define TLV_VERSION_NUMBER 0x200C
|
||||||
#define ENABLE_PORT 0x200D
|
#define TLV_ENABLE_PORT 0x200D
|
||||||
#define DISABLE_PORT 0x200E
|
#define TLV_DISABLE_PORT 0x200E
|
||||||
#define UNICAST_NEGOTIATION_ENABLE 0x2014
|
#define TLV_UNICAST_NEGOTIATION_ENABLE 0x2014
|
||||||
#define UNICAST_MASTER_TABLE 0x2018
|
#define TLV_UNICAST_MASTER_TABLE 0x2018
|
||||||
#define UNICAST_MASTER_MAX_TABLE_SIZE 0x2019
|
#define TLV_UNICAST_MASTER_MAX_TABLE_SIZE 0x2019
|
||||||
#define ACCEPTABLE_MASTER_TABLE_ENABLED 0x201B
|
#define TLV_ACCEPTABLE_MASTER_TABLE_ENABLED 0x201B
|
||||||
#define ALTERNATE_MASTER 0x201D
|
#define TLV_ALTERNATE_MASTER 0x201D
|
||||||
#define TRANSPARENT_CLOCK_PORT_DATA_SET 0x4001
|
#define TLV_TRANSPARENT_CLOCK_PORT_DATA_SET 0x4001
|
||||||
#define DELAY_MECHANISM 0x6000
|
#define TLV_DELAY_MECHANISM 0x6000
|
||||||
#define LOG_MIN_PDELAY_REQ_INTERVAL 0x6001
|
#define TLV_LOG_MIN_PDELAY_REQ_INTERVAL 0x6001
|
||||||
#define PORT_DATA_SET_NP 0xC002
|
#define TLV_PORT_DATA_SET_NP 0xC002
|
||||||
#define PORT_PROPERTIES_NP 0xC004
|
#define TLV_PORT_PROPERTIES_NP 0xC004
|
||||||
|
|
||||||
/* Management error ID values */
|
/* Management error ID values */
|
||||||
#define RESPONSE_TOO_BIG 0x0001
|
#define TLV_RESPONSE_TOO_BIG 0x0001
|
||||||
#define NO_SUCH_ID 0x0002
|
#define TLV_NO_SUCH_ID 0x0002
|
||||||
#define WRONG_LENGTH 0x0003
|
#define TLV_WRONG_LENGTH 0x0003
|
||||||
#define WRONG_VALUE 0x0004
|
#define TLV_WRONG_VALUE 0x0004
|
||||||
#define NOT_SETABLE 0x0005
|
#define TLV_NOT_SETABLE 0x0005
|
||||||
#define NOT_SUPPORTED 0x0006
|
#define TLV_NOT_SUPPORTED 0x0006
|
||||||
#define GENERAL_ERROR 0xFFFE
|
#define TLV_GENERAL_ERROR 0xFFFE
|
||||||
|
|
||||||
struct management_tlv {
|
struct management_tlv {
|
||||||
Enumeration16 type;
|
Enumeration16 type;
|
||||||
|
|
Loading…
Reference in New Issue