asn_parse_nlength:
  325|  98.1k|{
  326|  98.1k|    int len_len;
  327|       |
  328|  98.1k|    if (pkt_len < 1)
  ------------------
  |  Branch (328:9): [True: 0, False: 98.1k]
  ------------------
  329|      0|        return NULL;               /* always too short */
  330|       |
  331|  98.1k|    if (NULL == pkt || NULL == data_len)
  ------------------
  |  Branch (331:9): [True: 0, False: 98.1k]
  |  Branch (331:24): [True: 0, False: 98.1k]
  ------------------
  332|      0|        return NULL;
  333|       |
  334|  98.1k|    *data_len = 0;
  335|       |
  336|  98.1k|    if (*pkt & 0x80) {
  ------------------
  |  Branch (336:9): [True: 12.8k, False: 85.2k]
  ------------------
  337|       |        /*
  338|       |         * long length; first byte is length of length (after masking high bit)
  339|       |         */
  340|  12.8k|        len_len = (int) ((*pkt & ~0x80) + 1);
  341|  12.8k|        if (pkt_len < len_len)
  ------------------
  |  Branch (341:13): [True: 143, False: 12.7k]
  ------------------
  342|    143|            return NULL;           /* still too short for length and data */
  343|       |
  344|       |        /* now we know we have enough data to parse length */
  345|  12.7k|        if (NULL == asn_parse_length(pkt, data_len))
  ------------------
  |  Branch (345:13): [True: 363, False: 12.3k]
  ------------------
  346|    363|            return NULL;           /* propagate error from asn_parse_length */
  347|  85.2k|    } else {
  348|       |        /*
  349|       |         * short length; first byte is the length
  350|       |         */
  351|  85.2k|        len_len = 1;
  352|  85.2k|        *data_len = *pkt;
  353|  85.2k|    }
  354|       |
  355|  97.6k|    if ((*data_len + len_len) > pkt_len)
  ------------------
  |  Branch (355:9): [True: 1.09k, False: 96.5k]
  ------------------
  356|  1.09k|        return NULL;
  357|       |
  358|  96.5k|    return (pkt + len_len);
  359|  97.6k|}
asn_parse_int:
  557|  9.67k|{
  558|       |    /*
  559|       |     * ASN.1 integer ::= 0x02 asnlength byte {byte}*
  560|       |     */
  561|  9.67k|    static const char *errpre = "parse int";
  562|  9.67k|    register u_char *bufp = data;
  563|  9.67k|    u_long          asn_length;
  564|  9.67k|    int             i;
  565|  9.67k|    union {
  566|  9.67k|        long          l;
  567|  9.67k|        unsigned char b[sizeof(long)];
  568|  9.67k|    } value;
  569|       |
  570|  9.67k|    if (NULL == data || NULL == datalength || NULL == type || NULL == intp) {
  ------------------
  |  Branch (570:9): [True: 0, False: 9.67k]
  |  Branch (570:25): [True: 0, False: 9.67k]
  |  Branch (570:47): [True: 0, False: 9.67k]
  |  Branch (570:63): [True: 0, False: 9.67k]
  ------------------
  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.67k|    if (intsize != sizeof(long)) {
  ------------------
  |  Branch (575:9): [True: 0, False: 9.67k]
  ------------------
  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.67k|    if (*datalength < 2) {
  ------------------
  |  Branch (581:9): [True: 77, False: 9.59k]
  ------------------
  582|     77|        _asn_short_err(errpre, *datalength, 2);
  583|     77|        return NULL;
  584|     77|    }
  585|       |
  586|  9.59k|    *type = *bufp++;
  587|  9.59k|    if (*type != ASN_INTEGER) {
  ------------------
  |  |   75|  9.59k|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (587:9): [True: 36, False: 9.56k]
  ------------------
  588|     36|        _asn_type_err(errpre, *type);
  589|     36|        return NULL;
  590|     36|    }
  591|       |
  592|  9.56k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
  593|  9.56k|    if (NULL == bufp) {
  ------------------
  |  Branch (593:9): [True: 315, False: 9.24k]
  ------------------
  594|    315|        _asn_short_err(errpre, *datalength - 1, asn_length);
  595|    315|        return NULL;
  596|    315|    }
  597|       |
  598|  9.24k|    if ((size_t) asn_length > intsize || (int) asn_length == 0) {
  ------------------
  |  Branch (598:9): [True: 32, False: 9.21k]
  |  Branch (598:42): [True: 24, False: 9.18k]
  ------------------
  599|     56|        _asn_length_err(errpre, (size_t) asn_length, intsize);
  600|     56|        return NULL;
  601|     56|    }
  602|       |
  603|  9.18k|    *datalength -= (int) asn_length + (bufp - data);
  604|       |
  605|  9.18k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|  9.18k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  9.18k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 9.18k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 9.18k]
  |  |  ------------------
  ------------------
  606|       |
  607|  9.18k|    memset(&value.b, *bufp & 0x80 ? 0xff : 0, sizeof(value.b));
  ------------------
  |  Branch (607:22): [True: 1.80k, False: 7.38k]
  ------------------
  608|  9.18k|    if (NETSNMP_BIGENDIAN) {
  ------------------
  |  | 2393|  9.18k|#  define NETSNMP_BIGENDIAN 0
  |  |  ------------------
  |  |  |  Branch (2393:29): [Folded, False: 9.18k]
  |  |  ------------------
  ------------------
  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|  9.18k|    } else {
  612|  25.5k|        for (i = asn_length - 1; asn_length--; i--)
  ------------------
  |  Branch (612:34): [True: 16.3k, False: 9.18k]
  ------------------
  613|  16.3k|            value.b[i] = *bufp++;
  614|  9.18k|    }
  615|       |
  616|  9.18k|    CHECK_OVERFLOW_S(value.l, 1);
  ------------------
  |  |  214|  9.18k|#define CHECK_OVERFLOW_S(x,y) do {                                      \
  |  |  215|  9.18k|        if (x > INT32_MAX) {                                            \
  |  |  ------------------
  |  |  |  Branch (215:13): [True: 587, False: 8.60k]
  |  |  ------------------
  |  |  216|    587|            DEBUGMSG(("asn","truncating signed value %ld to 32 bits (%d)\n",(long)(x),y)); \
  |  |  ------------------
  |  |  |  |   61|    587|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|    587|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 587]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 587]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  217|    587|            x &= 0xffffffff;                                            \
  |  |  218|  8.60k|        } else if (x < INT32_MIN) {                                     \
  |  |  ------------------
  |  |  |  Branch (218:20): [True: 433, False: 8.16k]
  |  |  ------------------
  |  |  219|    433|            DEBUGMSG(("asn","truncating signed value %ld to 32 bits (%d)\n",(long)(x),y)); \
  |  |  ------------------
  |  |  |  |   61|    433|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|    433|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 433]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 433]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  220|    433|            x = 0 - (x & 0xffffffff);                                   \
  |  |  221|    433|        }                                                               \
  |  |  222|  9.18k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (222:13): [Folded, False: 9.18k]
  |  |  ------------------
  ------------------
  617|       |
  618|  9.18k|    DEBUGMSG(("dumpv_recv", "  Integer:\t%ld (0x%.2lX)\n", value.l, value.l));
  ------------------
  |  |   61|  9.18k|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|  9.18k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 9.18k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 9.18k]
  |  |  ------------------
  ------------------
  619|       |
  620|  9.18k|    *intp = value.l;
  621|  9.18k|    return bufp;
  622|  9.24k|}
