diff --git a/tlv.c b/tlv.c index 4921b4b..07da7be 100644 --- a/tlv.c +++ b/tlv.c @@ -42,6 +42,7 @@ static void mgt_post_recv(struct management_tlv *m) { struct defaultDS *dds; struct currentDS *cds; + struct parentDS *pds; struct time_status_np *tsn; switch (m->id) { case DEFAULT_DATA_SET: @@ -56,6 +57,17 @@ static void mgt_post_recv(struct management_tlv *m) cds->offsetFromMaster = net2host64(cds->offsetFromMaster); cds->meanPathDelay = net2host64(cds->meanPathDelay); 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: tsn = (struct time_status_np *) m->data; tsn->master_offset = net2host64(tsn->master_offset); @@ -73,6 +85,7 @@ static void mgt_pre_send(struct management_tlv *m) { struct defaultDS *dds; struct currentDS *cds; + struct parentDS *pds; struct time_status_np *tsn; switch (m->id) { case DEFAULT_DATA_SET: @@ -87,6 +100,17 @@ static void mgt_pre_send(struct management_tlv *m) cds->offsetFromMaster = host2net64(cds->offsetFromMaster); cds->meanPathDelay = host2net64(cds->meanPathDelay); 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: tsn = (struct time_status_np *) m->data; tsn->master_offset = host2net64(tsn->master_offset);