Convert the parent data set TLV to and from host byte order.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
b30c841cde
commit
e21280ef77
24
tlv.c
24
tlv.c
|
@ -42,6 +42,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 time_status_np *tsn;
|
struct time_status_np *tsn;
|
||||||
switch (m->id) {
|
switch (m->id) {
|
||||||
case DEFAULT_DATA_SET:
|
case DEFAULT_DATA_SET:
|
||||||
|
@ -56,6 +57,17 @@ static void mgt_post_recv(struct management_tlv *m)
|
||||||
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:
|
||||||
|
pds = (struct parentDS *) m->data;
|
||||||
|
pds->parentPortIdentity.portNumber =
|
||||||
|
ntohs(pds->parentPortIdentity.portNumber);
|
||||||
|
pds->observedParentOffsetScaledLogVariance =
|
||||||
|
ntohs(pds->observedParentOffsetScaledLogVariance);
|
||||||
|
pds->observedParentClockPhaseChangeRate =
|
||||||
|
ntohl(pds->observedParentClockPhaseChangeRate);
|
||||||
|
pds->grandmasterClockQuality.offsetScaledLogVariance =
|
||||||
|
ntohs(pds->grandmasterClockQuality.offsetScaledLogVariance);
|
||||||
|
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);
|
||||||
|
@ -73,6 +85,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 time_status_np *tsn;
|
struct time_status_np *tsn;
|
||||||
switch (m->id) {
|
switch (m->id) {
|
||||||
case DEFAULT_DATA_SET:
|
case DEFAULT_DATA_SET:
|
||||||
|
@ -87,6 +100,17 @@ static void mgt_pre_send(struct management_tlv *m)
|
||||||
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:
|
||||||
|
pds = (struct parentDS *) m->data;
|
||||||
|
pds->parentPortIdentity.portNumber =
|
||||||
|
htons(pds->parentPortIdentity.portNumber);
|
||||||
|
pds->observedParentOffsetScaledLogVariance =
|
||||||
|
htons(pds->observedParentOffsetScaledLogVariance);
|
||||||
|
pds->observedParentClockPhaseChangeRate =
|
||||||
|
htonl(pds->observedParentClockPhaseChangeRate);
|
||||||
|
pds->grandmasterClockQuality.offsetScaledLogVariance =
|
||||||
|
htons(pds->grandmasterClockQuality.offsetScaledLogVariance);
|
||||||
|
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