asn_parse_unsigned_int:
  650|  3.64k|{
  651|       |    /*
  652|       |     * ASN.1 integer ::= 0x02 asnlength byte {byte}*
  653|       |     */
  654|  3.64k|    static const char *errpre = "parse uint";
  655|  3.64k|    register u_char *bufp = data;
  656|  3.64k|    u_long          asn_length;
  657|  3.64k|    register u_long value = 0;
  658|       |
  659|  3.64k|    if (NULL == data || NULL == datalength || NULL == type || NULL == intp) {
  ------------------
  |  Branch (659:9): [True: 0, False: 3.64k]
  |  Branch (659:25): [True: 0, False: 3.64k]
  |  Branch (659:47): [True: 0, False: 3.64k]
  |  Branch (659:63): [True: 0, False: 3.64k]
  ------------------
  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.64k|    if (intsize != sizeof(long)) {
  ------------------
  |  Branch (664:9): [True: 0, False: 3.64k]
  ------------------
  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.64k|    if (*datalength < 2) {
  ------------------
  |  Branch (670:9): [True: 2, False: 3.64k]
  ------------------
  671|      2|        _asn_short_err(errpre, *datalength, 2);
  672|      2|        return NULL;
  673|      2|    }
  674|       |
  675|  3.64k|    *type = *bufp++;
  676|  3.64k|    if (*type != ASN_COUNTER && *type != ASN_GAUGE && *type != ASN_TIMETICKS
  ------------------
  |  |   89|  7.28k|#define ASN_COUNTER	(ASN_APPLICATION | 1)
  |  |  ------------------
  |  |  |  |   91|  3.64k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if (*type != ASN_COUNTER && *type != ASN_GAUGE && *type != ASN_TIMETICKS
  ------------------
  |  |   90|  6.12k|#define ASN_GAUGE	(ASN_APPLICATION | 2)
  |  |  ------------------
  |  |  |  |   91|  2.48k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if (*type != ASN_COUNTER && *type != ASN_GAUGE && *type != ASN_TIMETICKS
  ------------------
  |  |   92|  5.29k|#define ASN_TIMETICKS   (ASN_APPLICATION | 3)
  |  |  ------------------
  |  |  |  |   91|  1.65k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (676:9): [True: 2.48k, False: 1.16k]
  |  Branch (676:33): [True: 1.65k, False: 833]
  |  Branch (676:55): [True: 925, False: 725]
  ------------------
  677|    925|            && *type != ASN_UINTEGER) {
  ------------------
  |  |  100|    925|#define ASN_UINTEGER    (ASN_APPLICATION | 7)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|    925|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (677:16): [True: 18, False: 907]
  ------------------
  678|     18|        _asn_type_err(errpre, *type);
  679|     18|        return NULL;
  680|     18|    }
  681|       |
  682|  3.62k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
  683|  3.62k|    if (NULL == bufp) {
  ------------------
  |  Branch (683:9): [True: 147, False: 3.47k]
  ------------------
  684|    147|        _asn_short_err(errpre, *datalength - 1, asn_length);
  685|    147|        return NULL;
  686|    147|    }
  687|       |
  688|  3.47k|    if ((asn_length > (intsize + 1)) || ((int) asn_length == 0) ||
  ------------------
  |  Branch (688:9): [True: 14, False: 3.46k]
  |  Branch (688:41): [True: 20, False: 3.44k]
  ------------------
  689|  3.44k|        ((asn_length == intsize + 1) && *bufp != 0x00)) {
  ------------------
  |  Branch (689:10): [True: 292, False: 3.15k]
  |  Branch (689:41): [True: 8, False: 284]
  ------------------
  690|     42|        _asn_length_err(errpre, (size_t) asn_length, intsize);
  691|     42|        return NULL;
  692|     42|    }
  693|  3.43k|    *datalength -= (int) asn_length + (bufp - data);
  694|       |
  695|  3.43k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|  3.43k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  3.43k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3.43k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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.43k]
  |  |  ------------------
  ------------------
  696|       |
  697|  13.2k|    while (asn_length--)
  ------------------
  |  Branch (697:12): [True: 9.79k, False: 3.43k]
  ------------------
  698|  9.79k|        value = (value << 8) | *bufp++;
  699|       |
  700|  3.43k|    CHECK_OVERFLOW_U(value,2);
  ------------------
  |  |  224|  3.43k|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|  3.43k|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 877, False: 2.56k]
  |  |  ------------------
  |  |  226|    877|            x &= 0xffffffff;                                            \
  |  |  227|    877|            DEBUGMSG(("asn","truncating unsigned value to 32 bits (%d)\n",y)); \
  |  |  ------------------
  |  |  |  |   61|    877|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|    877|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 877]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 877]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  228|    877|        }                                                               \
  |  |  229|  3.43k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 3.43k]
  |  |  ------------------
  ------------------
  701|       |
  702|  3.43k|    DEBUGMSG(("dumpv_recv", "  UInteger:\t%ld (0x%.2lX)\n", value, value));
  ------------------
  |  |   61|  3.43k|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|  3.43k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3.43k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 3.43k]
  |  |  ------------------
  ------------------
  703|       |
  704|  3.43k|    *intp = value;
  705|  3.43k|    return bufp;
  706|  3.47k|}
