From: Michael Richardson Date: Mon, 16 Feb 2015 18:25:25 +0000 (-0500) Subject: enumerate F_OP values explicitely, provide reference to where they are defined. X-Git-Tag: tcpdump-4.7.2~1^2~6 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/3aad648ad05fd12217c56322d4514b659f3b9fa4 enumerate F_OP values explicitely, provide reference to where they are defined. guard against case where ops->print is nil --- diff --git a/print-forces.c b/print-forces.c index 7dbac817..6c02b256 100644 --- a/print-forces.c +++ b/print-forces.c @@ -187,26 +187,28 @@ static const struct tok ForCES_LFBs[] = { {0, NULL} }; +/* this is defined in RFC5810 section A.2 */ +/* http://www.iana.org/assignments/forces/forces.xhtml#oper-tlv-types */ enum { - F_OP_RSV, - F_OP_SET, - F_OP_SETPROP, - F_OP_SETRESP, - F_OP_SETPRESP, - F_OP_DEL, - F_OP_DELRESP, - F_OP_GET, - F_OP_GETPROP, - F_OP_GETRESP, - F_OP_GETPRESP, - F_OP_REPORT, - F_OP_COMMIT, - F_OP_RCOMMIT, - F_OP_RTRCOMP, + F_OP_RSV = 0, + F_OP_SET = 1, + F_OP_SETPROP = 2, + F_OP_SETRESP = 3, + F_OP_SETPRESP = 4, + F_OP_DEL = 5, + F_OP_DELRESP = 6, + F_OP_GET = 7, + F_OP_GETPROP = 8, + F_OP_GETRESP = 9, + F_OP_GETPRESP = 10, + F_OP_REPORT = 11, + F_OP_COMMIT = 12, + F_OP_RCOMMIT = 13, + F_OP_RTRCOMP = 14, _F_OP_MAX }; - #define F_OP_MAX (_F_OP_MAX - 1) + enum { B_OP_SET = 1 << (F_OP_SET - 1), B_OP_SETPROP = 1 << (F_OP_SETPROP - 1), @@ -1198,7 +1200,9 @@ otlv_print(netdissect_options *ndo, } /* XXX - do anything with ops->flags? */ - rc = ops->print(ndo, dp, tll, ops->op_msk, indent + 1); + if(ops->print) { + rc = ops->print(ndo, dp, tll, ops->op_msk, indent + 1); + } return rc; trunc: