asn_parse_nlength:
  325|  96.0k|{
  326|  96.0k|    int len_len;
  327|       |
  328|  96.0k|    if (pkt_len < 1)
  ------------------
  |  Branch (328:9): [True: 0, False: 96.0k]
  ------------------
  329|      0|        return NULL;               /* always too short */
  330|       |
  331|  96.0k|    if (NULL == pkt || NULL == data_len)
  ------------------
  |  Branch (331:9): [True: 0, False: 96.0k]
  |  Branch (331:24): [True: 0, False: 96.0k]
  ------------------
  332|      0|        return NULL;
  333|       |
  334|  96.0k|    *data_len = 0;
  335|       |
  336|  96.0k|    if (*pkt & 0x80) {
  ------------------
  |  Branch (336:9): [True: 12.5k, False: 83.5k]
  ------------------
  337|       |        /*
  338|       |         * long length; first byte is length of length (after masking high bit)
  339|       |         */
  340|  12.5k|        len_len = (int) ((*pkt & ~0x80) + 1);
  341|  12.5k|        if (pkt_len < len_len)
  ------------------
  |  Branch (341:13): [True: 140, False: 12.3k]
  ------------------
  342|    140|            return NULL;           /* still too short for length and data */
  343|       |
  344|       |        /* now we know we have enough data to parse length */
  345|  12.3k|        if (NULL == asn_parse_length(pkt, data_len))
  ------------------
  |  Branch (345:13): [True: 371, False: 12.0k]
  ------------------
  346|    371|            return NULL;           /* propagate error from asn_parse_length */
  347|  83.5k|    } else {
  348|       |        /*
  349|       |         * short length; first byte is the length
  350|       |         */
  351|  83.5k|        len_len = 1;
  352|  83.5k|        *data_len = *pkt;
  353|  83.5k|    }
  354|       |
  355|  95.5k|    if ((*data_len + len_len) > pkt_len)
  ------------------
  |  Branch (355:9): [True: 1.00k, False: 94.5k]
  ------------------
  356|  1.00k|        return NULL;
  357|       |
  358|  94.5k|    return (pkt + len_len);
  359|  95.5k|}
asn_parse_int:
  557|  9.40k|{
  558|       |    /*
  559|       |     * ASN.1 integer ::= 0x02 asnlength byte {byte}*
  560|       |     */
  561|  9.40k|    static const char *errpre = "parse int";
  562|  9.40k|    register u_char *bufp = data;
  563|  9.40k|    u_long          asn_length;
  564|  9.40k|    int             i;
  565|  9.40k|    union {
  566|  9.40k|        long          l;
  567|  9.40k|        unsigned char b[sizeof(long)];
  568|  9.40k|    } value;
  569|       |
  570|  9.40k|    if (NULL == data || NULL == datalength || NULL == type || NULL == intp) {
  ------------------
  |  Branch (570:9): [True: 0, False: 9.40k]
  |  Branch (570:25): [True: 0, False: 9.40k]
  |  Branch (570:47): [True: 0, False: 9.40k]
  |  Branch (570:63): [True: 0, False: 9.40k]
  ------------------
  571|      0|        ERROR_MSG("parse int: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  572|      0|        return NULL;
  573|      0|    }
  574|       |
  575|  9.40k|    if (intsize != sizeof(long)) {
  ------------------
  |  Branch (575:9): [True: 0, False: 9.40k]
  ------------------
  576|      0|        _asn_size_err(errpre, intsize, sizeof(long));
  577|      0|        return NULL;
  578|      0|    }
  579|       |
  580|       |    /** need at least 2 bytes to work with: type, length (which might be 0)  */
  581|  9.40k|    if (*datalength < 2) {
  ------------------
  |  Branch (581:9): [True: 81, False: 9.32k]
  ------------------
  582|     81|        _asn_short_err(errpre, *datalength, 2);
  583|     81|        return NULL;
  584|     81|    }
  585|       |
  586|  9.32k|    *type = *bufp++;
  587|  9.32k|    if (*type != ASN_INTEGER) {
  ------------------
  |  |   75|  9.32k|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (587:9): [True: 35, False: 9.28k]
  ------------------
  588|     35|        _asn_type_err(errpre, *type);
  589|     35|        return NULL;
  590|     35|    }
  591|       |
  592|  9.28k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
  593|  9.28k|    if (NULL == bufp) {
  ------------------
  |  Branch (593:9): [True: 303, False: 8.98k]
  ------------------
  594|    303|        _asn_short_err(errpre, *datalength - 1, asn_length);
  595|    303|        return NULL;
  596|    303|    }
  597|       |
  598|  8.98k|    if ((size_t) asn_length > intsize || (int) asn_length == 0) {
  ------------------
  |  Branch (598:9): [True: 31, False: 8.95k]
  |  Branch (598:42): [True: 20, False: 8.93k]
  ------------------
  599|     51|        _asn_length_err(errpre, (size_t) asn_length, intsize);
  600|     51|        return NULL;
  601|     51|    }
  602|       |
  603|  8.93k|    *datalength -= (int) asn_length + (bufp - data);
  604|       |
  605|  8.93k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|  8.93k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  8.93k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 8.93k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  196|      0|        debugmsg("dumpx" token, "dumpx_%s:%*s", token, __DBGINDENT(), ""); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  |  |  197|      0|        __DBGMSGHEX(("dumpx_" token,buf,len)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  |  |  ------------------
  |  |  |  |  198|      0|        if (debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (198:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  199|      0|            debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (199:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  200|      0|            debugmsg("dumpx_" token,"\n"); \
  |  |  |  |  201|      0|        } else { \
  |  |  |  |  202|      0|            debugmsg("dumpx_" token,"  "); \
  |  |  |  |  203|      0|        } \
  |  |  |  |  204|      0|        debugmsg("dumpv" token, "dumpv_%s:%*s", token, __DBGINDENT(), "");
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:60): [Folded, False: 8.93k]
  |  |  ------------------
  ------------------
  606|       |
  607|  8.93k|    memset(&value.b, *bufp & 0x80 ? 0xff : 0, sizeof(value.b));
  ------------------
  |  Branch (607:22): [True: 1.77k, False: 7.16k]
  ------------------
  608|  8.93k|    if (NETSNMP_BIGENDIAN) {
  ------------------
  |  | 2396|  8.93k|#  define NETSNMP_BIGENDIAN 0
  |  |  ------------------
  |  |  |  Branch (2396:29): [Folded, False: 8.93k]
  |  |  ------------------
  ------------------
  609|      0|        for (i = sizeof(long) - asn_length; asn_length--; i++)
  ------------------
  |  Branch (609:45): [True: 0, False: 0]
  ------------------
  610|      0|            value.b[i] = *bufp++;
  611|  8.93k|    } else {
  612|  24.8k|        for (i = asn_length - 1; asn_length--; i--)
  ------------------
  |  Branch (612:34): [True: 15.9k, False: 8.93k]
  ------------------
  613|  15.9k|            value.b[i] = *bufp++;
  614|  8.93k|    }
  615|       |
  616|  8.93k|    CHECK_OVERFLOW_S(value.l, 1);
  ------------------
  |  |  214|  8.93k|#define CHECK_OVERFLOW_S(x,y) do {                                      \
  |  |  215|  8.93k|        if (x > INT32_MAX) {                                            \
  |  |  ------------------
  |  |  |  Branch (215:13): [True: 623, False: 8.30k]
  |  |  ------------------
  |  |  216|    623|            DEBUGMSG(("asn","truncating signed value %ld to 32 bits (%d)\n",(long)(x),y)); \
  |  |  ------------------
  |  |  |  |   61|    623|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|    623|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 623]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 623]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  217|    623|            x &= 0xffffffff;                                            \
  |  |  218|  8.30k|        } else if (x < INT32_MIN) {                                     \
  |  |  ------------------
  |  |  |  Branch (218:20): [True: 410, False: 7.89k]
  |  |  ------------------
  |  |  219|    410|            DEBUGMSG(("asn","truncating signed value %ld to 32 bits (%d)\n",(long)(x),y)); \
  |  |  ------------------
  |  |  |  |   61|    410|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|    410|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 410]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 410]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  220|    410|            x = 0 - (x & 0xffffffff);                                   \
  |  |  221|    410|        }                                                               \
  |  |  222|  8.93k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (222:13): [Folded, False: 8.93k]
  |  |  ------------------
  ------------------
  617|       |
  618|  8.93k|    DEBUGMSG(("dumpv_recv", "  Integer:\t%ld (0x%.2lX)\n", value.l, value.l));
  ------------------
  |  |   61|  8.93k|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|  8.93k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 8.93k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 8.93k]
  |  |  ------------------
  ------------------
  619|       |
  620|  8.93k|    *intp = value.l;
  621|  8.93k|    return bufp;
  622|  8.98k|}
asn_parse_unsigned_int:
  650|  3.55k|{
  651|       |    /*
  652|       |     * ASN.1 integer ::= 0x02 asnlength byte {byte}*
  653|       |     */
  654|  3.55k|    static const char *errpre = "parse uint";
  655|  3.55k|    register u_char *bufp = data;
  656|  3.55k|    u_long          asn_length;
  657|  3.55k|    register u_long value = 0;
  658|       |
  659|  3.55k|    if (NULL == data || NULL == datalength || NULL == type || NULL == intp) {
  ------------------
  |  Branch (659:9): [True: 0, False: 3.55k]
  |  Branch (659:25): [True: 0, False: 3.55k]
  |  Branch (659:47): [True: 0, False: 3.55k]
  |  Branch (659:63): [True: 0, False: 3.55k]
  ------------------
  660|      0|        ERROR_MSG("parse uint: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  661|      0|        return NULL;
  662|      0|    }
  663|       |
  664|  3.55k|    if (intsize != sizeof(long)) {
  ------------------
  |  Branch (664:9): [True: 0, False: 3.55k]
  ------------------
  665|      0|        _asn_size_err(errpre, intsize, sizeof(long));
  666|      0|        return NULL;
  667|      0|    }
  668|       |
  669|       |    /** need at least 2 bytes to work with: type, length (which might be 0)  */
  670|  3.55k|    if (*datalength < 2) {
  ------------------
  |  Branch (670:9): [True: 2, False: 3.55k]
  ------------------
  671|      2|        _asn_short_err(errpre, *datalength, 2);
  672|      2|        return NULL;
  673|      2|    }
  674|       |
  675|  3.55k|    *type = *bufp++;
  676|  3.55k|    if (*type != ASN_COUNTER && *type != ASN_GAUGE && *type != ASN_TIMETICKS
  ------------------
  |  |   89|  7.10k|#define ASN_COUNTER	(ASN_APPLICATION | 1)
  |  |  ------------------
  |  |  |  |   91|  3.55k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if (*type != ASN_COUNTER && *type != ASN_GAUGE && *type != ASN_TIMETICKS
  ------------------
  |  |   90|  5.94k|#define ASN_GAUGE	(ASN_APPLICATION | 2)
  |  |  ------------------
  |  |  |  |   91|  2.39k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if (*type != ASN_COUNTER && *type != ASN_GAUGE && *type != ASN_TIMETICKS
  ------------------
  |  |   92|  5.14k|#define ASN_TIMETICKS   (ASN_APPLICATION | 3)
  |  |  ------------------
  |  |  |  |   91|  1.59k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (676:9): [True: 2.39k, False: 1.15k]
  |  Branch (676:33): [True: 1.59k, False: 799]
  |  Branch (676:55): [True: 879, False: 716]
  ------------------
  677|    879|            && *type != ASN_UINTEGER) {
  ------------------
  |  |  100|    879|#define ASN_UINTEGER    (ASN_APPLICATION | 7)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|    879|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (677:16): [True: 16, False: 863]
  ------------------
  678|     16|        _asn_type_err(errpre, *type);
  679|     16|        return NULL;
  680|     16|    }
  681|       |
  682|  3.53k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
  683|  3.53k|    if (NULL == bufp) {
  ------------------
  |  Branch (683:9): [True: 141, False: 3.39k]
  ------------------
  684|    141|        _asn_short_err(errpre, *datalength - 1, asn_length);
  685|    141|        return NULL;
  686|    141|    }
  687|       |
  688|  3.39k|    if ((asn_length > (intsize + 1)) || ((int) asn_length == 0) ||
  ------------------
  |  Branch (688:9): [True: 11, False: 3.38k]
  |  Branch (688:41): [True: 19, False: 3.36k]
  ------------------
  689|  3.36k|        ((asn_length == intsize + 1) && *bufp != 0x00)) {
  ------------------
  |  Branch (689:10): [True: 289, False: 3.07k]
  |  Branch (689:41): [True: 9, False: 280]
  ------------------
  690|     39|        _asn_length_err(errpre, (size_t) asn_length, intsize);
  691|     39|        return NULL;
  692|     39|    }
  693|  3.35k|    *datalength -= (int) asn_length + (bufp - data);
  694|       |
  695|  3.35k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|  3.35k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  3.35k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3.35k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  196|      0|        debugmsg("dumpx" token, "dumpx_%s:%*s", token, __DBGINDENT(), ""); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  |  |  197|      0|        __DBGMSGHEX(("dumpx_" token,buf,len)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  |  |  ------------------
  |  |  |  |  198|      0|        if (debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (198:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  199|      0|            debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (199:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  200|      0|            debugmsg("dumpx_" token,"\n"); \
  |  |  |  |  201|      0|        } else { \
  |  |  |  |  202|      0|            debugmsg("dumpx_" token,"  "); \
  |  |  |  |  203|      0|        } \
  |  |  |  |  204|      0|        debugmsg("dumpv" token, "dumpv_%s:%*s", token, __DBGINDENT(), "");
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:60): [Folded, False: 3.35k]
  |  |  ------------------
  ------------------
  696|       |
  697|  12.9k|    while (asn_length--)
  ------------------
  |  Branch (697:12): [True: 9.59k, False: 3.35k]
  ------------------
  698|  9.59k|        value = (value << 8) | *bufp++;
  699|       |
  700|  3.35k|    CHECK_OVERFLOW_U(value,2);
  ------------------
  |  |  224|  3.35k|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|  3.35k|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 868, False: 2.48k]
  |  |  ------------------
  |  |  226|    868|            x &= 0xffffffff;                                            \
  |  |  227|    868|            DEBUGMSG(("asn","truncating unsigned value to 32 bits (%d)\n",y)); \
  |  |  ------------------
  |  |  |  |   61|    868|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|    868|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 868]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 868]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  228|    868|        }                                                               \
  |  |  229|  3.35k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 3.35k]
  |  |  ------------------
  ------------------
  701|       |
  702|  3.35k|    DEBUGMSG(("dumpv_recv", "  UInteger:\t%ld (0x%.2lX)\n", value, value));
  ------------------
  |  |   61|  3.35k|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|  3.35k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3.35k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 3.35k]
  |  |  ------------------
  ------------------
  703|       |
  704|  3.35k|    *intp = value;
  705|  3.35k|    return bufp;
  706|  3.39k|}
asn_parse_string:
  910|  6.45k|{
  911|  6.45k|    static const char *errpre = "parse string";
  912|  6.45k|    u_char         *bufp = data;
  913|  6.45k|    u_long          asn_length;
  914|       |
  915|  6.45k|    if (NULL == data || NULL == datalength || NULL == type || NULL == str ||
  ------------------
  |  Branch (915:9): [True: 0, False: 6.45k]
  |  Branch (915:25): [True: 0, False: 6.45k]
  |  Branch (915:47): [True: 0, False: 6.45k]
  |  Branch (915:63): [True: 0, False: 6.45k]
  ------------------
  916|  6.45k|        NULL == strlength) {
  ------------------
  |  Branch (916:9): [True: 0, False: 6.45k]
  ------------------
  917|      0|        ERROR_MSG("parse string: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  918|      0|        return NULL;
  919|      0|    }
  920|       |
  921|       |    /** need at least 2 bytes to work with: type, length (which might be 0)  */
  922|  6.45k|    if (*datalength < 2) {
  ------------------
  |  Branch (922:9): [True: 304, False: 6.15k]
  ------------------
  923|    304|        _asn_short_err(errpre, *datalength, 2);
  924|    304|        return NULL;
  925|    304|    }
  926|       |
  927|  6.15k|    *type = *bufp++;
  928|  6.15k|    if (*type != ASN_OCTET_STR && *type != ASN_IPADDRESS && *type != ASN_OPAQUE
  ------------------
  |  |   78|  12.3k|#define ASN_OCTET_STR	    0x04U
  ------------------
                  if (*type != ASN_OCTET_STR && *type != ASN_IPADDRESS && *type != ASN_OPAQUE
  ------------------
  |  |   88|  10.2k|#define ASN_IPADDRESS   (ASN_APPLICATION | 0)
  |  |  ------------------
  |  |  |  |   91|  4.07k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if (*type != ASN_OCTET_STR && *type != ASN_IPADDRESS && *type != ASN_OPAQUE
  ------------------
  |  |   93|  9.61k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  3.46k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (928:9): [True: 4.07k, False: 2.07k]
  |  Branch (928:35): [True: 3.46k, False: 609]
  |  Branch (928:61): [True: 1.59k, False: 1.87k]
  ------------------
  929|  1.59k|            && *type != ASN_NSAP) {
  ------------------
  |  |   98|  1.59k|#define ASN_NSAP	(ASN_APPLICATION | 5)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|  1.59k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (929:16): [True: 398, False: 1.19k]
  ------------------
  930|    398|        _asn_type_err(errpre, *type);
  931|    398|        return NULL;
  932|    398|    }
  933|       |
  934|  5.75k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
  935|  5.75k|    if (NULL == bufp) {
  ------------------
  |  Branch (935:9): [True: 151, False: 5.60k]
  ------------------
  936|    151|        _asn_short_err(errpre, *datalength - 1, asn_length);
  937|    151|        return NULL;
  938|    151|    }
  939|       |
  940|  5.60k|    if (asn_length > *strlength) {
  ------------------
  |  Branch (940:9): [True: 35, False: 5.56k]
  ------------------
  941|     35|        _asn_length_err(errpre, (size_t) asn_length, *strlength);
  942|     35|        return NULL;
  943|     35|    }
  944|       |
  945|  5.56k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|  5.56k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  5.56k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 5.56k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  196|      0|        debugmsg("dumpx" token, "dumpx_%s:%*s", token, __DBGINDENT(), ""); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  |  |  197|      0|        __DBGMSGHEX(("dumpx_" token,buf,len)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  |  |  ------------------
  |  |  |  |  198|      0|        if (debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (198:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  199|      0|            debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (199:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  200|      0|            debugmsg("dumpx_" token,"\n"); \
  |  |  |  |  201|      0|        } else { \
  |  |  |  |  202|      0|            debugmsg("dumpx_" token,"  "); \
  |  |  |  |  203|      0|        } \
  |  |  |  |  204|      0|        debugmsg("dumpv" token, "dumpv_%s:%*s", token, __DBGINDENT(), "");
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:60): [Folded, False: 5.56k]
  |  |  ------------------
  ------------------
  946|       |
  947|  5.56k|    memmove(str, bufp, asn_length);
  948|  5.56k|    if (*strlength > asn_length)
  ------------------
  |  Branch (948:9): [True: 2.34k, False: 3.22k]
  ------------------
  949|  2.34k|        str[asn_length] = 0;
  950|  5.56k|    *strlength = asn_length;
  951|  5.56k|    *datalength -= asn_length + (bufp - data);
  952|       |
  953|  5.56k|    DEBUGIF("dumpv_recv") {
  ------------------
  |  |  145|  5.56k|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|  11.1k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 5.56k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (145:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  954|      0|        u_char         *buf = (u_char *) malloc(1 + asn_length);
  955|      0|        size_t          l = (buf != NULL) ? (1 + asn_length) : 0, ol = 0;
  ------------------
  |  Branch (955:29): [True: 0, False: 0]
  ------------------
  956|       |
  957|      0|        if (sprint_realloc_asciistring
  ------------------
  |  Branch (957:13): [True: 0, False: 0]
  ------------------
  958|      0|            (&buf, &l, &ol, 1, str, asn_length)) {
  959|      0|            DEBUGMSG(("dumpv_recv", "  String:\t%s\n", buf));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
  960|      0|        } else {
  961|      0|            if (buf == NULL) {
  ------------------
  |  Branch (961:17): [True: 0, False: 0]
  ------------------
  962|      0|                DEBUGMSG(("dumpv_recv", "  String:\t[TRUNCATED]\n"));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
  963|      0|            } else {
  964|      0|                DEBUGMSG(("dumpv_recv", "  String:\t%s [TRUNCATED]\n",
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
  965|      0|                          buf));
  966|      0|            }
  967|      0|        }
  968|      0|        if (buf != NULL) {
  ------------------
  |  Branch (968:13): [True: 0, False: 0]
  ------------------
  969|      0|            free(buf);
  970|      0|        }
  971|      0|    }
  972|       |
  973|  5.56k|    return bufp + asn_length;
  974|  5.60k|}
asn_parse_header:
 1071|  44.7k|{
 1072|  44.7k|    register u_char *bufp;
 1073|  44.7k|    u_long          asn_length = 0;
 1074|  44.7k|    const char      *errpre = "parse header";
 1075|       |
 1076|  44.7k|    if (!data || !datalength || !type) {
  ------------------
  |  Branch (1076:9): [True: 0, False: 44.7k]
  |  Branch (1076:18): [True: 0, False: 44.7k]
  |  Branch (1076:33): [True: 0, False: 44.7k]
  ------------------
 1077|      0|        ERROR_MSG("parse header: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1078|      0|        return NULL;
 1079|      0|    }
 1080|       |
 1081|       |    /** need at least 2 bytes to work with: type, length (which might be 0) */
 1082|  44.7k|    if (*datalength < 2) {
  ------------------
  |  Branch (1082:9): [True: 373, False: 44.3k]
  ------------------
 1083|    373|        _asn_short_err(errpre, *datalength, 2);
 1084|    373|        return NULL;
 1085|    373|    }
 1086|       |
 1087|  44.3k|    bufp = data;
 1088|       |    /*
 1089|       |     * this only works on data types < 30, i.e. no extension octets 
 1090|       |     */
 1091|  44.3k|    if (IS_EXTENSION_ID(*bufp)) {
  ------------------
  |  |  103|  44.3k|#define IS_EXTENSION_ID(byte)	(((byte) & ASN_EXTENSION_ID) == ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|  44.3k|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  |  |               #define IS_EXTENSION_ID(byte)	(((byte) & ASN_EXTENSION_ID) == ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|  44.3k|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  |  |  |  Branch (103:31): [True: 12, False: 44.3k]
  |  |  ------------------
  ------------------
 1092|     12|        ERROR_MSG("can't process ID >= 30");
  ------------------
  |  |  188|     12|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1093|     12|        return NULL;
 1094|     12|    }
 1095|  44.3k|    *type = *bufp++;
 1096|       |
 1097|  44.3k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 1098|  44.3k|    if (NULL == bufp) {
  ------------------
  |  Branch (1098:9): [True: 748, False: 43.6k]
  ------------------
 1099|    748|        _asn_short_err(errpre, *datalength - 1, asn_length);
 1100|    748|        return NULL;
 1101|    748|    }
 1102|       |
 1103|       |#ifdef DUMP_PRINT_HEADERS
 1104|       |    DEBUGDUMPSETUP("recv", data, (bufp - data));
 1105|       |    DEBUGMSG(("dumpv_recv", "  Header: 0x%.2X, len = %d (0x%X)\n", *data,
 1106|       |              asn_length, asn_length));
 1107|       |#else
 1108|       |    /*
 1109|       |     * DEBUGMSGHEXTLI(("recv",data,(bufp-data)));
 1110|       |     * DEBUGMSG(("dumpH_recv","\n"));
 1111|       |     */
 1112|  43.6k|#endif
 1113|       |
 1114|  43.6k|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 1115|       |
 1116|  43.6k|    if ((asn_length > 2) && (*type == ASN_OPAQUE) && (*bufp == ASN_OPAQUE_TAG1)) {
  ------------------
  |  |   93|  32.9k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  32.9k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if ((asn_length > 2) && (*type == ASN_OPAQUE) && (*bufp == ASN_OPAQUE_TAG1)) {
  ------------------
  |  |  131|  4.60k|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|  4.60k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|  4.60k|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
  |  Branch (1116:9): [True: 32.9k, False: 10.6k]
  |  Branch (1116:29): [True: 4.60k, False: 28.3k]
  |  Branch (1116:54): [True: 4.02k, False: 582]
  ------------------
 1117|       |
 1118|       |        /*
 1119|       |         * check if 64-but counter 
 1120|       |         */
 1121|  4.02k|        switch (*(bufp + 1)) {
 1122|    812|        case ASN_OPAQUE_COUNTER64:
  ------------------
  |  |  156|    812|#define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  136|    812|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  146|    812|#define ASN_APP_COUNTER64 (ASN_APPLICATION | 6)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    812|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1122:9): [True: 812, False: 3.21k]
  ------------------
 1123|  1.67k|        case ASN_OPAQUE_U64:
  ------------------
  |  |  192|  1.67k|#define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  136|  1.67k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  150|  1.67k|#define ASN_APP_U64 (ASN_APPLICATION | 11)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.67k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1123:9): [True: 865, False: 3.15k]
  ------------------
 1124|  2.01k|        case ASN_OPAQUE_FLOAT:
  ------------------
  |  |  165|  2.01k|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|  2.01k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|  2.01k|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  2.01k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1124:9): [True: 338, False: 3.68k]
  ------------------
 1125|  2.27k|        case ASN_OPAQUE_DOUBLE:
  ------------------
  |  |  174|  2.27k|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|  2.27k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|  2.27k|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  2.27k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1125:9): [True: 255, False: 3.76k]
  ------------------
 1126|  3.49k|        case ASN_OPAQUE_I64:
  ------------------
  |  |  183|  3.49k|#define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  136|  3.49k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  149|  3.49k|#define ASN_APP_I64 (ASN_APPLICATION | 10)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  3.49k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1126:9): [True: 1.22k, False: 2.80k]
  ------------------
 1127|  3.49k|            *type = *(bufp + 1);
 1128|  3.49k|            break;
 1129|       |
 1130|    530|        default:
  ------------------
  |  Branch (1130:9): [True: 530, False: 3.49k]
  ------------------
 1131|       |            /*
 1132|       |             * just an Opaque 
 1133|       |             */
 1134|    530|            *datalength = (int) asn_length;
 1135|    530|            return bufp;
 1136|  4.02k|        }
 1137|       |        /*
 1138|       |         * value is encoded as special format 
 1139|       |         */
 1140|  3.49k|        *datalength = (int) asn_length;
 1141|  3.49k|        bufp = asn_parse_nlength(bufp+2, *datalength - 2, &asn_length);
 1142|  3.49k|        if (NULL == bufp) {
  ------------------
  |  Branch (1142:13): [True: 37, False: 3.45k]
  ------------------
 1143|     37|            _asn_short_err("parse opaque header", *datalength - 2, asn_length);
 1144|     37|            return NULL;
 1145|     37|        }
 1146|  3.49k|    }
 1147|  43.0k|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 1148|       |
 1149|  43.0k|    *datalength = (int) asn_length;
 1150|       |
 1151|  43.0k|    return bufp;
 1152|  43.6k|}
asn_parse_sequence:
 1171|  26.0k|{                               /* error message prefix */
 1172|  26.0k|    data = asn_parse_header(data, datalength, type);
 1173|  26.0k|    if (data && (*type != expected_type)) {
  ------------------
  |  Branch (1173:9): [True: 24.8k, False: 1.13k]
  |  Branch (1173:17): [True: 1.65k, False: 23.2k]
  ------------------
 1174|  1.65k|        char            ebuf[128];
 1175|  1.65k|        snprintf(ebuf, sizeof(ebuf),
 1176|  1.65k|                 "%s header type %02X: s/b %02X", estr,
 1177|  1.65k|                (u_char) * type, (u_char) expected_type);
 1178|  1.65k|        ERROR_MSG(ebuf);
  ------------------
  |  |  188|  1.65k|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1179|  1.65k|        return NULL;
 1180|  1.65k|    }
 1181|  24.3k|    return data;
 1182|  26.0k|}
asn_parse_length:
 1293|  12.3k|{
 1294|  12.3k|    static const char *errpre = "parse length";
 1295|  12.3k|    char            ebuf[128];
 1296|  12.3k|    register u_char lengthbyte;
 1297|       |
 1298|  12.3k|    if (!data || !length) {
  ------------------
  |  Branch (1298:9): [True: 0, False: 12.3k]
  |  Branch (1298:18): [True: 0, False: 12.3k]
  ------------------
 1299|      0|        ERROR_MSG("parse length: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1300|      0|        return NULL;
 1301|      0|    }
 1302|  12.3k|    lengthbyte = *data;
 1303|       |
 1304|  12.3k|    if (lengthbyte & ASN_LONG_LEN) {
  ------------------
  |  |   98|  12.3k|#define ASN_LONG_LEN	    0x80U
  ------------------
  |  Branch (1304:9): [True: 12.3k, False: 0]
  ------------------
 1305|  12.3k|        lengthbyte &= ~ASN_LONG_LEN;    /* turn MSb off */
  ------------------
  |  |   98|  12.3k|#define ASN_LONG_LEN	    0x80U
  ------------------
 1306|  12.3k|        if (lengthbyte == 0) {
  ------------------
  |  Branch (1306:13): [True: 107, False: 12.2k]
  ------------------
 1307|    107|            snprintf(ebuf, sizeof(ebuf),
 1308|    107|                     "%s: indefinite length not supported", errpre);
 1309|    107|            ERROR_MSG(ebuf);
  ------------------
  |  |  188|    107|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1310|    107|            return NULL;
 1311|    107|        }
 1312|  12.2k|        if (lengthbyte > sizeof(long)) {
  ------------------
  |  Branch (1312:13): [True: 144, False: 12.1k]
  ------------------
 1313|    144|            snprintf(ebuf, sizeof(ebuf),
 1314|    144|                    "%s: data length %d > %lu not supported", errpre,
 1315|    144|                    lengthbyte, (unsigned long)sizeof(long));
 1316|    144|            ERROR_MSG(ebuf);
  ------------------
  |  |  188|    144|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1317|    144|            return NULL;
 1318|    144|        }
 1319|  12.1k|        data++;
 1320|  12.1k|        *length = 0;            /* protect against short lengths */
 1321|  30.4k|        while (lengthbyte--) {
  ------------------
  |  Branch (1321:16): [True: 18.3k, False: 12.1k]
  ------------------
 1322|  18.3k|            *length <<= 8;
 1323|  18.3k|            *length |= *data++;
 1324|  18.3k|        }
 1325|  12.1k|        if ((long) *length < 0) {
  ------------------
  |  Branch (1325:13): [True: 120, False: 12.0k]
  ------------------
 1326|    120|            snprintf(ebuf, sizeof(ebuf),
 1327|    120|                     "%s: negative data length %ld\n", errpre,
 1328|    120|                     (long) *length);
 1329|    120|            ERROR_MSG(ebuf);
  ------------------
  |  |  188|    120|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1330|    120|            return NULL;
 1331|    120|        }
 1332|  12.0k|        return data;
 1333|  12.1k|    } else {                    /* short asnlength */
 1334|      0|        *length = (long) lengthbyte;
 1335|      0|        return data + 1;
 1336|      0|    }
 1337|  12.3k|}
asn_parse_objid:
 1435|  19.2k|{
 1436|  19.2k|    static const char *errpre = "parse objid";
 1437|       |    /*
 1438|       |     * ASN.1 objid ::= 0x06 asnlength subidentifier {subidentifier}*
 1439|       |     * subidentifier ::= {leadingbyte}* lastbyte
 1440|       |     * leadingbyte ::= 1 7bitvalue
 1441|       |     * lastbyte ::= 0 7bitvalue
 1442|       |     */
 1443|  19.2k|    register u_char *bufp = data;
 1444|  19.2k|    register oid   *oidp = objid + 1;
 1445|  19.2k|    register u_long subidentifier;
 1446|  19.2k|    register long   length;
 1447|  19.2k|    u_long          asn_length;
 1448|  19.2k|    size_t          original_length = *objidlength;
 1449|       |
 1450|  19.2k|    if (NULL == data || NULL == datalength || NULL == type || NULL == objid) {
  ------------------
  |  Branch (1450:9): [True: 0, False: 19.2k]
  |  Branch (1450:25): [True: 0, False: 19.2k]
  |  Branch (1450:47): [True: 0, False: 19.2k]
  |  Branch (1450:63): [True: 0, False: 19.2k]
  ------------------
 1451|      0|        ERROR_MSG("parse objid: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1452|      0|        return NULL;
 1453|      0|    }
 1454|       |
 1455|       |    /** need at least 2 bytes to work with: type, length (which might be 0)  */
 1456|  19.2k|    if (*datalength < 2) {
  ------------------
  |  Branch (1456:9): [True: 18, False: 19.2k]
  ------------------
 1457|     18|        _asn_short_err(errpre, *datalength, 2);
 1458|     18|        return NULL;
 1459|     18|    }
 1460|       |
 1461|  19.2k|    *type = *bufp++;
 1462|  19.2k|    if (*type != ASN_OBJECT_ID) {
  ------------------
  |  |   81|  19.2k|#define ASN_OBJECT_ID	    0x06U
  ------------------
  |  Branch (1462:9): [True: 28, False: 19.2k]
  ------------------
 1463|     28|        _asn_type_err(errpre, *type);
 1464|     28|        return NULL;
 1465|     28|    }
 1466|  19.2k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 1467|  19.2k|    if (NULL == bufp) {
  ------------------
  |  Branch (1467:9): [True: 140, False: 19.1k]
  ------------------
 1468|    140|        _asn_short_err(errpre, *datalength - 1, asn_length);
 1469|    140|        return NULL;
 1470|    140|    }
 1471|       |
 1472|  19.1k|    *datalength -= (int) asn_length + (bufp - data);
 1473|       |
 1474|  19.1k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|  19.1k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  19.1k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 19.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  196|      0|        debugmsg("dumpx" token, "dumpx_%s:%*s", token, __DBGINDENT(), ""); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  |  |  197|      0|        __DBGMSGHEX(("dumpx_" token,buf,len)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  |  |  ------------------
  |  |  |  |  198|      0|        if (debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (198:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  199|      0|            debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (199:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  200|      0|            debugmsg("dumpx_" token,"\n"); \
  |  |  |  |  201|      0|        } else { \
  |  |  |  |  202|      0|            debugmsg("dumpx_" token,"  "); \
  |  |  |  |  203|      0|        } \
  |  |  |  |  204|      0|        debugmsg("dumpv" token, "dumpv_%s:%*s", token, __DBGINDENT(), "");
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:60): [Folded, False: 19.1k]
  |  |  ------------------
  ------------------
 1475|       |
 1476|       |    /*
 1477|       |     * Handle invalid object identifier encodings of the form 06 00 robustly 
 1478|       |     */
 1479|  19.1k|    if (asn_length == 0)
  ------------------
  |  Branch (1479:9): [True: 15.9k, False: 3.10k]
  ------------------
 1480|  15.9k|        objid[0] = objid[1] = 0;
 1481|       |
 1482|  19.1k|    length = asn_length;
 1483|  19.1k|    (*objidlength)--;           /* account for expansion of first byte */
 1484|       |
 1485|  34.8k|    while (length > 0 && (*objidlength)-- > 0) {
  ------------------
  |  Branch (1485:12): [True: 15.8k, False: 19.0k]
  |  Branch (1485:26): [True: 15.8k, False: 23]
  ------------------
 1486|  15.8k|        subidentifier = 0;
 1487|  18.0k|        do {                    /* shift and add in low order 7 bits */
 1488|  18.0k|            if (subidentifier > (MAX_SUBID >> 7)) {
  ------------------
  |  |   18|  18.0k|#define MAX_SUBID   0xFFFFFFFFUL
  ------------------
  |  Branch (1488:17): [True: 23, False: 18.0k]
  ------------------
 1489|     23|                ERROR_MSG("subidentifier too large / overflow");
  ------------------
  |  |  188|     23|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1490|     23|                return NULL;
 1491|     23|            }
 1492|  18.0k|            subidentifier =
 1493|  18.0k|                (subidentifier << 7) + (*(u_char *) bufp & ~ASN_BIT8);
  ------------------
  |  |  100|  18.0k|#define ASN_BIT8	    0x80U
  ------------------
 1494|  18.0k|            length--;
 1495|  18.0k|        } while ((*(u_char *) bufp++ & ASN_BIT8) && (length > 0));        /* last byte has high bit clear */
  ------------------
  |  |  100|  18.0k|#define ASN_BIT8	    0x80U
  ------------------
  |  Branch (1495:18): [True: 2.26k, False: 15.7k]
  |  Branch (1495:53): [True: 2.24k, False: 25]
  ------------------
 1496|       |
 1497|  15.7k|	if (length == 0) {
  ------------------
  |  Branch (1497:6): [True: 3.05k, False: 12.7k]
  ------------------
 1498|  3.05k|            u_char *last_byte = bufp - 1;
 1499|  3.05k|            if (*last_byte & ASN_BIT8) {
  ------------------
  |  |  100|  3.05k|#define ASN_BIT8	    0x80U
  ------------------
  |  Branch (1499:17): [True: 25, False: 3.03k]
  ------------------
 1500|       |                /* last byte has high bit set -> wrong BER encoded OID */
 1501|     25|                ERROR_MSG("subidentifier syntax error");
  ------------------
  |  |  188|     25|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1502|     25|                return NULL;
 1503|     25|            }
 1504|  3.05k|        }
 1505|  15.7k|        if (subidentifier > MAX_SUBID) {
  ------------------
  |  |   18|  15.7k|#define MAX_SUBID   0xFFFFFFFFUL
  ------------------
  |  Branch (1505:13): [True: 0, False: 15.7k]
  ------------------
 1506|      0|            ERROR_MSG("subidentifier too large");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1507|      0|            return NULL;
 1508|      0|        }
 1509|  15.7k|        *oidp++ = (oid) subidentifier;
 1510|  15.7k|    }
 1511|       |
 1512|  19.0k|    if (length || oidp < objid + 1) {
  ------------------
  |  Branch (1512:9): [True: 23, False: 19.0k]
  |  Branch (1512:19): [True: 0, False: 19.0k]
  ------------------
 1513|     23|        ERROR_MSG("OID length exceeds buffer size");
  ------------------
  |  |  188|     23|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1514|     23|        *objidlength = original_length;
 1515|     23|        return NULL;
 1516|     23|    }
 1517|       |
 1518|       |    /*
 1519|       |     * The first two subidentifiers are encoded into the first component
 1520|       |     * with the value (X * 40) + Y, where:
 1521|       |     *  X is the value of the first subidentifier.
 1522|       |     *  Y is the value of the second subidentifier.
 1523|       |     */
 1524|  19.0k|    subidentifier = oidp - objid >= 2 ? objid[1] : 0;
  ------------------
  |  Branch (1524:21): [True: 3.03k, False: 15.9k]
  ------------------
 1525|  19.0k|    if (subidentifier == 0x2B) {
  ------------------
  |  Branch (1525:9): [True: 475, False: 18.5k]
  ------------------
 1526|    475|        objid[0] = 1;
 1527|    475|        objid[1] = 3;
 1528|  18.5k|    } else {
 1529|  18.5k|        if (subidentifier < 40) {
  ------------------
  |  Branch (1529:13): [True: 16.4k, False: 2.06k]
  ------------------
 1530|  16.4k|            objid[0] = 0;
 1531|  16.4k|            objid[1] = subidentifier;
 1532|  16.4k|        } else if (subidentifier < 80) {
  ------------------
  |  Branch (1532:20): [True: 836, False: 1.22k]
  ------------------
 1533|    836|            objid[0] = 1;
 1534|    836|            objid[1] = subidentifier - 40;
 1535|  1.22k|        } else {
 1536|  1.22k|            objid[0] = 2;
 1537|  1.22k|            objid[1] = subidentifier - 80;
 1538|  1.22k|        }
 1539|  18.5k|    }
 1540|       |
 1541|  19.0k|    *objidlength = (int) (oidp - objid);
 1542|       |
 1543|  19.0k|    DEBUGMSG(("dumpv_recv", "  ObjID: "));
  ------------------
  |  |   61|  19.0k|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|  19.0k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 19.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 19.0k]
  |  |  ------------------
  ------------------
 1544|  19.0k|    DEBUGMSGOID(("dumpv_recv", objid, *objidlength));
  ------------------
  |  |   67|  19.0k|#define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  19.0k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 19.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  165|      0|#define __DBGMSGOID(x)     debugmsg_oid x
  |  |  ------------------
  |  |  |  Branch (67:71): [Folded, False: 19.0k]
  |  |  ------------------
  ------------------
 1545|  19.0k|    DEBUGMSG(("dumpv_recv", "\n"));
  ------------------
  |  |   61|  19.0k|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|  19.0k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 19.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 19.0k]
  |  |  ------------------
  ------------------
 1546|  19.0k|    return bufp;
 1547|  19.0k|}
asn_parse_bitstring:
 1817|    944|{
 1818|       |    /*
 1819|       |     * bitstring ::= 0x03 asnlength unused {byte}*
 1820|       |     */
 1821|    944|    static const char *errpre = "parse bitstring";
 1822|    944|    register u_char *bufp = data;
 1823|    944|    u_long          asn_length;
 1824|       |
 1825|    944|    if (NULL == data || NULL == datalength || NULL == type ||
  ------------------
  |  Branch (1825:9): [True: 0, False: 944]
  |  Branch (1825:25): [True: 0, False: 944]
  |  Branch (1825:47): [True: 0, False: 944]
  ------------------
 1826|    944|        NULL == str || NULL == strlength) {
  ------------------
  |  Branch (1826:9): [True: 0, False: 944]
  |  Branch (1826:24): [True: 0, False: 944]
  ------------------
 1827|      0|        ERROR_MSG("parse bitstring: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1828|      0|        return NULL;
 1829|      0|    }
 1830|       |
 1831|       |    /** need at least 2 bytes to work with: type, length (which might be 0)  */
 1832|    944|    if (*datalength < 2) {
  ------------------
  |  Branch (1832:9): [True: 0, False: 944]
  ------------------
 1833|      0|        _asn_short_err(errpre, *datalength, 2);
 1834|      0|        return NULL;
 1835|      0|    }
 1836|       |
 1837|    944|    *type = *bufp++;
 1838|    944|    if (*type != ASN_BIT_STR) {
  ------------------
  |  |   77|    944|#define ASN_BIT_STR	    0x03U
  ------------------
  |  Branch (1838:9): [True: 0, False: 944]
  ------------------
 1839|      0|        _asn_type_err(errpre, *type);
 1840|      0|        return NULL;
 1841|      0|    }
 1842|       |
 1843|    944|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 1844|    944|    if (NULL == bufp) {
  ------------------
  |  Branch (1844:9): [True: 0, False: 944]
  ------------------
 1845|      0|        _asn_short_err(errpre, *datalength - 1, asn_length);
 1846|      0|        return NULL;
 1847|      0|    }
 1848|       |
 1849|    944|    if ((size_t) asn_length > *strlength) {
  ------------------
  |  Branch (1849:9): [True: 0, False: 944]
  ------------------
 1850|      0|        _asn_length_err(errpre, (size_t) asn_length, *strlength);
 1851|      0|        return NULL;
 1852|      0|    }
 1853|    944|    if (_asn_bitstring_check(errpre, asn_length, *bufp))
  ------------------
  |  Branch (1853:9): [True: 9, False: 935]
  ------------------
 1854|      9|        return NULL;
 1855|       |
 1856|    935|    DEBUGDUMPSETUP("recv", data, bufp - data);
  ------------------
  |  |   83|    935|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    935|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 935]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  196|      0|        debugmsg("dumpx" token, "dumpx_%s:%*s", token, __DBGINDENT(), ""); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  |  |  197|      0|        __DBGMSGHEX(("dumpx_" token,buf,len)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  |  |  ------------------
  |  |  |  |  198|      0|        if (debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (198:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  199|      0|            debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (199:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  200|      0|            debugmsg("dumpx_" token,"\n"); \
  |  |  |  |  201|      0|        } else { \
  |  |  |  |  202|      0|            debugmsg("dumpx_" token,"  "); \
  |  |  |  |  203|      0|        } \
  |  |  |  |  204|      0|        debugmsg("dumpv" token, "dumpv_%s:%*s", token, __DBGINDENT(), "");
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:60): [Folded, False: 935]
  |  |  ------------------
  ------------------
 1857|    935|    DEBUGMSG(("dumpv_recv", "  Bitstring: "));
  ------------------
  |  |   61|    935|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    935|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 935]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 935]
  |  |  ------------------
  ------------------
 1858|    935|    DEBUGMSGHEX(("dumpv_recv", data, asn_length));
  ------------------
  |  |   71|    935|#define DEBUGMSGHEX(x)     do {if (_DBG_IF_) {__DBGMSGHEX(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    935|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 935]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGHEX(x)     do {if (_DBG_IF_) {__DBGMSGHEX(x);} }while(0)
  |  |  ------------------
  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  ------------------
  |  |  |  Branch (71:71): [Folded, False: 935]
  |  |  ------------------
  ------------------
 1859|    935|    DEBUGMSG(("dumpv_recv", "\n"));
  ------------------
  |  |   61|    935|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    935|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 935]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 935]
  |  |  ------------------
  ------------------
 1860|       |
 1861|    935|    memmove(str, bufp, asn_length);
 1862|    935|    *strlength = (int) asn_length;
 1863|    935|    *datalength -= (int) asn_length + (bufp - data);
 1864|    935|    return bufp + asn_length;
 1865|    944|}
asn_parse_unsigned_int64:
 1949|  3.14k|{
 1950|       |    /*
 1951|       |     * ASN.1 integer ::= 0x02 asnlength byte {byte}*
 1952|       |     */
 1953|  3.14k|    static const char *errpre = "parse uint64";
 1954|  3.14k|    const int       uint64sizelimit = (4 * 2) + 1;
 1955|  3.14k|    register u_char *bufp = data;
 1956|  3.14k|    u_long          asn_length;
 1957|  3.14k|    register u_long low = 0, high = 0;
 1958|       |
 1959|  3.14k|    if (countersize != sizeof(struct counter64)) {
  ------------------
  |  Branch (1959:9): [True: 0, False: 3.14k]
  ------------------
 1960|      0|        _asn_size_err(errpre, countersize, sizeof(struct counter64));
 1961|      0|        return NULL;
 1962|      0|    }
 1963|       |
 1964|  3.14k|    if (NULL == data || NULL == datalength || NULL == type || NULL == cp) {
  ------------------
  |  Branch (1964:9): [True: 0, False: 3.14k]
  |  Branch (1964:25): [True: 0, False: 3.14k]
  |  Branch (1964:47): [True: 0, False: 3.14k]
  |  Branch (1964:63): [True: 0, False: 3.14k]
  ------------------
 1965|      0|        ERROR_MSG("parse uint64: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1966|      0|        return NULL;
 1967|      0|    }
 1968|       |
 1969|       |    /** need at least 2 bytes to work with: type, length (which might be 0)  */
 1970|  3.14k|    if (*datalength < 2) {
  ------------------
  |  Branch (1970:9): [True: 0, False: 3.14k]
  ------------------
 1971|      0|        _asn_short_err(errpre, *datalength, 2);
 1972|      0|        return NULL;
 1973|      0|    }
 1974|       |
 1975|  3.14k|    *type = *bufp++;
 1976|  3.14k|    if (*type != ASN_COUNTER64
  ------------------
  |  |   99|  6.29k|#define ASN_COUNTER64   (ASN_APPLICATION | 6)
  |  |  ------------------
  |  |  |  |   91|  3.14k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (1976:9): [True: 1.66k, False: 1.48k]
  ------------------
 1977|  1.66k|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 1978|  1.66k|            && *type != ASN_OPAQUE
  ------------------
  |  |   93|  1.66k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  1.66k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (1978:16): [True: 6, False: 1.66k]
  ------------------
 1979|  3.14k|#endif
 1980|  3.14k|            ) {
 1981|      6|        _asn_type_err(errpre, *type);
 1982|      6|        return NULL;
 1983|      6|    }
 1984|  3.14k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 1985|  3.14k|    if (NULL == bufp) {
  ------------------
  |  Branch (1985:9): [True: 0, False: 3.14k]
  ------------------
 1986|      0|        _asn_short_err(errpre, *datalength - 1, asn_length);
 1987|      0|        return NULL;
 1988|      0|    }
 1989|       |
 1990|  3.14k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|  3.14k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  3.14k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3.14k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  196|      0|        debugmsg("dumpx" token, "dumpx_%s:%*s", token, __DBGINDENT(), ""); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  |  |  197|      0|        __DBGMSGHEX(("dumpx_" token,buf,len)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  |  |  ------------------
  |  |  |  |  198|      0|        if (debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (198:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  199|      0|            debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (199:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  200|      0|            debugmsg("dumpx_" token,"\n"); \
  |  |  |  |  201|      0|        } else { \
  |  |  |  |  202|      0|            debugmsg("dumpx_" token,"  "); \
  |  |  |  |  203|      0|        } \
  |  |  |  |  204|      0|        debugmsg("dumpv" token, "dumpv_%s:%*s", token, __DBGINDENT(), "");
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:60): [Folded, False: 3.14k]
  |  |  ------------------
  ------------------
 1991|  3.14k|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 1992|       |    /** need at least 2 bytes: ASN_OPAQUE_TAG1 and ASN_OPAQUE_<type> */
 1993|  3.14k|    if ((*type == ASN_OPAQUE) && (asn_length < 2)) {
  ------------------
  |  |   93|  3.14k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  3.14k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (1993:9): [True: 1.66k, False: 1.48k]
  |  Branch (1993:34): [True: 0, False: 1.66k]
  ------------------
 1994|      0|        _asn_short_err(errpre, asn_length, 2);
 1995|      0|        return NULL;
 1996|      0|    }
 1997|       |
 1998|       |    /*
 1999|       |     * 64 bit counters as opaque 
 2000|       |     */
 2001|  3.14k|    if ((*type == ASN_OPAQUE) &&
  ------------------
  |  |   93|  3.14k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  3.14k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2001:9): [True: 1.66k, False: 1.48k]
  ------------------
 2002|  1.66k|        (asn_length <= ASN_OPAQUE_COUNTER64_MX_BER_LEN) &&
  ------------------
  |  |  160|  1.66k|#define ASN_OPAQUE_COUNTER64_MX_BER_LEN 12
  ------------------
  |  Branch (2002:9): [True: 1.64k, False: 21]
  ------------------
 2003|  1.64k|        (*bufp == ASN_OPAQUE_TAG1) &&
  ------------------
  |  |  131|  1.64k|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|  1.64k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|  1.64k|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
  |  Branch (2003:9): [True: 1.64k, False: 0]
  ------------------
 2004|  1.64k|        ((*(bufp + 1) == ASN_OPAQUE_COUNTER64) ||
  ------------------
  |  |  156|  1.64k|#define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  136|  1.64k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  146|  1.64k|#define ASN_APP_COUNTER64 (ASN_APPLICATION | 6)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.64k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2004:10): [True: 795, False: 845]
  ------------------
 2005|  1.64k|         (*(bufp + 1) == ASN_OPAQUE_U64))) {
  ------------------
  |  |  192|    845|#define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  136|    845|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  150|    845|#define ASN_APP_U64 (ASN_APPLICATION | 11)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    845|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2005:10): [True: 845, False: 0]
  ------------------
 2006|       |        /*
 2007|       |         * change type to Counter64 or U64 
 2008|       |         */
 2009|  1.64k|        *type = *(bufp + 1);
 2010|       |        /*
 2011|       |         * value is encoded as special format 
 2012|       |         */
 2013|  1.64k|        *datalength = asn_length;
 2014|  1.64k|        bufp = asn_parse_nlength(bufp+2, *datalength - 2, &asn_length);
 2015|  1.64k|        if (NULL == bufp) {
  ------------------
  |  Branch (2015:13): [True: 0, False: 1.64k]
  ------------------
 2016|      0|            _asn_short_err("parse opaque uint64", *datalength - 2, asn_length);
 2017|      0|            return NULL;
 2018|      0|        }
 2019|  1.64k|    }
 2020|  3.14k|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 2021|  3.14k|    if (((int) asn_length > uint64sizelimit) ||
  ------------------
  |  Branch (2021:9): [True: 28, False: 3.11k]
  ------------------
 2022|  3.11k|        (((int) asn_length == uint64sizelimit) && *bufp != 0x00)) {
  ------------------
  |  Branch (2022:10): [True: 289, False: 2.82k]
  |  Branch (2022:51): [True: 10, False: 279]
  ------------------
 2023|     38|        _asn_length_err(errpre, (size_t) asn_length, uint64sizelimit);
 2024|     38|        return NULL;
 2025|     38|    }
 2026|  3.10k|    *datalength -= (int) asn_length + (bufp - data);
 2027|  7.14k|    while (asn_length--) {
  ------------------
  |  Branch (2027:12): [True: 4.03k, False: 3.10k]
  ------------------
 2028|  4.03k|        high = ((0x00FFFFFF & high) << 8) | ((low & 0xFF000000U) >> 24);
 2029|  4.03k|        low = ((low & 0x00FFFFFF) << 8) | *bufp++;
 2030|  4.03k|    }
 2031|       |
 2032|  3.10k|    CHECK_OVERFLOW_U(high,6);
  ------------------
  |  |  224|  3.10k|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|  3.10k|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 0, False: 3.10k]
  |  |  ------------------
  |  |  226|      0|            x &= 0xffffffff;                                            \
  |  |  227|      0|            DEBUGMSG(("asn","truncating unsigned value to 32 bits (%d)\n",y)); \
  |  |  ------------------
  |  |  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  228|      0|        }                                                               \
  |  |  229|  3.10k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 3.10k]
  |  |  ------------------
  ------------------
 2033|  3.10k|    CHECK_OVERFLOW_U(low,6);
  ------------------
  |  |  224|  3.10k|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|  3.10k|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 0, False: 3.10k]
  |  |  ------------------
  |  |  226|      0|            x &= 0xffffffff;                                            \
  |  |  227|      0|            DEBUGMSG(("asn","truncating unsigned value to 32 bits (%d)\n",y)); \
  |  |  ------------------
  |  |  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  228|      0|        }                                                               \
  |  |  229|  3.10k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 3.10k]
  |  |  ------------------
  ------------------
 2034|       |
 2035|  3.10k|    cp->low = low;
 2036|  3.10k|    cp->high = high;
 2037|       |
 2038|  3.10k|    DEBUGIF("dumpv_recv") {
  ------------------
  |  |  145|  3.10k|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|  6.20k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3.10k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (145:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2039|      0|        char            i64buf[I64CHARSZ + 1];
 2040|      0|        printU64(i64buf, cp);
 2041|      0|        DEBUGMSG(("dumpv_recv", "Counter64: %s\n", i64buf));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2042|      0|    }
 2043|       |
 2044|  3.10k|    return bufp;
 2045|  3.14k|}
asn_parse_signed_int64:
 2222|  1.22k|{
 2223|  1.22k|    static const char *errpre = "parse int64";
 2224|  1.22k|    const int       int64sizelimit = (4 * 2) + 1;
 2225|  1.22k|    char            ebuf[128];
 2226|  1.22k|    register u_char *bufp = data;
 2227|  1.22k|    u_long          asn_length;
 2228|  1.22k|    register u_int  low = 0, high = 0;
 2229|       |
 2230|  1.22k|    if (countersize != sizeof(struct counter64)) {
  ------------------
  |  Branch (2230:9): [True: 0, False: 1.22k]
  ------------------
 2231|      0|        _asn_size_err(errpre, countersize, sizeof(struct counter64));
 2232|      0|        return NULL;
 2233|      0|    }
 2234|       |
 2235|  1.22k|    if (NULL == data || NULL == datalength || NULL == type || NULL == cp) {
  ------------------
  |  Branch (2235:9): [True: 0, False: 1.22k]
  |  Branch (2235:25): [True: 0, False: 1.22k]
  |  Branch (2235:47): [True: 0, False: 1.22k]
  |  Branch (2235:63): [True: 0, False: 1.22k]
  ------------------
 2236|      0|        ERROR_MSG("parse int64: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 2237|      0|        return NULL;
 2238|      0|    }
 2239|       |
 2240|       |    /** need at least 2 bytes to work with: type, length (which might be 0) */
 2241|  1.22k|    if (*datalength < 2) {
  ------------------
  |  Branch (2241:9): [True: 0, False: 1.22k]
  ------------------
 2242|      0|        _asn_short_err(errpre, *datalength, 2);
 2243|      0|        return NULL;
 2244|      0|    }
 2245|       |
 2246|  1.22k|    *type = *bufp++;
 2247|  1.22k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 2248|  1.22k|    if (NULL == bufp) {
  ------------------
  |  Branch (2248:9): [True: 0, False: 1.22k]
  ------------------
 2249|      0|        _asn_short_err(errpre, *datalength - 1, asn_length);
 2250|      0|        return NULL;
 2251|      0|    }
 2252|       |
 2253|       |    /** need at least 2 bytes: ASN_OPAQUE_TAG1 and ASN_OPAQUE_I64 */
 2254|  1.22k|    if (asn_length < 2) {
  ------------------
  |  Branch (2254:9): [True: 11, False: 1.21k]
  ------------------
 2255|     11|        _asn_short_err(errpre, asn_length, 2);
 2256|     11|        return NULL;
 2257|     11|    }
 2258|       |
 2259|  1.21k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|  1.21k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  1.21k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1.21k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  196|      0|        debugmsg("dumpx" token, "dumpx_%s:%*s", token, __DBGINDENT(), ""); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  |  |  197|      0|        __DBGMSGHEX(("dumpx_" token,buf,len)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  |  |  ------------------
  |  |  |  |  198|      0|        if (debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (198:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  199|      0|            debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (199:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  200|      0|            debugmsg("dumpx_" token,"\n"); \
  |  |  |  |  201|      0|        } else { \
  |  |  |  |  202|      0|            debugmsg("dumpx_" token,"  "); \
  |  |  |  |  203|      0|        } \
  |  |  |  |  204|      0|        debugmsg("dumpv" token, "dumpv_%s:%*s", token, __DBGINDENT(), "");
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:60): [Folded, False: 1.21k]
  |  |  ------------------
  ------------------
 2260|  1.21k|    if ((*type == ASN_OPAQUE) &&
  ------------------
  |  |   93|  1.21k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  1.21k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2260:9): [True: 1.20k, False: 9]
  ------------------
 2261|  1.20k|        (asn_length <= ASN_OPAQUE_COUNTER64_MX_BER_LEN) &&
  ------------------
  |  |  160|  1.20k|#define ASN_OPAQUE_COUNTER64_MX_BER_LEN 12
  ------------------
  |  Branch (2261:9): [True: 1.19k, False: 17]
  ------------------
 2262|  1.19k|        (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_I64)) {
  ------------------
  |  |  131|  1.19k|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|  1.19k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|  1.19k|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
                      (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_I64)) {
  ------------------
  |  |  183|  1.19k|#define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  136|  1.19k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  149|  1.19k|#define ASN_APP_I64 (ASN_APPLICATION | 10)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.19k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2262:9): [True: 1.19k, False: 0]
  |  Branch (2262:39): [True: 1.19k, False: 0]
  ------------------
 2263|       |        /*
 2264|       |         * change type to Int64 
 2265|       |         */
 2266|  1.19k|        *type = *(bufp + 1);
 2267|       |        /*
 2268|       |         * value is encoded as special format 
 2269|       |         */
 2270|  1.19k|        *datalength = asn_length;
 2271|  1.19k|        bufp = asn_parse_nlength(bufp+2, *datalength - 2, &asn_length);
 2272|  1.19k|        if (NULL == bufp) {
  ------------------
  |  Branch (2272:13): [True: 0, False: 1.19k]
  ------------------
 2273|      0|            _asn_short_err("parse opaque int64", *datalength - 2, asn_length);
 2274|      0|            return NULL;
 2275|      0|        }
 2276|  1.19k|    }
 2277|       |    /*
 2278|       |     * this should always have been true until snmp gets int64 PDU types 
 2279|       |     */
 2280|     26|    else {
 2281|     26|        snprintf(ebuf, sizeof(ebuf),
 2282|     26|                "%s: wrong type: %d, len %d, buf bytes (%02X,%02X)",
 2283|     26|                errpre, *type, (int) asn_length, *bufp, *(bufp + 1));
 2284|     26|        ERROR_MSG(ebuf);
  ------------------
  |  |  188|     26|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 2285|     26|        return NULL;
 2286|     26|    }
 2287|  1.19k|    if (((int) asn_length > int64sizelimit) ||
  ------------------
  |  Branch (2287:9): [True: 0, False: 1.19k]
  ------------------
 2288|  1.19k|        (((int) asn_length == int64sizelimit) && *bufp != 0x00)) {
  ------------------
  |  Branch (2288:10): [True: 211, False: 980]
  |  Branch (2288:50): [True: 8, False: 203]
  ------------------
 2289|      8|        _asn_length_err(errpre, (size_t) asn_length, int64sizelimit);
 2290|      8|        return NULL;
 2291|      8|    }
 2292|  1.18k|    *datalength -= (int) asn_length + (bufp - data);
 2293|  1.18k|    if ((asn_length > 0) && (*bufp & 0x80)) {
  ------------------
  |  Branch (2293:9): [True: 846, False: 337]
  |  Branch (2293:29): [True: 252, False: 594]
  ------------------
 2294|    252|        low = 0xFFFFFFFFU;   /* first byte bit 1 means start the data with 1s */
 2295|    252|        high = 0xFFFFFF;
 2296|    252|    }
 2297|       |
 2298|  4.10k|    for ( ; asn_length; asn_length--) {
  ------------------
  |  Branch (2298:13): [True: 2.92k, False: 1.18k]
  ------------------
 2299|  2.92k|        high = ((0x00FFFFFF & high) << 8) | ((low & 0xFF000000U) >> 24);
 2300|  2.92k|        low = ((low & 0x00FFFFFF) << 8) | *bufp++;
 2301|  2.92k|    }
 2302|       |
 2303|  1.18k|    CHECK_OVERFLOW_U(high,8);
  ------------------
  |  |  224|  1.18k|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|  1.18k|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 0, False: 1.18k]
  |  |  ------------------
  |  |  226|      0|            x &= 0xffffffff;                                            \
  |  |  227|      0|            DEBUGMSG(("asn","truncating unsigned value to 32 bits (%d)\n",y)); \
  |  |  ------------------
  |  |  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  228|      0|        }                                                               \
  |  |  229|  1.18k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 1.18k]
  |  |  ------------------
  ------------------
 2304|  1.18k|    CHECK_OVERFLOW_U(low,8);
  ------------------
  |  |  224|  1.18k|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|  1.18k|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 0, False: 1.18k]
  |  |  ------------------
  |  |  226|      0|            x &= 0xffffffff;                                            \
  |  |  227|      0|            DEBUGMSG(("asn","truncating unsigned value to 32 bits (%d)\n",y)); \
  |  |  ------------------
  |  |  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  228|      0|        }                                                               \
  |  |  229|  1.18k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 1.18k]
  |  |  ------------------
  ------------------
 2305|       |
 2306|  1.18k|    cp->low = low;
 2307|  1.18k|    cp->high = high;
 2308|       |
 2309|  1.18k|    DEBUGIF("dumpv_recv") {
  ------------------
  |  |  145|  1.18k|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|  2.36k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1.18k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (145:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2310|      0|        char            i64buf[I64CHARSZ + 1];
 2311|      0|        printI64(i64buf, cp);
 2312|      0|        DEBUGMSG(("dumpv_recv", "Integer64: %s\n", i64buf));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2313|      0|    }
 2314|       |
 2315|  1.18k|    return bufp;
 2316|  1.19k|}
asn_parse_float:
 2439|    867|{
 2440|    867|    static const char *errpre = "parse float";
 2441|    867|    register u_char *bufp = data;
 2442|    867|    u_long          asn_length;
 2443|    867|    union {
 2444|    867|        float           floatVal;
 2445|    867|        long            longVal;
 2446|    867|        u_char          c[sizeof(float)];
 2447|    867|    } fu;
 2448|       |
 2449|    867|    if (floatsize != sizeof(float)) {
  ------------------
  |  Branch (2449:9): [True: 0, False: 867]
  ------------------
 2450|      0|        _asn_size_err("parse float", floatsize, sizeof(float));
 2451|      0|        return NULL;
 2452|      0|    }
 2453|       |
 2454|    867|    if (NULL == data || NULL == datalength || NULL == type || NULL == floatp) {
  ------------------
  |  Branch (2454:9): [True: 0, False: 867]
  |  Branch (2454:25): [True: 0, False: 867]
  |  Branch (2454:47): [True: 0, False: 867]
  |  Branch (2454:63): [True: 0, False: 867]
  ------------------
 2455|      0|        ERROR_MSG("parse float: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 2456|      0|        return NULL;
 2457|      0|    }
 2458|       |
 2459|       |    /** need at least 2 bytes to work with: type, length (which might be 0)  */
 2460|    867|    if (*datalength < 2) {
  ------------------
  |  Branch (2460:9): [True: 0, False: 867]
  ------------------
 2461|      0|        _asn_short_err(errpre, *datalength, 2);
 2462|      0|        return NULL;
 2463|      0|    }
 2464|       |
 2465|    867|    *type = *bufp++;
 2466|    867|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 2467|    867|    if (NULL == bufp) {
  ------------------
  |  Branch (2467:9): [True: 0, False: 867]
  ------------------
 2468|      0|        _asn_short_err(errpre, *datalength - 1, asn_length);
 2469|      0|        return NULL;
 2470|      0|    }
 2471|       |
 2472|    867|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|    867|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    867|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 867]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  196|      0|        debugmsg("dumpx" token, "dumpx_%s:%*s", token, __DBGINDENT(), ""); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  |  |  197|      0|        __DBGMSGHEX(("dumpx_" token,buf,len)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  |  |  ------------------
  |  |  |  |  198|      0|        if (debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (198:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  199|      0|            debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (199:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  200|      0|            debugmsg("dumpx_" token,"\n"); \
  |  |  |  |  201|      0|        } else { \
  |  |  |  |  202|      0|            debugmsg("dumpx_" token,"  "); \
  |  |  |  |  203|      0|        } \
  |  |  |  |  204|      0|        debugmsg("dumpv" token, "dumpv_%s:%*s", token, __DBGINDENT(), "");
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:60): [Folded, False: 867]
  |  |  ------------------
  ------------------
 2473|       |    /*
 2474|       |     * the float is encoded as an opaque 
 2475|       |     */
 2476|    867|    if ((*type == ASN_OPAQUE) &&
  ------------------
  |  |   93|    867|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|    867|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2476:9): [True: 330, False: 537]
  ------------------
 2477|    330|        (asn_length == ASN_OPAQUE_FLOAT_BER_LEN) &&
  ------------------
  |  |  169|    330|#define ASN_OPAQUE_FLOAT_BER_LEN 7
  ------------------
  |  Branch (2477:9): [True: 316, False: 14]
  ------------------
 2478|    316|        (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_FLOAT)) {
  ------------------
  |  |  131|    316|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|    316|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|    316|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
                      (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_FLOAT)) {
  ------------------
  |  |  165|    316|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|    316|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|    316|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    316|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2478:9): [True: 316, False: 0]
  |  Branch (2478:39): [True: 316, False: 0]
  ------------------
 2479|       |
 2480|       |        /*
 2481|       |         * value is encoded as special format 
 2482|       |         */
 2483|    316|        *datalength = asn_length;
 2484|    316|        bufp = asn_parse_nlength(bufp+2, *datalength - 2, &asn_length);
 2485|    316|        if (NULL == bufp) {
  ------------------
  |  Branch (2485:13): [True: 0, False: 316]
  ------------------
 2486|      0|            _asn_short_err("parse opaque float", *datalength - 2, asn_length);
 2487|      0|            return NULL;
 2488|      0|        }
 2489|       |        /*
 2490|       |         * change type to Float 
 2491|       |         */
 2492|    316|        *type = ASN_OPAQUE_FLOAT;
  ------------------
  |  |  165|    316|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|    316|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|    316|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    316|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2493|    316|    }
 2494|       |
 2495|    867|    if (*type != ASN_OPAQUE_FLOAT) {
  ------------------
  |  |  165|    867|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|    867|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|    867|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    867|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2495:9): [True: 14, False: 853]
  ------------------
 2496|     14|        _asn_type_err(errpre, *type);
 2497|     14|        return NULL;
 2498|     14|    }
 2499|       |
 2500|    853|    if (asn_length != sizeof(float)) {
  ------------------
  |  Branch (2500:9): [True: 24, False: 829]
  ------------------
 2501|     24|        _asn_size_err("parse seq float", asn_length, sizeof(float));
 2502|     24|        return NULL;
 2503|     24|    }
 2504|       |
 2505|    829|    *datalength -= (int) asn_length + (bufp - data);
 2506|    829|    memcpy(&fu.c[0], bufp, asn_length);
 2507|       |
 2508|       |    /*
 2509|       |     * correct for endian differences 
 2510|       |     */
 2511|    829|    fu.longVal = ntohl(fu.longVal);
 2512|       |
 2513|    829|    *floatp = fu.floatVal;
 2514|       |
 2515|    829|    DEBUGMSG(("dumpv_recv", "Opaque float: %f\n", *floatp));
  ------------------
  |  |   61|    829|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    829|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 829]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 829]
  |  |  ------------------
  ------------------
 2516|    829|    return bufp;
 2517|    853|}
asn_parse_double:
 2622|    819|{
 2623|    819|    static const char *errpre = "parse double";
 2624|    819|    register u_char *bufp = data;
 2625|    819|    u_long          asn_length;
 2626|    819|    long            tmp;
 2627|    819|    union {
 2628|    819|        double          doubleVal;
 2629|    819|        int             intVal[2];
 2630|    819|        u_char          c[sizeof(double)];
 2631|    819|    } fu;
 2632|       |
 2633|       |
 2634|    819|    if (doublesize != sizeof(double)) {
  ------------------
  |  Branch (2634:9): [True: 0, False: 819]
  ------------------
 2635|      0|        _asn_size_err("parse double", doublesize, sizeof(double));
 2636|      0|        return NULL;
 2637|      0|    }
 2638|       |
 2639|    819|    if (NULL == data || NULL == datalength || NULL == type || NULL == doublep) {
  ------------------
  |  Branch (2639:9): [True: 0, False: 819]
  |  Branch (2639:25): [True: 0, False: 819]
  |  Branch (2639:47): [True: 0, False: 819]
  |  Branch (2639:63): [True: 0, False: 819]
  ------------------
 2640|      0|        ERROR_MSG("parse double: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 2641|      0|        return NULL;
 2642|      0|    }
 2643|       |
 2644|       |    /** need at least 2 bytes to work with: type, length (which might be 0)  */
 2645|    819|    if (*datalength < 2) {
  ------------------
  |  Branch (2645:9): [True: 0, False: 819]
  ------------------
 2646|      0|        _asn_short_err(errpre, *datalength, 2);
 2647|      0|        return NULL;
 2648|      0|    }
 2649|       |
 2650|    819|    *type = *bufp++;
 2651|    819|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 2652|    819|    if (NULL == bufp) {
  ------------------
  |  Branch (2652:9): [True: 0, False: 819]
  ------------------
 2653|      0|        _asn_short_err(errpre, *datalength - 1, asn_length);
 2654|      0|        return NULL;
 2655|      0|    }
 2656|       |
 2657|    819|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|    819|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    819|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 819]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  196|      0|        debugmsg("dumpx" token, "dumpx_%s:%*s", token, __DBGINDENT(), ""); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  |  |  197|      0|        __DBGMSGHEX(("dumpx_" token,buf,len)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  |  |  ------------------
  |  |  |  |  198|      0|        if (debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (198:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  199|      0|            debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (199:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  200|      0|            debugmsg("dumpx_" token,"\n"); \
  |  |  |  |  201|      0|        } else { \
  |  |  |  |  202|      0|            debugmsg("dumpx_" token,"  "); \
  |  |  |  |  203|      0|        } \
  |  |  |  |  204|      0|        debugmsg("dumpv" token, "dumpv_%s:%*s", token, __DBGINDENT(), "");
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:60): [Folded, False: 819]
  |  |  ------------------
  ------------------
 2658|       |    /*
 2659|       |     * the double is encoded as an opaque 
 2660|       |     */
 2661|       |    /** need at least 2 bytes: ASN_OPAQUE_TAG1 and ASN_OPAQUE_DOUBLE */
 2662|    819|    if ((*type == ASN_OPAQUE) && (asn_length < 2)) {
  ------------------
  |  |   93|    819|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|    819|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2662:9): [True: 243, False: 576]
  |  Branch (2662:34): [True: 0, False: 243]
  ------------------
 2663|      0|        _asn_short_err(errpre, asn_length, 2);
 2664|      0|        return NULL;
 2665|      0|    }
 2666|    819|    if ((*type == ASN_OPAQUE) &&
  ------------------
  |  |   93|    819|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|    819|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2666:9): [True: 243, False: 576]
  ------------------
 2667|    243|        (asn_length == ASN_OPAQUE_DOUBLE_BER_LEN) &&
  ------------------
  |  |  178|    243|#define ASN_OPAQUE_DOUBLE_BER_LEN 11
  ------------------
  |  Branch (2667:9): [True: 226, False: 17]
  ------------------
 2668|    226|        (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_DOUBLE)) {
  ------------------
  |  |  131|    226|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|    226|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|    226|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
                      (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_DOUBLE)) {
  ------------------
  |  |  174|    226|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|    226|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|    226|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    226|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2668:9): [True: 226, False: 0]
  |  Branch (2668:39): [True: 226, False: 0]
  ------------------
 2669|       |
 2670|       |        /*
 2671|       |         * value is encoded as special format 
 2672|       |         */
 2673|    226|        *datalength = asn_length;
 2674|    226|        bufp = asn_parse_nlength(bufp+2, *datalength - 2, &asn_length);
 2675|    226|        if (NULL == bufp) {
  ------------------
  |  Branch (2675:13): [True: 0, False: 226]
  ------------------
 2676|      0|            _asn_short_err("parse opaque double", *datalength - 2, asn_length);
 2677|      0|            return NULL;
 2678|      0|        }
 2679|       |
 2680|       |        /*
 2681|       |         * change type to Double 
 2682|       |         */
 2683|    226|        *type = ASN_OPAQUE_DOUBLE;
  ------------------
  |  |  174|    226|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|    226|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|    226|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    226|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2684|    226|    }
 2685|       |
 2686|    819|    if (*type != ASN_OPAQUE_DOUBLE) {
  ------------------
  |  |  174|    819|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|    819|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|    819|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    819|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2686:9): [True: 17, False: 802]
  ------------------
 2687|     17|        _asn_type_err(errpre, *type);
 2688|     17|        return NULL;
 2689|     17|    }
 2690|       |
 2691|    802|    if (asn_length != sizeof(double)) {
  ------------------
  |  Branch (2691:9): [True: 27, False: 775]
  ------------------
 2692|     27|        _asn_size_err("parse seq double", asn_length, sizeof(double));
 2693|     27|        return NULL;
 2694|     27|    }
 2695|    775|    *datalength -= (int) asn_length + (bufp - data);
 2696|    775|    memcpy(&fu.c[0], bufp, asn_length);
 2697|       |
 2698|       |    /*
 2699|       |     * correct for endian differences 
 2700|       |     */
 2701|       |
 2702|    775|    tmp = ntohl(fu.intVal[0]);
 2703|    775|    fu.intVal[0] = ntohl(fu.intVal[1]);
 2704|    775|    fu.intVal[1] = tmp;
 2705|       |
 2706|    775|    *doublep = fu.doubleVal;
 2707|    775|    DEBUGMSG(("dumpv_recv", "  Opaque Double:\t%f\n", *doublep));
  ------------------
  |  |   61|    775|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    775|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 775]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 775]
  |  |  ------------------
  ------------------
 2708|       |
 2709|    775|    return bufp;
 2710|    802|}
asn1.c:_asn_size_err:
  242|     51|{
  243|     51|    char            ebuf[128];
  244|       |
  245|     51|    snprintf(ebuf, sizeof(ebuf),
  246|     51|            "%s size %lu: s/b %lu", str,
  247|     51|	    (unsigned long)wrongsize, (unsigned long)rightsize);
  248|     51|    ERROR_MSG(ebuf);
  ------------------
  |  |  188|     51|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  249|     51|}
asn1.c:_asn_short_err:
  299|  2.30k|{
  300|  2.30k|    char            ebuf[128];
  301|       |
  302|  2.30k|    snprintf(ebuf, sizeof(ebuf), "%s length %lu too short: need %lu", str,
  303|  2.30k|	    (unsigned long)wrongsize, (unsigned long)rightsize);
  304|  2.30k|    ERROR_MSG(ebuf);
  ------------------
  |  |  188|  2.30k|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  305|  2.30k|}
asn1.c:_asn_type_err:
  261|    514|{
  262|    514|    char            ebuf[128];
  263|       |
  264|    514|    snprintf(ebuf, sizeof(ebuf), "%s type %d", str, wrongtype);
  265|    514|    ebuf[ sizeof(ebuf)-1 ] = 0;
  266|    514|    ERROR_MSG(ebuf);
  ------------------
  |  |  188|    514|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  267|    514|}
asn1.c:_asn_length_err:
  280|    171|{
  281|    171|    char            ebuf[128];
  282|       |
  283|    171|    snprintf(ebuf, sizeof(ebuf),
  284|    171|            "%s length %lu too large: exceeds %lu", str,
  285|    171|	    (unsigned long)wrongsize, (unsigned long)rightsize);
  286|    171|    ERROR_MSG(ebuf);
  ------------------
  |  |  188|    171|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  287|    171|}
asn1.c:_asn_bitstring_check:
  513|    944|{
  514|    944|    char            ebuf[128];
  515|       |
  516|    944|    if (asn_length < 1) {
  ------------------
  |  Branch (516:9): [True: 9, False: 935]
  ------------------
  517|      9|        snprintf(ebuf, sizeof(ebuf),
  518|      9|                "%s: length %d too small", str, (int) asn_length);
  519|      9|        ERROR_MSG(ebuf);
  ------------------
  |  |  188|      9|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  520|      9|        return 1;
  521|      9|    }
  522|       |    /*
  523|       |     * if (datum > 7){
  524|       |     * sprintf(ebuf,"%s: datum %d >7: too large", str, (int)(datum));
  525|       |     * ERROR_MSG(ebuf);
  526|       |     * return 1;
  527|       |     * }
  528|       |     */
  529|    935|    return 0;
  530|    944|}

netsnmp_ds_get_boolean:
  242|  5.46k|{
  243|  5.46k|    if (storeid < 0 || storeid >= NETSNMP_DS_MAX_IDS || 
  ------------------
  |  |   38|  10.9k|#define NETSNMP_DS_MAX_IDS 3
  ------------------
  |  Branch (243:9): [True: 0, False: 5.46k]
  |  Branch (243:24): [True: 0, False: 5.46k]
  ------------------
  244|  5.46k|	which   < 0 || which   >= NETSNMP_DS_MAX_SUBIDS) {
  ------------------
  |  |   39|  5.46k|#define NETSNMP_DS_MAX_SUBIDS 64        /* needs to be a multiple of 8 */
  ------------------
  |  Branch (244:2): [True: 0, False: 5.46k]
  |  Branch (244:17): [True: 0, False: 5.46k]
  ------------------
  245|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  246|      0|    }
  247|       |
  248|  5.46k|    return (netsnmp_ds_booleans[storeid][which/8] & (1 << (which % 8))) ? 1:0;
  ------------------
  |  Branch (248:12): [True: 0, False: 5.46k]
  ------------------
  249|  5.46k|}

snmp_parse_var_op:
  160|  17.6k|{
  161|  17.6k|    u_char          var_op_type;
  162|  17.6k|    size_t          var_op_len = *listlength;
  163|  17.6k|    u_char         *var_op_start = data;
  164|       |
  165|  17.6k|    data = asn_parse_sequence(data, &var_op_len, &var_op_type,
  166|  17.6k|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR), "var_op");
  ------------------
  |  |   84|  17.6k|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR), "var_op");
  ------------------
  |  |   96|  17.6k|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
  167|  17.6k|    if (data == NULL) {
  ------------------
  |  Branch (167:9): [True: 299, False: 17.3k]
  ------------------
  168|       |        /*
  169|       |         * msg detail is set 
  170|       |         */
  171|    299|        return NULL;
  172|    299|    }
  173|  17.3k|    DEBUGDUMPHEADER("recv", "Name");
  ------------------
  |  |   79|  17.3k|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  17.3k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 17.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 17.3k]
  |  |  ------------------
  ------------------
  174|  17.3k|    data =
  175|  17.3k|        asn_parse_objid(data, &var_op_len, &var_op_type, var_name,
  176|  17.3k|                        var_name_len);
  177|  17.3k|    DEBUGINDENTLESS();
  ------------------
  |  |   75|  17.3k|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|  17.3k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 17.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 17.3k]
  |  |  ------------------
  ------------------
  178|  17.3k|    if (data == NULL) {
  ------------------
  |  Branch (178:9): [True: 45, False: 17.3k]
  ------------------
  179|     45|        ERROR_MSG("No OID for variable");
  ------------------
  |  |  188|     45|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  180|     45|        return NULL;
  181|     45|    }
  182|  17.3k|    if (var_op_type !=
  ------------------
  |  Branch (182:9): [True: 0, False: 17.3k]
  ------------------
  183|  17.3k|        (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OBJECT_ID))
  ------------------
  |  |   90|  17.3k|#define ASN_UNIVERSAL	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OBJECT_ID))
  ------------------
  |  |   95|  17.3k|#define ASN_PRIMITIVE	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OBJECT_ID))
  ------------------
  |  |   81|  17.3k|#define ASN_OBJECT_ID	    0x06U
  ------------------
  184|      0|        return NULL;
  185|  17.3k|    *var_val = data;            /* save pointer to this object */
  186|       |    /*
  187|       |     * find out what type of object this is 
  188|       |     */
  189|  17.3k|    data = asn_parse_header(data, &var_op_len, var_val_type);
  190|  17.3k|    if (data == NULL) {
  ------------------
  |  Branch (190:9): [True: 12, False: 17.3k]
  ------------------
  191|     12|        ERROR_MSG("No header for value");
  ------------------
  |  |  188|     12|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  192|     12|        return NULL;
  193|     12|    }
  194|       |    /*
  195|       |     * XXX no check for type! 
  196|       |     */
  197|  17.3k|    *var_val_len = var_op_len;
  198|  17.3k|    data += var_op_len;
  199|  17.3k|    *listlength -= (int) (data - var_op_start);
  200|  17.3k|    return data;
  201|  17.3k|}

snmp_get_next_transid:
  507|  2.64k|{
  508|  2.64k|    long            retVal;
  509|  2.64k|    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_TRANSID);
  ------------------
  |  |   79|  2.64k|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded, False: 2.64k]
  |  |  ------------------
  ------------------
  510|  2.64k|    retVal = 1 + Transid;       /*MTCRITICAL_RESOURCE */
  511|  2.64k|    if (!retVal)
  ------------------
  |  Branch (511:9): [True: 0, False: 2.64k]
  ------------------
  512|      0|        retVal = 2;
  513|  2.64k|    Transid = retVal;
  514|  2.64k|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS))
  ------------------
  |  |   48|  2.64k|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS))
  ------------------
  |  |   91|  2.64k|#define NETSNMP_DS_LIB_16BIT_IDS           31   /* restrict requestIDs, etc to 16-bit values */
  ------------------
  |  Branch (514:9): [True: 0, False: 2.64k]
  ------------------
  515|      0|        retVal &= 0x7fff;	/* mask to 15 bits */
  516|  2.64k|    else
  517|  2.64k|        retVal &= 0x7fffffff;	/* mask to 31 bits */
  518|       |
  519|  2.64k|    if (!retVal) {
  ------------------
  |  Branch (519:9): [True: 0, False: 2.64k]
  ------------------
  520|      0|        Transid = retVal = 2;
  521|      0|    }
  522|  2.64k|    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_TRANSID);
  ------------------
  |  |   80|  2.64k|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded, False: 2.64k]
  |  |  ------------------
  ------------------
  523|  2.64k|    return retVal;
  524|  2.64k|}
snmp_set_detail:
  538|  6.51k|{
  539|  6.51k|    if (detail_string != NULL) {
  ------------------
  |  Branch (539:9): [True: 6.51k, False: 0]
  ------------------
  540|  6.51k|        strlcpy(snmp_detail, detail_string, sizeof(snmp_detail));
  541|  6.51k|        snmp_detail_f = 1;
  542|  6.51k|    }
  543|  6.51k|}