asn_parse_string:
  910|  6.72k|{
  911|  6.72k|    static const char *errpre = "parse string";
  912|  6.72k|    u_char         *bufp = data;
  913|  6.72k|    u_long          asn_length;
  914|       |
  915|  6.72k|    if (NULL == data || NULL == datalength || NULL == type || NULL == str ||
  ------------------
  |  Branch (915:9): [True: 0, False: 6.72k]
  |  Branch (915:25): [True: 0, False: 6.72k]
  |  Branch (915:47): [True: 0, False: 6.72k]
  |  Branch (915:63): [True: 0, False: 6.72k]
  ------------------
  916|  6.72k|        NULL == strlength) {
  ------------------
  |  Branch (916:9): [True: 0, False: 6.72k]
  ------------------
  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.72k|    if (*datalength < 2) {
  ------------------
  |  Branch (922:9): [True: 320, False: 6.40k]
  ------------------
  923|    320|        _asn_short_err(errpre, *datalength, 2);
  924|    320|        return NULL;
  925|    320|    }
  926|       |
  927|  6.40k|    *type = *bufp++;
  928|  6.40k|    if (*type != ASN_OCTET_STR && *type != ASN_IPADDRESS && *type != ASN_OPAQUE
  ------------------
  |  |   78|  12.8k|#define ASN_OCTET_STR	    0x04U
  ------------------
                  if (*type != ASN_OCTET_STR && *type != ASN_IPADDRESS && *type != ASN_OPAQUE
  ------------------
  |  |   88|  10.5k|#define ASN_IPADDRESS   (ASN_APPLICATION | 0)
  |  |  ------------------
  |  |  |  |   91|  4.11k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if (*type != ASN_OCTET_STR && *type != ASN_IPADDRESS && *type != ASN_OPAQUE
  ------------------
  |  |   93|  9.88k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  3.48k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (928:9): [True: 4.11k, False: 2.28k]
  |  Branch (928:35): [True: 3.48k, False: 636]
  |  Branch (928:61): [True: 1.59k, False: 1.88k]
  ------------------
  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: 423, False: 1.17k]
  ------------------
  930|    423|        _asn_type_err(errpre, *type);
  931|    423|        return NULL;
  932|    423|    }
  933|       |
  934|  5.98k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
  935|  5.98k|    if (NULL == bufp) {
  ------------------
  |  Branch (935:9): [True: 156, False: 5.82k]
  ------------------
  936|    156|        _asn_short_err(errpre, *datalength - 1, asn_length);
  937|    156|        return NULL;
  938|    156|    }
  939|       |
  940|  5.82k|    if (asn_length > *strlength) {
  ------------------
  |  Branch (940:9): [True: 35, False: 5.79k]
  ------------------
  941|     35|        _asn_length_err(errpre, (size_t) asn_length, *strlength);
  942|     35|        return NULL;
  943|     35|    }
  944|       |
  945|  5.79k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|  5.79k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  5.79k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 5.79k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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.79k]
  |  |  ------------------
  ------------------
  946|       |
  947|  5.79k|    memmove(str, bufp, asn_length);
  948|  5.79k|    if (*strlength > asn_length)
  ------------------
  |  Branch (948:9): [True: 2.42k, False: 3.36k]
  ------------------
  949|  2.42k|        str[asn_length] = 0;
  950|  5.79k|    *strlength = asn_length;
  951|  5.79k|    *datalength -= asn_length + (bufp - data);
  952|       |
  953|  5.79k|    DEBUGIF("dumpv_recv") {
  ------------------
  |  |  145|  5.79k|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|  11.5k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 5.79k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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.79k|    return bufp + asn_length;
  974|  5.82k|}
asn_parse_header:
 1071|  45.7k|{
 1072|  45.7k|    register u_char *bufp;
 1073|  45.7k|    u_long          asn_length = 0;
 1074|  45.7k|    const char      *errpre = "parse header";
 1075|       |
 1076|  45.7k|    if (!data || !datalength || !type) {
  ------------------
  |  Branch (1076:9): [True: 0, False: 45.7k]
  |  Branch (1076:18): [True: 0, False: 45.7k]
  |  Branch (1076:33): [True: 0, False: 45.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|  45.7k|    if (*datalength < 2) {
  ------------------
  |  Branch (1082:9): [True: 379, False: 45.3k]
  ------------------
 1083|    379|        _asn_short_err(errpre, *datalength, 2);
 1084|    379|        return NULL;
 1085|    379|    }
 1086|       |
 1087|  45.3k|    bufp = data;
 1088|       |    /*
 1089|       |     * this only works on data types < 30, i.e. no extension octets 
 1090|       |     */
 1091|  45.3k|    if (IS_EXTENSION_ID(*bufp)) {
  ------------------
  |  |  103|  45.3k|#define IS_EXTENSION_ID(byte)	(((byte) & ASN_EXTENSION_ID) == ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|  45.3k|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  |  |               #define IS_EXTENSION_ID(byte)	(((byte) & ASN_EXTENSION_ID) == ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|  45.3k|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  |  |  |  Branch (103:31): [True: 10, False: 45.3k]
  |  |  ------------------
  ------------------
 1092|     10|        ERROR_MSG("can't process ID >= 30");
  ------------------
  |  |  188|     10|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1093|     10|        return NULL;
 1094|     10|    }
 1095|  45.3k|    *type = *bufp++;
 1096|       |
 1097|  45.3k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 1098|  45.3k|    if (NULL == bufp) {
  ------------------
  |  Branch (1098:9): [True: 796, False: 44.5k]
  ------------------
 1099|    796|        _asn_short_err(errpre, *datalength - 1, asn_length);
 1100|    796|        return NULL;
 1101|    796|    }
 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|  44.5k|#endif
 1113|       |
 1114|  44.5k|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 1115|       |
 1116|  44.5k|    if ((asn_length > 2) && (*type == ASN_OPAQUE) && (*bufp == ASN_OPAQUE_TAG1)) {
  ------------------
  |  |   93|  33.4k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  33.4k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if ((asn_length > 2) && (*type == ASN_OPAQUE) && (*bufp == ASN_OPAQUE_TAG1)) {
  ------------------
  |  |  131|  4.67k|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|  4.67k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|  4.67k|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
  |  Branch (1116:9): [True: 33.4k, False: 11.1k]
  |  Branch (1116:29): [True: 4.67k, False: 28.7k]
  |  Branch (1116:54): [True: 4.06k, False: 614]
  ------------------
 1117|       |
 1118|       |        /*
 1119|       |         * check if 64-but counter 
 1120|       |         */
 1121|  4.06k|        switch (*(bufp + 1)) {
 1122|    942|        case ASN_OPAQUE_COUNTER64:
  ------------------
  |  |  156|    942|#define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  136|    942|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  146|    942|#define ASN_APP_COUNTER64 (ASN_APPLICATION | 6)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    942|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1122:9): [True: 942, False: 3.12k]
  ------------------
 1123|  1.88k|        case ASN_OPAQUE_U64:
  ------------------
  |  |  192|  1.88k|#define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  136|  1.88k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  150|  1.88k|#define ASN_APP_U64 (ASN_APPLICATION | 11)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.88k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1123:9): [True: 942, False: 3.12k]
  ------------------
 1124|  2.11k|        case ASN_OPAQUE_FLOAT:
  ------------------
  |  |  165|  2.11k|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|  2.11k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|  2.11k|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  2.11k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1124:9): [True: 229, False: 3.83k]
  ------------------
 1125|  2.38k|        case ASN_OPAQUE_DOUBLE:
  ------------------
  |  |  174|  2.38k|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|  2.38k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|  2.38k|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  2.38k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1125:9): [True: 276, False: 3.78k]
  ------------------
 1126|  3.62k|        case ASN_OPAQUE_I64:
  ------------------
  |  |  183|  3.62k|#define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  136|  3.62k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  149|  3.62k|#define ASN_APP_I64 (ASN_APPLICATION | 10)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  3.62k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1126:9): [True: 1.24k, False: 2.82k]
  ------------------
 1127|  3.62k|            *type = *(bufp + 1);
 1128|  3.62k|            break;
 1129|       |
 1130|    434|        default:
  ------------------
  |  Branch (1130:9): [True: 434, False: 3.62k]
  ------------------
 1131|       |            /*
 1132|       |             * just an Opaque 
 1133|       |             */
 1134|    434|            *datalength = (int) asn_length;
 1135|    434|            return bufp;
 1136|  4.06k|        }
 1137|       |        /*
 1138|       |         * value is encoded as special format 
 1139|       |         */
 1140|  3.62k|        *datalength = (int) asn_length;
 1141|  3.62k|        bufp = asn_parse_nlength(bufp+2, *datalength - 2, &asn_length);
 1142|  3.62k|        if (NULL == bufp) {
  ------------------
  |  Branch (1142:13): [True: 38, False: 3.59k]
  ------------------
 1143|     38|            _asn_short_err("parse opaque header", *datalength - 2, asn_length);
 1144|     38|            return NULL;
 1145|     38|        }
 1146|  3.62k|    }
 1147|  44.0k|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 1148|       |
 1149|  44.0k|    *datalength = (int) asn_length;
 1150|       |
 1151|  44.0k|    return bufp;
 1152|  44.5k|}
asn_parse_sequence:
 1171|  26.6k|{                               /* error message prefix */
 1172|  26.6k|    data = asn_parse_header(data, datalength, type);
 1173|  26.6k|    if (data && (*type != expected_type)) {
  ------------------
  |  Branch (1173:9): [True: 25.4k, False: 1.19k]
  |  Branch (1173:17): [True: 1.71k, False: 23.7k]
  ------------------
 1174|  1.71k|        char            ebuf[128];
 1175|  1.71k|        snprintf(ebuf, sizeof(ebuf),
 1176|  1.71k|                 "%s header type %02X: s/b %02X", estr,
 1177|  1.71k|                (u_char) * type, (u_char) expected_type);
 1178|  1.71k|        ERROR_MSG(ebuf);
  ------------------
  |  |  188|  1.71k|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1179|  1.71k|        return NULL;
 1180|  1.71k|    }
 1181|  24.9k|    return data;
 1182|  26.6k|}
asn_parse_length:
 1293|  12.7k|{
 1294|  12.7k|    static const char *errpre = "parse length";
 1295|  12.7k|    char            ebuf[128];
 1296|  12.7k|    register u_char lengthbyte;
 1297|       |
 1298|  12.7k|    if (!data || !length) {
  ------------------
  |  Branch (1298:9): [True: 0, False: 12.7k]
  |  Branch (1298:18): [True: 0, False: 12.7k]
  ------------------
 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.7k|    lengthbyte = *data;
 1303|       |
 1304|  12.7k|    if (lengthbyte & ASN_LONG_LEN) {
  ------------------
  |  |   98|  12.7k|#define ASN_LONG_LEN	    0x80U
  ------------------
  |  Branch (1304:9): [True: 12.7k, False: 0]
  ------------------
 1305|  12.7k|        lengthbyte &= ~ASN_LONG_LEN;    /* turn MSb off */
  ------------------
  |  |   98|  12.7k|#define ASN_LONG_LEN	    0x80U
  ------------------
 1306|  12.7k|        if (lengthbyte == 0) {
  ------------------
  |  Branch (1306:13): [True: 104, False: 12.6k]
  ------------------
 1307|    104|            snprintf(ebuf, sizeof(ebuf),
 1308|    104|                     "%s: indefinite length not supported", errpre);
 1309|    104|            ERROR_MSG(ebuf);
  ------------------
  |  |  188|    104|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1310|    104|            return NULL;
 1311|    104|        }
 1312|  12.6k|        if (lengthbyte > sizeof(long)) {
  ------------------
  |  Branch (1312:13): [True: 136, False: 12.4k]
  ------------------
 1313|    136|            snprintf(ebuf, sizeof(ebuf),
 1314|    136|                    "%s: data length %d > %lu not supported", errpre,
 1315|    136|                    lengthbyte, (unsigned long)sizeof(long));
 1316|    136|            ERROR_MSG(ebuf);
  ------------------
  |  |  188|    136|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1317|    136|            return NULL;
 1318|    136|        }
 1319|  12.4k|        data++;
 1320|  12.4k|        *length = 0;            /* protect against short lengths */
 1321|  31.4k|        while (lengthbyte--) {
  ------------------
  |  Branch (1321:16): [True: 18.9k, False: 12.4k]
  ------------------
 1322|  18.9k|            *length <<= 8;
 1323|  18.9k|            *length |= *data++;
 1324|  18.9k|        }
 1325|  12.4k|        if ((long) *length < 0) {
  ------------------
  |  Branch (1325:13): [True: 123, False: 12.3k]
  ------------------
 1326|    123|            snprintf(ebuf, sizeof(ebuf),
 1327|    123|                     "%s: negative data length %ld\n", errpre,
 1328|    123|                     (long) *length);
 1329|    123|            ERROR_MSG(ebuf);
  ------------------
  |  |  188|    123|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1330|    123|            return NULL;
 1331|    123|        }
 1332|  12.3k|        return data;
 1333|  12.4k|    } else {                    /* short asnlength */
 1334|      0|        *length = (long) lengthbyte;
 1335|      0|        return data + 1;
 1336|      0|    }
 1337|  12.7k|}
asn_parse_objid:
 1435|  19.7k|{
 1436|  19.7k|    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.7k|    register u_char *bufp = data;
 1444|  19.7k|    register oid   *oidp = objid + 1;
 1445|  19.7k|    register u_long subidentifier;
 1446|  19.7k|    register long   length;
 1447|  19.7k|    u_long          asn_length;
 1448|  19.7k|    size_t          original_length = *objidlength;
 1449|       |
 1450|  19.7k|    if (NULL == data || NULL == datalength || NULL == type || NULL == objid) {
  ------------------
  |  Branch (1450:9): [True: 0, False: 19.7k]
  |  Branch (1450:25): [True: 0, False: 19.7k]
  |  Branch (1450:47): [True: 0, False: 19.7k]
  |  Branch (1450:63): [True: 0, False: 19.7k]
  ------------------
 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.7k|    if (*datalength < 2) {
  ------------------
  |  Branch (1456:9): [True: 20, False: 19.7k]
  ------------------
 1457|     20|        _asn_short_err(errpre, *datalength, 2);
 1458|     20|        return NULL;
 1459|     20|    }
 1460|       |
 1461|  19.7k|    *type = *bufp++;
 1462|  19.7k|    if (*type != ASN_OBJECT_ID) {
  ------------------
  |  |   81|  19.7k|#define ASN_OBJECT_ID	    0x06U
  ------------------
  |  Branch (1462:9): [True: 25, False: 19.6k]
  ------------------
 1463|     25|        _asn_type_err(errpre, *type);
 1464|     25|        return NULL;
 1465|     25|    }
 1466|  19.6k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 1467|  19.6k|    if (NULL == bufp) {
  ------------------
  |  Branch (1467:9): [True: 147, False: 19.5k]
  ------------------
 1468|    147|        _asn_short_err(errpre, *datalength - 1, asn_length);
 1469|    147|        return NULL;
 1470|    147|    }
 1471|       |
 1472|  19.5k|    *datalength -= (int) asn_length + (bufp - data);
 1473|       |
 1474|  19.5k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|  19.5k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  19.5k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 19.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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.5k]
  |  |  ------------------
  ------------------
 1475|       |
 1476|       |    /*
 1477|       |     * Handle invalid object identifier encodings of the form 06 00 robustly 
 1478|       |     */
 1479|  19.5k|    if (asn_length == 0)
  ------------------
  |  Branch (1479:9): [True: 16.2k, False: 3.31k]
  ------------------
 1480|  16.2k|        objid[0] = objid[1] = 0;
 1481|       |
 1482|  19.5k|    length = asn_length;
 1483|  19.5k|    (*objidlength)--;           /* account for expansion of first byte */
 1484|       |
 1485|  35.0k|    while (length > 0 && (*objidlength)-- > 0) {
  ------------------
  |  Branch (1485:12): [True: 15.5k, False: 19.4k]
  |  Branch (1485:26): [True: 15.5k, False: 22]
  ------------------
 1486|  15.5k|        subidentifier = 0;
 1487|  17.9k|        do {                    /* shift and add in low order 7 bits */
 1488|  17.9k|            if (subidentifier > (MAX_SUBID >> 7)) {
  ------------------
  |  |   18|  17.9k|#define MAX_SUBID   0xFFFFFFFFUL
  ------------------
  |  Branch (1488:17): [True: 24, False: 17.9k]
  ------------------
 1489|     24|                ERROR_MSG("subidentifier too large / overflow");
  ------------------
  |  |  188|     24|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1490|     24|                return NULL;
 1491|     24|            }
 1492|  17.9k|            subidentifier =
 1493|  17.9k|                (subidentifier << 7) + (*(u_char *) bufp & ~ASN_BIT8);
  ------------------
  |  |  100|  17.9k|#define ASN_BIT8	    0x80U
  ------------------
 1494|  17.9k|            length--;
 1495|  17.9k|        } while ((*(u_char *) bufp++ & ASN_BIT8) && (length > 0));        /* last byte has high bit clear */
  ------------------
  |  |  100|  17.9k|#define ASN_BIT8	    0x80U
  ------------------
  |  Branch (1495:18): [True: 2.46k, False: 15.4k]
  |  Branch (1495:53): [True: 2.44k, False: 25]
  ------------------
 1496|       |
 1497|  15.5k|	if (length == 0) {
  ------------------
  |  Branch (1497:6): [True: 3.26k, False: 12.2k]
  ------------------
 1498|  3.26k|            u_char *last_byte = bufp - 1;
 1499|  3.26k|            if (*last_byte & ASN_BIT8) {
  ------------------
  |  |  100|  3.26k|#define ASN_BIT8	    0x80U
  ------------------
  |  Branch (1499:17): [True: 25, False: 3.24k]
  ------------------
 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.26k|        }
 1505|  15.4k|        if (subidentifier > MAX_SUBID) {
  ------------------
  |  |   18|  15.4k|#define MAX_SUBID   0xFFFFFFFFUL
  ------------------
  |  Branch (1505:13): [True: 0, False: 15.4k]
  ------------------
 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.4k|        *oidp++ = (oid) subidentifier;
 1510|  15.4k|    }
 1511|       |
 1512|  19.4k|    if (length || oidp < objid + 1) {
  ------------------
  |  Branch (1512:9): [True: 22, False: 19.4k]
  |  Branch (1512:19): [True: 0, False: 19.4k]
  ------------------
 1513|     22|        ERROR_MSG("OID length exceeds buffer size");
  ------------------
  |  |  188|     22|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1514|     22|        *objidlength = original_length;
 1515|     22|        return NULL;
 1516|     22|    }
 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.4k|    subidentifier = oidp - objid >= 2 ? objid[1] : 0;
  ------------------
  |  Branch (1524:21): [True: 3.24k, False: 16.2k]
  ------------------
 1525|  19.4k|    if (subidentifier == 0x2B) {
  ------------------
  |  Branch (1525:9): [True: 619, False: 18.8k]
  ------------------
 1526|    619|        objid[0] = 1;
 1527|    619|        objid[1] = 3;
 1528|  18.8k|    } else {
 1529|  18.8k|        if (subidentifier < 40) {
  ------------------
  |  Branch (1529:13): [True: 16.7k, False: 2.10k]
  ------------------
 1530|  16.7k|            objid[0] = 0;
 1531|  16.7k|            objid[1] = subidentifier;
 1532|  16.7k|        } else if (subidentifier < 80) {
  ------------------
  |  Branch (1532:20): [True: 934, False: 1.17k]
  ------------------
 1533|    934|            objid[0] = 1;
 1534|    934|            objid[1] = subidentifier - 40;
 1535|  1.17k|        } else {
 1536|  1.17k|            objid[0] = 2;
 1537|  1.17k|            objid[1] = subidentifier - 80;
 1538|  1.17k|        }
 1539|  18.8k|    }
 1540|       |
 1541|  19.4k|    *objidlength = (int) (oidp - objid);
 1542|       |
 1543|  19.4k|    DEBUGMSG(("dumpv_recv", "  ObjID: "));
  ------------------
  |  |   61|  19.4k|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|  19.4k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 19.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 19.4k]
  |  |  ------------------
  ------------------
 1544|  19.4k|    DEBUGMSGOID(("dumpv_recv", objid, *objidlength));
  ------------------
  |  |   67|  19.4k|#define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  19.4k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 19.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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.4k]
  |  |  ------------------
  ------------------
 1545|  19.4k|    DEBUGMSG(("dumpv_recv", "\n"));
  ------------------
  |  |   61|  19.4k|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|  19.4k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 19.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 19.4k]
  |  |  ------------------
  ------------------
 1546|  19.4k|    return bufp;
 1547|  19.4k|}
asn_parse_bitstring:
 1817|    909|{
 1818|       |    /*
 1819|       |     * bitstring ::= 0x03 asnlength unused {byte}*
 1820|       |     */
 1821|    909|    static const char *errpre = "parse bitstring";
 1822|    909|    register u_char *bufp = data;
 1823|    909|    u_long          asn_length;
 1824|       |
 1825|    909|    if (NULL == data || NULL == datalength || NULL == type ||
  ------------------
  |  Branch (1825:9): [True: 0, False: 909]
  |  Branch (1825:25): [True: 0, False: 909]
  |  Branch (1825:47): [True: 0, False: 909]
  ------------------
 1826|    909|        NULL == str || NULL == strlength) {
  ------------------
  |  Branch (1826:9): [True: 0, False: 909]
  |  Branch (1826:24): [True: 0, False: 909]
  ------------------
 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|    909|    if (*datalength < 2) {
  ------------------
  |  Branch (1832:9): [True: 0, False: 909]
  ------------------
 1833|      0|        _asn_short_err(errpre, *datalength, 2);
 1834|      0|        return NULL;
 1835|      0|    }
 1836|       |
 1837|    909|    *type = *bufp++;
 1838|    909|    if (*type != ASN_BIT_STR) {
  ------------------
  |  |   77|    909|#define ASN_BIT_STR	    0x03U
  ------------------
  |  Branch (1838:9): [True: 0, False: 909]
  ------------------
 1839|      0|        _asn_type_err(errpre, *type);
 1840|      0|        return NULL;
 1841|      0|    }
 1842|       |
 1843|    909|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 1844|    909|    if (NULL == bufp) {
  ------------------
  |  Branch (1844:9): [True: 0, False: 909]
  ------------------
 1845|      0|        _asn_short_err(errpre, *datalength - 1, asn_length);
 1846|      0|        return NULL;
 1847|      0|    }
 1848|       |
 1849|    909|    if ((size_t) asn_length > *strlength) {
  ------------------
  |  Branch (1849:9): [True: 0, False: 909]
  ------------------
 1850|      0|        _asn_length_err(errpre, (size_t) asn_length, *strlength);
 1851|      0|        return NULL;
 1852|      0|    }
 1853|    909|    if (_asn_bitstring_check(errpre, asn_length, *bufp))
  ------------------
  |  Branch (1853:9): [True: 8, False: 901]
  ------------------
 1854|      8|        return NULL;
 1855|       |
 1856|    901|    DEBUGDUMPSETUP("recv", data, bufp - data);
  ------------------
  |  |   83|    901|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    901|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 901]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 901]
  |  |  ------------------
  ------------------
 1857|    901|    DEBUGMSG(("dumpv_recv", "  Bitstring: "));
  ------------------
  |  |   61|    901|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    901|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 901]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 901]
  |  |  ------------------
  ------------------
 1858|    901|    DEBUGMSGHEX(("dumpv_recv", data, asn_length));
  ------------------
  |  |   71|    901|#define DEBUGMSGHEX(x)     do {if (_DBG_IF_) {__DBGMSGHEX(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    901|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 901]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGHEX(x)     do {if (_DBG_IF_) {__DBGMSGHEX(x);} }while(0)
  |  |  ------------------
  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  ------------------
  |  |  |  Branch (71:71): [Folded, False: 901]
  |  |  ------------------
  ------------------
 1859|    901|    DEBUGMSG(("dumpv_recv", "\n"));
  ------------------
  |  |   61|    901|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    901|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 901]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 901]
  |  |  ------------------
  ------------------
 1860|       |
 1861|    901|    memmove(str, bufp, asn_length);
 1862|    901|    *strlength = (int) asn_length;
 1863|    901|    *datalength -= (int) asn_length + (bufp - data);
 1864|    901|    return bufp + asn_length;
 1865|    909|}
