Convert the port data set TLV to and from host byte order.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
c101dafb18
commit
28c08dfac6
13
ds.h
13
ds.h
|
@ -88,6 +88,19 @@ struct timePropertiesDS {
|
|||
Enumeration8 timeSource;
|
||||
} PACKED;
|
||||
|
||||
struct portDS {
|
||||
struct PortIdentity portIdentity;
|
||||
Enumeration8 portState;
|
||||
Integer8 logMinDelayReqInterval;
|
||||
TimeInterval peerMeanPathDelay;
|
||||
Integer8 logAnnounceInterval;
|
||||
UInteger8 announceReceiptTimeout;
|
||||
Integer8 logSyncInterval;
|
||||
Enumeration8 delayMechanism;
|
||||
Integer8 logMinPdelayReqInterval;
|
||||
UInteger8 versionNumber;
|
||||
} PACKED;
|
||||
|
||||
struct port_defaults {
|
||||
Integer8 logAnnounceInterval;
|
||||
Integer8 logSyncInterval;
|
||||
|
|
12
tlv.c
12
tlv.c
|
@ -44,6 +44,7 @@ static void mgt_post_recv(struct management_tlv *m)
|
|||
struct currentDS *cds;
|
||||
struct parentDS *pds;
|
||||
struct timePropertiesDS *tp;
|
||||
struct portDS *p;
|
||||
struct time_status_np *tsn;
|
||||
switch (m->id) {
|
||||
case DEFAULT_DATA_SET:
|
||||
|
@ -73,6 +74,11 @@ static void mgt_post_recv(struct management_tlv *m)
|
|||
tp = (struct timePropertiesDS *) m->data;
|
||||
tp->currentUtcOffset = ntohs(tp->currentUtcOffset);
|
||||
break;
|
||||
case PORT_DATA_SET:
|
||||
p = (struct portDS *) m->data;
|
||||
p->portIdentity.portNumber = ntohs(p->portIdentity.portNumber);
|
||||
p->peerMeanPathDelay = net2host64(p->peerMeanPathDelay);
|
||||
break;
|
||||
case TIME_STATUS_NP:
|
||||
tsn = (struct time_status_np *) m->data;
|
||||
tsn->master_offset = net2host64(tsn->master_offset);
|
||||
|
@ -92,6 +98,7 @@ static void mgt_pre_send(struct management_tlv *m)
|
|||
struct currentDS *cds;
|
||||
struct parentDS *pds;
|
||||
struct timePropertiesDS *tp;
|
||||
struct portDS *p;
|
||||
struct time_status_np *tsn;
|
||||
switch (m->id) {
|
||||
case DEFAULT_DATA_SET:
|
||||
|
@ -121,6 +128,11 @@ static void mgt_pre_send(struct management_tlv *m)
|
|||
tp = (struct timePropertiesDS *) m->data;
|
||||
tp->currentUtcOffset = htons(tp->currentUtcOffset);
|
||||
break;
|
||||
case PORT_DATA_SET:
|
||||
p = (struct portDS *) m->data;
|
||||
p->portIdentity.portNumber = htons(p->portIdentity.portNumber);
|
||||
p->peerMeanPathDelay = host2net64(p->peerMeanPathDelay);
|
||||
break;
|
||||
case TIME_STATUS_NP:
|
||||
tsn = (struct time_status_np *) m->data;
|
||||
tsn->master_offset = host2net64(tsn->master_offset);
|
||||
|
|
Loading…
Reference in New Issue