snmp_api_errstring:
  553|    690|{
  554|    690|    const char     *msg = "";
  555|    690|    static char     msg_buf[SPRINT_MAX_LEN];
  556|       |
  557|    690|    if (snmp_errnumber >= SNMPERR_MAX && snmp_errnumber <= SNMPERR_GENERR) {
  ------------------
  |  |  255|  1.38k|#define SNMPERR_MAX			(-69)
  ------------------
                  if (snmp_errnumber >= SNMPERR_MAX && snmp_errnumber <= SNMPERR_GENERR) {
  ------------------
  |  |  185|    690|#define SNMPERR_GENERR			(-1)
  ------------------
  |  Branch (557:9): [True: 690, False: 0]
  |  Branch (557:42): [True: 0, False: 690]
  ------------------
  558|      0|        msg = api_errors[-snmp_errnumber];
  559|    690|    } else if (snmp_errnumber != SNMPERR_SUCCESS) {
  ------------------
  |  |  184|    690|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (559:16): [True: 0, False: 690]
  ------------------
  560|      0|        msg = NULL;
  561|      0|    }
  562|    690|    if (!msg) {
  ------------------
  |  Branch (562:9): [True: 0, False: 690]
  ------------------
  563|      0|	snprintf(msg_buf, sizeof(msg_buf), "Unknown error: %d", snmp_errnumber);
  564|      0|        msg_buf[sizeof(msg_buf)-1] = '\0';
  565|    690|    } else if (snmp_detail_f) {
  ------------------
  |  Branch (565:16): [True: 690, False: 0]
  ------------------
  566|    690|        snprintf(msg_buf, sizeof(msg_buf), "%s (%s)", msg, snmp_detail);
  567|    690|        msg_buf[sizeof(msg_buf)-1] = '\0';
  568|    690|        snmp_detail_f = 0;
  569|    690|    } else {
  570|      0|        strlcpy(msg_buf, msg, sizeof(msg_buf));
  571|      0|    }
  572|       |
  573|    690|    return (msg_buf);
  574|    690|}
snmpv3_parse:
 3852|  2.64k|{
 3853|  2.64k|    u_char          type, msg_flags;
 3854|  2.64k|    long            ver, msg_sec_model;
 3855|  2.64k|    size_t          max_size_response;
 3856|  2.64k|    u_char          tmp_buf[SNMP_MAX_MSG_SIZE];
 3857|  2.64k|    size_t          tmp_buf_len;
 3858|  2.64k|    u_char          pdu_buf[SNMP_MAX_MSG_SIZE];
 3859|  2.64k|    u_char         *mallocbuf = NULL;
 3860|  2.64k|    size_t          pdu_buf_len = SNMP_MAX_MSG_SIZE;
  ------------------
  |  |  109|  2.64k|#define SNMP_MAX_MSG_SIZE          1472 /* ethernet MTU minus IP/UDP header */
  ------------------
 3861|  2.64k|    u_char         *sec_params;
 3862|  2.64k|    u_char         *msg_data;
 3863|  2.64k|    u_char         *cp;
 3864|  2.64k|    size_t          asn_len, msg_len;
 3865|  2.64k|    int             ret, ret_val;
 3866|  2.64k|    struct snmp_secmod_def *sptr;
 3867|       |
 3868|       |
 3869|  2.64k|    msg_data = data;
 3870|  2.64k|    msg_len = *length;
 3871|       |
 3872|       |
 3873|       |    /*
 3874|       |     * message is an ASN.1 SEQUENCE  
 3875|       |     */
 3876|  2.64k|    DEBUGDUMPSECTION("recv", "SNMPv3 Message");
  ------------------
  |  |   81|  2.64k|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.64k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.64k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 2.64k]
  |  |  ------------------
  ------------------
 3877|  2.64k|    data = asn_parse_sequence(data, length, &type,
 3878|  2.64k|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR), "message");
  ------------------
  |  |   84|  2.64k|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR), "message");
  ------------------
  |  |   96|  2.64k|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3879|  2.64k|    if (data == NULL) {
  ------------------
  |  Branch (3879:9): [True: 280, False: 2.36k]
  ------------------
 3880|       |        /*
 3881|       |         * error msg detail is set 
 3882|       |         */
 3883|    280|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|    280|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3884|    280|        DEBUGINDENTLESS();
  ------------------
  |  |   75|    280|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    280|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 280]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 280]
  |  |  ------------------
  ------------------
 3885|    280|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|    280|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3886|    280|    }
 3887|       |
 3888|       |    /*
 3889|       |     * parse msgVersion  
 3890|       |     */
 3891|  2.36k|    DEBUGDUMPHEADER("recv", "SNMP Version Number");
  ------------------
  |  |   79|  2.36k|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.36k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.36k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 2.36k]
  |  |  ------------------
  ------------------
 3892|  2.36k|    data = asn_parse_int(data, length, &type, &ver, sizeof(ver));
 3893|  2.36k|    DEBUGINDENTLESS();
  ------------------
  |  |   75|  2.36k|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.36k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.36k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 2.36k]
  |  |  ------------------
  ------------------
 3894|  2.36k|    if (data == NULL) {
  ------------------
  |  Branch (3894:9): [True: 178, False: 2.18k]
  ------------------
 3895|    178|        ERROR_MSG("bad parse of version");
  ------------------
  |  |  188|    178|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3896|    178|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|    178|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3897|    178|        DEBUGINDENTLESS();
  ------------------
  |  |   75|    178|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    178|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 178]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 178]
  |  |  ------------------
  ------------------
 3898|    178|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|    178|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3899|    178|    }
 3900|  2.18k|    pdu->version = ver;
 3901|       |
 3902|       |    /*
 3903|       |     * parse msgGlobalData sequence  
 3904|       |     */
 3905|  2.18k|    cp = data;
 3906|  2.18k|    asn_len = *length;
 3907|  2.18k|    DEBUGDUMPSECTION("recv", "msgGlobalData");
  ------------------
  |  |   81|  2.18k|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.18k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.18k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 2.18k]
  |  |  ------------------
  ------------------
 3908|  2.18k|    data = asn_parse_sequence(data, &asn_len, &type,
 3909|  2.18k|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   84|  2.18k|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   96|  2.18k|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3910|  2.18k|                              "msgGlobalData");
 3911|  2.18k|    if (data == NULL) {
  ------------------
  |  Branch (3911:9): [True: 1.81k, False: 367]
  ------------------
 3912|       |        /*
 3913|       |         * error msg detail is set 
 3914|       |         */
 3915|  1.81k|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|  1.81k|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3916|  1.81k|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|  1.81k|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  1.81k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1.81k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 1.81k]
  |  |  ------------------
  ------------------
 3917|  1.81k|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|  1.81k|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3918|  1.81k|    }
 3919|    367|    *length -= data - cp;       /* subtract off the length of the header */
 3920|       |
 3921|       |    /*
 3922|       |     * msgID 
 3923|       |     */
 3924|    367|    DEBUGDUMPHEADER("recv", "msgID");
  ------------------
  |  |   79|    367|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    367|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 367]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 367]
  |  |  ------------------
  ------------------
 3925|    367|    data =
 3926|    367|        asn_parse_int(data, length, &type, &pdu->msgid,
 3927|    367|                      sizeof(pdu->msgid));
 3928|    367|    DEBUGINDENTLESS();
  ------------------
  |  |   75|    367|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    367|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 367]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 367]
  |  |  ------------------
  ------------------
 3929|    367|    if (data == NULL || type != ASN_INTEGER) {
  ------------------
  |  |   75|    348|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (3929:9): [True: 19, False: 348]
  |  Branch (3929:25): [True: 0, False: 348]
  ------------------
 3930|     19|        ERROR_MSG("error parsing msgID");
  ------------------
  |  |  188|     19|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3931|     19|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|     19|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     19|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 19]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 19]
  |  |  ------------------
  ------------------
 3932|     19|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|     19|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3933|     19|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|     19|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3934|     19|    }
 3935|       |
 3936|       |    /*
 3937|       |     * Check the msgID we received is a legal value.  If not, then increment
 3938|       |     * snmpInASNParseErrs and return the appropriate error (see RFC 2572,
 3939|       |     * para. 7.2, section 2 -- note that a bad msgID means that the received
 3940|       |     * message is NOT a serialization of an SNMPv3Message, since the msgID
 3941|       |     * field is out of bounds).  
 3942|       |     */
 3943|       |
 3944|    348|    if (pdu->msgid < 0 || pdu->msgid > SNMP_MAX_PACKET_LEN) {
  ------------------
  |  |   49|    304|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  |  Branch (3944:9): [True: 44, False: 304]
  |  Branch (3944:27): [True: 4, False: 300]
  ------------------
 3945|     48|        snmp_log(LOG_ERR, "Received bad msgID (%ld %s %s).\n", pdu->msgid,
 3946|     48|                 (pdu->msgid < 0) ? "<" : ">",
  ------------------
  |  Branch (3946:18): [True: 44, False: 4]
  ------------------
 3947|     48|                 (pdu->msgid < 0) ? "0" : "2^31 - 1");
  ------------------
  |  Branch (3947:18): [True: 44, False: 4]
  ------------------
 3948|     48|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|     48|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3949|     48|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|     48|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     48|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 48]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 48]
  |  |  ------------------
  ------------------
 3950|     48|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|     48|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3951|     48|    }
 3952|       |
 3953|       |    /*
 3954|       |     * msgMaxSize 
 3955|       |     */
 3956|    300|    DEBUGDUMPHEADER("recv:msgMaxSize", "msgMaxSize");
  ------------------
  |  |   79|    300|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    300|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 300]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 300]
  |  |  ------------------
  ------------------
 3957|    300|    data = asn_parse_int(data, length, &type, &pdu->msgMaxSize,
 3958|    300|                         sizeof(pdu->msgMaxSize));
 3959|    300|    DEBUGINDENTLESS();
  ------------------
  |  |   75|    300|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    300|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 300]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 300]
  |  |  ------------------
  ------------------
 3960|    300|    if (data == NULL || type != ASN_INTEGER) {
  ------------------
  |  |   75|    238|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (3960:9): [True: 62, False: 238]
  |  Branch (3960:25): [True: 0, False: 238]
  ------------------
 3961|     62|        ERROR_MSG("error parsing msgMaxSize");
  ------------------
  |  |  188|     62|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3962|     62|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|     62|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3963|     62|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|     62|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     62|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 62]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 62]
  |  |  ------------------
  ------------------
 3964|     62|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|     62|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3965|     62|    }
 3966|       |
 3967|       |    /*
 3968|       |     * Check the msgMaxSize we received is a legal value.  If not, then
 3969|       |     * increment snmpInASNParseErrs and return the appropriate error (see RFC
 3970|       |     * 2572, para. 7.2, section 2 -- note that a bad msgMaxSize means that the
 3971|       |     * received message is NOT a serialization of an SNMPv3Message, since the
 3972|       |     * msgMaxSize field is out of bounds).
 3973|       |     */
 3974|       |
 3975|    238|    if (pdu->msgMaxSize < SNMP_MIN_MAX_LEN) {
  ------------------
  |  |   48|    238|#define SNMP_MIN_MAX_LEN    484 /* minimum maximum message size */
  ------------------
  |  Branch (3975:9): [True: 49, False: 189]
  ------------------
 3976|     49|        snmp_log(LOG_ERR, "Received bad msgMaxSize (%lu < 484).\n",
 3977|     49|                 pdu->msgMaxSize);
 3978|     49|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|     49|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3979|     49|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|     49|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     49|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 49]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 49]
  |  |  ------------------
  ------------------
 3980|     49|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|     49|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3981|    189|    } else if (pdu->msgMaxSize > SNMP_MAX_PACKET_LEN) {
  ------------------
  |  |   49|    189|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  |  Branch (3981:16): [True: 4, False: 185]
  ------------------
 3982|      4|        snmp_log(LOG_ERR, "Received bad msgMaxSize (%lu > 2^31 - 1).\n",
 3983|      4|                 pdu->msgMaxSize);
 3984|      4|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      4|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3985|      4|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|      4|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
 3986|      4|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|      4|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3987|    185|    } else {
 3988|    185|        DEBUGMSGTL(("snmpv3_parse:msgMaxSize", "msgMaxSize %lu received\n",
  ------------------
  |  |   66|    185|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    185|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 185]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 185]
  |  |  ------------------
  ------------------
 3989|    185|                    pdu->msgMaxSize));
 3990|       |        /** don't increase max msg size if we've already got one */
 3991|    185|        if (sess->sndMsgMaxSize < pdu->msgMaxSize) {
  ------------------
  |  Branch (3991:13): [True: 185, False: 0]
  ------------------
 3992|    185|            DEBUGMSGTL(("snmpv3_parse:msgMaxSize",
  ------------------
  |  |   66|    185|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    185|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 185]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 185]
  |  |  ------------------
  ------------------
 3993|    185|                        "msgMaxSize %" NETSNMP_PRIz "d greater than session max %ld; reducing\n",
 3994|    185|                        sess->sndMsgMaxSize, pdu->msgMaxSize));
 3995|    185|            pdu->msgMaxSize = sess->sndMsgMaxSize;
 3996|    185|        }
 3997|    185|    }
 3998|       |
 3999|       |    /*
 4000|       |     * msgFlags 
 4001|       |     */
 4002|    185|    tmp_buf_len = SNMP_MAX_MSG_SIZE;
  ------------------
  |  |  109|    185|#define SNMP_MAX_MSG_SIZE          1472 /* ethernet MTU minus IP/UDP header */
  ------------------
 4003|    185|    DEBUGDUMPHEADER("recv", "msgFlags");
  ------------------
  |  |   79|    185|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    185|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 185]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 185]
  |  |  ------------------
  ------------------
 4004|    185|    data = asn_parse_string(data, length, &type, tmp_buf, &tmp_buf_len);
 4005|    185|    DEBUGINDENTLESS();
  ------------------
  |  |   75|    185|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    185|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 185]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 185]
  |  |  ------------------
  ------------------
 4006|    185|    if (data == NULL || type != ASN_OCTET_STR || tmp_buf_len != 1) {
  ------------------
  |  |   78|    308|#define ASN_OCTET_STR	    0x04U
  ------------------
  |  Branch (4006:9): [True: 62, False: 123]
  |  Branch (4006:25): [True: 4, False: 119]
  |  Branch (4006:50): [True: 15, False: 104]
  ------------------
 4007|     81|        ERROR_MSG("error parsing msgFlags");
  ------------------
  |  |  188|     81|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4008|     81|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|     81|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4009|     81|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|     81|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     81|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 81]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 81]
  |  |  ------------------
  ------------------
 4010|     81|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|     81|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 4011|     81|    }
 4012|    104|    msg_flags = *tmp_buf;
 4013|    104|    if (msg_flags & SNMP_MSG_FLAG_RPRT_BIT)
  ------------------
  |  |  305|    104|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
  |  Branch (4013:9): [True: 63, False: 41]
  ------------------
 4014|     63|        pdu->flags |= SNMP_MSG_FLAG_RPRT_BIT;
  ------------------
  |  |  305|     63|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
 4015|     41|    else
 4016|     41|        pdu->flags &= (~SNMP_MSG_FLAG_RPRT_BIT);
  ------------------
  |  |  305|     41|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
 4017|       |
 4018|       |    /*
 4019|       |     * msgSecurityModel 
 4020|       |     */
 4021|    104|    DEBUGDUMPHEADER("recv", "msgSecurityModel");
  ------------------
  |  |   79|    104|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    104|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 104]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 104]
  |  |  ------------------
  ------------------
 4022|    104|    data = asn_parse_int(data, length, &type, &msg_sec_model,
 4023|    104|                         sizeof(msg_sec_model));
 4024|    104|    DEBUGINDENTADD(-4);         /* return from global data indent */
  ------------------
  |  |   73|    104|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    104|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 104]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 104]
  |  |  ------------------
  ------------------
 4025|    104|    if (data == NULL || type != ASN_INTEGER ||
  ------------------
  |  |   75|    204|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (4025:9): [True: 4, False: 100]
  |  Branch (4025:25): [True: 0, False: 100]
  ------------------
 4026|    100|        msg_sec_model < 1 || msg_sec_model > 0x7fffffff) {
  ------------------
  |  Branch (4026:9): [True: 40, False: 60]
  |  Branch (4026:30): [True: 2, False: 58]
  ------------------
 4027|     46|        ERROR_MSG("error parsing msgSecurityModel");
  ------------------
  |  |  188|     46|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4028|     46|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|     46|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4029|     46|        DEBUGINDENTLESS();
  ------------------
  |  |   75|     46|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     46|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 46]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 46]
  |  |  ------------------
  ------------------
 4030|     46|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|     46|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 4031|     46|    }
 4032|     58|    sptr = find_sec_mod(msg_sec_model);
 4033|     58|    if (!sptr) {
  ------------------
  |  Branch (4033:9): [True: 58, False: 0]
  ------------------
 4034|     58|        snmp_log(LOG_WARNING, "unknown security model: %ld\n",
 4035|     58|                 msg_sec_model);
 4036|     58|        snmp_increment_statistic(STAT_SNMPUNKNOWNSECURITYMODELS);
  ------------------
  |  |  611|     58|#define   STAT_SNMPUNKNOWNSECURITYMODELS     0
  ------------------
 4037|     58|        DEBUGINDENTLESS();
  ------------------
  |  |   75|     58|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     58|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 58]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 58]
  |  |  ------------------
  ------------------
 4038|     58|        return SNMPERR_UNKNOWN_SEC_MODEL;
  ------------------
  |  |  214|     58|#define SNMPERR_UNKNOWN_SEC_MODEL 	(-30)
  ------------------
 4039|     58|    }
 4040|      0|    pdu->securityModel = msg_sec_model;
 4041|       |
 4042|      0|    if (msg_flags & SNMP_MSG_FLAG_PRIV_BIT &&
  ------------------
  |  |  304|      0|#define SNMP_MSG_FLAG_PRIV_BIT          0x02
  ------------------
  |  Branch (4042:9): [True: 0, False: 0]
  ------------------
 4043|      0|        !(msg_flags & SNMP_MSG_FLAG_AUTH_BIT)) {
  ------------------
  |  |  303|      0|#define SNMP_MSG_FLAG_AUTH_BIT          0x01
  ------------------
  |  Branch (4043:9): [True: 0, False: 0]
  ------------------
 4044|      0|        ERROR_MSG("invalid message, illegal msgFlags");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4045|      0|        snmp_increment_statistic(STAT_SNMPINVALIDMSGS);
  ------------------
  |  |  612|      0|#define   STAT_SNMPINVALIDMSGS               1
  ------------------
 4046|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4047|      0|        return SNMPERR_INVALID_MSG;
  ------------------
  |  |  215|      0|#define SNMPERR_INVALID_MSG             (-31)
  ------------------
 4048|      0|    }
 4049|      0|    pdu->securityLevel = ((msg_flags & SNMP_MSG_FLAG_AUTH_BIT)
  ------------------
  |  |  303|      0|#define SNMP_MSG_FLAG_AUTH_BIT          0x01
  ------------------
  |  Branch (4049:27): [True: 0, False: 0]
  ------------------
 4050|      0|                          ? ((msg_flags & SNMP_MSG_FLAG_PRIV_BIT)
  ------------------
  |  |  304|      0|#define SNMP_MSG_FLAG_PRIV_BIT          0x02
  ------------------
  |  Branch (4050:30): [True: 0, False: 0]
  ------------------
 4051|      0|                             ? SNMP_SEC_LEVEL_AUTHPRIV
  ------------------
  |  |  301|      0|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
 4052|      0|                             : SNMP_SEC_LEVEL_AUTHNOPRIV)
  ------------------
  |  |  300|      0|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
 4053|      0|                          : SNMP_SEC_LEVEL_NOAUTH);
  ------------------
  |  |  299|      0|#define SNMP_SEC_LEVEL_NOAUTH		1
  ------------------
 4054|       |    /*
 4055|       |     * end of msgGlobalData 
 4056|       |     */
 4057|       |
 4058|       |    /*
 4059|       |     * securtityParameters OCTET STRING begins after msgGlobalData 
 4060|       |     */
 4061|      0|    sec_params = data;
 4062|      0|    pdu->contextEngineID = calloc(1, SNMP_MAX_ENG_SIZE);
  ------------------
  |  |  111|      0|#define SNMP_MAX_ENG_SIZE          32
  ------------------
 4063|      0|    pdu->contextEngineIDLen = SNMP_MAX_ENG_SIZE;
  ------------------
  |  |  111|      0|#define SNMP_MAX_ENG_SIZE          32
  ------------------
 4064|       |
 4065|       |    /*
 4066|       |     * Note: there is no length limit on the msgAuthoritativeEngineID field,
 4067|       |     * although we would EXPECT it to be limited to 32 (the SnmpEngineID TC
 4068|       |     * limit).  We'll use double that here to be on the safe side.  
 4069|       |     */
 4070|       |
 4071|      0|    pdu->securityEngineID = calloc(1, SNMP_MAX_ENG_SIZE * 2);
  ------------------
  |  |  111|      0|#define SNMP_MAX_ENG_SIZE          32
  ------------------
 4072|      0|    pdu->securityEngineIDLen = SNMP_MAX_ENG_SIZE * 2;
  ------------------
  |  |  111|      0|#define SNMP_MAX_ENG_SIZE          32
  ------------------
 4073|      0|    pdu->securityName = calloc(1, SNMP_MAX_SEC_NAME_SIZE);
  ------------------
  |  |  112|      0|#define SNMP_MAX_SEC_NAME_SIZE     256
  ------------------
 4074|      0|    pdu->securityNameLen = SNMP_MAX_SEC_NAME_SIZE;
  ------------------
  |  |  112|      0|#define SNMP_MAX_SEC_NAME_SIZE     256
  ------------------
 4075|       |
 4076|      0|    if ((pdu->securityName == NULL) ||
  ------------------
  |  Branch (4076:9): [True: 0, False: 0]
  ------------------
 4077|      0|        (pdu->securityEngineID == NULL) ||
  ------------------
  |  Branch (4077:9): [True: 0, False: 0]
  ------------------
 4078|      0|        (pdu->contextEngineID == NULL)) {
  ------------------
  |  Branch (4078:9): [True: 0, False: 0]
  ------------------
 4079|      0|        return SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 4080|      0|    }
 4081|       |
 4082|      0|    if (pdu_buf_len < msg_len
  ------------------
  |  Branch (4082:9): [True: 0, False: 0]
  ------------------
 4083|      0|        && pdu->securityLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|      0|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (4083:12): [True: 0, False: 0]
  ------------------
 4084|       |        /*
 4085|       |         * space needed is larger than we have in the default buffer 
 4086|       |         */
 4087|      0|        mallocbuf = calloc(1, msg_len);
 4088|      0|        pdu_buf_len = msg_len;
 4089|      0|        cp = mallocbuf;
 4090|      0|    } else {
 4091|      0|        memset(pdu_buf, 0, pdu_buf_len);
 4092|      0|        cp = pdu_buf;
 4093|      0|    }
 4094|       |
 4095|      0|    DEBUGDUMPSECTION("recv", "SM msgSecurityParameters");
  ------------------
  |  |   81|      0|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4096|      0|    if (sptr->decode) {
  ------------------
  |  Branch (4096:9): [True: 0, False: 0]
  ------------------
 4097|      0|        struct snmp_secmod_incoming_params parms;
 4098|      0|        parms.msgProcModel = pdu->msgParseModel;
 4099|      0|        parms.maxMsgSize = pdu->msgMaxSize;
 4100|      0|        parms.secParams = sec_params;
 4101|      0|        parms.secModel = msg_sec_model;
 4102|      0|        parms.secLevel = pdu->securityLevel;
 4103|      0|        parms.wholeMsg = msg_data;
 4104|      0|        parms.wholeMsgLen = msg_len;
 4105|      0|        parms.secEngineID = pdu->securityEngineID;
 4106|      0|        parms.secEngineIDLen = &pdu->securityEngineIDLen;
 4107|      0|        parms.secName = pdu->securityName;
 4108|      0|        parms.secNameLen = &pdu->securityNameLen;
 4109|      0|        parms.scopedPdu = &cp;
 4110|      0|        parms.scopedPduLen = &pdu_buf_len;
 4111|      0|        parms.maxSizeResponse = &max_size_response;
 4112|      0|        parms.secStateRef = &pdu->securityStateRef;
 4113|      0|        parms.sess = sess;
 4114|      0|        parms.pdu = pdu;
 4115|      0|        parms.msg_flags = msg_flags;
 4116|      0|        ret_val = (*sptr->decode) (&parms);
 4117|      0|    } else {
 4118|      0|        SNMP_FREE(mallocbuf);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4119|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4120|      0|        snmp_log(LOG_WARNING, "security service %ld can't decode packets\n",
 4121|      0|                 msg_sec_model);
 4122|      0|        return (-1);
 4123|      0|    }
 4124|       |
 4125|      0|    if (ret_val != SNMPERR_SUCCESS) {
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (4125:9): [True: 0, False: 0]
  ------------------
 4126|      0|        DEBUGDUMPSECTION("recv", "ScopedPDU");
  ------------------
  |  |   81|      0|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4127|       |        /*
 4128|       |         * Parse as much as possible -- though I don't see the point? [jbpn].  
 4129|       |         */
 4130|      0|        if (cp) {
  ------------------
  |  Branch (4130:13): [True: 0, False: 0]
  ------------------
 4131|      0|            cp = snmpv3_scopedPDU_parse(pdu, cp, &pdu_buf_len);
 4132|      0|        }
 4133|      0|        if (cp) {
  ------------------
  |  Branch (4133:13): [True: 0, False: 0]
  ------------------
 4134|      0|            DEBUGPRINTPDUTYPE("recv", *cp);
  ------------------
  |  |  440|      0|    DEBUGDUMPSECTION(token, snmp_pdu_type(type))
  |  |  ------------------
  |  |  |  |   81|      0|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (81:56): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4135|      0|            snmp_pdu_parse(pdu, cp, &pdu_buf_len);
 4136|      0|            DEBUGINDENTADD(-8);
  ------------------
  |  |   73|      0|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4137|      0|        } else {
 4138|      0|            DEBUGINDENTADD(-4);
  ------------------
  |  |   73|      0|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4139|      0|        }
 4140|       |
 4141|      0|        SNMP_FREE(mallocbuf);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4142|      0|        return ret_val;
 4143|      0|    }
 4144|       |
 4145|       |    /*
 4146|       |     * parse plaintext ScopedPDU sequence 
 4147|       |     */
 4148|      0|    *length = pdu_buf_len;
 4149|      0|    DEBUGDUMPSECTION("recv", "ScopedPDU");
  ------------------
  |  |   81|      0|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4150|      0|    data = snmpv3_scopedPDU_parse(pdu, cp, length);
 4151|      0|    if (data == NULL) {
  ------------------
  |  Branch (4151:9): [True: 0, False: 0]
  ------------------
 4152|      0|        snmp_log(LOG_WARNING, "security service %ld error parsing ScopedPDU\n",
 4153|      0|                 msg_sec_model);
 4154|      0|        ERROR_MSG("error parsing PDU");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4155|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4156|      0|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|      0|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4157|      0|        SNMP_FREE(mallocbuf);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4158|      0|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 4159|      0|    }
 4160|       |
 4161|       |    /*
 4162|       |     * parse the PDU.  
 4163|       |     */
 4164|      0|    if (after_header != NULL) {
  ------------------
  |  Branch (4164:9): [True: 0, False: 0]
  ------------------
 4165|      0|        *after_header = data;
 4166|      0|        tmp_buf_len = *length;
 4167|      0|    }
 4168|       |
 4169|      0|    DEBUGPRINTPDUTYPE("recv", *data);
  ------------------
  |  |  440|      0|    DEBUGDUMPSECTION(token, snmp_pdu_type(type))
  |  |  ------------------
  |  |  |  |   81|      0|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (81:56): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4170|      0|    ret = snmp_pdu_parse(pdu, data, length);
 4171|      0|    DEBUGINDENTADD(-8);
  ------------------
  |  |   73|      0|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4172|       |
 4173|      0|    if (after_header != NULL) {
  ------------------
  |  Branch (4173:9): [True: 0, False: 0]
  ------------------
 4174|      0|        *length = tmp_buf_len;
 4175|      0|    }
 4176|       |
 4177|      0|    if (ret != SNMPERR_SUCCESS) {
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (4177:9): [True: 0, False: 0]
  ------------------
 4178|      0|        snmp_log(LOG_WARNING, "security service %ld error parsing ScopedPDU\n",
 4179|      0|                 msg_sec_model);
 4180|      0|        ERROR_MSG("error parsing PDU");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4181|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4182|      0|        SNMP_FREE(mallocbuf);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4183|      0|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 4184|      0|    }
 4185|       |
 4186|      0|    SNMP_FREE(mallocbuf);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4187|      0|    return SNMPERR_SUCCESS;
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 4188|      0|}                               /* end snmpv3_parse() */
snmp_parse:
 4714|  2.64k|{
 4715|  2.64k|    int             rc;
 4716|       |
 4717|  2.64k|    rc = _snmp_parse(slp, pss, pdu, data, length);
 4718|  2.64k|    if (rc) {
  ------------------
  |  Branch (4718:9): [True: 2.49k, False: 150]
  ------------------
 4719|  2.49k|        if (!pss->s_snmp_errno) {
  ------------------
  |  Branch (4719:13): [True: 2.41k, False: 78]
  ------------------
 4720|  2.41k|            pss->s_snmp_errno = SNMPERR_BAD_PARSE;
  ------------------
  |  |  197|  2.41k|#define SNMPERR_BAD_PARSE		(-13)
  ------------------
 4721|  2.41k|        }
 4722|  2.49k|        SET_SNMP_ERROR(pss->s_snmp_errno);
  ------------------
  |  |   43|  2.49k|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 4723|  2.49k|    }
 4724|       |
 4725|  2.64k|    return rc;
 4726|  2.64k|}