asn_parse_unsigned_int64:
 1949|  3.25k|{
 1950|       |    /*
 1951|       |     * ASN.1 integer ::= 0x02 asnlength byte {byte}*
 1952|       |     */
 1953|  3.25k|    static const char *errpre = "parse uint64";
 1954|  3.25k|    const int       uint64sizelimit = (4 * 2) + 1;
 1955|  3.25k|    register u_char *bufp = data;
 1956|  3.25k|    u_long          asn_length;
 1957|  3.25k|    register u_long low = 0, high = 0;
 1958|       |
 1959|  3.25k|    if (countersize != sizeof(struct counter64)) {
  ------------------
  |  Branch (1959:9): [True: 0, False: 3.25k]
  ------------------
 1960|      0|        _asn_size_err(errpre, countersize, sizeof(struct counter64));
 1961|      0|        return NULL;
 1962|      0|    }
 1963|       |
 1964|  3.25k|    if (NULL == data || NULL == datalength || NULL == type || NULL == cp) {
  ------------------
  |  Branch (1964:9): [True: 0, False: 3.25k]
  |  Branch (1964:25): [True: 0, False: 3.25k]
  |  Branch (1964:47): [True: 0, False: 3.25k]
  |  Branch (1964:63): [True: 0, False: 3.25k]
  ------------------
 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.25k|    if (*datalength < 2) {
  ------------------
  |  Branch (1970:9): [True: 0, False: 3.25k]
  ------------------
 1971|      0|        _asn_short_err(errpre, *datalength, 2);
 1972|      0|        return NULL;
 1973|      0|    }
 1974|       |
 1975|  3.25k|    *type = *bufp++;
 1976|  3.25k|    if (*type != ASN_COUNTER64
  ------------------
  |  |   99|  6.51k|#define ASN_COUNTER64   (ASN_APPLICATION | 6)
  |  |  ------------------
  |  |  |  |   91|  3.25k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (1976:9): [True: 1.87k, False: 1.38k]
  ------------------
 1977|  1.87k|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 1978|  1.87k|            && *type != ASN_OPAQUE
  ------------------
  |  |   93|  1.87k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  1.87k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (1978:16): [True: 8, False: 1.86k]
  ------------------
 1979|  3.25k|#endif
 1980|  3.25k|            ) {
 1981|      8|        _asn_type_err(errpre, *type);
 1982|      8|        return NULL;
 1983|      8|    }
 1984|  3.24k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 1985|  3.24k|    if (NULL == bufp) {
  ------------------
  |  Branch (1985:9): [True: 0, False: 3.24k]
  ------------------
 1986|      0|        _asn_short_err(errpre, *datalength - 1, asn_length);
 1987|      0|        return NULL;
 1988|      0|    }
 1989|       |
 1990|  3.24k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|  3.24k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  3.24k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3.24k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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.24k]
  |  |  ------------------
  ------------------
 1991|  3.24k|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 1992|       |    /** need at least 2 bytes: ASN_OPAQUE_TAG1 and ASN_OPAQUE_<type> */
 1993|  3.24k|    if ((*type == ASN_OPAQUE) && (asn_length < 2)) {
  ------------------
  |  |   93|  3.24k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  3.24k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (1993:9): [True: 1.86k, False: 1.38k]
  |  Branch (1993:34): [True: 0, False: 1.86k]
  ------------------
 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.24k|    if ((*type == ASN_OPAQUE) &&
  ------------------
  |  |   93|  3.24k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  3.24k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2001:9): [True: 1.86k, False: 1.38k]
  ------------------
 2002|  1.86k|        (asn_length <= ASN_OPAQUE_COUNTER64_MX_BER_LEN) &&
  ------------------
  |  |  160|  1.86k|#define ASN_OPAQUE_COUNTER64_MX_BER_LEN 12
  ------------------
  |  Branch (2002:9): [True: 1.84k, False: 22]
  ------------------
 2003|  1.84k|        (*bufp == ASN_OPAQUE_TAG1) &&
  ------------------
  |  |  131|  1.84k|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|  1.84k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|  1.84k|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
  |  Branch (2003:9): [True: 1.84k, False: 0]
  ------------------
 2004|  1.84k|        ((*(bufp + 1) == ASN_OPAQUE_COUNTER64) ||
  ------------------
  |  |  156|  1.84k|#define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  136|  1.84k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  146|  1.84k|#define ASN_APP_COUNTER64 (ASN_APPLICATION | 6)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.84k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2004:10): [True: 924, False: 921]
  ------------------
 2005|  1.84k|         (*(bufp + 1) == ASN_OPAQUE_U64))) {
  ------------------
  |  |  192|    921|#define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  136|    921|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  150|    921|#define ASN_APP_U64 (ASN_APPLICATION | 11)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    921|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2005:10): [True: 921, False: 0]
  ------------------
 2006|       |        /*
 2007|       |         * change type to Counter64 or U64 
 2008|       |         */
 2009|  1.84k|        *type = *(bufp + 1);
 2010|       |        /*
 2011|       |         * value is encoded as special format 
 2012|       |         */
 2013|  1.84k|        *datalength = asn_length;
 2014|  1.84k|        bufp = asn_parse_nlength(bufp+2, *datalength - 2, &asn_length);
 2015|  1.84k|        if (NULL == bufp) {
  ------------------
  |  Branch (2015:13): [True: 0, False: 1.84k]
  ------------------
 2016|      0|            _asn_short_err("parse opaque uint64", *datalength - 2, asn_length);
 2017|      0|            return NULL;
 2018|      0|        }
 2019|  1.84k|    }
 2020|  3.24k|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 2021|  3.24k|    if (((int) asn_length > uint64sizelimit) ||
  ------------------
  |  Branch (2021:9): [True: 28, False: 3.22k]
  ------------------
 2022|  3.22k|        (((int) asn_length == uint64sizelimit) && *bufp != 0x00)) {
  ------------------
  |  Branch (2022:10): [True: 293, False: 2.92k]
  |  Branch (2022:51): [True: 9, False: 284]
  ------------------
 2023|     37|        _asn_length_err(errpre, (size_t) asn_length, uint64sizelimit);
 2024|     37|        return NULL;
 2025|     37|    }
 2026|  3.21k|    *datalength -= (int) asn_length + (bufp - data);
 2027|  7.42k|    while (asn_length--) {
  ------------------
  |  Branch (2027:12): [True: 4.21k, False: 3.21k]
  ------------------
 2028|  4.21k|        high = ((0x00FFFFFF & high) << 8) | ((low & 0xFF000000U) >> 24);
 2029|  4.21k|        low = ((low & 0x00FFFFFF) << 8) | *bufp++;
 2030|  4.21k|    }
 2031|       |
 2032|  3.21k|    CHECK_OVERFLOW_U(high,6);
  ------------------
  |  |  224|  3.21k|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|  3.21k|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 0, False: 3.21k]
  |  |  ------------------
  |  |  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.21k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 3.21k]
  |  |  ------------------
  ------------------
 2033|  3.21k|    CHECK_OVERFLOW_U(low,6);
  ------------------
  |  |  224|  3.21k|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|  3.21k|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 0, False: 3.21k]
  |  |  ------------------
  |  |  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.21k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 3.21k]
  |  |  ------------------
  ------------------
 2034|       |
 2035|  3.21k|    cp->low = low;
 2036|  3.21k|    cp->high = high;
 2037|       |
 2038|  3.21k|    DEBUGIF("dumpv_recv") {
  ------------------
  |  |  145|  3.21k|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|  6.42k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3.21k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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.21k|    return bufp;
 2045|  3.24k|}
