From e6d52c54e968f46e35d7c2e53b03f913eedc0ba5 Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Tue, 31 Mar 2020 10:25:06 -0700 Subject: [PATCH] pmc: Allow printing of the SUBSCRIBE_EVENTS_NP tlv. While we are at it, reformat the pmc_show() function into reverse Christmas tree order. Signed-off-by: Richard Cochran --- pmc.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/pmc.c b/pmc.c index e3cd6f3..f074621 100644 --- a/pmc.c +++ b/pmc.c @@ -28,6 +28,7 @@ #include "ds.h" #include "fsm.h" +#include "notification.h" #include "pmc_common.h" #include "print.h" #include "tlv.h" @@ -56,22 +57,23 @@ static char *bin2str(Octet *data, int len) static void pmc_show(struct ptp_message *msg, FILE *fp) { - int action; - struct TLV *tlv; - struct management_tlv *mgt; + struct grandmaster_settings_np *gsn; + struct mgmt_clock_description *cd; + struct subscribe_events_np *sen; struct management_tlv_datum *mtd; + struct port_properties_np *ppn; + struct timePropertiesDS *tp; + struct management_tlv *mgt; + struct time_status_np *tsn; + struct port_stats_np *pcp; + struct tlv_extra *extra; + struct port_ds_np *pnp; struct defaultDS *dds; struct currentDS *cds; struct parentDS *pds; - struct timePropertiesDS *tp; - struct time_status_np *tsn; - struct grandmaster_settings_np *gsn; - struct mgmt_clock_description *cd; - struct tlv_extra *extra; struct portDS *p; - struct port_ds_np *pnp; - struct port_properties_np *ppn; - struct port_stats_np *pcp; + struct TLV *tlv; + int action; if (msg_type(msg) != MANAGEMENT) { return; @@ -295,6 +297,14 @@ static void pmc_show(struct ptp_message *msg, FILE *fp) gsn->time_flags & FREQ_TRACEABLE ? 1 : 0, gsn->time_source); break; + case TLV_SUBSCRIBE_EVENTS_NP: + sen = (struct subscribe_events_np *) mgt->data; + fprintf(fp, "SUBSCRIBE_EVENTS_NP " + IFMT "duration %hu" + IFMT "NOTIFY_PORT_STATE %s", + sen->duration, + (sen->bitmask[0] & 1 << NOTIFY_PORT_STATE) ? "on" : "off"); + break; case TLV_PORT_DATA_SET: p = (struct portDS *) mgt->data; if (p->portState > PS_SLAVE) {