snmp_pdu_parse:
 4730|  1.40k|{
 4731|  1.40k|    u_char          type;
 4732|  1.40k|    u_char          msg_type;
 4733|  1.40k|    u_char         *var_val;
 4734|  1.40k|    size_t          len;
 4735|  1.40k|    size_t          four;
 4736|  1.40k|    netsnmp_variable_list *vp = NULL, *vplast = NULL;
 4737|  1.40k|    oid             objid[MAX_OID_LEN];
 4738|  1.40k|    u_char         *p;
 4739|       |
 4740|       |    /*
 4741|       |     * Get the PDU type 
 4742|       |     */
 4743|  1.40k|    data = asn_parse_header(data, length, &msg_type);
 4744|  1.40k|    if (data == NULL)
  ------------------
  |  Branch (4744:9): [True: 20, False: 1.38k]
  ------------------
 4745|     20|        return -1;
 4746|  1.38k|    DEBUGMSGTL(("dumpv_recv","    Command %s\n", snmp_pdu_type(msg_type)));
  ------------------
  |  |   66|  1.38k|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  1.38k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1.38k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 1.38k]
  |  |  ------------------
  ------------------
 4747|  1.38k|    pdu->command = msg_type;
 4748|  1.38k|    pdu->flags &= (~UCD_MSG_FLAG_RESPONSE_PDU);
  ------------------
  |  |  311|  1.38k|#define UCD_MSG_FLAG_RESPONSE_PDU            0x100
  ------------------
 4749|       |
 4750|       |    /*
 4751|       |     * get the fields in the PDU preceding the variable-bindings sequence
 4752|       |     */
 4753|  1.38k|    switch (pdu->command) {
 4754|  1.07k|    case SNMP_MSG_TRAP:
  ------------------
  |  |  135|  1.07k|#define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   92|  1.07k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   96|  1.07k|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4754:5): [True: 1.07k, False: 306]
  ------------------
 4755|       |        /*
 4756|       |         * enterprise 
 4757|       |         */
 4758|  1.07k|        pdu->enterprise_length = MAX_OID_LEN;
  ------------------
  |  |  120|  1.07k|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
 4759|  1.07k|        data = asn_parse_objid(data, length, &type, objid,
 4760|  1.07k|                               &pdu->enterprise_length);
 4761|  1.07k|        if (data == NULL)
  ------------------
  |  Branch (4761:13): [True: 209, False: 867]
  ------------------
 4762|    209|            return -1;
 4763|    867|        pdu->enterprise = netsnmp_memdup(objid,
 4764|    867|                                         pdu->enterprise_length * sizeof(oid));
 4765|    867|        if (pdu->enterprise == NULL) {
  ------------------
  |  Branch (4765:13): [True: 0, False: 867]
  ------------------
 4766|      0|            return -1;
 4767|      0|        }
 4768|       |
 4769|       |        /*
 4770|       |         * agent-addr 
 4771|       |         */
 4772|    867|        four = 4;
 4773|    867|        data = asn_parse_string(data, length, &type,
 4774|    867|                                (u_char *) pdu->agent_addr, &four);
 4775|    867|        if (data == NULL)
  ------------------
  |  Branch (4775:13): [True: 121, False: 746]
  ------------------
 4776|    121|            return -1;
 4777|       |
 4778|       |        /*
 4779|       |         * generic trap 
 4780|       |         */
 4781|    746|        data = asn_parse_int(data, length, &type, (long *) &pdu->trap_type,
 4782|    746|                             sizeof(pdu->trap_type));
 4783|    746|        if (data == NULL)
  ------------------
  |  Branch (4783:13): [True: 5, False: 741]
  ------------------
 4784|      5|            return -1;
 4785|       |        /*
 4786|       |         * specific trap 
 4787|       |         */
 4788|    741|        data =
 4789|    741|            asn_parse_int(data, length, &type,
 4790|    741|                          (long *) &pdu->specific_type,
 4791|    741|                          sizeof(pdu->specific_type));
 4792|    741|        if (data == NULL)
  ------------------
  |  Branch (4792:13): [True: 3, False: 738]
  ------------------
 4793|      3|            return -1;
 4794|       |
 4795|       |        /*
 4796|       |         * timestamp  
 4797|       |         */
 4798|    738|        data = asn_parse_unsigned_int(data, length, &type, &pdu->time,
 4799|    738|                                      sizeof(pdu->time));
 4800|    738|        if (data == NULL)
  ------------------
  |  Branch (4800:13): [True: 180, False: 558]
  ------------------
 4801|    180|            return -1;
 4802|       |
 4803|    558|        break;
 4804|       |
 4805|    558|    case SNMP_MSG_RESPONSE:
  ------------------
  |  |  127|     25|#define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   92|     25|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   96|     25|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4805:5): [True: 25, False: 1.35k]
  ------------------
 4806|     50|    case SNMP_MSG_REPORT:
  ------------------
  |  |  147|     50|#define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   92|     50|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   96|     50|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4806:5): [True: 25, False: 1.35k]
  ------------------
 4807|     50|        pdu->flags |= UCD_MSG_FLAG_RESPONSE_PDU;
  ------------------
  |  |  311|     50|#define UCD_MSG_FLAG_RESPONSE_PDU            0x100
  ------------------
 4808|     50|        NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2414|     50|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 4809|       |
 4810|     81|    case SNMP_MSG_TRAP2:
  ------------------
  |  |  142|     81|#define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   92|     81|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   96|     81|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4810:5): [True: 31, False: 1.35k]
  ------------------
 4811|    126|    case SNMP_MSG_INFORM:
  ------------------
  |  |  141|    126|#define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   92|    126|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   96|    126|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4811:5): [True: 45, False: 1.33k]
  ------------------
 4812|    126|#ifndef NETSNMP_NOTIFY_ONLY
 4813|    158|    case SNMP_MSG_GET:
  ------------------
  |  |  125|    158|#define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  ------------------
  |  |  |  |   92|    158|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  ------------------
  |  |  |  |   96|    158|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4813:5): [True: 32, False: 1.35k]
  ------------------
 4814|    190|    case SNMP_MSG_GETNEXT:
  ------------------
  |  |  126|    190|#define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   92|    190|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   96|    190|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4814:5): [True: 32, False: 1.35k]
  ------------------
 4815|    248|    case SNMP_MSG_GETBULK:
  ------------------
  |  |  140|    248|#define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  ------------------
  |  |  |  |   92|    248|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  ------------------
  |  |  |  |   96|    248|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4815:5): [True: 58, False: 1.32k]
  ------------------
 4816|    248|#endif /* ! NETSNMP_NOTIFY_ONLY */
 4817|    248|#ifndef NETSNMP_NO_WRITE_SUPPORT
 4818|    299|    case SNMP_MSG_SET:
  ------------------
  |  |  129|    299|#define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  ------------------
  |  |  |  |   92|    299|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  ------------------
  |  |  |  |   96|    299|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4818:5): [True: 51, False: 1.33k]
  ------------------
 4819|    299|#endif /* !NETSNMP_NO_WRITE_SUPPORT */
 4820|       |        /*
 4821|       |         * PDU is not an SNMPv1 TRAP 
 4822|       |         */
 4823|       |
 4824|       |        /*
 4825|       |         * request id 
 4826|       |         */
 4827|    299|        DEBUGDUMPHEADER("recv", "request_id");
  ------------------
  |  |   79|    299|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    299|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 299]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 299]
  |  |  ------------------
  ------------------
 4828|    299|        data = asn_parse_int(data, length, &type, &pdu->reqid,
 4829|    299|                             sizeof(pdu->reqid));
 4830|    299|        DEBUGINDENTLESS();
  ------------------
  |  |   75|    299|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    299|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 299]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 299]
  |  |  ------------------
  ------------------
 4831|    299|        if (data == NULL) {
  ------------------
  |  Branch (4831:13): [True: 14, False: 285]
  ------------------
 4832|     14|            return -1;
 4833|     14|        }
 4834|       |
 4835|       |        /*
 4836|       |         * error status (getbulk non-repeaters) 
 4837|       |         */
 4838|    285|        DEBUGDUMPHEADER("recv", "error status");
  ------------------
  |  |   79|    285|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    285|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 285]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 285]
  |  |  ------------------
  ------------------
 4839|    285|        data = asn_parse_int(data, length, &type, &pdu->errstat,
 4840|    285|                             sizeof(pdu->errstat));
 4841|    285|        DEBUGINDENTLESS();
  ------------------
  |  |   75|    285|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    285|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 285]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 285]
  |  |  ------------------
  ------------------
 4842|    285|        if (data == NULL) {
  ------------------
  |  Branch (4842:13): [True: 2, False: 283]
  ------------------
 4843|      2|            return -1;
 4844|      2|        }
 4845|       |
 4846|       |        /*
 4847|       |         * error index (getbulk max-repetitions) 
 4848|       |         */
 4849|    283|        DEBUGDUMPHEADER("recv", "error index");
  ------------------
  |  |   79|    283|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    283|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 283]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 283]
  |  |  ------------------
  ------------------
 4850|    283|        data = asn_parse_int(data, length, &type, &pdu->errindex,
 4851|    283|                             sizeof(pdu->errindex));
 4852|    283|        DEBUGINDENTLESS();
  ------------------
  |  |   75|    283|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    283|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 283]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 283]
  |  |  ------------------
  ------------------
 4853|    283|        if (data == NULL) {
  ------------------
  |  Branch (4853:13): [True: 1, False: 282]
  ------------------
 4854|      1|            return -1;
 4855|      1|        }
 4856|    282|	break;
 4857|       |
 4858|    282|    default:
  ------------------
  |  Branch (4858:5): [True: 7, False: 1.37k]
  ------------------
 4859|      7|        snmp_log(LOG_ERR, "Bad PDU type received: 0x%.2x\n", pdu->command);
 4860|      7|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      7|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4861|      7|        return -1;
 4862|  1.38k|    }
 4863|       |
 4864|       |    /*
 4865|       |     * get header for variable-bindings sequence 
 4866|       |     */
 4867|    840|    DEBUGDUMPSECTION("recv", "VarBindList");
  ------------------
  |  |   81|    840|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    840|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 840]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 840]
  |  |  ------------------
  ------------------
 4868|    840|    data = asn_parse_sequence(data, length, &type,
 4869|    840|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   84|    840|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   96|    840|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 4870|    840|                              "varbinds");
 4871|    840|    if (data == NULL)
  ------------------
  |  Branch (4871:9): [True: 119, False: 721]
  ------------------
 4872|    119|        goto fail;
 4873|       |
 4874|       |    /*
 4875|       |     * get each varBind sequence 
 4876|       |     */
 4877|  17.8k|    while ((int) *length > 0) {
  ------------------
  |  Branch (4877:12): [True: 17.6k, False: 150]
  ------------------
 4878|  17.6k|        vp = SNMP_MALLOC_TYPEDEF(netsnmp_variable_list);
  ------------------
  |  |   73|  17.6k|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
 4879|  17.6k|        if (NULL == vp)
  ------------------
  |  Branch (4879:13): [True: 0, False: 17.6k]
  ------------------
 4880|      0|            goto fail;
 4881|       |
 4882|  17.6k|        vp->name_length = MAX_OID_LEN;
  ------------------
  |  |  120|  17.6k|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
 4883|  17.6k|        DEBUGDUMPSECTION("recv", "VarBind");
  ------------------
  |  |   81|  17.6k|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  17.6k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 17.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 17.6k]
  |  |  ------------------
  ------------------
 4884|  17.6k|        data = snmp_parse_var_op(data, objid, &vp->name_length, &vp->type,
 4885|  17.6k|                                 &vp->val_len, &var_val, length);
 4886|  17.6k|        if (data == NULL)
  ------------------
  |  Branch (4886:13): [True: 356, False: 17.3k]
  ------------------
 4887|    356|            goto fail;
 4888|  17.3k|        if (snmp_set_var_objid(vp, objid, vp->name_length))
  ------------------
  |  Branch (4888:13): [True: 0, False: 17.3k]
  ------------------
 4889|      0|            goto fail;
 4890|       |
 4891|  17.3k|        len = SNMP_MAX_PACKET_LEN;
  ------------------
  |  |   49|  17.3k|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
 4892|  17.3k|        DEBUGDUMPHEADER("recv", "Value");
  ------------------
  |  |   79|  17.3k|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  17.3k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 17.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 17.3k]
  |  |  ------------------
  ------------------
 4893|  17.3k|        switch ((short) vp->type) {
 4894|  1.55k|        case ASN_INTEGER:
  ------------------
  |  |   75|  1.55k|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (4894:9): [True: 1.55k, False: 15.7k]
  ------------------
 4895|  1.55k|            vp->val.integer = (long *) vp->buf;
 4896|  1.55k|            vp->val_len = sizeof(long);
 4897|  1.55k|            p = asn_parse_int(var_val, &len, &vp->type,
 4898|  1.55k|                          (long *) vp->val.integer,
 4899|  1.55k|                          sizeof(*vp->val.integer));
 4900|  1.55k|            if (!p)
  ------------------
  |  Branch (4900:17): [True: 4, False: 1.54k]
  ------------------
 4901|      4|                goto fail;
 4902|  1.54k|            break;
 4903|  1.54k|        case ASN_COUNTER:
  ------------------
  |  |   89|  1.03k|#define ASN_COUNTER	(ASN_APPLICATION | 1)
  |  |  ------------------
  |  |  |  |   91|  1.03k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4903:9): [True: 1.03k, False: 16.3k]
  ------------------
 4904|  1.64k|        case ASN_GAUGE:
  ------------------
  |  |   90|  1.64k|#define ASN_GAUGE	(ASN_APPLICATION | 2)
  |  |  ------------------
  |  |  |  |   91|  1.64k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4904:9): [True: 612, False: 16.7k]
  ------------------
 4905|  2.21k|        case ASN_TIMETICKS:
  ------------------
  |  |   92|  2.21k|#define ASN_TIMETICKS   (ASN_APPLICATION | 3)
  |  |  ------------------
  |  |  |  |   91|  2.21k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4905:9): [True: 570, False: 16.7k]
  ------------------
 4906|  2.81k|        case ASN_UINTEGER:
  ------------------
  |  |  100|  2.81k|#define ASN_UINTEGER    (ASN_APPLICATION | 7)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|  2.81k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4906:9): [True: 601, False: 16.7k]
  ------------------
 4907|  2.81k|            vp->val.integer = (long *) vp->buf;
 4908|  2.81k|            vp->val_len = sizeof(u_long);
 4909|  2.81k|            p = asn_parse_unsigned_int(var_val, &len, &vp->type,
 4910|  2.81k|                                   (u_long *) vp->val.integer,
 4911|  2.81k|                                   vp->val_len);
 4912|  2.81k|            if (!p)
  ------------------
  |  Branch (4912:17): [True: 18, False: 2.79k]
  ------------------
 4913|     18|                goto fail;
 4914|  2.79k|            break;
 4915|  2.79k|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 4916|  2.79k|        case ASN_OPAQUE_COUNTER64:
  ------------------
  |  |  156|    808|#define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  136|    808|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  146|    808|#define ASN_APP_COUNTER64 (ASN_APPLICATION | 6)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    808|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4916:9): [True: 808, False: 16.5k]
  ------------------
 4917|  1.66k|        case ASN_OPAQUE_U64:
  ------------------
  |  |  192|  1.66k|#define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  136|  1.66k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  150|  1.66k|#define ASN_APP_U64 (ASN_APPLICATION | 11)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.66k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4917:9): [True: 859, False: 16.4k]
  ------------------
 4918|  1.66k|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 4919|  3.14k|        case ASN_COUNTER64:
  ------------------
  |  |   99|  3.14k|#define ASN_COUNTER64   (ASN_APPLICATION | 6)
  |  |  ------------------
  |  |  |  |   91|  3.14k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4919:9): [True: 1.48k, False: 15.8k]
  ------------------
 4920|  3.14k|            vp->val.counter64 = (struct counter64 *) vp->buf;
 4921|  3.14k|            vp->val_len = sizeof(struct counter64);
 4922|  3.14k|            p = asn_parse_unsigned_int64(var_val, &len, &vp->type,
 4923|  3.14k|                                     (struct counter64 *) vp->val.
 4924|  3.14k|                                     counter64, vp->val_len);
 4925|  3.14k|            if (!p)
  ------------------
  |  Branch (4925:17): [True: 44, False: 3.10k]
  ------------------
 4926|     44|                goto fail;
 4927|  3.10k|            break;
 4928|  3.10k|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 4929|  3.10k|        case ASN_OPAQUE_FLOAT:
  ------------------
  |  |  165|    867|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|    867|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|    867|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    867|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4929:9): [True: 867, False: 16.4k]
  ------------------
 4930|    867|            vp->val.floatVal = (float *) vp->buf;
 4931|    867|            vp->val_len = sizeof(float);
 4932|    867|            p = asn_parse_float(var_val, &len, &vp->type,
 4933|    867|                            vp->val.floatVal, vp->val_len);
 4934|    867|            if (!p)
  ------------------
  |  Branch (4934:17): [True: 38, False: 829]
  ------------------
 4935|     38|                goto fail;
 4936|    829|            break;
 4937|    829|        case ASN_OPAQUE_DOUBLE:
  ------------------
  |  |  174|    819|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|    819|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|    819|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    819|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4937:9): [True: 819, False: 16.5k]
  ------------------
 4938|    819|            vp->val.doubleVal = (double *) vp->buf;
 4939|    819|            vp->val_len = sizeof(double);
 4940|    819|            p = asn_parse_double(var_val, &len, &vp->type,
 4941|    819|                             vp->val.doubleVal, vp->val_len);
 4942|    819|            if (!p)
  ------------------
  |  Branch (4942:17): [True: 44, False: 775]
  ------------------
 4943|     44|                goto fail;
 4944|    775|            break;
 4945|  1.22k|        case ASN_OPAQUE_I64:
  ------------------
  |  |  183|  1.22k|#define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  136|  1.22k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  149|  1.22k|#define ASN_APP_I64 (ASN_APPLICATION | 10)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.22k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4945:9): [True: 1.22k, False: 16.1k]
  ------------------
 4946|  1.22k|            vp->val.counter64 = (struct counter64 *) vp->buf;
 4947|  1.22k|            vp->val_len = sizeof(struct counter64);
 4948|  1.22k|            p = asn_parse_signed_int64(var_val, &len, &vp->type,
 4949|  1.22k|                                   (struct counter64 *) vp->val.counter64,
 4950|  1.22k|                                   sizeof(*vp->val.counter64));
 4951|       |
 4952|  1.22k|            if (!p)
  ------------------
  |  Branch (4952:17): [True: 45, False: 1.18k]
  ------------------
 4953|     45|                goto fail;
 4954|  1.18k|            break;
 4955|  1.18k|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 4956|  1.18k|        case ASN_IPADDRESS:
  ------------------
  |  |   88|    249|#define ASN_IPADDRESS   (ASN_APPLICATION | 0)
  |  |  ------------------
  |  |  |  |   91|    249|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4956:9): [True: 249, False: 17.0k]
  ------------------
 4957|    249|            if (vp->val_len != 4)
  ------------------
  |  Branch (4957:17): [True: 1, False: 248]
  ------------------
 4958|      1|                goto fail;
 4959|    248|            NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2414|    248|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 4960|  1.10k|        case ASN_OCTET_STR:
  ------------------
  |  |   78|  1.10k|#define ASN_OCTET_STR	    0x04U
  ------------------
  |  Branch (4960:9): [True: 859, False: 16.4k]
  ------------------
 4961|  2.56k|        case ASN_OPAQUE:
  ------------------
  |  |   93|  2.56k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  2.56k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4961:9): [True: 1.46k, False: 15.8k]
  ------------------
 4962|  3.22k|        case ASN_NSAP:
  ------------------
  |  |   98|  3.22k|#define ASN_NSAP	(ASN_APPLICATION | 5)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|  3.22k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4962:9): [True: 653, False: 16.6k]
  ------------------
 4963|  3.22k|            if (vp->val_len < sizeof(vp->buf)) {
  ------------------
  |  Branch (4963:17): [True: 2.92k, False: 296]
  ------------------
 4964|  2.92k|                vp->val.string = (u_char *) vp->buf;
 4965|  2.92k|            } else {
 4966|    296|                vp->val.string = (u_char *) malloc(vp->val_len);
 4967|    296|            }
 4968|  3.22k|            if (vp->val.string == NULL) {
  ------------------
  |  Branch (4968:17): [True: 0, False: 3.22k]
  ------------------
 4969|      0|                goto fail;
 4970|      0|            }
 4971|  3.22k|            p = asn_parse_string(var_val, &len, &vp->type, vp->val.string,
 4972|  3.22k|                             &vp->val_len);
 4973|  3.22k|            if (!p)
  ------------------
  |  Branch (4973:17): [True: 0, False: 3.22k]
  ------------------
 4974|      0|                goto fail;
 4975|  3.22k|            break;
 4976|  3.22k|        case ASN_OBJECT_ID:
  ------------------
  |  |   81|    820|#define ASN_OBJECT_ID	    0x06U
  ------------------
  |  Branch (4976:9): [True: 820, False: 16.5k]
  ------------------
 4977|    820|            vp->val_len = MAX_OID_LEN;
  ------------------
  |  |  120|    820|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
 4978|    820|            p = asn_parse_objid(var_val, &len, &vp->type, objid, &vp->val_len);
 4979|    820|            if (!p)
  ------------------
  |  Branch (4979:17): [True: 3, False: 817]
  ------------------
 4980|      3|                goto fail;
 4981|    817|            vp->val_len *= sizeof(oid);
 4982|    817|            vp->val.objid = netsnmp_memdup(objid, vp->val_len);
 4983|    817|            if (vp->val.objid == NULL)
  ------------------
  |  Branch (4983:17): [True: 0, False: 817]
  ------------------
 4984|      0|                goto fail;
 4985|    817|            break;
 4986|    817|        case SNMP_NOSUCHOBJECT:
  ------------------
  |  |  201|    325|#define SNMP_NOSUCHOBJECT    (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) /* 80=128 */
  |  |  ------------------
  |  |  |  |   92|    325|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_NOSUCHOBJECT    (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) /* 80=128 */
  |  |  ------------------
  |  |  |  |   95|    325|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (4986:9): [True: 325, False: 17.0k]
  ------------------
 4987|  1.06k|        case SNMP_NOSUCHINSTANCE:
  ------------------
  |  |  202|  1.06k|#define SNMP_NOSUCHINSTANCE  (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* 81=129 */
  |  |  ------------------
  |  |  |  |   92|  1.06k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_NOSUCHINSTANCE  (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* 81=129 */
  |  |  ------------------
  |  |  |  |   95|  1.06k|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (4987:9): [True: 744, False: 16.5k]
  ------------------
 4988|  1.45k|        case SNMP_ENDOFMIBVIEW:
  ------------------
  |  |  203|  1.45k|#define SNMP_ENDOFMIBVIEW    (ASN_CONTEXT | ASN_PRIMITIVE | 0x2) /* 82=130 */
  |  |  ------------------
  |  |  |  |   92|  1.45k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_ENDOFMIBVIEW    (ASN_CONTEXT | ASN_PRIMITIVE | 0x2) /* 82=130 */
  |  |  ------------------
  |  |  |  |   95|  1.45k|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (4988:9): [True: 383, False: 16.9k]
  ------------------
 4989|  1.91k|        case ASN_NULL:
  ------------------
  |  |   79|  1.91k|#define ASN_NULL	    0x05U
  ------------------
  |  Branch (4989:9): [True: 461, False: 16.8k]
  ------------------
 4990|  1.91k|            break;
 4991|    944|        case ASN_BIT_STR:
  ------------------
  |  |   77|    944|#define ASN_BIT_STR	    0x03U
  ------------------
  |  Branch (4991:9): [True: 944, False: 16.3k]
  ------------------
 4992|    944|            vp->val.bitstring = (u_char *) malloc(vp->val_len);
 4993|    944|            if (vp->val.bitstring == NULL) {
  ------------------
  |  Branch (4993:17): [True: 0, False: 944]
  ------------------
 4994|      0|                goto fail;
 4995|      0|            }
 4996|    944|            p = asn_parse_bitstring(var_val, &len, &vp->type,
 4997|    944|                                vp->val.bitstring, &vp->val_len);
 4998|    944|            if (!p)
  ------------------
  |  Branch (4998:17): [True: 9, False: 935]
  ------------------
 4999|      9|                goto fail;
 5000|    935|            break;
 5001|    935|        default:
  ------------------
  |  Branch (5001:9): [True: 9, False: 17.3k]
  ------------------
 5002|      9|            snmp_log(LOG_ERR, "bad type returned (%x)\n", vp->type);
 5003|      9|            goto fail;
 5004|      0|            break;
 5005|  17.3k|        }
 5006|  17.1k|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|  17.1k|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  17.1k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 17.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 17.1k]
  |  |  ------------------
  ------------------
 5007|       |
 5008|  17.1k|        if (NULL == vplast) {
  ------------------
  |  Branch (5008:13): [True: 564, False: 16.5k]
  ------------------
 5009|    564|            pdu->variables = vp;
 5010|  16.5k|        } else {
 5011|  16.5k|            vplast->next_variable = vp;
 5012|  16.5k|        }
 5013|  17.1k|        vplast = vp;
 5014|  17.1k|        vp = NULL;
 5015|  17.1k|    }
 5016|    150|    return 0;
 5017|       |
 5018|    690|  fail:
 5019|    690|    {
 5020|    690|        const char *errstr = snmp_api_errstring(SNMPERR_SUCCESS);
  ------------------
  |  |  184|    690|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 5021|    690|        DEBUGMSGTL(("recv", "error while parsing VarBindList:%s\n", errstr));
  ------------------
  |  |   66|    690|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    690|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 690]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 690]
  |  |  ------------------
  ------------------
 5022|    690|    }
 5023|       |    /** if we were parsing a var, remove it from the pdu and free it */
 5024|    690|    if (vp)
  ------------------
  |  Branch (5024:9): [True: 571, False: 119]
  ------------------
 5025|    571|        snmp_free_var(vp);
 5026|       |
 5027|    690|    return -1;
 5028|    721|}
snmp_free_var_internals:
 5648|  17.6k|{
 5649|  17.6k|    if (!var)
  ------------------
  |  Branch (5649:9): [True: 0, False: 17.6k]
  ------------------
 5650|      0|        return;
 5651|       |
 5652|  17.6k|    if (var->name != var->name_loc)
  ------------------
  |  Branch (5652:9): [True: 356, False: 17.3k]
  ------------------
 5653|    356|        SNMP_FREE(var->name);
  ------------------
  |  |   62|    356|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 356]
  |  |  |  Branch (62:66): [Folded, False: 356]
  |  |  ------------------
  ------------------
 5654|  17.6k|    if (var->val.string != var->buf)
  ------------------
  |  Branch (5654:9): [True: 4.33k, False: 13.3k]
  ------------------
 5655|  4.33k|        SNMP_FREE(var->val.string);
  ------------------
  |  |   62|  4.33k|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 2.05k, False: 2.28k]
  |  |  |  Branch (62:66): [Folded, False: 4.33k]
  |  |  ------------------
  ------------------
 5656|  17.6k|    if (var->data) {
  ------------------
  |  Branch (5656:9): [True: 0, False: 17.6k]
  ------------------
 5657|      0|        if (var->dataFreeHook) {
  ------------------
  |  Branch (5657:13): [True: 0, False: 0]
  ------------------
 5658|      0|            var->dataFreeHook(var->data);
 5659|      0|            var->data = NULL;
 5660|      0|        } else {
 5661|       |            SNMP_FREE(var->data);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5662|      0|        }
 5663|      0|    }
 5664|  17.6k|}
snmp_free_var:
 5668|  17.6k|{
 5669|  17.6k|    snmp_free_var_internals(var);
 5670|  17.6k|    free(var);
 5671|  17.6k|}
snmp_free_varbind:
 5675|  5.28k|{
 5676|  5.28k|    netsnmp_variable_list *ptr;
 5677|  22.4k|    while (var) {
  ------------------
  |  Branch (5677:12): [True: 17.1k, False: 5.28k]
  ------------------
 5678|  17.1k|        ptr = var->next_variable;
 5679|  17.1k|        snmp_free_var(var);
 5680|  17.1k|        var = ptr;
 5681|  17.1k|    }
 5682|  5.28k|}
snmp_free_pdu:
 5689|  5.28k|{
 5690|  5.28k|    struct snmp_secmod_def *sptr;
 5691|       |
 5692|  5.28k|    if (!pdu)
  ------------------
  |  Branch (5692:9): [True: 0, False: 5.28k]
  ------------------
 5693|      0|        return;
 5694|       |
 5695|  5.28k|    free_securityStateRef(pdu);
 5696|       |
 5697|  5.28k|    sptr = find_sec_mod(pdu->securityModel);
 5698|  5.28k|    if (sptr && sptr->pdu_free)
  ------------------
  |  Branch (5698:9): [True: 0, False: 5.28k]
  |  Branch (5698:17): [True: 0, False: 0]
  ------------------
 5699|      0|        (*sptr->pdu_free)(pdu);
 5700|       |
 5701|  5.28k|    snmp_free_varbind(pdu->variables);
 5702|  5.28k|    free(pdu->enterprise);
 5703|  5.28k|    free(pdu->community);
 5704|  5.28k|    free(pdu->contextEngineID);
 5705|  5.28k|    free(pdu->securityEngineID);
 5706|  5.28k|    free(pdu->contextName);
 5707|  5.28k|    free(pdu->securityName);
 5708|  5.28k|    free(pdu->transport_data);
 5709|  5.28k|    free(pdu);
 5710|  5.28k|}
snmp_increment_statistic:
 8188|  3.90k|{
 8189|  3.90k|    if (which >= 0 && which < NETSNMP_STAT_MAX_STATS) {
  ------------------
  |  |  710|  3.90k|#define  NETSNMP_STAT_MAX_STATS              (STAT_TLSTM_STATS_END+1)
  |  |  ------------------
  |  |  |  |  706|  3.90k|#define  STAT_TLSTM_STATS_END          STAT_TLSTM_SNMPTLSTMSESSIONINVALIDCACHES
  |  |  |  |  ------------------
  |  |  |  |  |  |  703|  3.90k|#define  STAT_TLSTM_SNMPTLSTMSESSIONINVALIDCACHES              56
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (8189:9): [True: 3.90k, False: 0]
  |  Branch (8189:23): [True: 3.90k, False: 0]
  ------------------
 8190|  3.90k|        statistics[which]++;
 8191|  3.90k|        return statistics[which];
 8192|  3.90k|    }
 8193|      0|    return 0;
 8194|  3.90k|}
snmp_api.c:free_securityStateRef:
 4192|  5.28k|{
 4193|  5.28k|    struct snmp_secmod_def *sptr;
 4194|       |
 4195|  5.28k|    if (!pdu->securityStateRef)
  ------------------
  |  Branch (4195:9): [True: 5.28k, False: 0]
  ------------------
 4196|  5.28k|        return;
 4197|       |
 4198|      0|    sptr = find_sec_mod(pdu->securityModel);
 4199|      0|    if (sptr) {
  ------------------
  |  Branch (4199:9): [True: 0, False: 0]
  ------------------
 4200|      0|        if (sptr->pdu_free_state_ref) {
  ------------------
  |  Branch (4200:13): [True: 0, False: 0]
  ------------------
 4201|      0|            (*sptr->pdu_free_state_ref) (pdu->securityStateRef);
 4202|      0|        } else {
 4203|      0|            snmp_log(LOG_ERR,
 4204|      0|                     "Security Model %d can't free state references\n",
 4205|      0|                     pdu->securityModel);
 4206|      0|	}
 4207|      0|    } else {
 4208|      0|	snmp_log(LOG_ERR,
 4209|      0|		 "Can't find security model to free ptr: %d\n",
 4210|      0|		 pdu->securityModel);
 4211|      0|    }
 4212|       |    pdu->securityStateRef = NULL;
 4213|      0|}