asn_parse_signed_int64:
 2222|  1.24k|{
 2223|  1.24k|    static const char *errpre = "parse int64";
 2224|  1.24k|    const int       int64sizelimit = (4 * 2) + 1;
 2225|  1.24k|    char            ebuf[128];
 2226|  1.24k|    register u_char *bufp = data;
 2227|  1.24k|    u_long          asn_length;
 2228|  1.24k|    register u_int  low = 0, high = 0;
 2229|       |
 2230|  1.24k|    if (countersize != sizeof(struct counter64)) {
  ------------------
  |  Branch (2230:9): [True: 0, False: 1.24k]
  ------------------
 2231|      0|        _asn_size_err(errpre, countersize, sizeof(struct counter64));
 2232|      0|        return NULL;
 2233|      0|    }
 2234|       |
 2235|  1.24k|    if (NULL == data || NULL == datalength || NULL == type || NULL == cp) {
  ------------------
  |  Branch (2235:9): [True: 0, False: 1.24k]
  |  Branch (2235:25): [True: 0, False: 1.24k]
  |  Branch (2235:47): [True: 0, False: 1.24k]
  |  Branch (2235:63): [True: 0, False: 1.24k]
  ------------------
 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.24k|    if (*datalength < 2) {
  ------------------
  |  Branch (2241:9): [True: 0, False: 1.24k]
  ------------------
 2242|      0|        _asn_short_err(errpre, *datalength, 2);
 2243|      0|        return NULL;
 2244|      0|    }
 2245|       |
 2246|  1.24k|    *type = *bufp++;
 2247|  1.24k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 2248|  1.24k|    if (NULL == bufp) {
  ------------------
  |  Branch (2248:9): [True: 0, False: 1.24k]
  ------------------
 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.24k|    if (asn_length < 2) {
  ------------------
  |  Branch (2254:9): [True: 10, False: 1.23k]
  ------------------
 2255|     10|        _asn_short_err(errpre, asn_length, 2);
 2256|     10|        return NULL;
 2257|     10|    }
 2258|       |
 2259|  1.23k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|  1.23k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  1.23k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1.23k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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.23k]
  |  |  ------------------
  ------------------
 2260|  1.23k|    if ((*type == ASN_OPAQUE) &&
  ------------------
  |  |   93|  1.23k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  1.23k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2260:9): [True: 1.22k, False: 9]
  ------------------
 2261|  1.22k|        (asn_length <= ASN_OPAQUE_COUNTER64_MX_BER_LEN) &&
  ------------------
  |  |  160|  1.22k|#define ASN_OPAQUE_COUNTER64_MX_BER_LEN 12
  ------------------
  |  Branch (2261:9): [True: 1.20k, False: 16]
  ------------------
 2262|  1.20k|        (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_I64)) {
  ------------------
  |  |  131|  1.20k|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|  1.20k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|  1.20k|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
                      (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_I64)) {
  ------------------
  |  |  183|  1.20k|#define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  136|  1.20k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  149|  1.20k|#define ASN_APP_I64 (ASN_APPLICATION | 10)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.20k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2262:9): [True: 1.20k, False: 0]
  |  Branch (2262:39): [True: 1.20k, False: 0]
  ------------------
 2263|       |        /*
 2264|       |         * change type to Int64 
 2265|       |         */
 2266|  1.20k|        *type = *(bufp + 1);
 2267|       |        /*
 2268|       |         * value is encoded as special format 
 2269|       |         */
 2270|  1.20k|        *datalength = asn_length;
 2271|  1.20k|        bufp = asn_parse_nlength(bufp+2, *datalength - 2, &asn_length);
 2272|  1.20k|        if (NULL == bufp) {
  ------------------
  |  Branch (2272:13): [True: 0, False: 1.20k]
  ------------------
 2273|      0|            _asn_short_err("parse opaque int64", *datalength - 2, asn_length);
 2274|      0|            return NULL;
 2275|      0|        }
 2276|  1.20k|    }
 2277|       |    /*
 2278|       |     * this should always have been true until snmp gets int64 PDU types 
 2279|       |     */
 2280|     25|    else {
 2281|     25|        snprintf(ebuf, sizeof(ebuf),
 2282|     25|                "%s: wrong type: %d, len %d, buf bytes (%02X,%02X)",
 2283|     25|                errpre, *type, (int) asn_length, *bufp, *(bufp + 1));
 2284|     25|        ERROR_MSG(ebuf);
  ------------------
  |  |  188|     25|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 2285|     25|        return NULL;
 2286|     25|    }
 2287|  1.20k|    if (((int) asn_length > int64sizelimit) ||
  ------------------
  |  Branch (2287:9): [True: 0, False: 1.20k]
  ------------------
 2288|  1.20k|        (((int) asn_length == int64sizelimit) && *bufp != 0x00)) {
  ------------------
  |  Branch (2288:10): [True: 221, False: 985]
  |  Branch (2288:50): [True: 8, False: 213]
  ------------------
 2289|      8|        _asn_length_err(errpre, (size_t) asn_length, int64sizelimit);
 2290|      8|        return NULL;
 2291|      8|    }
 2292|  1.19k|    *datalength -= (int) asn_length + (bufp - data);
 2293|  1.19k|    if ((asn_length > 0) && (*bufp & 0x80)) {
  ------------------
  |  Branch (2293:9): [True: 816, False: 382]
  |  Branch (2293:29): [True: 252, False: 564]
  ------------------
 2294|    252|        low = 0xFFFFFFFFU;   /* first byte bit 1 means start the data with 1s */
 2295|    252|        high = 0xFFFFFF;
 2296|    252|    }
 2297|       |
 2298|  4.18k|    for ( ; asn_length; asn_length--) {
  ------------------
  |  Branch (2298:13): [True: 2.98k, False: 1.19k]
  ------------------
 2299|  2.98k|        high = ((0x00FFFFFF & high) << 8) | ((low & 0xFF000000U) >> 24);
 2300|  2.98k|        low = ((low & 0x00FFFFFF) << 8) | *bufp++;
 2301|  2.98k|    }
 2302|       |
 2303|  1.19k|    CHECK_OVERFLOW_U(high,8);
  ------------------
  |  |  224|  1.19k|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|  1.19k|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 0, False: 1.19k]
  |  |  ------------------
  |  |  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.19k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 1.19k]
  |  |  ------------------
  ------------------
 2304|  1.19k|    CHECK_OVERFLOW_U(low,8);
  ------------------
  |  |  224|  1.19k|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|  1.19k|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 0, False: 1.19k]
  |  |  ------------------
  |  |  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.19k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 1.19k]
  |  |  ------------------
  ------------------
 2305|       |
 2306|  1.19k|    cp->low = low;
 2307|  1.19k|    cp->high = high;
 2308|       |
 2309|  1.19k|    DEBUGIF("dumpv_recv") {
  ------------------
  |  |  145|  1.19k|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|  2.39k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1.19k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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.19k|    return bufp;
 2316|  1.20k|}
