Convert the time properties data set TLV to and from host byte order.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
aa6708d09a
commit
49a98c1fcf
10
tlv.c
10
tlv.c
|
@ -43,6 +43,7 @@ static void mgt_post_recv(struct management_tlv *m)
|
||||||
struct defaultDS *dds;
|
struct defaultDS *dds;
|
||||||
struct currentDS *cds;
|
struct currentDS *cds;
|
||||||
struct parentDS *pds;
|
struct parentDS *pds;
|
||||||
|
struct timePropertiesDS *tp;
|
||||||
struct time_status_np *tsn;
|
struct time_status_np *tsn;
|
||||||
switch (m->id) {
|
switch (m->id) {
|
||||||
case DEFAULT_DATA_SET:
|
case DEFAULT_DATA_SET:
|
||||||
|
@ -68,6 +69,10 @@ static void mgt_post_recv(struct management_tlv *m)
|
||||||
pds->grandmasterClockQuality.offsetScaledLogVariance =
|
pds->grandmasterClockQuality.offsetScaledLogVariance =
|
||||||
ntohs(pds->grandmasterClockQuality.offsetScaledLogVariance);
|
ntohs(pds->grandmasterClockQuality.offsetScaledLogVariance);
|
||||||
break;
|
break;
|
||||||
|
case TIME_PROPERTIES_DATA_SET:
|
||||||
|
tp = (struct timePropertiesDS *) m->data;
|
||||||
|
tp->currentUtcOffset = ntohs(tp->currentUtcOffset);
|
||||||
|
break;
|
||||||
case TIME_STATUS_NP:
|
case TIME_STATUS_NP:
|
||||||
tsn = (struct time_status_np *) m->data;
|
tsn = (struct time_status_np *) m->data;
|
||||||
tsn->master_offset = net2host64(tsn->master_offset);
|
tsn->master_offset = net2host64(tsn->master_offset);
|
||||||
|
@ -86,6 +91,7 @@ static void mgt_pre_send(struct management_tlv *m)
|
||||||
struct defaultDS *dds;
|
struct defaultDS *dds;
|
||||||
struct currentDS *cds;
|
struct currentDS *cds;
|
||||||
struct parentDS *pds;
|
struct parentDS *pds;
|
||||||
|
struct timePropertiesDS *tp;
|
||||||
struct time_status_np *tsn;
|
struct time_status_np *tsn;
|
||||||
switch (m->id) {
|
switch (m->id) {
|
||||||
case DEFAULT_DATA_SET:
|
case DEFAULT_DATA_SET:
|
||||||
|
@ -111,6 +117,10 @@ static void mgt_pre_send(struct management_tlv *m)
|
||||||
pds->grandmasterClockQuality.offsetScaledLogVariance =
|
pds->grandmasterClockQuality.offsetScaledLogVariance =
|
||||||
htons(pds->grandmasterClockQuality.offsetScaledLogVariance);
|
htons(pds->grandmasterClockQuality.offsetScaledLogVariance);
|
||||||
break;
|
break;
|
||||||
|
case TIME_PROPERTIES_DATA_SET:
|
||||||
|
tp = (struct timePropertiesDS *) m->data;
|
||||||
|
tp->currentUtcOffset = htons(tp->currentUtcOffset);
|
||||||
|
break;
|
||||||
case TIME_STATUS_NP:
|
case 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);
|
||||||
|
|
Loading…
Reference in New Issue