snmp_api.c:_snmp_parse:
 4418|  2.64k|{
 4419|  2.64k|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 4420|  2.64k|    u_char          community[COMMUNITY_MAX_LEN];
 4421|  2.64k|    size_t          community_length = COMMUNITY_MAX_LEN;
  ------------------
  |  |   41|  2.64k|#define COMMUNITY_MAX_LEN	256
  ------------------
 4422|  2.64k|#endif
 4423|  2.64k|    int             result = -1;
 4424|       |
 4425|  2.64k|    static const oid snmpEngineIDoid[]   = { 1,3,6,1,6,3,10,2,1,1,0};
 4426|  2.64k|    static size_t   snmpEngineIDoid_len = 11;
 4427|       |
 4428|  2.64k|    static char     ourEngineID[SNMP_SEC_PARAM_BUF_SIZE];
 4429|  2.64k|    static size_t   ourEngineID_len = sizeof(ourEngineID);
 4430|       |
 4431|  2.64k|    netsnmp_pdu    *pdu2 = NULL;
 4432|       |
 4433|  2.64k|    session->s_snmp_errno = 0;
 4434|  2.64k|    session->s_errno = 0;
 4435|       |
 4436|       |    /*
 4437|       |     * Ensure all incoming PDUs have a unique means of identification 
 4438|       |     * (This is not restricted to AgentX handling,
 4439|       |     * though that is where the need becomes visible)   
 4440|       |     */
 4441|  2.64k|    pdu->transid = snmp_get_next_transid();
 4442|       |
 4443|  2.64k|    if (session->version != SNMP_DEFAULT_VERSION) {
  ------------------
  |  |   90|  2.64k|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  |  Branch (4443:9): [True: 2.64k, False: 0]
  ------------------
 4444|  2.64k|        pdu->version = session->version;
 4445|  2.64k|    } else {
 4446|      0|        pdu->version = snmp_parse_version(data, length);
 4447|      0|    }
 4448|       |
 4449|  2.64k|    switch (pdu->version) {
 4450|      0|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 4451|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 4452|  2.64k|    case SNMP_VERSION_1:
  ------------------
  |  |  107|  2.64k|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (4452:5): [True: 2.64k, False: 0]
  ------------------
 4453|  2.64k|#endif
 4454|  2.64k|#ifndef NETSNMP_DISABLE_SNMPV2C
 4455|  2.64k|    case SNMP_VERSION_2c:
  ------------------
  |  |  110|  2.64k|#define SNMP_VERSION_2c    1
  ------------------
  |  Branch (4455:5): [True: 0, False: 2.64k]
  ------------------
 4456|  2.64k|#endif
 4457|  2.64k|        NETSNMP_RUNTIME_PROTOCOL_CHECK_V1V2(pdu->version,unsupported_version);
  ------------------
  |  |  220|  2.64k|#define NETSNMP_RUNTIME_PROTOCOL_CHECK_V1V2(pc_ver, pc_target) do {    \
  |  |  221|  2.64k|        if (NETSNMP_RUNTIME_PROTOCOL_SKIP_V1(pc_ver) ||                \
  |  |  ------------------
  |  |  |  |  205|  5.28k|    ((pc_ver) == SNMP_VERSION_1 &&                                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |  107|  5.28k|#define SNMP_VERSION_1	   0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (205:6): [True: 2.64k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  206|  5.28k|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|  2.64k|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (206:6): [True: 0, False: 2.64k]
  |  |  |  |  ------------------
  |  |  |  |  207|  2.64k|                            NETSNMP_DS_LIB_DISABLE_V1))
  |  |  |  |  ------------------
  |  |  |  |  |  |  103|  2.64k|#define NETSNMP_DS_LIB_DISABLE_V1          43 /* disable SNMPv1 */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  222|  2.64k|            NETSNMP_RUNTIME_PROTOCOL_SKIP_V2(pc_ver)) {                \
  |  |  ------------------
  |  |  |  |  215|  2.64k|    ((pc_ver) == SNMP_VERSION_2c &&                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  5.28k|#define SNMP_VERSION_2c    1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (215:6): [True: 0, False: 2.64k]
  |  |  |  |  ------------------
  |  |  |  |  216|  2.64k|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (216:6): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  217|      0|                            NETSNMP_DS_LIB_DISABLE_V2c))
  |  |  |  |  ------------------
  |  |  |  |  |  |  104|      0|#define NETSNMP_DS_LIB_DISABLE_V2c         44 /* disable SNMPv2c */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  223|      0|            DEBUGMSGTL(("snmp:protocol:disabled", "enforced\n"));      \
  |  |  ------------------
  |  |  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  224|      0|            goto pc_target;                                            \
  |  |  225|      0|        }                                                              \
  |  |  226|  2.64k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (226:13): [Folded, False: 2.64k]
  |  |  ------------------
  ------------------
 4458|  2.64k|        DEBUGMSGTL(("snmp_api", "Parsing SNMPv%ld message...\n",
  ------------------
  |  |   66|  2.64k|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.64k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.64k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 2.64k]
  |  |  ------------------
  ------------------
 4459|  2.64k|                    (1 + pdu->version)));
 4460|       |
 4461|       |        /*
 4462|       |         * authenticates message and returns length if valid 
 4463|       |         */
 4464|  2.64k|#ifndef NETSNMP_DISABLE_SNMPV1
 4465|  2.64k|        if (pdu->version == SNMP_VERSION_1) {
  ------------------
  |  |  107|  2.64k|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (4465:13): [True: 2.64k, False: 0]
  ------------------
 4466|  2.64k|            DEBUGDUMPSECTION("recv", "SNMPv1 message\n");
  ------------------
  |  |   81|  2.64k|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.64k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.64k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 2.64k]
  |  |  ------------------
  ------------------
 4467|  2.64k|        } else {
 4468|      0|#endif
 4469|      0|            DEBUGDUMPSECTION("recv", "SNMPv2c message\n");
  ------------------
  |  |   81|      0|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4470|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 4471|      0|        }
 4472|  2.64k|#endif
 4473|  2.64k|        data = snmp_comstr_parse(data, &length,
 4474|  2.64k|                                 community, &community_length,
 4475|  2.64k|                                 &pdu->version);
 4476|  2.64k|        if (data == NULL)
  ------------------
  |  Branch (4476:13): [True: 1.16k, False: 1.48k]
  ------------------
 4477|  1.16k|            return -1;
 4478|       |
 4479|  1.48k|        if (pdu->version != session->version &&
  ------------------
  |  Branch (4479:13): [True: 78, False: 1.40k]
  ------------------
 4480|     78|            session->version != SNMP_DEFAULT_VERSION) {
  ------------------
  |  |   90|     78|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  |  Branch (4480:13): [True: 78, False: 0]
  ------------------
 4481|     78|            session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  198|     78|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 4482|     78|            return -1;
 4483|     78|        }
 4484|       |
 4485|       |        /*
 4486|       |         * maybe get the community string. 
 4487|       |         */
 4488|  1.40k|        pdu->securityLevel = SNMP_SEC_LEVEL_NOAUTH;
  ------------------
  |  |  299|  1.40k|#define SNMP_SEC_LEVEL_NOAUTH		1
  ------------------
 4489|  1.40k|        pdu->securityModel = 
 4490|  1.40k|#ifndef NETSNMP_DISABLE_SNMPV1
 4491|  1.40k|            (pdu->version == SNMP_VERSION_1) ? SNMP_SEC_MODEL_SNMPv1 : 
  ------------------
  |  |  107|  1.40k|#define SNMP_VERSION_1	   0
  ------------------
                          (pdu->version == SNMP_VERSION_1) ? SNMP_SEC_MODEL_SNMPv1 : 
  ------------------
  |  |  293|  1.40k|#define SNMP_SEC_MODEL_SNMPv1		1
  ------------------
  |  Branch (4491:13): [True: 1.40k, False: 0]
  ------------------
 4492|  1.40k|#endif
 4493|  1.40k|                                               SNMP_SEC_MODEL_SNMPv2c;
  ------------------
  |  |  294|  1.40k|#define SNMP_SEC_MODEL_SNMPv2c		2
  ------------------
 4494|  1.40k|        SNMP_FREE(pdu->community);
  ------------------
  |  |   62|  1.40k|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 1.40k]
  |  |  |  Branch (62:66): [Folded, False: 1.40k]
  |  |  ------------------
  ------------------
 4495|  1.40k|        pdu->community_len = 0;
 4496|  1.40k|        pdu->community = (u_char *) 0;
 4497|  1.40k|        if (community_length) {
  ------------------
  |  Branch (4497:13): [True: 46, False: 1.35k]
  ------------------
 4498|     46|            pdu->community_len = community_length;
 4499|     46|            pdu->community = netsnmp_memdup(community, community_length);
 4500|     46|            if (pdu->community == NULL) {
  ------------------
  |  Branch (4500:17): [True: 0, False: 46]
  ------------------
 4501|      0|                session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 4502|      0|                return -1;
 4503|      0|            }
 4504|     46|        }
 4505|  1.40k|        if (session->authenticator) {
  ------------------
  |  Branch (4505:13): [True: 0, False: 1.40k]
  ------------------
 4506|      0|            data = session->authenticator(data, &length,
 4507|      0|                                          community, community_length);
 4508|      0|            if (data == NULL) {
  ------------------
  |  Branch (4508:17): [True: 0, False: 0]
  ------------------
 4509|      0|                session->s_snmp_errno = SNMPERR_AUTHENTICATION_FAILURE;
  ------------------
  |  |  219|      0|#define SNMPERR_AUTHENTICATION_FAILURE 	(-35)
  ------------------
 4510|      0|                return -1;
 4511|      0|            }
 4512|      0|        }
 4513|       |
 4514|  1.40k|        DEBUGDUMPSECTION("recv", "PDU");
  ------------------
  |  |   81|  1.40k|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  1.40k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1.40k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 1.40k]
  |  |  ------------------
  ------------------
 4515|  1.40k|        result = snmp_pdu_parse(pdu, data, &length);
 4516|  1.40k|        if (result < 0) {
  ------------------
  |  Branch (4516:13): [True: 1.25k, False: 150]
  ------------------
 4517|       |            /*
 4518|       |             * This indicates a parse error.  
 4519|       |             */
 4520|  1.25k|            snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|  1.25k|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4521|  1.25k|        }
 4522|  1.40k|        DEBUGINDENTADD(-6);
  ------------------
  |  |   73|  1.40k|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  1.40k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1.40k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 1.40k]
  |  |  ------------------
  ------------------
 4523|  1.40k|        break;
 4524|      0|#endif /* support for community based SNMP */
 4525|       |
 4526|      0|    case SNMP_VERSION_3:
  ------------------
  |  |  113|      0|#define SNMP_VERSION_3     3
  ------------------
  |  Branch (4526:5): [True: 0, False: 2.64k]
  ------------------
 4527|      0|        NETSNMP_RUNTIME_PROTOCOL_CHECK_V3(SNMP_VERSION_3,unsupported_version);
  ------------------
  |  |  233|      0|#define NETSNMP_RUNTIME_PROTOCOL_CHECK_V3(pc_ver, pc_target) do {      \
  |  |  234|      0|        if (NETSNMP_RUNTIME_PROTOCOL_SKIP_V3(pc_ver)) {                \
  |  |  ------------------
  |  |  |  |  229|      0|    ((pc_ver == SNMP_VERSION_3) &&                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  113|      0|#define SNMP_VERSION_3     3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (229:6): [True: 0, Folded]
  |  |  |  |  ------------------
  |  |  |  |  230|      0|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (230:6): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  231|      0|                            NETSNMP_DS_LIB_DISABLE_V3))
  |  |  |  |  ------------------
  |  |  |  |  |  |  105|      0|#define NETSNMP_DS_LIB_DISABLE_V3          45 /* disable SNMPv3 */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  235|      0|            DEBUGMSGTL(("snmp:protocol:disabled", "enforced\n"));      \
  |  |  ------------------
  |  |  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  236|      0|            goto pc_target;                                            \
  |  |  237|      0|        }                                                              \
  |  |  238|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (238:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4528|      0|        result = snmpv3_parse(pdu, data, &length, NULL, session);
 4529|      0|        DEBUGMSGTL(("snmp_parse",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4530|      0|                    "Parsed SNMPv3 message (secName:%s, secLevel:%s): %s\n",
 4531|      0|                    pdu->securityName, secLevelName[pdu->securityLevel],
 4532|      0|                    snmp_api_errstring(result)));
 4533|       |
 4534|      0|        if (result == SNMPERR_USM_UNKNOWNSECURITYNAME) {
  ------------------
  |  |  227|      0|#define SNMPERR_USM_UNKNOWNSECURITYNAME		(-43)
  ------------------
  |  Branch (4534:13): [True: 0, False: 0]
  ------------------
 4535|      0|            snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
  ------------------
  |  |   19|      0|#define SNMP_CALLBACK_APPLICATION 1
  ------------------
 4536|      0|                                SNMPD_CALLBACK_AUTH_FAILURE, pdu);
  ------------------
  |  |   21|      0|#define SNMPD_CALLBACK_AUTH_FAILURE             17
  ------------------
 4537|      0|        }
 4538|       |        
 4539|      0|        if (result) {
  ------------------
  |  Branch (4539:13): [True: 0, False: 0]
  ------------------
 4540|      0|            struct snmp_secmod_def *secmod =
 4541|      0|                find_sec_mod(pdu->securityModel);
 4542|      0|            if (!slp) {
  ------------------
  |  Branch (4542:17): [True: 0, False: 0]
  ------------------
 4543|      0|                session->s_snmp_errno = result;
 4544|      0|            } else {
 4545|       |                /*
 4546|       |                 * Call the security model to special handle any errors
 4547|       |                 */
 4548|       |
 4549|      0|                if (secmod && secmod->handle_report) {
  ------------------
  |  Branch (4549:21): [True: 0, False: 0]
  |  Branch (4549:31): [True: 0, False: 0]
  ------------------
 4550|      0|                    (*secmod->handle_report)(slp, slp->transport, session,
 4551|      0|                                             result, pdu);
 4552|      0|                }
 4553|      0|            }
 4554|      0|            free_securityStateRef(pdu);
 4555|      0|        }
 4556|       |
 4557|       |        /* Implement RFC5343 here for two reasons:
 4558|       |           1) From a security perspective it handles this otherwise
 4559|       |              always approved request earlier.  It bypasses the need
 4560|       |              for authorization to the snmpEngineID scalar, which is
 4561|       |              what is what RFC3415 appendix A species as ok.  Note
 4562|       |              that we haven't bypassed authentication since if there
 4563|       |              was an authentication error it would have been handled
 4564|       |              above in the if(result) part at the latest.
 4565|       |           2) From an application point of view if we let this request
 4566|       |              get all the way to the application, it'd require that
 4567|       |              all application types supporting discovery also fire up
 4568|       |              a minimal agent in order to handle just this request
 4569|       |              which seems like overkill.  Though there is no other
 4570|       |              application types that currently need discovery (NRs
 4571|       |              accept notifications from contextEngineIDs that derive
 4572|       |              from the NO not the NR).  Also a lame excuse for doing
 4573|       |              it here.
 4574|       |           3) Less important technically, but the net-snmp agent
 4575|       |              doesn't currently handle registrations of different
 4576|       |              engineIDs either and it would have been a lot more work
 4577|       |              to implement there since we'd need to support that
 4578|       |              first. :-/ Supporting multiple context engineIDs should
 4579|       |              be done anyway, so it's not a valid excuse here.
 4580|       |           4) There is a lot less to do if we trump the agent at this
 4581|       |              point; IE, the agent does a lot more unnecessary
 4582|       |              processing when the only thing that should ever be in
 4583|       |              this context by definition is the single scalar.
 4584|       |        */
 4585|       |
 4586|       |        /* special RFC5343 engineID discovery engineID check */
 4587|      0|        if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (4587:13): [True: 0, False: 0]
  ------------------
 4588|      0|                                    NETSNMP_DS_LIB_NO_DISCOVERY) &&
  ------------------
  |  |   98|      0|#define NETSNMP_DS_LIB_NO_DISCOVERY        38 /* don't support RFC5343 contextEngineID discovery */
  ------------------
 4589|      0|            SNMP_MSG_RESPONSE       != pdu->command &&
  ------------------
  |  |  127|      0|#define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4589:13): [True: 0, False: 0]
  ------------------
 4590|      0|            NULL                    != pdu->contextEngineID &&
  ------------------
  |  Branch (4590:13): [True: 0, False: 0]
  ------------------
 4591|      0|            pdu->contextEngineIDLen == 5 &&
  ------------------
  |  Branch (4591:13): [True: 0, False: 0]
  ------------------
 4592|      0|            pdu->contextEngineID[0] == 0x80 &&
  ------------------
  |  Branch (4592:13): [True: 0, False: 0]
  ------------------
 4593|      0|            pdu->contextEngineID[1] == 0x00 &&
  ------------------
  |  Branch (4593:13): [True: 0, False: 0]
  ------------------
 4594|      0|            pdu->contextEngineID[2] == 0x00 &&
  ------------------
  |  Branch (4594:13): [True: 0, False: 0]
  ------------------
 4595|      0|            pdu->contextEngineID[3] == 0x00 &&
  ------------------
  |  Branch (4595:13): [True: 0, False: 0]
  ------------------
 4596|      0|            pdu->contextEngineID[4] == 0x06) {
  ------------------
  |  Branch (4596:13): [True: 0, False: 0]
  ------------------
 4597|       |
 4598|       |            /* define a result so it doesn't get past us at this point
 4599|       |               and gets dropped by future parts of the stack */
 4600|      0|            result = SNMPERR_JUST_A_CONTEXT_PROBE;
  ------------------
  |  |  250|      0|#define SNMPERR_JUST_A_CONTEXT_PROBE    (-66)
  ------------------
 4601|       |
 4602|      0|            DEBUGMSGTL(("snmpv3_contextid", "starting context ID discovery\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4603|       |            /* ensure exactly one variable */
 4604|      0|            if (NULL != pdu->variables &&
  ------------------
  |  Branch (4604:17): [True: 0, False: 0]
  ------------------
 4605|      0|                NULL == pdu->variables->next_variable &&
  ------------------
  |  Branch (4605:17): [True: 0, False: 0]
  ------------------
 4606|       |
 4607|       |                /* if it's a GET, match it exactly */
 4608|      0|                ((SNMP_MSG_GET == pdu->command &&
  ------------------
  |  |  125|      0|#define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4608:19): [True: 0, False: 0]
  ------------------
 4609|      0|                  snmp_oid_compare(snmpEngineIDoid,
  ------------------
  |  Branch (4609:19): [True: 0, False: 0]
  ------------------
 4610|      0|                                   snmpEngineIDoid_len,
 4611|      0|                                   pdu->variables->name,
 4612|      0|                                   pdu->variables->name_length) == 0)
 4613|       |                 /* if it's a GETNEXT ensure it's less than the engineID oid */
 4614|      0|                 ||
 4615|      0|                 (SNMP_MSG_GETNEXT == pdu->command &&
  ------------------
  |  |  126|      0|#define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4615:19): [True: 0, False: 0]
  ------------------
 4616|      0|                  snmp_oid_compare(snmpEngineIDoid,
  ------------------
  |  Branch (4616:19): [True: 0, False: 0]
  ------------------
 4617|      0|                                   snmpEngineIDoid_len,
 4618|      0|                                   pdu->variables->name,
 4619|      0|                                   pdu->variables->name_length) > 0)
 4620|      0|                    )) {
 4621|       |
 4622|      0|                DEBUGMSGTL(("snmpv3_contextid",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4623|      0|                            "  One correct variable found\n"));
 4624|       |
 4625|       |                /* Note: we're explicitly not handling a GETBULK.  Deal. */
 4626|       |
 4627|       |                /* set up the response */
 4628|      0|                pdu2 = snmp_clone_pdu(pdu);
 4629|       |
 4630|       |                /* free the current varbind */
 4631|      0|                snmp_free_varbind(pdu2->variables);
 4632|       |
 4633|       |                /* set the variables */
 4634|      0|                pdu2->variables = NULL;
 4635|      0|                pdu2->command = SNMP_MSG_RESPONSE;
  ------------------
  |  |  127|      0|#define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
 4636|      0|                pdu2->errstat = 0;
 4637|      0|                pdu2->errindex = 0;
 4638|       |
 4639|      0|                ourEngineID_len =
 4640|      0|                    snmpv3_get_engineID((u_char*)ourEngineID, ourEngineID_len);
 4641|      0|                if (0 != ourEngineID_len) {
  ------------------
  |  Branch (4641:21): [True: 0, False: 0]
  ------------------
 4642|       |
 4643|      0|                    DEBUGMSGTL(("snmpv3_contextid",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4644|      0|                                "  responding with our engineID\n"));
 4645|       |
 4646|      0|                    snmp_pdu_add_variable(pdu2,
 4647|      0|                                          snmpEngineIDoid, snmpEngineIDoid_len,
 4648|      0|                                          ASN_OCTET_STR,
  ------------------
  |  |   78|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
 4649|      0|                                          ourEngineID, ourEngineID_len);
 4650|       |                    
 4651|       |                    /* send the response */
 4652|      0|                    if (0 == snmp_sess_send(slp, pdu2)) {
  ------------------
  |  Branch (4652:25): [True: 0, False: 0]
  ------------------
 4653|       |
 4654|      0|                        DEBUGMSGTL(("snmpv3_contextid",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4655|      0|                                    "  sent it off!\n"));
 4656|       |
 4657|      0|                        snmp_free_pdu(pdu2);
 4658|       |                        
 4659|      0|                        snmp_log(LOG_ERR, "sending a response to the context engineID probe failed\n");
 4660|      0|                    }
 4661|      0|                } else {
 4662|      0|                    snmp_log(LOG_ERR, "failed to get our own engineID!\n");
 4663|      0|                    snmp_free_pdu(pdu2);
 4664|      0|                }
 4665|      0|            } else {
 4666|      0|                snmp_log(LOG_WARNING,
 4667|      0|                         "received an odd context engineID probe\n");
 4668|      0|            }
 4669|      0|        }
 4670|       |
 4671|      0|        break;
 4672|      0|    case SNMPERR_BAD_VERSION:
  ------------------
  |  |  198|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
  |  Branch (4672:5): [True: 0, False: 2.64k]
  ------------------
 4673|      0|        ERROR_MSG("error parsing snmp message version");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4674|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4675|      0|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  198|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 4676|      0|        break;
 4677|       |
 4678|      0|        unsupported_version:  /* goto label */
 4679|      0|    case SNMP_VERSION_sec:
  ------------------
  |  |  118|      0|#define SNMP_VERSION_sec   128  /* not (will never be) supported by this code */
  ------------------
  |  Branch (4679:5): [True: 0, False: 2.64k]
  ------------------
 4680|      0|    case SNMP_VERSION_2u:
  ------------------
  |  |  112|      0|#define SNMP_VERSION_2u    2    /* not (will never be) supported by this code */
  ------------------
  |  Branch (4680:5): [True: 0, False: 2.64k]
  ------------------
 4681|      0|    case SNMP_VERSION_2star:
  ------------------
  |  |  120|      0|#define SNMP_VERSION_2star 130  /* not (will never be) supported by this code */
  ------------------
  |  Branch (4681:5): [True: 0, False: 2.64k]
  ------------------
 4682|      0|    case SNMP_VERSION_2p:
  ------------------
  |  |  119|      0|#define SNMP_VERSION_2p	   129  /* no longer supported by this code (> 4.0) */
  ------------------
  |  Branch (4682:5): [True: 0, False: 2.64k]
  ------------------
 4683|      0|    default:
  ------------------
  |  Branch (4683:5): [True: 0, False: 2.64k]
  ------------------
 4684|      0|        ERROR_MSG("unsupported snmp message version");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4685|      0|        snmp_increment_statistic(STAT_SNMPINBADVERSIONS);
  ------------------
  |  |  634|      0|#define  STAT_SNMPINBADVERSIONS              11
  ------------------
 4686|       |
 4687|       |        /*
 4688|       |         * need better way to determine OS independent
 4689|       |         * INT32_MAX value, for now hardcode
 4690|       |         */
 4691|      0|        if (pdu->version < 0 || pdu->version > 2147483647) {
  ------------------
  |  Branch (4691:13): [True: 0, False: 0]
  |  Branch (4691:33): [True: 0, False: 0]
  ------------------
 4692|      0|            snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4693|      0|        }
 4694|      0|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  198|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 4695|      0|        break;
 4696|  2.64k|    }
 4697|       |
 4698|  1.40k|    return result;
 4699|  2.64k|}