asn_parse_float:
 2439|    568|{
 2440|    568|    static const char *errpre = "parse float";
 2441|    568|    register u_char *bufp = data;
 2442|    568|    u_long          asn_length;
 2443|    568|    union {
 2444|    568|        float           floatVal;
 2445|    568|        long            longVal;
 2446|    568|        u_char          c[sizeof(float)];
 2447|    568|    } fu;
 2448|       |
 2449|    568|    if (floatsize != sizeof(float)) {
  ------------------
  |  Branch (2449:9): [True: 0, False: 568]
  ------------------
 2450|      0|        _asn_size_err("parse float", floatsize, sizeof(float));
 2451|      0|        return NULL;
 2452|      0|    }
 2453|       |
 2454|    568|    if (NULL == data || NULL == datalength || NULL == type || NULL == floatp) {
  ------------------
  |  Branch (2454:9): [True: 0, False: 568]
  |  Branch (2454:25): [True: 0, False: 568]
  |  Branch (2454:47): [True: 0, False: 568]
  |  Branch (2454:63): [True: 0, False: 568]
  ------------------
 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|    568|    if (*datalength < 2) {
  ------------------
  |  Branch (2460:9): [True: 0, False: 568]
  ------------------
 2461|      0|        _asn_short_err(errpre, *datalength, 2);
 2462|      0|        return NULL;
 2463|      0|    }
 2464|       |
 2465|    568|    *type = *bufp++;
 2466|    568|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 2467|    568|    if (NULL == bufp) {
  ------------------
  |  Branch (2467:9): [True: 0, False: 568]
  ------------------
 2468|      0|        _asn_short_err(errpre, *datalength - 1, asn_length);
 2469|      0|        return NULL;
 2470|      0|    }
 2471|       |
 2472|    568|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|    568|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    568|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 568]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 568]
  |  |  ------------------
  ------------------
 2473|       |    /*
 2474|       |     * the float is encoded as an opaque 
 2475|       |     */
 2476|    568|    if ((*type == ASN_OPAQUE) &&
  ------------------
  |  |   93|    568|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|    568|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2476:9): [True: 220, False: 348]
  ------------------
 2477|    220|        (asn_length == ASN_OPAQUE_FLOAT_BER_LEN) &&
  ------------------
  |  |  169|    220|#define ASN_OPAQUE_FLOAT_BER_LEN 7
  ------------------
  |  Branch (2477:9): [True: 204, False: 16]
  ------------------
 2478|    204|        (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_FLOAT)) {
  ------------------
  |  |  131|    204|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|    204|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|    204|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
                      (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_FLOAT)) {
  ------------------
  |  |  165|    204|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|    204|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|    204|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    204|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2478:9): [True: 204, False: 0]
  |  Branch (2478:39): [True: 204, False: 0]
  ------------------
 2479|       |
 2480|       |        /*
 2481|       |         * value is encoded as special format 
 2482|       |         */
 2483|    204|        *datalength = asn_length;
 2484|    204|        bufp = asn_parse_nlength(bufp+2, *datalength - 2, &asn_length);
 2485|    204|        if (NULL == bufp) {
  ------------------
  |  Branch (2485:13): [True: 0, False: 204]
  ------------------
 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|    204|        *type = ASN_OPAQUE_FLOAT;
  ------------------
  |  |  165|    204|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|    204|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|    204|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    204|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2493|    204|    }
 2494|       |
 2495|    568|    if (*type != ASN_OPAQUE_FLOAT) {
  ------------------
  |  |  165|    568|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|    568|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|    568|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    568|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2495:9): [True: 16, False: 552]
  ------------------
 2496|     16|        _asn_type_err(errpre, *type);
 2497|     16|        return NULL;
 2498|     16|    }
 2499|       |
 2500|    552|    if (asn_length != sizeof(float)) {
  ------------------
  |  Branch (2500:9): [True: 17, False: 535]
  ------------------
 2501|     17|        _asn_size_err("parse seq float", asn_length, sizeof(float));
 2502|     17|        return NULL;
 2503|     17|    }
 2504|       |
 2505|    535|    *datalength -= (int) asn_length + (bufp - data);
 2506|    535|    memcpy(&fu.c[0], bufp, asn_length);
 2507|       |
 2508|       |    /*
 2509|       |     * correct for endian differences 
 2510|       |     */
 2511|    535|    fu.longVal = ntohl(fu.longVal);
 2512|       |
 2513|    535|    *floatp = fu.floatVal;
 2514|       |
 2515|    535|    DEBUGMSG(("dumpv_recv", "Opaque float: %f\n", *floatp));
  ------------------
  |  |   61|    535|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    535|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 535]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 535]
  |  |  ------------------
  ------------------
 2516|    535|    return bufp;
 2517|    552|}
