pmc: show the fields of the current data set responses.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
8c0393321e
commit
97df9b66b2
17
pmc.c
17
pmc.c
|
@ -159,10 +159,14 @@ static char *action_string[] = {
|
||||||
"ACKNOWLEDGE",
|
"ACKNOWLEDGE",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define IFMT "\n\t\t"
|
||||||
|
|
||||||
static void pmc_show(struct ptp_message *msg, FILE *fp)
|
static void pmc_show(struct ptp_message *msg, FILE *fp)
|
||||||
{
|
{
|
||||||
int action;
|
int action;
|
||||||
struct TLV *tlv;
|
struct TLV *tlv;
|
||||||
|
struct management_tlv *mgt;
|
||||||
|
struct currentDS *cds;
|
||||||
if (msg_type(msg) != MANAGEMENT) {
|
if (msg_type(msg) != MANAGEMENT) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -181,9 +185,22 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
|
||||||
fprintf(fp, "MANAGMENT ");
|
fprintf(fp, "MANAGMENT ");
|
||||||
} else if (tlv->type == TLV_MANAGEMENT_ERROR_STATUS) {
|
} else if (tlv->type == TLV_MANAGEMENT_ERROR_STATUS) {
|
||||||
fprintf(fp, "MANAGMENT_ERROR_STATUS ");
|
fprintf(fp, "MANAGMENT_ERROR_STATUS ");
|
||||||
|
goto out;
|
||||||
} else {
|
} else {
|
||||||
fprintf(fp, "unknown-tlv ");
|
fprintf(fp, "unknown-tlv ");
|
||||||
}
|
}
|
||||||
|
mgt = (struct management_tlv *) msg->management.suffix;
|
||||||
|
switch (mgt->id) {
|
||||||
|
case CURRENT_DATA_SET:
|
||||||
|
cds = (struct currentDS *) mgt->data;
|
||||||
|
fprintf(fp, "CURRENT_DATA_SET "
|
||||||
|
IFMT "stepsRemoved %hd "
|
||||||
|
IFMT "offsetFromMaster %.1f "
|
||||||
|
IFMT "meanPathDelay %.1f ",
|
||||||
|
cds->stepsRemoved, cds->offsetFromMaster / 65536.0,
|
||||||
|
cds->meanPathDelay / 65536.0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
out:
|
out:
|
||||||
fprintf(fp, "\n");
|
fprintf(fp, "\n");
|
||||||
fflush(fp);
|
fflush(fp);
|
||||||
|
|
Loading…
Reference in New Issue