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 <richardcochran@gmail.com>
master
Richard Cochran 2020-03-31 10:25:06 -07:00
parent aed79c38d4
commit e6d52c54e9
1 changed files with 21 additions and 11 deletions

32
pmc.c
View File

@ -28,6 +28,7 @@
#include "ds.h" #include "ds.h"
#include "fsm.h" #include "fsm.h"
#include "notification.h"
#include "pmc_common.h" #include "pmc_common.h"
#include "print.h" #include "print.h"
#include "tlv.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) static void pmc_show(struct ptp_message *msg, FILE *fp)
{ {
int action; struct grandmaster_settings_np *gsn;
struct TLV *tlv; struct mgmt_clock_description *cd;
struct management_tlv *mgt; struct subscribe_events_np *sen;
struct management_tlv_datum *mtd; 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 defaultDS *dds;
struct currentDS *cds; struct currentDS *cds;
struct parentDS *pds; 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 portDS *p;
struct port_ds_np *pnp; struct TLV *tlv;
struct port_properties_np *ppn; int action;
struct port_stats_np *pcp;
if (msg_type(msg) != MANAGEMENT) { if (msg_type(msg) != MANAGEMENT) {
return; return;
@ -295,6 +297,14 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
gsn->time_flags & FREQ_TRACEABLE ? 1 : 0, gsn->time_flags & FREQ_TRACEABLE ? 1 : 0,
gsn->time_source); gsn->time_source);
break; 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: case TLV_PORT_DATA_SET:
p = (struct portDS *) mgt->data; p = (struct portDS *) mgt->data;
if (p->portState > PS_SLAVE) { if (p->portState > PS_SLAVE) {