asn_parse_double:
 2622|    805|{
 2623|    805|    static const char *errpre = "parse double";
 2624|    805|    register u_char *bufp = data;
 2625|    805|    u_long          asn_length;
 2626|    805|    long            tmp;
 2627|    805|    union {
 2628|    805|        double          doubleVal;
 2629|    805|        int             intVal[2];
 2630|    805|        u_char          c[sizeof(double)];
 2631|    805|    } fu;
 2632|       |
 2633|       |
 2634|    805|    if (doublesize != sizeof(double)) {
  ------------------
  |  Branch (2634:9): [True: 0, False: 805]
  ------------------
 2635|      0|        _asn_size_err("parse double", doublesize, sizeof(double));
 2636|      0|        return NULL;
 2637|      0|    }
 2638|       |
 2639|    805|    if (NULL == data || NULL == datalength || NULL == type || NULL == doublep) {
  ------------------
  |  Branch (2639:9): [True: 0, False: 805]
  |  Branch (2639:25): [True: 0, False: 805]
  |  Branch (2639:47): [True: 0, False: 805]
  |  Branch (2639:63): [True: 0, False: 805]
  ------------------
 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|    805|    if (*datalength < 2) {
  ------------------
  |  Branch (2645:9): [True: 0, False: 805]
  ------------------
 2646|      0|        _asn_short_err(errpre, *datalength, 2);
 2647|      0|        return NULL;
 2648|      0|    }
 2649|       |
 2650|    805|    *type = *bufp++;
 2651|    805|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 2652|    805|    if (NULL == bufp) {
  ------------------
  |  Branch (2652:9): [True: 0, False: 805]
  ------------------
 2653|      0|        _asn_short_err(errpre, *datalength - 1, asn_length);
 2654|      0|        return NULL;
 2655|      0|    }
 2656|       |
 2657|    805|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|    805|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    805|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 805]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 805]
  |  |  ------------------
  ------------------
 2658|       |    /*
 2659|       |     * the double is encoded as an opaque 
 2660|       |     */
 2661|       |    /** need at least 2 bytes: ASN_OPAQUE_TAG1 and ASN_OPAQUE_DOUBLE */
 2662|    805|    if ((*type == ASN_OPAQUE) && (asn_length < 2)) {
  ------------------
  |  |   93|    805|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|    805|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2662:9): [True: 265, False: 540]
  |  Branch (2662:34): [True: 0, False: 265]
  ------------------
 2663|      0|        _asn_short_err(errpre, asn_length, 2);
 2664|      0|        return NULL;
 2665|      0|    }
 2666|    805|    if ((*type == ASN_OPAQUE) &&
  ------------------
  |  |   93|    805|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|    805|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2666:9): [True: 265, False: 540]
  ------------------
 2667|    265|        (asn_length == ASN_OPAQUE_DOUBLE_BER_LEN) &&
  ------------------
  |  |  178|    265|#define ASN_OPAQUE_DOUBLE_BER_LEN 11
  ------------------
  |  Branch (2667:9): [True: 249, False: 16]
  ------------------
 2668|    249|        (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_DOUBLE)) {
  ------------------
  |  |  131|    249|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|    249|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|    249|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
                      (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_DOUBLE)) {
  ------------------
  |  |  174|    249|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|    249|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|    249|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    249|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2668:9): [True: 249, False: 0]
  |  Branch (2668:39): [True: 249, False: 0]
  ------------------
 2669|       |
 2670|       |        /*
 2671|       |         * value is encoded as special format 
 2672|       |         */
 2673|    249|        *datalength = asn_length;
 2674|    249|        bufp = asn_parse_nlength(bufp+2, *datalength - 2, &asn_length);
 2675|    249|        if (NULL == bufp) {
  ------------------
  |  Branch (2675:13): [True: 0, False: 249]
  ------------------
 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|    249|        *type = ASN_OPAQUE_DOUBLE;
  ------------------
  |  |  174|    249|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|    249|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|    249|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    249|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2684|    249|    }
 2685|       |
 2686|    805|    if (*type != ASN_OPAQUE_DOUBLE) {
  ------------------
  |  |  174|    805|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|    805|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|    805|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    805|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2686:9): [True: 16, False: 789]
  ------------------
 2687|     16|        _asn_type_err(errpre, *type);
 2688|     16|        return NULL;
 2689|     16|    }
 2690|       |
 2691|    789|    if (asn_length != sizeof(double)) {
  ------------------
  |  Branch (2691:9): [True: 32, False: 757]
  ------------------
 2692|     32|        _asn_size_err("parse seq double", asn_length, sizeof(double));
 2693|     32|        return NULL;
 2694|     32|    }
 2695|    757|    *datalength -= (int) asn_length + (bufp - data);
 2696|    757|    memcpy(&fu.c[0], bufp, asn_length);
 2697|       |
 2698|       |    /*
 2699|       |     * correct for endian differences 
 2700|       |     */
 2701|       |
 2702|    757|    tmp = ntohl(fu.intVal[0]);
 2703|    757|    fu.intVal[0] = ntohl(fu.intVal[1]);
 2704|    757|    fu.intVal[1] = tmp;
 2705|       |
 2706|    757|    *doublep = fu.doubleVal;
 2707|    757|    DEBUGMSG(("dumpv_recv", "  Opaque Double:\t%f\n", *doublep));
  ------------------
  |  |   61|    757|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    757|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 757]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 757]
  |  |  ------------------
  ------------------
 2708|       |
 2709|    757|    return bufp;
 2710|    789|}
asn1.c:_asn_size_err:
  242|     49|{
  243|     49|    char            ebuf[128];
  244|       |
  245|     49|    snprintf(ebuf, sizeof(ebuf),
  246|     49|            "%s size %lu: s/b %lu", str,
  247|     49|	    (unsigned long)wrongsize, (unsigned long)rightsize);
  248|     49|    ERROR_MSG(ebuf);
  ------------------
  |  |  188|     49|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  249|     49|}
asn1.c:_asn_short_err:
  299|  2.40k|{
  300|  2.40k|    char            ebuf[128];
  301|       |
  302|  2.40k|    snprintf(ebuf, sizeof(ebuf), "%s length %lu too short: need %lu", str,
  303|  2.40k|	    (unsigned long)wrongsize, (unsigned long)rightsize);
  304|  2.40k|    ERROR_MSG(ebuf);
  ------------------
  |  |  188|  2.40k|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  305|  2.40k|}
asn1.c:_asn_type_err:
  261|    542|{
  262|    542|    char            ebuf[128];
  263|       |
  264|    542|    snprintf(ebuf, sizeof(ebuf), "%s type %d", str, wrongtype);
  265|    542|    ebuf[ sizeof(ebuf)-1 ] = 0;
  266|    542|    ERROR_MSG(ebuf);
  ------------------
  |  |  188|    542|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  267|    542|}
asn1.c:_asn_length_err:
  280|    178|{
  281|    178|    char            ebuf[128];
  282|       |
  283|    178|    snprintf(ebuf, sizeof(ebuf),
  284|    178|            "%s length %lu too large: exceeds %lu", str,
  285|    178|	    (unsigned long)wrongsize, (unsigned long)rightsize);
  286|    178|    ERROR_MSG(ebuf);
  ------------------
  |  |  188|    178|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  287|    178|}
asn1.c:_asn_bitstring_check:
  513|    909|{
  514|    909|    char            ebuf[128];
  515|       |
  516|    909|    if (asn_length < 1) {
  ------------------
  |  Branch (516:9): [True: 8, False: 901]
  ------------------
  517|      8|        snprintf(ebuf, sizeof(ebuf),
  518|      8|                "%s: length %d too small", str, (int) asn_length);
  519|      8|        ERROR_MSG(ebuf);
  ------------------
  |  |  188|      8|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  520|      8|        return 1;
  521|      8|    }
  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|    901|    return 0;
  530|    909|}

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

snmp_parse_var_op:
  160|  18.0k|{
  161|  18.0k|    u_char          var_op_type;
  162|  18.0k|    size_t          var_op_len = *listlength;
  163|  18.0k|    u_char         *var_op_start = data;
  164|       |
  165|  18.0k|    data = asn_parse_sequence(data, &var_op_len, &var_op_type,
  166|  18.0k|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR), "var_op");
  ------------------
  |  |   84|  18.0k|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR), "var_op");
  ------------------
  |  |   96|  18.0k|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
  167|  18.0k|    if (data == NULL) {
  ------------------
  |  Branch (167:9): [True: 308, False: 17.7k]
  ------------------
  168|       |        /*
  169|       |         * msg detail is set 
  170|       |         */
  171|    308|        return NULL;
  172|    308|    }
  173|  17.7k|    DEBUGDUMPHEADER("recv", "Name");
  ------------------
  |  |   79|  17.7k|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  17.7k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 17.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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.7k]
  |  |  ------------------
  ------------------
  174|  17.7k|    data =
  175|  17.7k|        asn_parse_objid(data, &var_op_len, &var_op_type, var_name,
  176|  17.7k|                        var_name_len);
  177|  17.7k|    DEBUGINDENTLESS();
  ------------------
  |  |   75|  17.7k|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|  17.7k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 17.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 17.7k]
  |  |  ------------------
  ------------------
  178|  17.7k|    if (data == NULL) {
  ------------------
  |  Branch (178:9): [True: 42, False: 17.6k]
  ------------------
  179|     42|        ERROR_MSG("No OID for variable");
  ------------------
  |  |  188|     42|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  180|     42|        return NULL;
  181|     42|    }
  182|  17.6k|    if (var_op_type !=
  ------------------
  |  Branch (182:9): [True: 0, False: 17.6k]
  ------------------
  183|  17.6k|        (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OBJECT_ID))
  ------------------
  |  |   90|  17.6k|#define ASN_UNIVERSAL	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OBJECT_ID))
  ------------------
  |  |   95|  17.6k|#define ASN_PRIMITIVE	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OBJECT_ID))
  ------------------
  |  |   81|  17.6k|#define ASN_OBJECT_ID	    0x06U
  ------------------
  184|      0|        return NULL;
  185|  17.6k|    *var_val = data;            /* save pointer to this object */
  186|       |    /*
  187|       |     * find out what type of object this is 
  188|       |     */
  189|  17.6k|    data = asn_parse_header(data, &var_op_len, var_val_type);
  190|  17.6k|    if (data == NULL) {
  ------------------
  |  Branch (190:9): [True: 12, False: 17.6k]
  ------------------
  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.6k|    *var_val_len = var_op_len;
  198|  17.6k|    data += var_op_len;
  199|  17.6k|    *listlength -= (int) (data - var_op_start);
  200|  17.6k|    return data;
  201|  17.6k|}

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