snmp_comstr_parse:
  109|  2.64k|{
  110|  2.64k|    u_char          type;
  111|  2.64k|    long            ver;
  112|  2.64k|    size_t          origlen = *slen;
  113|       |
  114|       |    /*
  115|       |     * Message is an ASN.1 SEQUENCE.
  116|       |     */
  117|  2.64k|    data = asn_parse_sequence(data, length, &type,
  118|  2.64k|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   84|  2.64k|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   96|  2.64k|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
  119|  2.64k|                              "auth message");
  120|  2.64k|    if (data == NULL) {
  ------------------
  |  Branch (120:9): [True: 280, False: 2.36k]
  ------------------
  121|    280|        return NULL;
  122|    280|    }
  123|       |
  124|       |    /*
  125|       |     * First field is the version.
  126|       |     */
  127|  2.36k|    DEBUGDUMPHEADER("recv", "SNMP version");
  ------------------
  |  |   79|  2.36k|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.36k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.36k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 2.36k]
  |  |  ------------------
  ------------------
  128|  2.36k|    data = asn_parse_int(data, length, &type, &ver, sizeof(ver));
  129|  2.36k|    DEBUGINDENTLESS();
  ------------------
  |  |   75|  2.36k|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.36k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.36k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 2.36k]
  |  |  ------------------
  ------------------
  130|  2.36k|    *version = ver;
  131|  2.36k|    if (data == NULL) {
  ------------------
  |  Branch (131:9): [True: 178, False: 2.18k]
  ------------------
  132|    178|        ERROR_MSG("bad parse of version");
  ------------------
  |  |  188|    178|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  133|    178|        return NULL;
  134|    178|    }
  135|       |
  136|       |    /*
  137|       |     * second field is the community string for SNMPv1 & SNMPv2c 
  138|       |     */
  139|  2.18k|    DEBUGDUMPHEADER("recv", "community string");
  ------------------
  |  |   79|  2.18k|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.18k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.18k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 2.18k]
  |  |  ------------------
  ------------------
  140|  2.18k|    data = asn_parse_string(data, length, &type, psid, slen);
  141|  2.18k|    DEBUGINDENTLESS();
  ------------------
  |  |   75|  2.18k|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.18k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.18k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 2.18k]
  |  |  ------------------
  ------------------
  142|  2.18k|    if (data == NULL) {
  ------------------
  |  Branch (142:9): [True: 705, False: 1.48k]
  ------------------
  143|    705|        ERROR_MSG("bad parse of community");
  ------------------
  |  |  188|    705|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  144|    705|        return NULL;
  145|    705|    }
  146|  1.48k|    psid[SNMP_MIN(*slen, origlen - 1)] = '\0';
  ------------------
  |  |  111|  1.48k|#define SNMP_MIN(a,b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (111:24): [True: 1, False: 1.47k]
  |  |  ------------------
  ------------------
  147|  1.48k|    return (u_char *) data;
  148|       |
  149|  2.18k|}                               /* end snmp_comstr_parse() */

snmp_set_var_objid:
  689|  17.3k|{
  690|  17.3k|    size_t          len = sizeof(oid) * name_length;
  691|       |
  692|  17.3k|    if (vp->name != vp->name_loc && vp->name != NULL) {
  ------------------
  |  Branch (692:9): [True: 17.3k, False: 0]
  |  Branch (692:37): [True: 0, False: 17.3k]
  ------------------
  693|       |        /*
  694|       |         * Probably previously-allocated "big storage".  Better free it
  695|       |         * else memory leaks possible.  
  696|       |         */
  697|      0|        free(vp->name);
  698|      0|    }
  699|       |
  700|       |    /*
  701|       |     * use built-in storage for smaller values 
  702|       |     */
  703|  17.3k|    if (len <= sizeof(vp->name_loc)) {
  ------------------
  |  Branch (703:9): [True: 17.3k, False: 0]
  ------------------
  704|  17.3k|        vp->name = vp->name_loc;
  705|  17.3k|    } else {
  706|      0|        vp->name = (oid *) malloc(len);
  707|      0|        if (!vp->name)
  ------------------
  |  Branch (707:13): [True: 0, False: 0]
  ------------------
  708|      0|            return 1;
  709|      0|    }
  710|  17.3k|    if (objid)
  ------------------
  |  Branch (710:9): [True: 17.3k, False: 0]
  ------------------
  711|  17.3k|        memmove(vp->name, objid, len);
  712|  17.3k|    vp->name_length = name_length;
  713|  17.3k|    return 0;
  714|  17.3k|}

snmp_get_do_debugging:
  551|   252k|{
  552|   252k|    return dodebug;
  553|   252k|}

se_add_pair_to_list:
  269|      2|{
  270|      2|    struct snmp_enum_list *lastnode = NULL, *new_node, *tmp;
  271|       |
  272|      2|    if (!list) {
  ------------------
  |  Branch (272:9): [True: 0, False: 2]
  ------------------
  273|      0|        free(label);
  274|      0|        return SE_DNE;
  ------------------
  |  |   45|      0|#define SE_DNE           -2
  ------------------
  275|      0|    }
  276|       |
  277|      2|    tmp = *list;
  278|      2|    while (tmp) {
  ------------------
  |  Branch (278:12): [True: 0, False: 2]
  ------------------
  279|      0|        if (tmp->value == value) {
  ------------------
  |  Branch (279:13): [True: 0, False: 0]
  ------------------
  280|      0|            free(label);
  281|      0|            return (SE_ALREADY_THERE);
  ------------------
  |  |   44|      0|#define SE_ALREADY_THERE 2
  ------------------
  282|      0|        }
  283|      0|        lastnode = tmp;
  284|      0|        tmp = tmp->next;
  285|      0|    }
  286|       |
  287|      2|    new_node = SNMP_MALLOC_STRUCT(snmp_enum_list);
  ------------------
  |  |   69|      2|#define SNMP_MALLOC_STRUCT(s)   (struct s *) calloc(1, sizeof(struct s))
  ------------------
  288|      2|    if (!new_node) {
  ------------------
  |  Branch (288:9): [True: 0, False: 2]
  ------------------
  289|      0|        free(label);
  290|      0|        return (SE_NOMEM);
  ------------------
  |  |   43|      0|#define SE_NOMEM         1
  ------------------
  291|      0|    }
  292|       |
  293|      2|    if (lastnode)
  ------------------
  |  Branch (293:9): [True: 0, False: 2]
  ------------------
  294|      0|        lastnode->next = new_node;
  295|      2|    else
  296|      2|        *list = new_node;
  297|      2|    new_node->label = label;
  298|      2|    new_node->value = value;
  299|      2|    new_node->next = NULL;
  300|      2|    return (SE_OK);
  ------------------
  |  |   42|      2|#define SE_OK            0
  ------------------
  301|      2|}
se_add_pair_to_slist:
  365|      2|{
  366|      2|    struct snmp_enum_list **list_p = se_find_slist_ptr(listname);
  367|       |
  368|      2|    if (!list_p) {
  ------------------
  |  Branch (368:9): [True: 2, False: 0]
  ------------------
  369|      2|        struct snmp_enum_list_str *sptr =
  370|      2|            SNMP_MALLOC_STRUCT(snmp_enum_list_str);
  ------------------
  |  |   69|      2|#define SNMP_MALLOC_STRUCT(s)   (struct s *) calloc(1, sizeof(struct s))
  ------------------
  371|      2|        if (!sptr) {
  ------------------
  |  Branch (371:13): [True: 0, False: 2]
  ------------------
  372|      0|            free(label);
  373|      0|            return SE_NOMEM;
  ------------------
  |  |   43|      0|#define SE_NOMEM         1
  ------------------
  374|      0|        }
  375|      2|        sptr->next = sliststorage;
  376|      2|        sptr->name = strdup(listname);
  377|      2|        if (!sptr->name) {
  ------------------
  |  Branch (377:13): [True: 0, False: 2]
  ------------------
  378|      0|            free(sptr);
  379|      0|            free(label);
  380|      0|            return SE_NOMEM;
  ------------------
  |  |   43|      0|#define SE_NOMEM         1
  ------------------
  381|      0|        }
  382|      2|        list_p = &sptr->list;
  383|      2|        sliststorage = sptr;
  384|      2|    }
  385|       |
  386|      2|    return se_add_pair_to_list(list_p, label, value);
  387|      2|}
snmp_enum.c:se_find_slist_ptr:
  314|      2|{
  315|      2|    struct snmp_enum_list_str *sptr;
  316|      2|    if (!listname)
  ------------------
  |  Branch (316:9): [True: 0, False: 2]
  ------------------
  317|      0|        return NULL;
  318|       |
  319|      2|    for (sptr = sliststorage; sptr != NULL; sptr = sptr->next)
  ------------------
  |  Branch (319:31): [True: 0, False: 2]
  ------------------
  320|      0|        if (sptr->name && strcmp(sptr->name, listname) == 0)
  ------------------
  |  Branch (320:13): [True: 0, False: 0]
  |  Branch (320:27): [True: 0, False: 0]
  ------------------
  321|      0|            return &sptr->list;
  322|       |
  323|      2|    return NULL;
  324|      2|}

netsnmp_set_line_buffering:
  187|      1|{
  188|       |#if defined(WIN32)
  189|       |    /*
  190|       |     * According to MSDN, the Microsoft Visual Studio C runtime library does
  191|       |     * not support line buffering, so turn off buffering completely.
  192|       |     * See also http://msdn.microsoft.com/en-us/library/86cebhfs(VS.71).aspx.
  193|       |     */
  194|       |    setvbuf(stream, NULL, _IONBF, BUFSIZ);
  195|       |#elif defined(HAVE_SETLINEBUF)
  196|       |    /* setlinefunction() is a function from the BSD Unix API. */
  197|       |    setlinebuf(stream);
  198|       |#else
  199|       |    /* See also the C89 or C99 standard for more information about setvbuf(). */
  200|      1|    setvbuf(stream, NULL, _IOLBF, BUFSIZ);
  201|      1|#endif
  202|      1|}
log_handler_stdouterr:
 1101|    175|{
 1102|    175|    static int      newline = 1;	 /* MTCRITICAL_RESOURCE */
 1103|    175|    const char     *newline_ptr;
 1104|    175|    char            sbuf[40];
 1105|       |
 1106|    175|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|    175|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1106:9): [True: 0, False: 175]
  ------------------
 1107|    175|                               NETSNMP_DS_LIB_LOG_TIMESTAMP) && newline) {
  ------------------
  |  |   64|    175|#define NETSNMP_DS_LIB_LOG_TIMESTAMP       5
  ------------------
  |  Branch (1107:65): [True: 0, False: 0]
  ------------------
 1108|      0|        sprintf_stamp(NULL, sbuf);
 1109|    175|    } else {
 1110|    175|        strcpy(sbuf, "");
 1111|    175|    }
 1112|       |    /*
 1113|       |     * Remember whether or not the current line ends with a newline for the
 1114|       |     * next call of log_handler_stdouterr().
 1115|       |     */
 1116|    175|    newline_ptr = strrchr(str, '\n');
 1117|    175|    newline = newline_ptr && newline_ptr[1] == 0;
  ------------------
  |  Branch (1117:15): [True: 175, False: 0]
  |  Branch (1117:30): [True: 175, False: 0]
  ------------------
 1118|       |
 1119|    175|    if (logh->imagic)
  ------------------
  |  Branch (1119:9): [True: 0, False: 175]
  ------------------
 1120|      0|       printf(         "%s%s", sbuf, str);
 1121|    175|    else
 1122|    175|       fprintf(stderr, "%s%s", sbuf, str);
 1123|       |
 1124|    175|    return 1;
 1125|    175|}
snmp_log_string:
 1292|    175|{
 1293|    175|#ifndef NETSNMP_FEATURE_REMOVE_LOGGING_STDIO
 1294|    175|    static int stderr_enabled = 0;
 1295|    175|    static netsnmp_log_handler lh = { 1, 0, 0, 0, "stderr",
 1296|    175|                                      log_handler_stdouterr, 0, NULL,  NULL,
 1297|    175|                                      NULL };
 1298|    175|#endif /* NETSNMP_FEATURE_REMOVE_LOGGING_STDIO */
 1299|    175|    netsnmp_log_handler *logh;
 1300|       |
 1301|       |    /*
 1302|       |     * We've got to be able to log messages *somewhere*!
 1303|       |     * If you don't want stderr logging, then enable something else.
 1304|       |     */
 1305|    175|    if (0 == logh_enabled) {
  ------------------
  |  Branch (1305:9): [True: 175, False: 0]
  ------------------
 1306|    175|#ifndef NETSNMP_FEATURE_REMOVE_LOGGING_STDIO
 1307|    175|        if (!stderr_enabled) {
  ------------------
  |  Branch (1307:13): [True: 1, False: 174]
  ------------------
 1308|      1|            ++stderr_enabled;
 1309|      1|            netsnmp_set_line_buffering(stderr);
 1310|      1|        }
 1311|    175|        log_handler_stdouterr( &lh, priority, str );
 1312|    175|#endif /* NETSNMP_FEATURE_REMOVE_LOGGING_STDIO */
 1313|       |
 1314|    175|        return;
 1315|    175|    }
 1316|      0|#ifndef NETSNMP_FEATURE_REMOVE_LOGGING_STDIO
 1317|      0|    else if (stderr_enabled) {
  ------------------
  |  Branch (1317:14): [True: 0, False: 0]
  ------------------
 1318|      0|        stderr_enabled = 0;
 1319|      0|        log_handler_stdouterr( &lh, LOG_INFO,
 1320|      0|                               "Log handling defined - disabling stderr\n" );
 1321|      0|    }
 1322|      0|#endif /* NETSNMP_FEATURE_REMOVE_LOGGING_STDIO */
 1323|       |        
 1324|       |
 1325|       |    /*
 1326|       |     * Start at the given priority, and work "upwards"....
 1327|       |     */
 1328|      0|    if (priority > LOG_DEBUG)
  ------------------
  |  Branch (1328:9): [True: 0, False: 0]
  ------------------
 1329|      0|        priority = LOG_DEBUG;
 1330|      0|    logh = logh_priorities[priority];
 1331|      0|    for ( ; logh; logh = logh->next ) {
  ------------------
  |  Branch (1331:13): [True: 0, False: 0]
  ------------------
 1332|       |        /*
 1333|       |         * ... but skipping any handlers with a "maximum priority"
 1334|       |         *     that we have already exceeded. And don't forget to
 1335|       |         *     ensure this logging is turned on (see snmp_disable_stderrlog
 1336|       |         *     and its cohorts).
 1337|       |         */
 1338|      0|        if (logh->enabled && priority <= logh->pri_max)
  ------------------
  |  Branch (1338:13): [True: 0, False: 0]
  |  Branch (1338:30): [True: 0, False: 0]
  ------------------
 1339|      0|            logh->handler( logh, priority, str );
 1340|      0|    }
 1341|      0|}
snmp_vlog:
 1379|    175|{
 1380|    175|    char           *buffer = NULL;
 1381|    175|    int             length;
 1382|       |
 1383|    175|    length = vasprintf(&buffer, format, ap);
 1384|    175|    if (length < 0) {
  ------------------
  |  Branch (1384:9): [True: 0, False: 175]
  ------------------
 1385|      0|        snmp_log_string(LOG_ERR, "Could not format log-string\n");
 1386|      0|        return -1;
 1387|      0|    }
 1388|       |
 1389|    175|    snmp_log_string(priority, buffer);
 1390|    175|    free(buffer);
 1391|    175|    return 0;
 1392|    175|}
snmp_log:
 1403|    175|{
 1404|    175|    va_list         ap;
 1405|    175|    int             ret;
 1406|    175|    va_start(ap, format);
 1407|    175|    ret = snmp_vlog(priority, format, ap);
 1408|       |    va_end(ap);
 1409|    175|    return (ret);
 1410|    175|}

register_sec_mod:
   70|      2|{
   71|      2|    int             result = 0;
   72|      2|    struct snmp_secmod_list *sptr;
   73|      2|    char           *othername, *modname2 = NULL;
   74|       |
   75|      2|    for (sptr = registered_services; sptr; sptr = sptr->next) {
  ------------------
  |  Branch (75:38): [True: 0, False: 2]
  ------------------
   76|      0|        if (sptr->securityModel == secmod) {
  ------------------
  |  Branch (76:13): [True: 0, False: 0]
  ------------------
   77|      0|            return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
   78|      0|        }
   79|      0|    }
   80|      2|    sptr = SNMP_MALLOC_STRUCT(snmp_secmod_list);
  ------------------
  |  |   69|      2|#define SNMP_MALLOC_STRUCT(s)   (struct s *) calloc(1, sizeof(struct s))
  ------------------
   81|      2|    if (sptr == NULL)
  ------------------
  |  Branch (81:9): [True: 0, False: 2]
  ------------------
   82|      0|        return SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
   83|      2|    sptr->secDef = newdef;
   84|      2|    sptr->securityModel = secmod;
   85|      2|    sptr->next = registered_services;
   86|      2|    registered_services = sptr;
   87|      2|    modname2 = strdup(modname);
   88|      2|    if (!modname2)
  ------------------
  |  Branch (88:9): [True: 0, False: 2]
  ------------------
   89|      0|        result = SE_NOMEM;
  ------------------
  |  |   43|      0|#define SE_NOMEM         1
  ------------------
   90|      2|    else
   91|      2|        result = se_add_pair_to_slist("snmp_secmods", modname2, secmod);
   92|      2|    if (result != SE_OK) {
  ------------------
  |  |   42|      2|#define SE_OK            0
  ------------------
  |  Branch (92:9): [True: 0, False: 2]
  ------------------
   93|      0|        switch (result) {
   94|      0|        case SE_NOMEM:
  ------------------
  |  |   43|      0|#define SE_NOMEM         1
  ------------------
  |  Branch (94:9): [True: 0, False: 0]
  ------------------
   95|      0|            snmp_log(LOG_CRIT, "snmp_secmod: no memory\n");
   96|      0|            break;
   97|       |
   98|      0|        case SE_ALREADY_THERE:
  ------------------
  |  |   44|      0|#define SE_ALREADY_THERE 2
  ------------------
  |  Branch (98:9): [True: 0, False: 0]
  ------------------
   99|      0|            othername = se_find_label_in_slist("snmp_secmods", secmod);
  100|      0|            if (strcmp(othername, modname) != 0) {
  ------------------
  |  Branch (100:17): [True: 0, False: 0]
  ------------------
  101|      0|                snmp_log(LOG_ERR,
  102|      0|                         "snmp_secmod: two security modules %s and %s registered with the same security number\n",
  103|      0|                         modname, othername);
  104|      0|            }
  105|      0|            break;
  106|       |
  107|      0|        default:
  ------------------
  |  Branch (107:9): [True: 0, False: 0]
  ------------------
  108|      0|            snmp_log(LOG_ERR,
  109|      0|                     "snmp_secmod: unknown error trying to register a new security module\n");
  110|      0|            break;
  111|      0|        }
  112|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  113|      0|    }
  114|      2|    return SNMPERR_SUCCESS;
  ------------------
  |  |  184|      2|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  115|      2|}
find_sec_mod:
  160|  5.34k|{
  161|  5.34k|    struct snmp_secmod_list *sptr;
  162|       |
  163|  10.6k|    for (sptr = registered_services; sptr; sptr = sptr->next) {
  ------------------
  |  Branch (163:38): [True: 5.34k, False: 5.34k]
  ------------------
  164|  5.34k|        if (sptr->securityModel == secmod) {
  ------------------
  |  Branch (164:13): [True: 0, False: 5.34k]
  ------------------
  165|      0|            return sptr->secDef;
  166|      0|        }
  167|  5.34k|    }
  168|       |    /*
  169|       |     * not registered 
  170|       |     */
  171|  5.34k|    return NULL;
  172|  5.34k|}

strlcpy:
   26|  6.32k|{ 
   27|  6.32k|	size_t src_len = strlen(src); 
   28|  6.32k|	size_t new_len; 
   29|       |
   30|  6.32k|	if (len == 0) {
  ------------------
  |  Branch (30:6): [True: 0, False: 6.32k]
  ------------------
   31|      0|		return (src_len);
   32|      0|	}
   33|       |
   34|  6.32k|        if (src_len >= len) {
  ------------------
  |  Branch (34:13): [True: 0, False: 6.32k]
  ------------------
   35|      0|		new_len = len - 1;
   36|  6.32k|	} else {
   37|  6.32k|                new_len = src_len;
   38|  6.32k|	}
   39|       |
   40|  6.32k|        memcpy(dest, src, new_len); 
   41|  6.32k|	dest[new_len] = '\0'; 
   42|  6.32k|	return (src_len); 
   43|  6.32k|}

netsnmp_memdup:
  279|  1.73k|{
  280|  1.73k|    void *to = NULL;
  281|       |
  282|  1.73k|    if (from) {
  ------------------
  |  Branch (282:9): [True: 1.73k, False: 0]
  ------------------
  283|  1.73k|        to = malloc(size);
  284|  1.73k|        if (to)
  ------------------
  |  Branch (284:13): [True: 1.73k, False: 0]
  ------------------
  285|  1.73k|            memcpy(to, from, size);
  286|  1.73k|    }
  287|  1.73k|    return to;
  288|  1.73k|}                               /* end netsnmp_memdup() */

LLVMFuzzerInitialize:
   40|      2|int LLVMFuzzerInitialize(int *argc, char ***argv) {
   41|      2|    if (getenv("NETSNMP_DEBUGGING") != NULL) {
  ------------------
  |  Branch (41:9): [True: 0, False: 2]
  ------------------
   42|       |        /*
   43|       |         * Turn on all debugging, to help understand what
   44|       |         * bits of the parser are running.
   45|       |         */
   46|      0|        snmp_enable_stderrlog();
   47|      0|        snmp_set_do_debugging(1);
   48|      0|        debug_register_tokens("");
   49|      0|    }
   50|       |
   51|      2|    struct snmp_secmod_def *sndef = SNMP_MALLOC_STRUCT(snmp_secmod_def);
  ------------------
  |  |   69|      2|#define SNMP_MALLOC_STRUCT(s)   (struct s *) calloc(1, sizeof(struct s))
  ------------------
   52|      2|    sndef->decode = SecmodInMsg_CB;
   53|      2|    register_sec_mod(-1, "modname", sndef);
   54|      2|    return 0;
   55|      2|}
LLVMFuzzerTestOneInput:
   57|  2.64k|int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
   58|  2.64k|    size_t bytes_remaining = size;
   59|  2.64k|    netsnmp_pdu *pdu = SNMP_MALLOC_TYPEDEF(netsnmp_pdu);
  ------------------
  |  |   73|  2.64k|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
   60|       |
   61|  2.64k|    netsnmp_session sess = { };
   62|  2.64k|    snmpv3_parse(pdu, NETSNMP_REMOVE_CONST(uint8_t *, data), &bytes_remaining,
  ------------------
  |  |   91|  2.64k|    (__extension__ ({ const t tmp = (e); (t)(size_t)tmp; }))
  ------------------
   63|  2.64k|                 NULL, &sess);
   64|  2.64k|    snmp_free_pdu(pdu);
   65|       |
   66|  2.64k|    pdu = SNMP_MALLOC_TYPEDEF(netsnmp_pdu);
  ------------------
  |  |   73|  2.64k|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
   67|  2.64k|    memset(&sess, 0, sizeof(sess));
   68|  2.64k|    snmp_parse(NULL, &sess, pdu, NETSNMP_REMOVE_CONST(uint8_t *, data), size);
  ------------------
  |  |   91|  2.64k|    (__extension__ ({ const t tmp = (e); (t)(size_t)tmp; }))
  ------------------
   69|  2.64k|    snmp_free_pdu(pdu);
   70|       |
   71|  2.64k|    return 0;
   72|  2.64k|}