snmp_comstr_parse:
  109|  2.75k|{
  110|  2.75k|    u_char          type;
  111|  2.75k|    long            ver;
  112|  2.75k|    size_t          origlen = *slen;
  113|       |
  114|       |    /*
  115|       |     * Message is an ASN.1 SEQUENCE.
  116|       |     */
  117|  2.75k|    data = asn_parse_sequence(data, length, &type,
  118|  2.75k|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   84|  2.75k|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   96|  2.75k|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
  119|  2.75k|                              "auth message");
  120|  2.75k|    if (data == NULL) {
  ------------------
  |  Branch (120:9): [True: 297, False: 2.45k]
  ------------------
  121|    297|        return NULL;
  122|    297|    }
  123|       |
  124|       |    /*
  125|       |     * First field is the version.
  126|       |     */
  127|  2.45k|    DEBUGDUMPHEADER("recv", "SNMP version");
  ------------------
  |  |   79|  2.45k|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.45k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.45k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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.45k]
  |  |  ------------------
  ------------------
  128|  2.45k|    data = asn_parse_int(data, length, &type, &ver, sizeof(ver));
  129|  2.45k|    DEBUGINDENTLESS();
  ------------------
  |  |   75|  2.45k|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.45k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.45k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 2.45k]
  |  |  ------------------
  ------------------
  130|  2.45k|    *version = ver;
  131|  2.45k|    if (data == NULL) {
  ------------------
  |  Branch (131:9): [True: 187, False: 2.26k]
  ------------------
  132|    187|        ERROR_MSG("bad parse of version");
  ------------------
  |  |  188|    187|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  133|    187|        return NULL;
  134|    187|    }
  135|       |
  136|       |    /*
  137|       |     * second field is the community string for SNMPv1 & SNMPv2c 
  138|       |     */
  139|  2.26k|    DEBUGDUMPHEADER("recv", "community string");
  ------------------
  |  |   79|  2.26k|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.26k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.26k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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.26k]
  |  |  ------------------
  ------------------
  140|  2.26k|    data = asn_parse_string(data, length, &type, psid, slen);
  141|  2.26k|    DEBUGINDENTLESS();
  ------------------
  |  |   75|  2.26k|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.26k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.26k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 2.26k]
  |  |  ------------------
  ------------------
  142|  2.26k|    if (data == NULL) {
  ------------------
  |  Branch (142:9): [True: 739, False: 1.53k]
  ------------------
  143|    739|        ERROR_MSG("bad parse of community");
  ------------------
  |  |  188|    739|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  144|    739|        return NULL;
  145|    739|    }
  146|  1.53k|    psid[SNMP_MIN(*slen, origlen - 1)] = '\0';
  ------------------
  |  |  111|  1.53k|#define SNMP_MIN(a,b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (111:24): [True: 1, False: 1.52k]
  |  |  ------------------
  ------------------
  147|  1.53k|    return (u_char *) data;
  148|       |
  149|  2.26k|}                               /* end snmp_comstr_parse() */

snmp_set_var_objid:
  689|  17.6k|{
  690|  17.6k|    size_t          len = sizeof(oid) * name_length;
  691|       |
  692|  17.6k|    if (vp->name != vp->name_loc && vp->name != NULL) {
  ------------------
  |  Branch (692:9): [True: 17.6k, False: 0]
  |  Branch (692:37): [True: 0, False: 17.6k]
  ------------------
  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.6k|    if (len <= sizeof(vp->name_loc)) {
  ------------------
  |  Branch (703:9): [True: 17.6k, False: 0]
  ------------------
  704|  17.6k|        vp->name = vp->name_loc;
  705|  17.6k|    } 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.6k|    if (objid)
  ------------------
  |  Branch (710:9): [True: 17.6k, False: 0]
  ------------------
  711|  17.6k|        memmove(vp->name, objid, len);
  712|  17.6k|    vp->name_length = name_length;
  713|  17.6k|    return 0;
  714|  17.6k|}

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

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|    196|{
 1102|    196|    static int      newline = 1;	 /* MTCRITICAL_RESOURCE */
 1103|    196|    const char     *newline_ptr;
 1104|    196|    char            sbuf[40];
 1105|       |
 1106|    196|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|    196|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1106:9): [True: 0, False: 196]
  ------------------
 1107|    196|                               NETSNMP_DS_LIB_LOG_TIMESTAMP) && newline) {
  ------------------
  |  |   64|    196|#define NETSNMP_DS_LIB_LOG_TIMESTAMP       5
  ------------------
  |  Branch (1107:65): [True: 0, False: 0]
  ------------------
 1108|      0|        sprintf_stamp(NULL, sbuf);
 1109|    196|    } else {
 1110|    196|        strcpy(sbuf, "");
 1111|    196|    }
 1112|       |    /*
 1113|       |     * Remember whether or not the current line ends with a newline for the
 1114|       |     * next call of log_handler_stdouterr().
 1115|       |     */
 1116|    196|    newline_ptr = strrchr(str, '\n');
 1117|    196|    newline = newline_ptr && newline_ptr[1] == 0;
  ------------------
  |  Branch (1117:15): [True: 196, False: 0]
  |  Branch (1117:30): [True: 196, False: 0]
  ------------------
 1118|       |
 1119|    196|    if (logh->imagic)
  ------------------
  |  Branch (1119:9): [True: 0, False: 196]
  ------------------
 1120|      0|       printf(         "%s%s", sbuf, str);
 1121|    196|    else
 1122|    196|       fprintf(stderr, "%s%s", sbuf, str);
 1123|       |
 1124|    196|    return 1;
 1125|    196|}
snmp_log_string:
 1292|    196|{
 1293|    196|#ifndef NETSNMP_FEATURE_REMOVE_LOGGING_STDIO
 1294|    196|    static int stderr_enabled = 0;
 1295|    196|    static netsnmp_log_handler lh = { 1, 0, 0, 0, "stderr",
 1296|    196|                                      log_handler_stdouterr, 0, NULL,  NULL,
 1297|    196|                                      NULL };
 1298|    196|#endif /* NETSNMP_FEATURE_REMOVE_LOGGING_STDIO */
 1299|    196|    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|    196|    if (0 == logh_enabled) {
  ------------------
  |  Branch (1305:9): [True: 196, False: 0]
  ------------------
 1306|    196|#ifndef NETSNMP_FEATURE_REMOVE_LOGGING_STDIO
 1307|    196|        if (!stderr_enabled) {
  ------------------
  |  Branch (1307:13): [True: 1, False: 195]
  ------------------
 1308|      1|            ++stderr_enabled;
 1309|      1|            netsnmp_set_line_buffering(stderr);
 1310|      1|        }
 1311|    196|        log_handler_stdouterr( &lh, priority, str );
 1312|    196|#endif /* NETSNMP_FEATURE_REMOVE_LOGGING_STDIO */
 1313|       |
 1314|    196|        return;
 1315|    196|    }
 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|    196|{
 1380|    196|    char           *buffer = NULL;
 1381|    196|    int             length;
 1382|       |
 1383|    196|    length = vasprintf(&buffer, format, ap);
 1384|    196|    if (length < 0) {
  ------------------
  |  Branch (1384:9): [True: 0, False: 196]
  ------------------
 1385|      0|        snmp_log_string(LOG_ERR, "Could not format log-string\n");
 1386|      0|        return -1;
 1387|      0|    }
 1388|       |
 1389|    196|    snmp_log_string(priority, buffer);
 1390|    196|    free(buffer);
 1391|    196|    return 0;
 1392|    196|}
snmp_log:
 1403|    196|{
 1404|    196|    va_list         ap;
 1405|    196|    int             ret;
 1406|    196|    va_start(ap, format);
 1407|    196|    ret = snmp_vlog(priority, format, ap);
 1408|       |    va_end(ap);
 1409|    196|    return (ret);
 1410|    196|}

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.57k|{
  161|  5.57k|    struct snmp_secmod_list *sptr;
  162|       |
  163|  11.1k|    for (sptr = registered_services; sptr; sptr = sptr->next) {
  ------------------
  |  Branch (163:38): [True: 5.57k, False: 5.57k]
  ------------------
  164|  5.57k|        if (sptr->securityModel == secmod) {
  ------------------
  |  Branch (164:13): [True: 0, False: 5.57k]
  ------------------
  165|      0|            return sptr->secDef;
  166|      0|        }
  167|  5.57k|    }
  168|       |    /*
  169|       |     * not registered 
  170|       |     */
  171|  5.57k|    return NULL;
  172|  5.57k|}

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

netsnmp_memdup:
  279|  1.84k|{
  280|  1.84k|    void *to = NULL;
  281|       |
  282|  1.84k|    if (from) {
  ------------------
  |  Branch (282:9): [True: 1.84k, False: 0]
  ------------------
  283|  1.84k|        to = malloc(size);
  284|  1.84k|        if (to)
  ------------------
  |  Branch (284:13): [True: 1.84k, False: 0]
  ------------------
  285|  1.84k|            memcpy(to, from, size);
  286|  1.84k|    }
  287|  1.84k|    return to;
  288|  1.84k|}                               /* 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.75k|int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
   58|  2.75k|    size_t bytes_remaining = size;
   59|  2.75k|    netsnmp_pdu *pdu = SNMP_MALLOC_TYPEDEF(netsnmp_pdu);
  ------------------
  |  |   73|  2.75k|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
   60|       |
   61|  2.75k|    netsnmp_session sess = { };
   62|  2.75k|    snmpv3_parse(pdu, NETSNMP_REMOVE_CONST(uint8_t *, data), &bytes_remaining,
  ------------------
  |  |   91|  2.75k|    (__extension__ ({ const t tmp = (e); (t)(size_t)tmp; }))
  ------------------
   63|  2.75k|                 NULL, &sess);
   64|  2.75k|    snmp_free_pdu(pdu);
   65|       |
   66|  2.75k|    pdu = SNMP_MALLOC_TYPEDEF(netsnmp_pdu);
  ------------------
  |  |   73|  2.75k|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
   67|  2.75k|    memset(&sess, 0, sizeof(sess));
   68|  2.75k|    snmp_parse(NULL, &sess, pdu, NETSNMP_REMOVE_CONST(uint8_t *, data), size);
  ------------------
  |  |   91|  2.75k|    (__extension__ ({ const t tmp = (e); (t)(size_t)tmp; }))
  ------------------
   69|  2.75k|    snmp_free_pdu(pdu);
   70|       |
   71|  2.75k|    return 0;
   72|  2.75k|}

