asn_parse_nlength:
  327|  95.1k|{
  328|  95.1k|    int len_len;
  329|       |
  330|  95.1k|    if (pkt_len < 1)
  ------------------
  |  Branch (330:9): [True: 0, False: 95.1k]
  ------------------
  331|      0|        return NULL;               /* always too short */
  332|       |
  333|  95.1k|    if (NULL == pkt || NULL == data_len)
  ------------------
  |  Branch (333:9): [True: 0, False: 95.1k]
  |  Branch (333:24): [True: 0, False: 95.1k]
  ------------------
  334|      0|        return NULL;
  335|       |
  336|  95.1k|    *data_len = 0;
  337|       |
  338|  95.1k|    if (*pkt & 0x80) {
  ------------------
  |  Branch (338:9): [True: 12.1k, False: 82.9k]
  ------------------
  339|       |        /*
  340|       |         * long length; first byte is length of length (after masking high bit)
  341|       |         */
  342|  12.1k|        len_len = (int) ((*pkt & ~0x80) + 1);
  343|  12.1k|        if (pkt_len < len_len)
  ------------------
  |  Branch (343:13): [True: 137, False: 12.0k]
  ------------------
  344|    137|            return NULL;           /* still too short for length and data */
  345|       |
  346|       |        /* now we know we have enough data to parse length */
  347|  12.0k|        if (NULL == asn_parse_length(pkt, data_len))
  ------------------
  |  Branch (347:13): [True: 356, False: 11.6k]
  ------------------
  348|    356|            return NULL;           /* propagate error from asn_parse_length */
  349|  82.9k|    } else {
  350|       |        /*
  351|       |         * short length; first byte is the length
  352|       |         */
  353|  82.9k|        len_len = 1;
  354|  82.9k|        *data_len = *pkt;
  355|  82.9k|    }
  356|       |
  357|  94.6k|    if ((*data_len + len_len) > pkt_len)
  ------------------
  |  Branch (357:9): [True: 1.10k, False: 93.5k]
  ------------------
  358|  1.10k|        return NULL;
  359|       |
  360|  93.5k|    return (pkt + len_len);
  361|  94.6k|}
asn_parse_int:
  563|  9.30k|{
  564|       |    /*
  565|       |     * ASN.1 integer ::= 0x02 asnlength byte {byte}*
  566|       |     */
  567|  9.30k|    static const char *errpre = "parse int";
  568|  9.30k|    register u_char *bufp = data;
  569|  9.30k|    u_long          asn_length;
  570|  9.30k|    int             i;
  571|  9.30k|    union {
  572|  9.30k|        long          l;
  573|  9.30k|        unsigned char b[sizeof(long)];
  574|  9.30k|    } value;
  575|       |
  576|  9.30k|    if (NULL == data || NULL == datalength || NULL == type || NULL == intp) {
  ------------------
  |  Branch (576:9): [True: 0, False: 9.30k]
  |  Branch (576:25): [True: 0, False: 9.30k]
  |  Branch (576:47): [True: 0, False: 9.30k]
  |  Branch (576:63): [True: 0, False: 9.30k]
  ------------------
  577|      0|        ERROR_MSG("parse int: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  578|      0|        return NULL;
  579|      0|    }
  580|       |
  581|  9.30k|    if (intsize != sizeof(long)) {
  ------------------
  |  Branch (581:9): [True: 0, False: 9.30k]
  ------------------
  582|      0|        _asn_size_err(errpre, intsize, sizeof(long));
  583|      0|        return NULL;
  584|      0|    }
  585|       |
  586|       |    /** need at least 2 bytes to work with: type, length (which might be 0)  */
  587|  9.30k|    if (*datalength < 2) {
  ------------------
  |  Branch (587:9): [True: 78, False: 9.22k]
  ------------------
  588|     78|        _asn_short_err(errpre, *datalength, 2);
  589|     78|        return NULL;
  590|     78|    }
  591|       |
  592|  9.22k|    *type = *bufp++;
  593|  9.22k|    if (*type != ASN_INTEGER) {
  ------------------
  |  |   75|  9.22k|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (593:9): [True: 36, False: 9.18k]
  ------------------
  594|     36|        _asn_type_err(errpre, *type);
  595|     36|        return NULL;
  596|     36|    }
  597|       |
  598|  9.18k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
  599|  9.18k|    if (NULL == bufp) {
  ------------------
  |  Branch (599:9): [True: 311, False: 8.87k]
  ------------------
  600|    311|        _asn_short_err(errpre, *datalength - 1, asn_length);
  601|    311|        return NULL;
  602|    311|    }
  603|       |
  604|  8.87k|    if ((size_t) asn_length > intsize || (int) asn_length == 0) {
  ------------------
  |  Branch (604:9): [True: 37, False: 8.83k]
  |  Branch (604:42): [True: 24, False: 8.81k]
  ------------------
  605|     61|        _asn_length_err(errpre, (size_t) asn_length, intsize);
  606|     61|        return NULL;
  607|     61|    }
  608|       |
  609|  8.81k|    *datalength -= (int) asn_length + (bufp - data);
  610|       |
  611|  8.81k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|  8.81k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  8.81k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 8.81k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (199:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  200|      0|            debugmsg("dumpx_" token,"\n"); \
  |  |  |  |  201|      0|        } else { \
  |  |  |  |  202|      0|            debugmsg("dumpx_" token,"  "); \
  |  |  |  |  203|      0|        } \
  |  |  |  |  204|      0|        debugmsg("dumpv" token, "dumpv_%s:%*s", token, __DBGINDENT(), "");
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:60): [Folded, False: 8.81k]
  |  |  ------------------
  ------------------
  612|       |
  613|  8.81k|    memset(&value.b, *bufp & 0x80 ? 0xff : 0, sizeof(value.b));
  ------------------
  |  Branch (613:22): [True: 1.79k, False: 7.01k]
  ------------------
  614|  8.81k|    if (NETSNMP_BIGENDIAN) {
  ------------------
  |  | 2390|  8.81k|#  define NETSNMP_BIGENDIAN 0
  |  |  ------------------
  |  |  |  Branch (2390:29): [Folded, False: 8.81k]
  |  |  ------------------
  ------------------
  615|      0|        for (i = sizeof(long) - asn_length; asn_length--; i++)
  ------------------
  |  Branch (615:45): [True: 0, False: 0]
  ------------------
  616|      0|            value.b[i] = *bufp++;
  617|  8.81k|    } else {
  618|  24.0k|        for (i = asn_length - 1; asn_length--; i--)
  ------------------
  |  Branch (618:34): [True: 15.2k, False: 8.81k]
  ------------------
  619|  15.2k|            value.b[i] = *bufp++;
  620|  8.81k|    }
  621|       |
  622|  8.81k|    CHECK_OVERFLOW_S(value.l, 1);
  ------------------
  |  |  214|  8.81k|#define CHECK_OVERFLOW_S(x,y) do {                                      \
  |  |  215|  8.81k|        if (x > INT32_MAX) {                                            \
  |  |  ------------------
  |  |  |  Branch (215:13): [True: 461, False: 8.35k]
  |  |  ------------------
  |  |  216|    461|            DEBUGMSG(("asn","truncating signed value %ld to 32 bits (%d)\n",(long)(x),y)); \
  |  |  ------------------
  |  |  |  |   61|    461|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|    461|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 461]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 461]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  217|    461|            x &= 0xffffffff;                                            \
  |  |  218|  8.35k|        } else if (x < INT32_MIN) {                                     \
  |  |  ------------------
  |  |  |  Branch (218:20): [True: 440, False: 7.91k]
  |  |  ------------------
  |  |  219|    440|            DEBUGMSG(("asn","truncating signed value %ld to 32 bits (%d)\n",(long)(x),y)); \
  |  |  ------------------
  |  |  |  |   61|    440|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|    440|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 440]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 440]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  220|    440|            x = 0 - (x & 0xffffffff);                                   \
  |  |  221|    440|        }                                                               \
  |  |  222|  8.81k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (222:13): [Folded, False: 8.81k]
  |  |  ------------------
  ------------------
  623|       |
  624|  8.81k|    DEBUGMSG(("dumpv_recv", "  Integer:\t%ld (0x%.2lX)\n", value.l, value.l));
  ------------------
  |  |   61|  8.81k|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|  8.81k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 8.81k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 8.81k]
  |  |  ------------------
  ------------------
  625|       |
  626|  8.81k|    *intp = value.l;
  627|  8.81k|    return bufp;
  628|  8.87k|}
asn_parse_unsigned_int:
  656|  3.72k|{
  657|       |    /*
  658|       |     * ASN.1 integer ::= 0x02 asnlength byte {byte}*
  659|       |     */
  660|  3.72k|    static const char *errpre = "parse uint";
  661|  3.72k|    register u_char *bufp = data;
  662|  3.72k|    u_long          asn_length;
  663|  3.72k|    register u_long value = 0;
  664|       |
  665|  3.72k|    if (NULL == data || NULL == datalength || NULL == type || NULL == intp) {
  ------------------
  |  Branch (665:9): [True: 0, False: 3.72k]
  |  Branch (665:25): [True: 0, False: 3.72k]
  |  Branch (665:47): [True: 0, False: 3.72k]
  |  Branch (665:63): [True: 0, False: 3.72k]
  ------------------
  666|      0|        ERROR_MSG("parse uint: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  667|      0|        return NULL;
  668|      0|    }
  669|       |
  670|  3.72k|    if (intsize != sizeof(long)) {
  ------------------
  |  Branch (670:9): [True: 0, False: 3.72k]
  ------------------
  671|      0|        _asn_size_err(errpre, intsize, sizeof(long));
  672|      0|        return NULL;
  673|      0|    }
  674|       |
  675|       |    /** need at least 2 bytes to work with: type, length (which might be 0)  */
  676|  3.72k|    if (*datalength < 2) {
  ------------------
  |  Branch (676:9): [True: 2, False: 3.72k]
  ------------------
  677|      2|        _asn_short_err(errpre, *datalength, 2);
  678|      2|        return NULL;
  679|      2|    }
  680|       |
  681|  3.72k|    *type = *bufp++;
  682|  3.72k|    if (*type != ASN_COUNTER && *type != ASN_GAUGE && *type != ASN_TIMETICKS
  ------------------
  |  |   89|  7.44k|#define ASN_COUNTER	(ASN_APPLICATION | 1)
  |  |  ------------------
  |  |  |  |   91|  3.72k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if (*type != ASN_COUNTER && *type != ASN_GAUGE && *type != ASN_TIMETICKS
  ------------------
  |  |   90|  6.33k|#define ASN_GAUGE	(ASN_APPLICATION | 2)
  |  |  ------------------
  |  |  |  |   91|  2.60k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if (*type != ASN_COUNTER && *type != ASN_GAUGE && *type != ASN_TIMETICKS
  ------------------
  |  |   92|  5.47k|#define ASN_TIMETICKS   (ASN_APPLICATION | 3)
  |  |  ------------------
  |  |  |  |   91|  1.74k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (682:9): [True: 2.60k, False: 1.11k]
  |  Branch (682:33): [True: 1.74k, False: 863]
  |  Branch (682:55): [True: 935, False: 811]
  ------------------
  683|    935|            && *type != ASN_UINTEGER) {
  ------------------
  |  |  100|    935|#define ASN_UINTEGER    (ASN_APPLICATION | 7)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|    935|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (683:16): [True: 16, False: 919]
  ------------------
  684|     16|        _asn_type_err(errpre, *type);
  685|     16|        return NULL;
  686|     16|    }
  687|       |
  688|  3.70k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
  689|  3.70k|    if (NULL == bufp) {
  ------------------
  |  Branch (689:9): [True: 132, False: 3.57k]
  ------------------
  690|    132|        _asn_short_err(errpre, *datalength - 1, asn_length);
  691|    132|        return NULL;
  692|    132|    }
  693|       |
  694|  3.57k|    if ((asn_length > (intsize + 1)) || ((int) asn_length == 0) ||
  ------------------
  |  Branch (694:9): [True: 14, False: 3.56k]
  |  Branch (694:41): [True: 15, False: 3.54k]
  ------------------
  695|  3.54k|        ((asn_length == intsize + 1) && *bufp != 0x00)) {
  ------------------
  |  Branch (695:10): [True: 344, False: 3.20k]
  |  Branch (695:41): [True: 10, False: 334]
  ------------------
  696|     39|        _asn_length_err(errpre, (size_t) asn_length, intsize);
  697|     39|        return NULL;
  698|     39|    }
  699|  3.53k|    *datalength -= (int) asn_length + (bufp - data);
  700|       |
  701|  3.53k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|  3.53k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  3.53k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3.53k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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.53k]
  |  |  ------------------
  ------------------
  702|       |
  703|  13.9k|    while (asn_length--)
  ------------------
  |  Branch (703:12): [True: 10.4k, False: 3.53k]
  ------------------
  704|  10.4k|        value = (value << 8) | *bufp++;
  705|       |
  706|  3.53k|    CHECK_OVERFLOW_U(value,2);
  ------------------
  |  |  224|  3.53k|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|  3.53k|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 960, False: 2.57k]
  |  |  ------------------
  |  |  226|    960|            x &= 0xffffffff;                                            \
  |  |  227|    960|            DEBUGMSG(("asn","truncating unsigned value to 32 bits (%d)\n",y)); \
  |  |  ------------------
  |  |  |  |   61|    960|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|    960|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 960]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 960]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  228|    960|        }                                                               \
  |  |  229|  3.53k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 3.53k]
  |  |  ------------------
  ------------------
  707|       |
  708|  3.53k|    DEBUGMSG(("dumpv_recv", "  UInteger:\t%ld (0x%.2lX)\n", value, value));
  ------------------
  |  |   61|  3.53k|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|  3.53k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3.53k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 3.53k]
  |  |  ------------------
  ------------------
  709|       |
  710|  3.53k|    *intp = value;
  711|  3.53k|    return bufp;
  712|  3.57k|}
asn_parse_string:
  916|  6.52k|{
  917|  6.52k|    static const char *errpre = "parse string";
  918|  6.52k|    u_char         *bufp = data;
  919|  6.52k|    u_long          asn_length;
  920|       |
  921|  6.52k|    if (NULL == data || NULL == datalength || NULL == type || NULL == str ||
  ------------------
  |  Branch (921:9): [True: 0, False: 6.52k]
  |  Branch (921:25): [True: 0, False: 6.52k]
  |  Branch (921:47): [True: 0, False: 6.52k]
  |  Branch (921:63): [True: 0, False: 6.52k]
  ------------------
  922|  6.52k|        NULL == strlength) {
  ------------------
  |  Branch (922:9): [True: 0, False: 6.52k]
  ------------------
  923|      0|        ERROR_MSG("parse string: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  924|      0|        return NULL;
  925|      0|    }
  926|       |
  927|       |    /** need at least 2 bytes to work with: type, length (which might be 0)  */
  928|  6.52k|    if (*datalength < 2) {
  ------------------
  |  Branch (928:9): [True: 281, False: 6.24k]
  ------------------
  929|    281|        _asn_short_err(errpre, *datalength, 2);
  930|    281|        return NULL;
  931|    281|    }
  932|       |
  933|  6.24k|    *type = *bufp++;
  934|  6.24k|    if (*type != ASN_OCTET_STR && *type != ASN_IPADDRESS && *type != ASN_OPAQUE
  ------------------
  |  |   78|  12.4k|#define ASN_OCTET_STR	    0x04U
  ------------------
                  if (*type != ASN_OCTET_STR && *type != ASN_IPADDRESS && *type != ASN_OPAQUE
  ------------------
  |  |   88|  10.2k|#define ASN_IPADDRESS   (ASN_APPLICATION | 0)
  |  |  ------------------
  |  |  |  |   91|  4.00k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if (*type != ASN_OCTET_STR && *type != ASN_IPADDRESS && *type != ASN_OPAQUE
  ------------------
  |  |   93|  9.63k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  3.39k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (934:9): [True: 4.00k, False: 2.23k]
  |  Branch (934:35): [True: 3.39k, False: 616]
  |  Branch (934:61): [True: 1.62k, False: 1.76k]
  ------------------
  935|  1.62k|            && *type != ASN_NSAP) {
  ------------------
  |  |   98|  1.62k|#define ASN_NSAP	(ASN_APPLICATION | 5)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|  1.62k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (935:16): [True: 419, False: 1.20k]
  ------------------
  936|    419|        _asn_type_err(errpre, *type);
  937|    419|        return NULL;
  938|    419|    }
  939|       |
  940|  5.82k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
  941|  5.82k|    if (NULL == bufp) {
  ------------------
  |  Branch (941:9): [True: 159, False: 5.66k]
  ------------------
  942|    159|        _asn_short_err(errpre, *datalength - 1, asn_length);
  943|    159|        return NULL;
  944|    159|    }
  945|       |
  946|  5.66k|    if (asn_length > *strlength) {
  ------------------
  |  Branch (946:9): [True: 34, False: 5.63k]
  ------------------
  947|     34|        _asn_length_err(errpre, (size_t) asn_length, *strlength);
  948|     34|        return NULL;
  949|     34|    }
  950|       |
  951|  5.63k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|  5.63k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  5.63k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 5.63k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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.63k]
  |  |  ------------------
  ------------------
  952|       |
  953|  5.63k|    memmove(str, bufp, asn_length);
  954|  5.63k|    if (*strlength > asn_length)
  ------------------
  |  Branch (954:9): [True: 2.33k, False: 3.29k]
  ------------------
  955|  2.33k|        str[asn_length] = 0;
  956|  5.63k|    *strlength = asn_length;
  957|  5.63k|    *datalength -= asn_length + (bufp - data);
  958|       |
  959|  5.63k|    DEBUGIF("dumpv_recv") {
  ------------------
  |  |  145|  5.63k|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|  11.2k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 5.63k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (145:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  960|      0|        u_char         *buf = (u_char *) malloc(1 + asn_length);
  961|      0|        size_t          l = (buf != NULL) ? (1 + asn_length) : 0, ol = 0;
  ------------------
  |  Branch (961:29): [True: 0, False: 0]
  ------------------
  962|       |
  963|      0|        if (sprint_realloc_asciistring
  ------------------
  |  Branch (963:13): [True: 0, False: 0]
  ------------------
  964|      0|            (&buf, &l, &ol, 1, str, asn_length)) {
  965|      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]
  |  |  ------------------
  ------------------
  966|      0|        } else {
  967|      0|            if (buf == NULL) {
  ------------------
  |  Branch (967:17): [True: 0, False: 0]
  ------------------
  968|      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]
  |  |  ------------------
  ------------------
  969|      0|            } else {
  970|      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]
  |  |  ------------------
  ------------------
  971|      0|                          buf));
  972|      0|            }
  973|      0|        }
  974|      0|        if (buf != NULL) {
  ------------------
  |  Branch (974:13): [True: 0, False: 0]
  ------------------
  975|      0|            free(buf);
  976|      0|        }
  977|      0|    }
  978|       |
  979|  5.63k|    return bufp + asn_length;
  980|  5.66k|}
asn_parse_header:
 1077|  44.2k|{
 1078|  44.2k|    register u_char *bufp;
 1079|  44.2k|    u_long          asn_length = 0;
 1080|  44.2k|    const char      *errpre = "parse header";
 1081|       |
 1082|  44.2k|    if (!data || !datalength || !type) {
  ------------------
  |  Branch (1082:9): [True: 0, False: 44.2k]
  |  Branch (1082:18): [True: 0, False: 44.2k]
  |  Branch (1082:33): [True: 0, False: 44.2k]
  ------------------
 1083|      0|        ERROR_MSG("parse header: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1084|      0|        return NULL;
 1085|      0|    }
 1086|       |
 1087|       |    /** need at least 2 bytes to work with: type, length (which might be 0) */
 1088|  44.2k|    if (*datalength < 2) {
  ------------------
  |  Branch (1088:9): [True: 388, False: 43.8k]
  ------------------
 1089|    388|        _asn_short_err(errpre, *datalength, 2);
 1090|    388|        return NULL;
 1091|    388|    }
 1092|       |
 1093|  43.8k|    bufp = data;
 1094|       |    /*
 1095|       |     * this only works on data types < 30, i.e. no extension octets 
 1096|       |     */
 1097|  43.8k|    if (IS_EXTENSION_ID(*bufp)) {
  ------------------
  |  |  103|  43.8k|#define IS_EXTENSION_ID(byte)	(((byte) & ASN_EXTENSION_ID) == ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|  43.8k|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  |  |               #define IS_EXTENSION_ID(byte)	(((byte) & ASN_EXTENSION_ID) == ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|  43.8k|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  |  |  |  Branch (103:31): [True: 17, False: 43.8k]
  |  |  ------------------
  ------------------
 1098|     17|        ERROR_MSG("can't process ID >= 30");
  ------------------
  |  |  188|     17|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1099|     17|        return NULL;
 1100|     17|    }
 1101|  43.8k|    *type = *bufp++;
 1102|       |
 1103|  43.8k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 1104|  43.8k|    if (NULL == bufp) {
  ------------------
  |  Branch (1104:9): [True: 797, False: 43.0k]
  ------------------
 1105|    797|        _asn_short_err(errpre, *datalength - 1, asn_length);
 1106|    797|        return NULL;
 1107|    797|    }
 1108|       |
 1109|       |#ifdef DUMP_PRINT_HEADERS
 1110|       |    DEBUGDUMPSETUP("recv", data, (bufp - data));
 1111|       |    DEBUGMSG(("dumpv_recv", "  Header: 0x%.2X, len = %d (0x%X)\n", *data,
 1112|       |              asn_length, asn_length));
 1113|       |#else
 1114|       |    /*
 1115|       |     * DEBUGMSGHEXTLI(("recv",data,(bufp-data)));
 1116|       |     * DEBUGMSG(("dumpH_recv","\n"));
 1117|       |     */
 1118|  43.0k|#endif
 1119|       |
 1120|  43.0k|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 1121|       |
 1122|  43.0k|    if ((asn_length > 2) && (*type == ASN_OPAQUE) && (*bufp == ASN_OPAQUE_TAG1)) {
  ------------------
  |  |   93|  32.5k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  32.5k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if ((asn_length > 2) && (*type == ASN_OPAQUE) && (*bufp == ASN_OPAQUE_TAG1)) {
  ------------------
  |  |  131|  4.62k|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|  4.62k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|  4.62k|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
  |  Branch (1122:9): [True: 32.5k, False: 10.5k]
  |  Branch (1122:29): [True: 4.62k, False: 27.8k]
  |  Branch (1122:54): [True: 4.07k, False: 550]
  ------------------
 1123|       |
 1124|       |        /*
 1125|       |         * check if 64-but counter 
 1126|       |         */
 1127|  4.07k|        switch (*(bufp + 1)) {
 1128|    833|        case ASN_OPAQUE_COUNTER64:
  ------------------
  |  |  156|    833|#define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  136|    833|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  146|    833|#define ASN_APP_COUNTER64 (ASN_APPLICATION | 6)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    833|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1128:9): [True: 833, False: 3.24k]
  ------------------
 1129|  1.68k|        case ASN_OPAQUE_U64:
  ------------------
  |  |  192|  1.68k|#define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  136|  1.68k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  150|  1.68k|#define ASN_APP_U64 (ASN_APPLICATION | 11)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.68k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1129:9): [True: 854, False: 3.22k]
  ------------------
 1130|  2.03k|        case ASN_OPAQUE_FLOAT:
  ------------------
  |  |  165|  2.03k|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|  2.03k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|  2.03k|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  2.03k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1130:9): [True: 348, False: 3.73k]
  ------------------
 1131|  2.28k|        case ASN_OPAQUE_DOUBLE:
  ------------------
  |  |  174|  2.28k|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|  2.28k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|  2.28k|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  2.28k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1131:9): [True: 247, False: 3.83k]
  ------------------
 1132|  3.54k|        case ASN_OPAQUE_I64:
  ------------------
  |  |  183|  3.54k|#define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  136|  3.54k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  149|  3.54k|#define ASN_APP_I64 (ASN_APPLICATION | 10)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  3.54k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1132:9): [True: 1.26k, False: 2.81k]
  ------------------
 1133|  3.54k|            *type = *(bufp + 1);
 1134|  3.54k|            break;
 1135|       |
 1136|    529|        default:
  ------------------
  |  Branch (1136:9): [True: 529, False: 3.54k]
  ------------------
 1137|       |            /*
 1138|       |             * just an Opaque 
 1139|       |             */
 1140|    529|            *datalength = (int) asn_length;
 1141|    529|            return bufp;
 1142|  4.07k|        }
 1143|       |        /*
 1144|       |         * value is encoded as special format 
 1145|       |         */
 1146|  3.54k|        *datalength = (int) asn_length;
 1147|  3.54k|        bufp = asn_parse_nlength(bufp+2, *datalength - 2, &asn_length);
 1148|  3.54k|        if (NULL == bufp) {
  ------------------
  |  Branch (1148:13): [True: 40, False: 3.50k]
  ------------------
 1149|     40|            _asn_short_err("parse opaque header", *datalength - 2, asn_length);
 1150|     40|            return NULL;
 1151|     40|        }
 1152|  3.54k|    }
 1153|  42.5k|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 1154|       |
 1155|  42.5k|    *datalength = (int) asn_length;
 1156|       |
 1157|  42.5k|    return bufp;
 1158|  43.0k|}
asn_parse_sequence:
 1177|  25.8k|{                               /* error message prefix */
 1178|  25.8k|    data = asn_parse_header(data, datalength, type);
 1179|  25.8k|    if (data && (*type != expected_type)) {
  ------------------
  |  Branch (1179:9): [True: 24.6k, False: 1.20k]
  |  Branch (1179:17): [True: 1.62k, False: 23.0k]
  ------------------
 1180|  1.62k|        char            ebuf[128];
 1181|  1.62k|        snprintf(ebuf, sizeof(ebuf),
 1182|  1.62k|                 "%s header type %02X: s/b %02X", estr,
 1183|  1.62k|                (u_char) * type, (u_char) expected_type);
 1184|  1.62k|        ebuf[ sizeof(ebuf)-1 ] = 0;
 1185|  1.62k|        ERROR_MSG(ebuf);
  ------------------
  |  |  188|  1.62k|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1186|  1.62k|        return NULL;
 1187|  1.62k|    }
 1188|  24.2k|    return data;
 1189|  25.8k|}
asn_parse_length:
 1302|  12.0k|{
 1303|  12.0k|    static const char *errpre = "parse length";
 1304|  12.0k|    char            ebuf[128];
 1305|  12.0k|    register u_char lengthbyte;
 1306|       |
 1307|  12.0k|    if (!data || !length) {
  ------------------
  |  Branch (1307:9): [True: 0, False: 12.0k]
  |  Branch (1307:18): [True: 0, False: 12.0k]
  ------------------
 1308|      0|        ERROR_MSG("parse length: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1309|      0|        return NULL;
 1310|      0|    }
 1311|  12.0k|    lengthbyte = *data;
 1312|       |
 1313|  12.0k|    if (lengthbyte & ASN_LONG_LEN) {
  ------------------
  |  |   98|  12.0k|#define ASN_LONG_LEN	    0x80U
  ------------------
  |  Branch (1313:9): [True: 12.0k, False: 0]
  ------------------
 1314|  12.0k|        lengthbyte &= ~ASN_LONG_LEN;    /* turn MSb off */
  ------------------
  |  |   98|  12.0k|#define ASN_LONG_LEN	    0x80U
  ------------------
 1315|  12.0k|        if (lengthbyte == 0) {
  ------------------
  |  Branch (1315:13): [True: 100, False: 11.9k]
  ------------------
 1316|    100|            snprintf(ebuf, sizeof(ebuf),
 1317|    100|                     "%s: indefinite length not supported", errpre);
 1318|    100|            ebuf[ sizeof(ebuf)-1 ] = 0;
 1319|    100|            ERROR_MSG(ebuf);
  ------------------
  |  |  188|    100|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1320|    100|            return NULL;
 1321|    100|        }
 1322|  11.9k|        if (lengthbyte > sizeof(long)) {
  ------------------
  |  Branch (1322:13): [True: 135, False: 11.8k]
  ------------------
 1323|    135|            snprintf(ebuf, sizeof(ebuf),
 1324|    135|                    "%s: data length %d > %lu not supported", errpre,
 1325|    135|                    lengthbyte, (unsigned long)sizeof(long));
 1326|    135|            ebuf[ sizeof(ebuf)-1 ] = 0;
 1327|    135|            ERROR_MSG(ebuf);
  ------------------
  |  |  188|    135|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1328|    135|            return NULL;
 1329|    135|        }
 1330|  11.8k|        data++;
 1331|  11.8k|        *length = 0;            /* protect against short lengths */
 1332|  30.0k|        while (lengthbyte--) {
  ------------------
  |  Branch (1332:16): [True: 18.2k, False: 11.8k]
  ------------------
 1333|  18.2k|            *length <<= 8;
 1334|  18.2k|            *length |= *data++;
 1335|  18.2k|        }
 1336|  11.8k|        if ((long) *length < 0) {
  ------------------
  |  Branch (1336:13): [True: 121, False: 11.6k]
  ------------------
 1337|    121|            snprintf(ebuf, sizeof(ebuf),
 1338|    121|                     "%s: negative data length %ld\n", errpre,
 1339|    121|                     (long) *length);
 1340|    121|            ebuf[ sizeof(ebuf)-1 ] = 0;
 1341|    121|            ERROR_MSG(ebuf);
  ------------------
  |  |  188|    121|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1342|    121|            return NULL;
 1343|    121|        }
 1344|  11.6k|        return data;
 1345|  11.8k|    } else {                    /* short asnlength */
 1346|      0|        *length = (long) lengthbyte;
 1347|      0|        return data + 1;
 1348|      0|    }
 1349|  12.0k|}
asn_parse_objid:
 1450|  18.9k|{
 1451|  18.9k|    static const char *errpre = "parse objid";
 1452|       |    /*
 1453|       |     * ASN.1 objid ::= 0x06 asnlength subidentifier {subidentifier}*
 1454|       |     * subidentifier ::= {leadingbyte}* lastbyte
 1455|       |     * leadingbyte ::= 1 7bitvalue
 1456|       |     * lastbyte ::= 0 7bitvalue
 1457|       |     */
 1458|  18.9k|    register u_char *bufp = data;
 1459|  18.9k|    register oid   *oidp = objid + 1;
 1460|  18.9k|    register u_long subidentifier;
 1461|  18.9k|    register long   length;
 1462|  18.9k|    u_long          asn_length;
 1463|  18.9k|    size_t          original_length = *objidlength;
 1464|       |
 1465|  18.9k|    if (NULL == data || NULL == datalength || NULL == type || NULL == objid) {
  ------------------
  |  Branch (1465:9): [True: 0, False: 18.9k]
  |  Branch (1465:25): [True: 0, False: 18.9k]
  |  Branch (1465:47): [True: 0, False: 18.9k]
  |  Branch (1465:63): [True: 0, False: 18.9k]
  ------------------
 1466|      0|        ERROR_MSG("parse objid: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1467|      0|        return NULL;
 1468|      0|    }
 1469|       |
 1470|       |    /** need at least 2 bytes to work with: type, length (which might be 0)  */
 1471|  18.9k|    if (*datalength < 2) {
  ------------------
  |  Branch (1471:9): [True: 23, False: 18.9k]
  ------------------
 1472|     23|        _asn_short_err(errpre, *datalength, 2);
 1473|     23|        return NULL;
 1474|     23|    }
 1475|       |
 1476|  18.9k|    *type = *bufp++;
 1477|  18.9k|    if (*type != ASN_OBJECT_ID) {
  ------------------
  |  |   81|  18.9k|#define ASN_OBJECT_ID	    0x06U
  ------------------
  |  Branch (1477:9): [True: 27, False: 18.9k]
  ------------------
 1478|     27|        _asn_type_err(errpre, *type);
 1479|     27|        return NULL;
 1480|     27|    }
 1481|  18.9k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 1482|  18.9k|    if (NULL == bufp) {
  ------------------
  |  Branch (1482:9): [True: 154, False: 18.7k]
  ------------------
 1483|    154|        _asn_short_err(errpre, *datalength - 1, asn_length);
 1484|    154|        return NULL;
 1485|    154|    }
 1486|       |
 1487|  18.7k|    *datalength -= (int) asn_length + (bufp - data);
 1488|       |
 1489|  18.7k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|  18.7k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  18.7k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 18.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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: 18.7k]
  |  |  ------------------
  ------------------
 1490|       |
 1491|       |    /*
 1492|       |     * Handle invalid object identifier encodings of the form 06 00 robustly 
 1493|       |     */
 1494|  18.7k|    if (asn_length == 0)
  ------------------
  |  Branch (1494:9): [True: 16.1k, False: 2.63k]
  ------------------
 1495|  16.1k|        objid[0] = objid[1] = 0;
 1496|       |
 1497|  18.7k|    length = asn_length;
 1498|  18.7k|    (*objidlength)--;           /* account for expansion of first byte */
 1499|       |
 1500|  34.5k|    while (length > 0 && (*objidlength)-- > 0) {
  ------------------
  |  Branch (1500:12): [True: 15.7k, False: 18.7k]
  |  Branch (1500:26): [True: 15.7k, False: 20]
  ------------------
 1501|  15.7k|        subidentifier = 0;
 1502|  18.5k|        do {                    /* shift and add in low order 7 bits */
 1503|  18.5k|            subidentifier =
 1504|  18.5k|                (subidentifier << 7) + (*(u_char *) bufp & ~ASN_BIT8);
  ------------------
  |  |  100|  18.5k|#define ASN_BIT8	    0x80U
  ------------------
 1505|  18.5k|            length--;
 1506|  18.5k|        } while ((*(u_char *) bufp++ & ASN_BIT8) && (length > 0));        /* last byte has high bit clear */
  ------------------
  |  |  100|  18.5k|#define ASN_BIT8	    0x80U
  ------------------
  |  Branch (1506:18): [True: 2.74k, False: 15.7k]
  |  Branch (1506:53): [True: 2.72k, False: 18]
  ------------------
 1507|       |
 1508|  15.7k|	if (length == 0) {
  ------------------
  |  Branch (1508:6): [True: 2.60k, False: 13.1k]
  ------------------
 1509|  2.60k|            u_char *last_byte = bufp - 1;
 1510|  2.60k|            if (*last_byte & ASN_BIT8) {
  ------------------
  |  |  100|  2.60k|#define ASN_BIT8	    0x80U
  ------------------
  |  Branch (1510:17): [True: 18, False: 2.58k]
  ------------------
 1511|       |                /* last byte has high bit set -> wrong BER encoded OID */
 1512|     18|                ERROR_MSG("subidentifier syntax error");
  ------------------
  |  |  188|     18|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1513|     18|                return NULL;
 1514|     18|            }
 1515|  2.60k|        }
 1516|  15.7k|        if (subidentifier > MAX_SUBID) {
  ------------------
  |  |   18|  15.7k|#define MAX_SUBID   0xFFFFFFFFUL
  ------------------
  |  Branch (1516:13): [True: 15, False: 15.7k]
  ------------------
 1517|     15|            ERROR_MSG("subidentifier too large");
  ------------------
  |  |  188|     15|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1518|     15|            return NULL;
 1519|     15|        }
 1520|  15.7k|        *oidp++ = (oid) subidentifier;
 1521|  15.7k|    }
 1522|       |
 1523|  18.7k|    if (length || oidp < objid + 1) {
  ------------------
  |  Branch (1523:9): [True: 20, False: 18.7k]
  |  Branch (1523:19): [True: 0, False: 18.7k]
  ------------------
 1524|     20|        ERROR_MSG("OID length exceeds buffer size");
  ------------------
  |  |  188|     20|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1525|     20|        *objidlength = original_length;
 1526|     20|        return NULL;
 1527|     20|    }
 1528|       |
 1529|       |    /*
 1530|       |     * The first two subidentifiers are encoded into the first component
 1531|       |     * with the value (X * 40) + Y, where:
 1532|       |     *  X is the value of the first subidentifier.
 1533|       |     *  Y is the value of the second subidentifier.
 1534|       |     */
 1535|  18.7k|    subidentifier = oidp - objid >= 2 ? objid[1] : 0;
  ------------------
  |  Branch (1535:21): [True: 2.58k, False: 16.1k]
  ------------------
 1536|  18.7k|    if (subidentifier == 0x2B) {
  ------------------
  |  Branch (1536:9): [True: 499, False: 18.2k]
  ------------------
 1537|    499|        objid[0] = 1;
 1538|    499|        objid[1] = 3;
 1539|  18.2k|    } else {
 1540|  18.2k|        if (subidentifier < 40) {
  ------------------
  |  Branch (1540:13): [True: 16.5k, False: 1.69k]
  ------------------
 1541|  16.5k|            objid[0] = 0;
 1542|  16.5k|            objid[1] = subidentifier;
 1543|  16.5k|        } else if (subidentifier < 80) {
  ------------------
  |  Branch (1543:20): [True: 759, False: 931]
  ------------------
 1544|    759|            objid[0] = 1;
 1545|    759|            objid[1] = subidentifier - 40;
 1546|    931|        } else {
 1547|    931|            objid[0] = 2;
 1548|    931|            objid[1] = subidentifier - 80;
 1549|    931|        }
 1550|  18.2k|    }
 1551|       |
 1552|  18.7k|    *objidlength = (int) (oidp - objid);
 1553|       |
 1554|  18.7k|    DEBUGMSG(("dumpv_recv", "  ObjID: "));
  ------------------
  |  |   61|  18.7k|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|  18.7k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 18.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 18.7k]
  |  |  ------------------
  ------------------
 1555|  18.7k|    DEBUGMSGOID(("dumpv_recv", objid, *objidlength));
  ------------------
  |  |   67|  18.7k|#define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  18.7k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 18.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  165|      0|#define __DBGMSGOID(x)     debugmsg_oid x
  |  |  ------------------
  |  |  |  Branch (67:71): [Folded, False: 18.7k]
  |  |  ------------------
  ------------------
 1556|  18.7k|    DEBUGMSG(("dumpv_recv", "\n"));
  ------------------
  |  |   61|  18.7k|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|  18.7k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 18.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 18.7k]
  |  |  ------------------
  ------------------
 1557|  18.7k|    return bufp;
 1558|  18.7k|}
asn_parse_bitstring:
 1828|    726|{
 1829|       |    /*
 1830|       |     * bitstring ::= 0x03 asnlength unused {byte}*
 1831|       |     */
 1832|    726|    static const char *errpre = "parse bitstring";
 1833|    726|    register u_char *bufp = data;
 1834|    726|    u_long          asn_length;
 1835|       |
 1836|    726|    if (NULL == data || NULL == datalength || NULL == type ||
  ------------------
  |  Branch (1836:9): [True: 0, False: 726]
  |  Branch (1836:25): [True: 0, False: 726]
  |  Branch (1836:47): [True: 0, False: 726]
  ------------------
 1837|    726|        NULL == str || NULL == strlength) {
  ------------------
  |  Branch (1837:9): [True: 0, False: 726]
  |  Branch (1837:24): [True: 0, False: 726]
  ------------------
 1838|      0|        ERROR_MSG("parse bitstring: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1839|      0|        return NULL;
 1840|      0|    }
 1841|       |
 1842|       |    /** need at least 2 bytes to work with: type, length (which might be 0)  */
 1843|    726|    if (*datalength < 2) {
  ------------------
  |  Branch (1843:9): [True: 0, False: 726]
  ------------------
 1844|      0|        _asn_short_err(errpre, *datalength, 2);
 1845|      0|        return NULL;
 1846|      0|    }
 1847|       |
 1848|    726|    *type = *bufp++;
 1849|    726|    if (*type != ASN_BIT_STR) {
  ------------------
  |  |   77|    726|#define ASN_BIT_STR	    0x03U
  ------------------
  |  Branch (1849:9): [True: 0, False: 726]
  ------------------
 1850|      0|        _asn_type_err(errpre, *type);
 1851|      0|        return NULL;
 1852|      0|    }
 1853|       |
 1854|    726|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 1855|    726|    if (NULL == bufp) {
  ------------------
  |  Branch (1855:9): [True: 0, False: 726]
  ------------------
 1856|      0|        _asn_short_err(errpre, *datalength - 1, asn_length);
 1857|      0|        return NULL;
 1858|      0|    }
 1859|       |
 1860|    726|    if ((size_t) asn_length > *strlength) {
  ------------------
  |  Branch (1860:9): [True: 0, False: 726]
  ------------------
 1861|      0|        _asn_length_err(errpre, (size_t) asn_length, *strlength);
 1862|      0|        return NULL;
 1863|      0|    }
 1864|    726|    if (_asn_bitstring_check(errpre, asn_length, *bufp))
  ------------------
  |  Branch (1864:9): [True: 7, False: 719]
  ------------------
 1865|      7|        return NULL;
 1866|       |
 1867|    719|    DEBUGDUMPSETUP("recv", data, bufp - data);
  ------------------
  |  |   83|    719|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    719|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 719]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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: 719]
  |  |  ------------------
  ------------------
 1868|    719|    DEBUGMSG(("dumpv_recv", "  Bitstring: "));
  ------------------
  |  |   61|    719|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    719|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 719]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 719]
  |  |  ------------------
  ------------------
 1869|    719|    DEBUGMSGHEX(("dumpv_recv", data, asn_length));
  ------------------
  |  |   71|    719|#define DEBUGMSGHEX(x)     do {if (_DBG_IF_) {__DBGMSGHEX(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    719|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 719]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGHEX(x)     do {if (_DBG_IF_) {__DBGMSGHEX(x);} }while(0)
  |  |  ------------------
  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  ------------------
  |  |  |  Branch (71:71): [Folded, False: 719]
  |  |  ------------------
  ------------------
 1870|    719|    DEBUGMSG(("dumpv_recv", "\n"));
  ------------------
  |  |   61|    719|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    719|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 719]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 719]
  |  |  ------------------
  ------------------
 1871|       |
 1872|    719|    memmove(str, bufp, asn_length);
 1873|    719|    *strlength = (int) asn_length;
 1874|    719|    *datalength -= (int) asn_length + (bufp - data);
 1875|    719|    return bufp + asn_length;
 1876|    726|}
asn_parse_unsigned_int64:
 1960|  3.05k|{
 1961|       |    /*
 1962|       |     * ASN.1 integer ::= 0x02 asnlength byte {byte}*
 1963|       |     */
 1964|  3.05k|    static const char *errpre = "parse uint64";
 1965|  3.05k|    const int       uint64sizelimit = (4 * 2) + 1;
 1966|  3.05k|    register u_char *bufp = data;
 1967|  3.05k|    u_long          asn_length;
 1968|  3.05k|    register u_long low = 0, high = 0;
 1969|       |
 1970|  3.05k|    if (countersize != sizeof(struct counter64)) {
  ------------------
  |  Branch (1970:9): [True: 0, False: 3.05k]
  ------------------
 1971|      0|        _asn_size_err(errpre, countersize, sizeof(struct counter64));
 1972|      0|        return NULL;
 1973|      0|    }
 1974|       |
 1975|  3.05k|    if (NULL == data || NULL == datalength || NULL == type || NULL == cp) {
  ------------------
  |  Branch (1975:9): [True: 0, False: 3.05k]
  |  Branch (1975:25): [True: 0, False: 3.05k]
  |  Branch (1975:47): [True: 0, False: 3.05k]
  |  Branch (1975:63): [True: 0, False: 3.05k]
  ------------------
 1976|      0|        ERROR_MSG("parse uint64: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1977|      0|        return NULL;
 1978|      0|    }
 1979|       |
 1980|       |    /** need at least 2 bytes to work with: type, length (which might be 0)  */
 1981|  3.05k|    if (*datalength < 2) {
  ------------------
  |  Branch (1981:9): [True: 0, False: 3.05k]
  ------------------
 1982|      0|        _asn_short_err(errpre, *datalength, 2);
 1983|      0|        return NULL;
 1984|      0|    }
 1985|       |
 1986|  3.05k|    *type = *bufp++;
 1987|  3.05k|    if (*type != ASN_COUNTER64
  ------------------
  |  |   99|  6.10k|#define ASN_COUNTER64   (ASN_APPLICATION | 6)
  |  |  ------------------
  |  |  |  |   91|  3.05k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (1987:9): [True: 1.67k, False: 1.37k]
  ------------------
 1988|  1.67k|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 1989|  1.67k|            && *type != ASN_OPAQUE
  ------------------
  |  |   93|  1.67k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  1.67k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (1989:16): [True: 6, False: 1.67k]
  ------------------
 1990|  3.05k|#endif
 1991|  3.05k|            ) {
 1992|      6|        _asn_type_err(errpre, *type);
 1993|      6|        return NULL;
 1994|      6|    }
 1995|  3.04k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 1996|  3.04k|    if (NULL == bufp) {
  ------------------
  |  Branch (1996:9): [True: 0, False: 3.04k]
  ------------------
 1997|      0|        _asn_short_err(errpre, *datalength - 1, asn_length);
 1998|      0|        return NULL;
 1999|      0|    }
 2000|       |
 2001|  3.04k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|  3.04k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  3.04k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3.04k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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.04k]
  |  |  ------------------
  ------------------
 2002|  3.04k|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 2003|       |    /** need at least 2 bytes: ASN_OPAQUE_TAG1 and ASN_OPAQUE_<type> */
 2004|  3.04k|    if ((*type == ASN_OPAQUE) && (asn_length < 2)) {
  ------------------
  |  |   93|  3.04k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  3.04k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2004:9): [True: 1.67k, False: 1.37k]
  |  Branch (2004:34): [True: 0, False: 1.67k]
  ------------------
 2005|      0|        _asn_short_err(errpre, asn_length, 2);
 2006|      0|        return NULL;
 2007|      0|    }
 2008|       |
 2009|       |    /*
 2010|       |     * 64 bit counters as opaque 
 2011|       |     */
 2012|  3.04k|    if ((*type == ASN_OPAQUE) &&
  ------------------
  |  |   93|  3.04k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  3.04k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2012:9): [True: 1.67k, False: 1.37k]
  ------------------
 2013|  1.67k|        (asn_length <= ASN_OPAQUE_COUNTER64_MX_BER_LEN) &&
  ------------------
  |  |  160|  1.67k|#define ASN_OPAQUE_COUNTER64_MX_BER_LEN 12
  ------------------
  |  Branch (2013:9): [True: 1.65k, False: 18]
  ------------------
 2014|  1.65k|        (*bufp == ASN_OPAQUE_TAG1) &&
  ------------------
  |  |  131|  1.65k|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|  1.65k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|  1.65k|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
  |  Branch (2014:9): [True: 1.65k, False: 0]
  ------------------
 2015|  1.65k|        ((*(bufp + 1) == ASN_OPAQUE_COUNTER64) ||
  ------------------
  |  |  156|  1.65k|#define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  136|  1.65k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  146|  1.65k|#define ASN_APP_COUNTER64 (ASN_APPLICATION | 6)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.65k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2015:10): [True: 817, False: 836]
  ------------------
 2016|  1.65k|         (*(bufp + 1) == ASN_OPAQUE_U64))) {
  ------------------
  |  |  192|    836|#define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  136|    836|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  150|    836|#define ASN_APP_U64 (ASN_APPLICATION | 11)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    836|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2016:10): [True: 836, False: 0]
  ------------------
 2017|       |        /*
 2018|       |         * change type to Counter64 or U64 
 2019|       |         */
 2020|  1.65k|        *type = *(bufp + 1);
 2021|       |        /*
 2022|       |         * value is encoded as special format 
 2023|       |         */
 2024|  1.65k|        *datalength = asn_length;
 2025|  1.65k|        bufp = asn_parse_nlength(bufp+2, *datalength - 2, &asn_length);
 2026|  1.65k|        if (NULL == bufp) {
  ------------------
  |  Branch (2026:13): [True: 0, False: 1.65k]
  ------------------
 2027|      0|            _asn_short_err("parse opaque uint64", *datalength - 2, asn_length);
 2028|      0|            return NULL;
 2029|      0|        }
 2030|  1.65k|    }
 2031|  3.04k|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 2032|  3.04k|    if (((int) asn_length > uint64sizelimit) ||
  ------------------
  |  Branch (2032:9): [True: 24, False: 3.02k]
  ------------------
 2033|  3.02k|        (((int) asn_length == uint64sizelimit) && *bufp != 0x00)) {
  ------------------
  |  Branch (2033:10): [True: 253, False: 2.77k]
  |  Branch (2033:51): [True: 8, False: 245]
  ------------------
 2034|     32|        _asn_length_err(errpre, (size_t) asn_length, uint64sizelimit);
 2035|     32|        return NULL;
 2036|     32|    }
 2037|  3.01k|    *datalength -= (int) asn_length + (bufp - data);
 2038|  6.75k|    while (asn_length--) {
  ------------------
  |  Branch (2038:12): [True: 3.73k, False: 3.01k]
  ------------------
 2039|  3.73k|        high = ((0x00FFFFFF & high) << 8) | ((low & 0xFF000000U) >> 24);
 2040|  3.73k|        low = ((low & 0x00FFFFFF) << 8) | *bufp++;
 2041|  3.73k|    }
 2042|       |
 2043|  3.01k|    CHECK_OVERFLOW_U(high,6);
  ------------------
  |  |  224|  3.01k|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|  3.01k|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 0, False: 3.01k]
  |  |  ------------------
  |  |  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.01k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 3.01k]
  |  |  ------------------
  ------------------
 2044|  3.01k|    CHECK_OVERFLOW_U(low,6);
  ------------------
  |  |  224|  3.01k|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|  3.01k|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 0, False: 3.01k]
  |  |  ------------------
  |  |  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.01k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 3.01k]
  |  |  ------------------
  ------------------
 2045|       |
 2046|  3.01k|    cp->low = low;
 2047|  3.01k|    cp->high = high;
 2048|       |
 2049|  3.01k|    DEBUGIF("dumpv_recv") {
  ------------------
  |  |  145|  3.01k|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|  6.03k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3.01k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (145:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2050|      0|        char            i64buf[I64CHARSZ + 1];
 2051|      0|        printU64(i64buf, cp);
 2052|      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]
  |  |  ------------------
  ------------------
 2053|      0|    }
 2054|       |
 2055|  3.01k|    return bufp;
 2056|  3.04k|}
asn_parse_signed_int64:
 2233|  1.27k|{
 2234|  1.27k|    static const char *errpre = "parse int64";
 2235|  1.27k|    const int       int64sizelimit = (4 * 2) + 1;
 2236|  1.27k|    char            ebuf[128];
 2237|  1.27k|    register u_char *bufp = data;
 2238|  1.27k|    u_long          asn_length;
 2239|  1.27k|    register u_int  low = 0, high = 0;
 2240|       |
 2241|  1.27k|    if (countersize != sizeof(struct counter64)) {
  ------------------
  |  Branch (2241:9): [True: 0, False: 1.27k]
  ------------------
 2242|      0|        _asn_size_err(errpre, countersize, sizeof(struct counter64));
 2243|      0|        return NULL;
 2244|      0|    }
 2245|       |
 2246|  1.27k|    if (NULL == data || NULL == datalength || NULL == type || NULL == cp) {
  ------------------
  |  Branch (2246:9): [True: 0, False: 1.27k]
  |  Branch (2246:25): [True: 0, False: 1.27k]
  |  Branch (2246:47): [True: 0, False: 1.27k]
  |  Branch (2246:63): [True: 0, False: 1.27k]
  ------------------
 2247|      0|        ERROR_MSG("parse int64: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 2248|      0|        return NULL;
 2249|      0|    }
 2250|       |
 2251|       |    /** need at least 2 bytes to work with: type, length (which might be 0) */
 2252|  1.27k|    if (*datalength < 2) {
  ------------------
  |  Branch (2252:9): [True: 0, False: 1.27k]
  ------------------
 2253|      0|        _asn_short_err(errpre, *datalength, 2);
 2254|      0|        return NULL;
 2255|      0|    }
 2256|       |
 2257|  1.27k|    *type = *bufp++;
 2258|  1.27k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 2259|  1.27k|    if (NULL == bufp) {
  ------------------
  |  Branch (2259:9): [True: 0, False: 1.27k]
  ------------------
 2260|      0|        _asn_short_err(errpre, *datalength - 1, asn_length);
 2261|      0|        return NULL;
 2262|      0|    }
 2263|       |
 2264|       |    /** need at least 2 bytes: ASN_OPAQUE_TAG1 and ASN_OPAQUE_I64 */
 2265|  1.27k|    if (asn_length < 2) {
  ------------------
  |  Branch (2265:9): [True: 12, False: 1.25k]
  ------------------
 2266|     12|        _asn_short_err(errpre, asn_length, 2);
 2267|     12|        return NULL;
 2268|     12|    }
 2269|       |
 2270|  1.25k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|  1.25k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  1.25k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1.25k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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.25k]
  |  |  ------------------
  ------------------
 2271|  1.25k|    if ((*type == ASN_OPAQUE) &&
  ------------------
  |  |   93|  1.25k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  1.25k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2271:9): [True: 1.24k, False: 10]
  ------------------
 2272|  1.24k|        (asn_length <= ASN_OPAQUE_COUNTER64_MX_BER_LEN) &&
  ------------------
  |  |  160|  1.24k|#define ASN_OPAQUE_COUNTER64_MX_BER_LEN 12
  ------------------
  |  Branch (2272:9): [True: 1.23k, False: 16]
  ------------------
 2273|  1.23k|        (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_I64)) {
  ------------------
  |  |  131|  1.23k|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|  1.23k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|  1.23k|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
                      (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_I64)) {
  ------------------
  |  |  183|  1.23k|#define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  136|  1.23k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  149|  1.23k|#define ASN_APP_I64 (ASN_APPLICATION | 10)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.23k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2273:9): [True: 1.23k, False: 0]
  |  Branch (2273:39): [True: 1.23k, False: 0]
  ------------------
 2274|       |        /*
 2275|       |         * change type to Int64 
 2276|       |         */
 2277|  1.23k|        *type = *(bufp + 1);
 2278|       |        /*
 2279|       |         * value is encoded as special format 
 2280|       |         */
 2281|  1.23k|        *datalength = asn_length;
 2282|  1.23k|        bufp = asn_parse_nlength(bufp+2, *datalength - 2, &asn_length);
 2283|  1.23k|        if (NULL == bufp) {
  ------------------
  |  Branch (2283:13): [True: 0, False: 1.23k]
  ------------------
 2284|      0|            _asn_short_err("parse opaque int64", *datalength - 2, asn_length);
 2285|      0|            return NULL;
 2286|      0|        }
 2287|  1.23k|    }
 2288|       |    /*
 2289|       |     * this should always have been true until snmp gets int64 PDU types 
 2290|       |     */
 2291|     26|    else {
 2292|     26|        snprintf(ebuf, sizeof(ebuf),
 2293|     26|                "%s: wrong type: %d, len %d, buf bytes (%02X,%02X)",
 2294|     26|                errpre, *type, (int) asn_length, *bufp, *(bufp + 1));
 2295|     26|        ebuf[ sizeof(ebuf)-1 ] = 0;
 2296|     26|        ERROR_MSG(ebuf);
  ------------------
  |  |  188|     26|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 2297|     26|        return NULL;
 2298|     26|    }
 2299|  1.23k|    if (((int) asn_length > int64sizelimit) ||
  ------------------
  |  Branch (2299:9): [True: 0, False: 1.23k]
  ------------------
 2300|  1.23k|        (((int) asn_length == int64sizelimit) && *bufp != 0x00)) {
  ------------------
  |  Branch (2300:10): [True: 218, False: 1.01k]
  |  Branch (2300:50): [True: 8, False: 210]
  ------------------
 2301|      8|        _asn_length_err(errpre, (size_t) asn_length, int64sizelimit);
 2302|      8|        return NULL;
 2303|      8|    }
 2304|  1.22k|    *datalength -= (int) asn_length + (bufp - data);
 2305|  1.22k|    if ((asn_length > 0) && (*bufp & 0x80)) {
  ------------------
  |  Branch (2305:9): [True: 802, False: 423]
  |  Branch (2305:29): [True: 259, False: 543]
  ------------------
 2306|    259|        low = 0xFFFFFFFFU;   /* first byte bit 1 means start the data with 1s */
 2307|    259|        high = 0xFFFFFF;
 2308|    259|    }
 2309|       |
 2310|  3.87k|    for ( ; asn_length; asn_length--) {
  ------------------
  |  Branch (2310:13): [True: 2.64k, False: 1.22k]
  ------------------
 2311|  2.64k|        high = ((0x00FFFFFF & high) << 8) | ((low & 0xFF000000U) >> 24);
 2312|  2.64k|        low = ((low & 0x00FFFFFF) << 8) | *bufp++;
 2313|  2.64k|    }
 2314|       |
 2315|  1.22k|    CHECK_OVERFLOW_U(high,8);
  ------------------
  |  |  224|  1.22k|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|  1.22k|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 0, False: 1.22k]
  |  |  ------------------
  |  |  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.22k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 1.22k]
  |  |  ------------------
  ------------------
 2316|  1.22k|    CHECK_OVERFLOW_U(low,8);
  ------------------
  |  |  224|  1.22k|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|  1.22k|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 0, False: 1.22k]
  |  |  ------------------
  |  |  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.22k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 1.22k]
  |  |  ------------------
  ------------------
 2317|       |
 2318|  1.22k|    cp->low = low;
 2319|  1.22k|    cp->high = high;
 2320|       |
 2321|  1.22k|    DEBUGIF("dumpv_recv") {
  ------------------
  |  |  145|  1.22k|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|  2.45k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1.22k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (145:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2322|      0|        char            i64buf[I64CHARSZ + 1];
 2323|      0|        printI64(i64buf, cp);
 2324|      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]
  |  |  ------------------
  ------------------
 2325|      0|    }
 2326|       |
 2327|  1.22k|    return bufp;
 2328|  1.23k|}
asn_parse_float:
 2451|    693|{
 2452|    693|    static const char *errpre = "parse float";
 2453|    693|    register u_char *bufp = data;
 2454|    693|    u_long          asn_length;
 2455|    693|    union {
 2456|    693|        float           floatVal;
 2457|    693|        long            longVal;
 2458|    693|        u_char          c[sizeof(float)];
 2459|    693|    } fu;
 2460|       |
 2461|    693|    if (floatsize != sizeof(float)) {
  ------------------
  |  Branch (2461:9): [True: 0, False: 693]
  ------------------
 2462|      0|        _asn_size_err("parse float", floatsize, sizeof(float));
 2463|      0|        return NULL;
 2464|      0|    }
 2465|       |
 2466|    693|    if (NULL == data || NULL == datalength || NULL == type || NULL == floatp) {
  ------------------
  |  Branch (2466:9): [True: 0, False: 693]
  |  Branch (2466:25): [True: 0, False: 693]
  |  Branch (2466:47): [True: 0, False: 693]
  |  Branch (2466:63): [True: 0, False: 693]
  ------------------
 2467|      0|        ERROR_MSG("parse float: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 2468|      0|        return NULL;
 2469|      0|    }
 2470|       |
 2471|       |    /** need at least 2 bytes to work with: type, length (which might be 0)  */
 2472|    693|    if (*datalength < 2) {
  ------------------
  |  Branch (2472:9): [True: 0, False: 693]
  ------------------
 2473|      0|        _asn_short_err(errpre, *datalength, 2);
 2474|      0|        return NULL;
 2475|      0|    }
 2476|       |
 2477|    693|    *type = *bufp++;
 2478|    693|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 2479|    693|    if (NULL == bufp) {
  ------------------
  |  Branch (2479:9): [True: 0, False: 693]
  ------------------
 2480|      0|        _asn_short_err(errpre, *datalength - 1, asn_length);
 2481|      0|        return NULL;
 2482|      0|    }
 2483|       |
 2484|    693|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|    693|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    693|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 693]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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: 693]
  |  |  ------------------
  ------------------
 2485|       |    /*
 2486|       |     * the float is encoded as an opaque 
 2487|       |     */
 2488|    693|    if ((*type == ASN_OPAQUE) &&
  ------------------
  |  |   93|    693|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|    693|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2488:9): [True: 341, False: 352]
  ------------------
 2489|    341|        (asn_length == ASN_OPAQUE_FLOAT_BER_LEN) &&
  ------------------
  |  |  169|    341|#define ASN_OPAQUE_FLOAT_BER_LEN 7
  ------------------
  |  Branch (2489:9): [True: 326, False: 15]
  ------------------
 2490|    326|        (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_FLOAT)) {
  ------------------
  |  |  131|    326|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|    326|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|    326|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
                      (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_FLOAT)) {
  ------------------
  |  |  165|    326|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|    326|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|    326|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    326|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2490:9): [True: 326, False: 0]
  |  Branch (2490:39): [True: 326, False: 0]
  ------------------
 2491|       |
 2492|       |        /*
 2493|       |         * value is encoded as special format 
 2494|       |         */
 2495|    326|        *datalength = asn_length;
 2496|    326|        bufp = asn_parse_nlength(bufp+2, *datalength - 2, &asn_length);
 2497|    326|        if (NULL == bufp) {
  ------------------
  |  Branch (2497:13): [True: 0, False: 326]
  ------------------
 2498|      0|            _asn_short_err("parse opaque float", *datalength - 2, asn_length);
 2499|      0|            return NULL;
 2500|      0|        }
 2501|       |        /*
 2502|       |         * change type to Float 
 2503|       |         */
 2504|    326|        *type = ASN_OPAQUE_FLOAT;
  ------------------
  |  |  165|    326|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|    326|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|    326|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    326|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2505|    326|    }
 2506|       |
 2507|    693|    if (*type != ASN_OPAQUE_FLOAT) {
  ------------------
  |  |  165|    693|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|    693|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|    693|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    693|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2507:9): [True: 15, False: 678]
  ------------------
 2508|     15|        _asn_type_err(errpre, *type);
 2509|     15|        return NULL;
 2510|     15|    }
 2511|       |
 2512|    678|    if (asn_length != sizeof(float)) {
  ------------------
  |  Branch (2512:9): [True: 25, False: 653]
  ------------------
 2513|     25|        _asn_size_err("parse seq float", asn_length, sizeof(float));
 2514|     25|        return NULL;
 2515|     25|    }
 2516|       |
 2517|    653|    *datalength -= (int) asn_length + (bufp - data);
 2518|    653|    memcpy(&fu.c[0], bufp, asn_length);
 2519|       |
 2520|       |    /*
 2521|       |     * correct for endian differences 
 2522|       |     */
 2523|    653|    fu.longVal = ntohl(fu.longVal);
 2524|       |
 2525|    653|    *floatp = fu.floatVal;
 2526|       |
 2527|    653|    DEBUGMSG(("dumpv_recv", "Opaque float: %f\n", *floatp));
  ------------------
  |  |   61|    653|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    653|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 653]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 653]
  |  |  ------------------
  ------------------
 2528|    653|    return bufp;
 2529|    678|}
asn_parse_double:
 2634|    917|{
 2635|    917|    static const char *errpre = "parse double";
 2636|    917|    register u_char *bufp = data;
 2637|    917|    u_long          asn_length;
 2638|    917|    long            tmp;
 2639|    917|    union {
 2640|    917|        double          doubleVal;
 2641|    917|        int             intVal[2];
 2642|    917|        u_char          c[sizeof(double)];
 2643|    917|    } fu;
 2644|       |
 2645|       |
 2646|    917|    if (doublesize != sizeof(double)) {
  ------------------
  |  Branch (2646:9): [True: 0, False: 917]
  ------------------
 2647|      0|        _asn_size_err("parse double", doublesize, sizeof(double));
 2648|      0|        return NULL;
 2649|      0|    }
 2650|       |
 2651|    917|    if (NULL == data || NULL == datalength || NULL == type || NULL == doublep) {
  ------------------
  |  Branch (2651:9): [True: 0, False: 917]
  |  Branch (2651:25): [True: 0, False: 917]
  |  Branch (2651:47): [True: 0, False: 917]
  |  Branch (2651:63): [True: 0, False: 917]
  ------------------
 2652|      0|        ERROR_MSG("parse double: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 2653|      0|        return NULL;
 2654|      0|    }
 2655|       |
 2656|       |    /** need at least 2 bytes to work with: type, length (which might be 0)  */
 2657|    917|    if (*datalength < 2) {
  ------------------
  |  Branch (2657:9): [True: 0, False: 917]
  ------------------
 2658|      0|        _asn_short_err(errpre, *datalength, 2);
 2659|      0|        return NULL;
 2660|      0|    }
 2661|       |
 2662|    917|    *type = *bufp++;
 2663|    917|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 2664|    917|    if (NULL == bufp) {
  ------------------
  |  Branch (2664:9): [True: 0, False: 917]
  ------------------
 2665|      0|        _asn_short_err(errpre, *datalength - 1, asn_length);
 2666|      0|        return NULL;
 2667|      0|    }
 2668|       |
 2669|    917|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|    917|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    917|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 917]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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: 917]
  |  |  ------------------
  ------------------
 2670|       |    /*
 2671|       |     * the double is encoded as an opaque 
 2672|       |     */
 2673|       |    /** need at least 2 bytes: ASN_OPAQUE_TAG1 and ASN_OPAQUE_DOUBLE */
 2674|    917|    if ((*type == ASN_OPAQUE) && (asn_length < 2)) {
  ------------------
  |  |   93|    917|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|    917|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2674:9): [True: 238, False: 679]
  |  Branch (2674:34): [True: 0, False: 238]
  ------------------
 2675|      0|        _asn_short_err(errpre, asn_length, 2);
 2676|      0|        return NULL;
 2677|      0|    }
 2678|    917|    if ((*type == ASN_OPAQUE) &&
  ------------------
  |  |   93|    917|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|    917|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2678:9): [True: 238, False: 679]
  ------------------
 2679|    238|        (asn_length == ASN_OPAQUE_DOUBLE_BER_LEN) &&
  ------------------
  |  |  178|    238|#define ASN_OPAQUE_DOUBLE_BER_LEN 11
  ------------------
  |  Branch (2679:9): [True: 217, False: 21]
  ------------------
 2680|    217|        (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_DOUBLE)) {
  ------------------
  |  |  131|    217|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|    217|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|    217|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
                      (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_DOUBLE)) {
  ------------------
  |  |  174|    217|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|    217|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|    217|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    217|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2680:9): [True: 217, False: 0]
  |  Branch (2680:39): [True: 217, False: 0]
  ------------------
 2681|       |
 2682|       |        /*
 2683|       |         * value is encoded as special format 
 2684|       |         */
 2685|    217|        *datalength = asn_length;
 2686|    217|        bufp = asn_parse_nlength(bufp+2, *datalength - 2, &asn_length);
 2687|    217|        if (NULL == bufp) {
  ------------------
  |  Branch (2687:13): [True: 0, False: 217]
  ------------------
 2688|      0|            _asn_short_err("parse opaque double", *datalength - 2, asn_length);
 2689|      0|            return NULL;
 2690|      0|        }
 2691|       |
 2692|       |        /*
 2693|       |         * change type to Double 
 2694|       |         */
 2695|    217|        *type = ASN_OPAQUE_DOUBLE;
  ------------------
  |  |  174|    217|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|    217|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|    217|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    217|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2696|    217|    }
 2697|       |
 2698|    917|    if (*type != ASN_OPAQUE_DOUBLE) {
  ------------------
  |  |  174|    917|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|    917|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|    917|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    917|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2698:9): [True: 21, False: 896]
  ------------------
 2699|     21|        _asn_type_err(errpre, *type);
 2700|     21|        return NULL;
 2701|     21|    }
 2702|       |
 2703|    896|    if (asn_length != sizeof(double)) {
  ------------------
  |  Branch (2703:9): [True: 24, False: 872]
  ------------------
 2704|     24|        _asn_size_err("parse seq double", asn_length, sizeof(double));
 2705|     24|        return NULL;
 2706|     24|    }
 2707|    872|    *datalength -= (int) asn_length + (bufp - data);
 2708|    872|    memcpy(&fu.c[0], bufp, asn_length);
 2709|       |
 2710|       |    /*
 2711|       |     * correct for endian differences 
 2712|       |     */
 2713|       |
 2714|    872|    tmp = ntohl(fu.intVal[0]);
 2715|    872|    fu.intVal[0] = ntohl(fu.intVal[1]);
 2716|    872|    fu.intVal[1] = tmp;
 2717|       |
 2718|    872|    *doublep = fu.doubleVal;
 2719|    872|    DEBUGMSG(("dumpv_recv", "  Opaque Double:\t%f\n", *doublep));
  ------------------
  |  |   61|    872|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    872|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 872]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 872]
  |  |  ------------------
  ------------------
 2720|       |
 2721|    872|    return bufp;
 2722|    896|}
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|    ebuf[ sizeof(ebuf)-1 ] = 0;
  249|     49|    ERROR_MSG(ebuf);
  ------------------
  |  |  188|     49|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  250|     49|}
asn1.c:_asn_short_err:
  301|  2.37k|{
  302|  2.37k|    char            ebuf[128];
  303|       |
  304|  2.37k|    snprintf(ebuf, sizeof(ebuf), "%s length %lu too short: need %lu", str,
  305|  2.37k|	    (unsigned long)wrongsize, (unsigned long)rightsize);
  306|  2.37k|    ERROR_MSG(ebuf);
  ------------------
  |  |  188|  2.37k|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  307|  2.37k|}
asn1.c:_asn_type_err:
  262|    540|{
  263|    540|    char            ebuf[128];
  264|       |
  265|    540|    snprintf(ebuf, sizeof(ebuf), "%s type %d", str, wrongtype);
  266|    540|    ebuf[ sizeof(ebuf)-1 ] = 0;
  267|    540|    ERROR_MSG(ebuf);
  ------------------
  |  |  188|    540|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  268|    540|}
asn1.c:_asn_length_err:
  281|    174|{
  282|    174|    char            ebuf[128];
  283|       |
  284|    174|    snprintf(ebuf, sizeof(ebuf),
  285|    174|            "%s length %lu too large: exceeds %lu", str,
  286|    174|	    (unsigned long)wrongsize, (unsigned long)rightsize);
  287|    174|    ebuf[ sizeof(ebuf)-1 ] = 0;
  288|    174|    ERROR_MSG(ebuf);
  ------------------
  |  |  188|    174|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  289|    174|}
asn1.c:_asn_bitstring_check:
  518|    726|{
  519|    726|    char            ebuf[128];
  520|       |
  521|    726|    if (asn_length < 1) {
  ------------------
  |  Branch (521:9): [True: 7, False: 719]
  ------------------
  522|      7|        snprintf(ebuf, sizeof(ebuf),
  523|      7|                "%s: length %d too small", str, (int) asn_length);
  524|      7|        ebuf[ sizeof(ebuf)-1 ] = 0;
  525|      7|        ERROR_MSG(ebuf);
  ------------------
  |  |  188|      7|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  526|      7|        return 1;
  527|      7|    }
  528|       |    /*
  529|       |     * if (datum > 7){
  530|       |     * sprintf(ebuf,"%s: datum %d >7: too large", str, (int)(datum));
  531|       |     * ERROR_MSG(ebuf);
  532|       |     * return 1;
  533|       |     * }
  534|       |     */
  535|    719|    return 0;
  536|    726|}

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

snmp_parse_var_op:
  153|  17.4k|{
  154|  17.4k|    u_char          var_op_type;
  155|  17.4k|    size_t          var_op_len = *listlength;
  156|  17.4k|    u_char         *var_op_start = data;
  157|       |
  158|  17.4k|    data = asn_parse_sequence(data, &var_op_len, &var_op_type,
  159|  17.4k|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR), "var_op");
  ------------------
  |  |   84|  17.4k|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR), "var_op");
  ------------------
  |  |   96|  17.4k|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
  160|  17.4k|    if (data == NULL) {
  ------------------
  |  Branch (160:9): [True: 311, False: 17.1k]
  ------------------
  161|       |        /*
  162|       |         * msg detail is set 
  163|       |         */
  164|    311|        return NULL;
  165|    311|    }
  166|  17.1k|    DEBUGDUMPHEADER("recv", "Name");
  ------------------
  |  |   79|  17.1k|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  17.1k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 17.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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.1k]
  |  |  ------------------
  ------------------
  167|  17.1k|    data =
  168|  17.1k|        asn_parse_objid(data, &var_op_len, &var_op_type, var_name,
  169|  17.1k|                        var_name_len);
  170|  17.1k|    DEBUGINDENTLESS();
  ------------------
  |  |   75|  17.1k|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|  17.1k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 17.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 17.1k]
  |  |  ------------------
  ------------------
  171|  17.1k|    if (data == NULL) {
  ------------------
  |  Branch (171:9): [True: 47, False: 17.0k]
  ------------------
  172|     47|        ERROR_MSG("No OID for variable");
  ------------------
  |  |  188|     47|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  173|     47|        return NULL;
  174|     47|    }
  175|  17.0k|    if (var_op_type !=
  ------------------
  |  Branch (175:9): [True: 0, False: 17.0k]
  ------------------
  176|  17.0k|        (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OBJECT_ID))
  ------------------
  |  |   90|  17.0k|#define ASN_UNIVERSAL	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OBJECT_ID))
  ------------------
  |  |   95|  17.0k|#define ASN_PRIMITIVE	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OBJECT_ID))
  ------------------
  |  |   81|  17.0k|#define ASN_OBJECT_ID	    0x06U
  ------------------
  177|      0|        return NULL;
  178|  17.0k|    *var_val = data;            /* save pointer to this object */
  179|       |    /*
  180|       |     * find out what type of object this is 
  181|       |     */
  182|  17.0k|    data = asn_parse_header(data, &var_op_len, var_val_type);
  183|  17.0k|    if (data == NULL) {
  ------------------
  |  Branch (183:9): [True: 16, False: 17.0k]
  ------------------
  184|     16|        ERROR_MSG("No header for value");
  ------------------
  |  |  188|     16|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  185|     16|        return NULL;
  186|     16|    }
  187|       |    /*
  188|       |     * XXX no check for type! 
  189|       |     */
  190|  17.0k|    *var_val_len = var_op_len;
  191|  17.0k|    data += var_op_len;
  192|  17.0k|    *listlength -= (int) (data - var_op_start);
  193|  17.0k|    return data;
  194|  17.0k|}

snmp_get_next_transid:
  485|  2.68k|{
  486|  2.68k|    long            retVal;
  487|  2.68k|    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_TRANSID);
  ------------------
  |  |   79|  2.68k|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded, False: 2.68k]
  |  |  ------------------
  ------------------
  488|  2.68k|    retVal = 1 + Transid;       /*MTCRITICAL_RESOURCE */
  489|  2.68k|    if (!retVal)
  ------------------
  |  Branch (489:9): [True: 0, False: 2.68k]
  ------------------
  490|      0|        retVal = 2;
  491|  2.68k|    Transid = retVal;
  492|  2.68k|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS))
  ------------------
  |  |   48|  2.68k|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS))
  ------------------
  |  |   91|  2.68k|#define NETSNMP_DS_LIB_16BIT_IDS           31   /* restrict requestIDs, etc to 16-bit values */
  ------------------
  |  Branch (492:9): [True: 0, False: 2.68k]
  ------------------
  493|      0|        retVal &= 0x7fff;	/* mask to 15 bits */
  494|  2.68k|    else
  495|  2.68k|        retVal &= 0x7fffffff;	/* mask to 31 bits */
  496|       |
  497|  2.68k|    if (!retVal) {
  ------------------
  |  Branch (497:9): [True: 0, False: 2.68k]
  ------------------
  498|      0|        Transid = retVal = 2;
  499|      0|    }
  500|  2.68k|    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_TRANSID);
  ------------------
  |  |   80|  2.68k|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded, False: 2.68k]
  |  |  ------------------
  ------------------
  501|  2.68k|    return retVal;
  502|  2.68k|}
snmp_set_detail:
  516|  6.61k|{
  517|  6.61k|    if (detail_string != NULL) {
  ------------------
  |  Branch (517:9): [True: 6.61k, False: 0]
  ------------------
  518|  6.61k|        strlcpy(snmp_detail, detail_string, sizeof(snmp_detail));
  519|  6.61k|        snmp_detail_f = 1;
  520|  6.61k|    }
  521|  6.61k|}
snmp_api_errstring:
  531|    711|{
  532|    711|    const char     *msg = "";
  533|    711|    static char     msg_buf[SPRINT_MAX_LEN];
  534|       |
  535|    711|    if (snmp_errnumber >= SNMPERR_MAX && snmp_errnumber <= SNMPERR_GENERR) {
  ------------------
  |  |  288|  1.42k|#define SNMPERR_MAX			(-69)
  ------------------
                  if (snmp_errnumber >= SNMPERR_MAX && snmp_errnumber <= SNMPERR_GENERR) {
  ------------------
  |  |  218|    711|#define SNMPERR_GENERR			(-1)
  ------------------
  |  Branch (535:9): [True: 711, False: 0]
  |  Branch (535:42): [True: 0, False: 711]
  ------------------
  536|      0|        msg = api_errors[-snmp_errnumber];
  537|    711|    } else if (snmp_errnumber != SNMPERR_SUCCESS) {
  ------------------
  |  |  217|    711|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (537:16): [True: 0, False: 711]
  ------------------
  538|      0|        msg = NULL;
  539|      0|    }
  540|    711|    if (!msg) {
  ------------------
  |  Branch (540:9): [True: 0, False: 711]
  ------------------
  541|      0|	snprintf(msg_buf, sizeof(msg_buf), "Unknown error: %d", snmp_errnumber);
  542|      0|        msg_buf[sizeof(msg_buf)-1] = '\0';
  543|    711|    } else if (snmp_detail_f) {
  ------------------
  |  Branch (543:16): [True: 711, False: 0]
  ------------------
  544|    711|        snprintf(msg_buf, sizeof(msg_buf), "%s (%s)", msg, snmp_detail);
  545|    711|        msg_buf[sizeof(msg_buf)-1] = '\0';
  546|    711|        snmp_detail_f = 0;
  547|    711|    } else {
  548|      0|        strlcpy(msg_buf, msg, sizeof(msg_buf));
  549|      0|    }
  550|       |
  551|    711|    return (msg_buf);
  552|    711|}
snmpv3_parse:
 3798|  2.68k|{
 3799|  2.68k|    u_char          type, msg_flags;
 3800|  2.68k|    long            ver, msg_sec_model;
 3801|  2.68k|    size_t          max_size_response;
 3802|  2.68k|    u_char          tmp_buf[SNMP_MAX_MSG_SIZE];
 3803|  2.68k|    size_t          tmp_buf_len;
 3804|  2.68k|    u_char          pdu_buf[SNMP_MAX_MSG_SIZE];
 3805|  2.68k|    u_char         *mallocbuf = NULL;
 3806|  2.68k|    size_t          pdu_buf_len = SNMP_MAX_MSG_SIZE;
  ------------------
  |  |  142|  2.68k|#define SNMP_MAX_MSG_SIZE          1472 /* ethernet MTU minus IP/UDP header */
  ------------------
 3807|  2.68k|    u_char         *sec_params;
 3808|  2.68k|    u_char         *msg_data;
 3809|  2.68k|    u_char         *cp;
 3810|  2.68k|    size_t          asn_len, msg_len;
 3811|  2.68k|    int             ret, ret_val;
 3812|  2.68k|    struct snmp_secmod_def *sptr;
 3813|       |
 3814|       |
 3815|  2.68k|    msg_data = data;
 3816|  2.68k|    msg_len = *length;
 3817|       |
 3818|       |
 3819|       |    /*
 3820|       |     * message is an ASN.1 SEQUENCE  
 3821|       |     */
 3822|  2.68k|    DEBUGDUMPSECTION("recv", "SNMPv3 Message");
  ------------------
  |  |   81|  2.68k|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.68k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.68k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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.68k]
  |  |  ------------------
  ------------------
 3823|  2.68k|    data = asn_parse_sequence(data, length, &type,
 3824|  2.68k|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR), "message");
  ------------------
  |  |   84|  2.68k|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR), "message");
  ------------------
  |  |   96|  2.68k|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3825|  2.68k|    if (data == NULL) {
  ------------------
  |  Branch (3825:9): [True: 300, False: 2.38k]
  ------------------
 3826|       |        /*
 3827|       |         * error msg detail is set 
 3828|       |         */
 3829|    300|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|    300|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3830|    300|        DEBUGINDENTLESS();
  ------------------
  |  |   75|    300|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    300|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 300]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 300]
  |  |  ------------------
  ------------------
 3831|    300|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|    300|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3832|    300|    }
 3833|       |
 3834|       |    /*
 3835|       |     * parse msgVersion  
 3836|       |     */
 3837|  2.38k|    DEBUGDUMPHEADER("recv", "SNMP Version Number");
  ------------------
  |  |   79|  2.38k|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.38k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.38k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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.38k]
  |  |  ------------------
  ------------------
 3838|  2.38k|    data = asn_parse_int(data, length, &type, &ver, sizeof(ver));
 3839|  2.38k|    DEBUGINDENTLESS();
  ------------------
  |  |   75|  2.38k|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.38k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.38k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 2.38k]
  |  |  ------------------
  ------------------
 3840|  2.38k|    if (data == NULL) {
  ------------------
  |  Branch (3840:9): [True: 187, False: 2.19k]
  ------------------
 3841|    187|        ERROR_MSG("bad parse of version");
  ------------------
  |  |  188|    187|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3842|    187|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|    187|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3843|    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]
  |  |  ------------------
  ------------------
 3844|    187|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|    187|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3845|    187|    }
 3846|  2.19k|    pdu->version = ver;
 3847|       |
 3848|       |    /*
 3849|       |     * parse msgGlobalData sequence  
 3850|       |     */
 3851|  2.19k|    cp = data;
 3852|  2.19k|    asn_len = *length;
 3853|  2.19k|    DEBUGDUMPSECTION("recv", "msgGlobalData");
  ------------------
  |  |   81|  2.19k|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.19k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.19k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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.19k]
  |  |  ------------------
  ------------------
 3854|  2.19k|    data = asn_parse_sequence(data, &asn_len, &type,
 3855|  2.19k|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   84|  2.19k|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   96|  2.19k|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3856|  2.19k|                              "msgGlobalData");
 3857|  2.19k|    if (data == NULL) {
  ------------------
  |  Branch (3857:9): [True: 1.80k, False: 386]
  ------------------
 3858|       |        /*
 3859|       |         * error msg detail is set 
 3860|       |         */
 3861|  1.80k|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|  1.80k|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3862|  1.80k|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|  1.80k|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  1.80k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1.80k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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.80k]
  |  |  ------------------
  ------------------
 3863|  1.80k|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|  1.80k|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3864|  1.80k|    }
 3865|    386|    *length -= data - cp;       /* subtract off the length of the header */
 3866|       |
 3867|       |    /*
 3868|       |     * msgID 
 3869|       |     */
 3870|    386|    DEBUGDUMPHEADER("recv", "msgID");
  ------------------
  |  |   79|    386|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    386|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 386]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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: 386]
  |  |  ------------------
  ------------------
 3871|    386|    data =
 3872|    386|        asn_parse_int(data, length, &type, &pdu->msgid,
 3873|    386|                      sizeof(pdu->msgid));
 3874|    386|    DEBUGINDENTLESS();
  ------------------
  |  |   75|    386|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    386|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 386]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 386]
  |  |  ------------------
  ------------------
 3875|    386|    if (data == NULL || type != ASN_INTEGER) {
  ------------------
  |  |   75|    367|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (3875:9): [True: 19, False: 367]
  |  Branch (3875:25): [True: 0, False: 367]
  ------------------
 3876|     19|        ERROR_MSG("error parsing msgID");
  ------------------
  |  |  188|     19|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3877|     19|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|     19|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     19|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 19]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 19]
  |  |  ------------------
  ------------------
 3878|     19|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|     19|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3879|     19|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|     19|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3880|     19|    }
 3881|       |
 3882|       |    /*
 3883|       |     * Check the msgID we received is a legal value.  If not, then increment
 3884|       |     * snmpInASNParseErrs and return the appropriate error (see RFC 2572,
 3885|       |     * para. 7.2, section 2 -- note that a bad msgID means that the received
 3886|       |     * message is NOT a serialization of an SNMPv3Message, since the msgID
 3887|       |     * field is out of bounds).  
 3888|       |     */
 3889|       |
 3890|    367|    if (pdu->msgid < 0 || pdu->msgid > SNMP_MAX_PACKET_LEN) {
  ------------------
  |  |   49|    320|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  |  Branch (3890:9): [True: 47, False: 320]
  |  Branch (3890:27): [True: 3, False: 317]
  ------------------
 3891|     50|        snmp_log(LOG_ERR, "Received bad msgID (%ld %s %s).\n", pdu->msgid,
 3892|     50|                 (pdu->msgid < 0) ? "<" : ">",
  ------------------
  |  Branch (3892:18): [True: 47, False: 3]
  ------------------
 3893|     50|                 (pdu->msgid < 0) ? "0" : "2^31 - 1");
  ------------------
  |  Branch (3893:18): [True: 47, False: 3]
  ------------------
 3894|     50|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|     50|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3895|     50|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|     50|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     50|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 50]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 50]
  |  |  ------------------
  ------------------
 3896|     50|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|     50|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3897|     50|    }
 3898|       |
 3899|       |    /*
 3900|       |     * msgMaxSize 
 3901|       |     */
 3902|    317|    DEBUGDUMPHEADER("recv:msgMaxSize", "msgMaxSize");
  ------------------
  |  |   79|    317|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    317|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 317]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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: 317]
  |  |  ------------------
  ------------------
 3903|    317|    data = asn_parse_int(data, length, &type, &pdu->msgMaxSize,
 3904|    317|                         sizeof(pdu->msgMaxSize));
 3905|    317|    DEBUGINDENTLESS();
  ------------------
  |  |   75|    317|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    317|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 317]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 317]
  |  |  ------------------
  ------------------
 3906|    317|    if (data == NULL || type != ASN_INTEGER) {
  ------------------
  |  |   75|    257|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (3906:9): [True: 60, False: 257]
  |  Branch (3906:25): [True: 0, False: 257]
  ------------------
 3907|     60|        ERROR_MSG("error parsing msgMaxSize");
  ------------------
  |  |  188|     60|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3908|     60|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|     60|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3909|     60|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|     60|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     60|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 60]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 60]
  |  |  ------------------
  ------------------
 3910|     60|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|     60|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3911|     60|    }
 3912|       |
 3913|       |    /*
 3914|       |     * Check the msgMaxSize we received is a legal value.  If not, then
 3915|       |     * increment snmpInASNParseErrs and return the appropriate error (see RFC
 3916|       |     * 2572, para. 7.2, section 2 -- note that a bad msgMaxSize means that the
 3917|       |     * received message is NOT a serialization of an SNMPv3Message, since the
 3918|       |     * msgMaxSize field is out of bounds).
 3919|       |     */
 3920|       |
 3921|    257|    if (pdu->msgMaxSize < SNMP_MIN_MAX_LEN) {
  ------------------
  |  |   48|    257|#define SNMP_MIN_MAX_LEN    484 /* minimum maximum message size */
  ------------------
  |  Branch (3921:9): [True: 52, False: 205]
  ------------------
 3922|     52|        snmp_log(LOG_ERR, "Received bad msgMaxSize (%lu < 484).\n",
 3923|     52|                 pdu->msgMaxSize);
 3924|     52|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|     52|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3925|     52|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|     52|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     52|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 52]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 52]
  |  |  ------------------
  ------------------
 3926|     52|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|     52|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3927|    205|    } else if (pdu->msgMaxSize > SNMP_MAX_PACKET_LEN) {
  ------------------
  |  |   49|    205|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  |  Branch (3927:16): [True: 5, False: 200]
  ------------------
 3928|      5|        snmp_log(LOG_ERR, "Received bad msgMaxSize (%lu > 2^31 - 1).\n",
 3929|      5|                 pdu->msgMaxSize);
 3930|      5|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      5|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3931|      5|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|      5|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      5|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 5]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 5]
  |  |  ------------------
  ------------------
 3932|      5|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|      5|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3933|    200|    } else {
 3934|    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]
  |  |  ------------------
  ------------------
 3935|    200|                    pdu->msgMaxSize));
 3936|       |        /** don't increase max msg size if we've already got one */
 3937|    200|        if (sess->sndMsgMaxSize < pdu->msgMaxSize) {
  ------------------
  |  Branch (3937:13): [True: 200, False: 0]
  ------------------
 3938|    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]
  |  |  ------------------
  ------------------
 3939|    200|                        "msgMaxSize %" NETSNMP_PRIz "d greater than session max %ld; reducing\n",
 3940|    200|                        sess->sndMsgMaxSize, pdu->msgMaxSize));
 3941|    200|            pdu->msgMaxSize = sess->sndMsgMaxSize;
 3942|    200|        }
 3943|    200|    }
 3944|       |
 3945|       |    /*
 3946|       |     * msgFlags 
 3947|       |     */
 3948|    200|    tmp_buf_len = SNMP_MAX_MSG_SIZE;
  ------------------
  |  |  142|    200|#define SNMP_MAX_MSG_SIZE          1472 /* ethernet MTU minus IP/UDP header */
  ------------------
 3949|    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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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]
  |  |  ------------------
  ------------------
 3950|    200|    data = asn_parse_string(data, length, &type, tmp_buf, &tmp_buf_len);
 3951|    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]
  |  |  ------------------
  ------------------
 3952|    200|    if (data == NULL || type != ASN_OCTET_STR || tmp_buf_len != 1) {
  ------------------
  |  |   78|    335|#define ASN_OCTET_STR	    0x04U
  ------------------
  |  Branch (3952:9): [True: 65, False: 135]
  |  Branch (3952:25): [True: 4, False: 131]
  |  Branch (3952:50): [True: 15, False: 116]
  ------------------
 3953|     84|        ERROR_MSG("error parsing msgFlags");
  ------------------
  |  |  188|     84|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3954|     84|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|     84|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3955|     84|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|     84|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     84|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 84]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 84]
  |  |  ------------------
  ------------------
 3956|     84|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|     84|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3957|     84|    }
 3958|    116|    msg_flags = *tmp_buf;
 3959|    116|    if (msg_flags & SNMP_MSG_FLAG_RPRT_BIT)
  ------------------
  |  |  305|    116|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
  |  Branch (3959:9): [True: 54, False: 62]
  ------------------
 3960|     54|        pdu->flags |= SNMP_MSG_FLAG_RPRT_BIT;
  ------------------
  |  |  305|     54|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
 3961|     62|    else
 3962|     62|        pdu->flags &= (~SNMP_MSG_FLAG_RPRT_BIT);
  ------------------
  |  |  305|     62|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
 3963|       |
 3964|       |    /*
 3965|       |     * msgSecurityModel 
 3966|       |     */
 3967|    116|    DEBUGDUMPHEADER("recv", "msgSecurityModel");
  ------------------
  |  |   79|    116|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    116|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 116]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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: 116]
  |  |  ------------------
  ------------------
 3968|    116|    data = asn_parse_int(data, length, &type, &msg_sec_model,
 3969|    116|                         sizeof(msg_sec_model));
 3970|    116|    DEBUGINDENTADD(-4);         /* return from global data indent */
  ------------------
  |  |   73|    116|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    116|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 116]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 116]
  |  |  ------------------
  ------------------
 3971|    116|    if (data == NULL || type != ASN_INTEGER ||
  ------------------
  |  |   75|    229|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (3971:9): [True: 3, False: 113]
  |  Branch (3971:25): [True: 0, False: 113]
  ------------------
 3972|    113|        msg_sec_model < 1 || msg_sec_model > 0x7fffffff) {
  ------------------
  |  Branch (3972:9): [True: 48, False: 65]
  |  Branch (3972:30): [True: 3, False: 62]
  ------------------
 3973|     54|        ERROR_MSG("error parsing msgSecurityModel");
  ------------------
  |  |  188|     54|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3974|     54|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|     54|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3975|     54|        DEBUGINDENTLESS();
  ------------------
  |  |   75|     54|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     54|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 54]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 54]
  |  |  ------------------
  ------------------
 3976|     54|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|     54|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3977|     54|    }
 3978|     62|    sptr = find_sec_mod(msg_sec_model);
 3979|     62|    if (!sptr) {
  ------------------
  |  Branch (3979:9): [True: 62, False: 0]
  ------------------
 3980|     62|        snmp_log(LOG_WARNING, "unknown security model: %ld\n",
 3981|     62|                 msg_sec_model);
 3982|     62|        snmp_increment_statistic(STAT_SNMPUNKNOWNSECURITYMODELS);
  ------------------
  |  |  644|     62|#define   STAT_SNMPUNKNOWNSECURITYMODELS     0
  ------------------
 3983|     62|        DEBUGINDENTLESS();
  ------------------
  |  |   75|     62|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     62|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 62]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 62]
  |  |  ------------------
  ------------------
 3984|     62|        return SNMPERR_UNKNOWN_SEC_MODEL;
  ------------------
  |  |  247|     62|#define SNMPERR_UNKNOWN_SEC_MODEL 	(-30)
  ------------------
 3985|     62|    }
 3986|      0|    pdu->securityModel = msg_sec_model;
 3987|       |
 3988|      0|    if (msg_flags & SNMP_MSG_FLAG_PRIV_BIT &&
  ------------------
  |  |  304|      0|#define SNMP_MSG_FLAG_PRIV_BIT          0x02
  ------------------
  |  Branch (3988:9): [True: 0, False: 0]
  ------------------
 3989|      0|        !(msg_flags & SNMP_MSG_FLAG_AUTH_BIT)) {
  ------------------
  |  |  303|      0|#define SNMP_MSG_FLAG_AUTH_BIT          0x01
  ------------------
  |  Branch (3989:9): [True: 0, False: 0]
  ------------------
 3990|      0|        ERROR_MSG("invalid message, illegal msgFlags");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3991|      0|        snmp_increment_statistic(STAT_SNMPINVALIDMSGS);
  ------------------
  |  |  645|      0|#define   STAT_SNMPINVALIDMSGS               1
  ------------------
 3992|      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]
  |  |  ------------------
  ------------------
 3993|      0|        return SNMPERR_INVALID_MSG;
  ------------------
  |  |  248|      0|#define SNMPERR_INVALID_MSG             (-31)
  ------------------
 3994|      0|    }
 3995|      0|    pdu->securityLevel = ((msg_flags & SNMP_MSG_FLAG_AUTH_BIT)
  ------------------
  |  |  303|      0|#define SNMP_MSG_FLAG_AUTH_BIT          0x01
  ------------------
  |  Branch (3995:27): [True: 0, False: 0]
  ------------------
 3996|      0|                          ? ((msg_flags & SNMP_MSG_FLAG_PRIV_BIT)
  ------------------
  |  |  304|      0|#define SNMP_MSG_FLAG_PRIV_BIT          0x02
  ------------------
  |  Branch (3996:30): [True: 0, False: 0]
  ------------------
 3997|      0|                             ? SNMP_SEC_LEVEL_AUTHPRIV
  ------------------
  |  |  301|      0|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
 3998|      0|                             : SNMP_SEC_LEVEL_AUTHNOPRIV)
  ------------------
  |  |  300|      0|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
 3999|      0|                          : SNMP_SEC_LEVEL_NOAUTH);
  ------------------
  |  |  299|      0|#define SNMP_SEC_LEVEL_NOAUTH		1
  ------------------
 4000|       |    /*
 4001|       |     * end of msgGlobalData 
 4002|       |     */
 4003|       |
 4004|       |    /*
 4005|       |     * securtityParameters OCTET STRING begins after msgGlobalData 
 4006|       |     */
 4007|      0|    sec_params = data;
 4008|      0|    pdu->contextEngineID = calloc(1, SNMP_MAX_ENG_SIZE);
  ------------------
  |  |  144|      0|#define SNMP_MAX_ENG_SIZE          32
  ------------------
 4009|      0|    pdu->contextEngineIDLen = SNMP_MAX_ENG_SIZE;
  ------------------
  |  |  144|      0|#define SNMP_MAX_ENG_SIZE          32
  ------------------
 4010|       |
 4011|       |    /*
 4012|       |     * Note: there is no length limit on the msgAuthoritativeEngineID field,
 4013|       |     * although we would EXPECT it to be limited to 32 (the SnmpEngineID TC
 4014|       |     * limit).  We'll use double that here to be on the safe side.  
 4015|       |     */
 4016|       |
 4017|      0|    pdu->securityEngineID = calloc(1, SNMP_MAX_ENG_SIZE * 2);
  ------------------
  |  |  144|      0|#define SNMP_MAX_ENG_SIZE          32
  ------------------
 4018|      0|    pdu->securityEngineIDLen = SNMP_MAX_ENG_SIZE * 2;
  ------------------
  |  |  144|      0|#define SNMP_MAX_ENG_SIZE          32
  ------------------
 4019|      0|    pdu->securityName = calloc(1, SNMP_MAX_SEC_NAME_SIZE);
  ------------------
  |  |  145|      0|#define SNMP_MAX_SEC_NAME_SIZE     256
  ------------------
 4020|      0|    pdu->securityNameLen = SNMP_MAX_SEC_NAME_SIZE;
  ------------------
  |  |  145|      0|#define SNMP_MAX_SEC_NAME_SIZE     256
  ------------------
 4021|       |
 4022|      0|    if ((pdu->securityName == NULL) ||
  ------------------
  |  Branch (4022:9): [True: 0, False: 0]
  ------------------
 4023|      0|        (pdu->securityEngineID == NULL) ||
  ------------------
  |  Branch (4023:9): [True: 0, False: 0]
  ------------------
 4024|      0|        (pdu->contextEngineID == NULL)) {
  ------------------
  |  Branch (4024:9): [True: 0, False: 0]
  ------------------
 4025|      0|        return SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 4026|      0|    }
 4027|       |
 4028|      0|    if (pdu_buf_len < msg_len
  ------------------
  |  Branch (4028:9): [True: 0, False: 0]
  ------------------
 4029|      0|        && pdu->securityLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|      0|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (4029:12): [True: 0, False: 0]
  ------------------
 4030|       |        /*
 4031|       |         * space needed is larger than we have in the default buffer 
 4032|       |         */
 4033|      0|        mallocbuf = calloc(1, msg_len);
 4034|      0|        pdu_buf_len = msg_len;
 4035|      0|        cp = mallocbuf;
 4036|      0|    } else {
 4037|      0|        memset(pdu_buf, 0, pdu_buf_len);
 4038|      0|        cp = pdu_buf;
 4039|      0|    }
 4040|       |
 4041|      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]
  |  |  ------------------
  ------------------
 4042|      0|    if (sptr->decode) {
  ------------------
  |  Branch (4042:9): [True: 0, False: 0]
  ------------------
 4043|      0|        struct snmp_secmod_incoming_params parms;
 4044|      0|        parms.msgProcModel = pdu->msgParseModel;
 4045|      0|        parms.maxMsgSize = pdu->msgMaxSize;
 4046|      0|        parms.secParams = sec_params;
 4047|      0|        parms.secModel = msg_sec_model;
 4048|      0|        parms.secLevel = pdu->securityLevel;
 4049|      0|        parms.wholeMsg = msg_data;
 4050|      0|        parms.wholeMsgLen = msg_len;
 4051|      0|        parms.secEngineID = pdu->securityEngineID;
 4052|      0|        parms.secEngineIDLen = &pdu->securityEngineIDLen;
 4053|      0|        parms.secName = pdu->securityName;
 4054|      0|        parms.secNameLen = &pdu->securityNameLen;
 4055|      0|        parms.scopedPdu = &cp;
 4056|      0|        parms.scopedPduLen = &pdu_buf_len;
 4057|      0|        parms.maxSizeResponse = &max_size_response;
 4058|      0|        parms.secStateRef = &pdu->securityStateRef;
 4059|      0|        parms.sess = sess;
 4060|      0|        parms.pdu = pdu;
 4061|      0|        parms.msg_flags = msg_flags;
 4062|      0|        ret_val = (*sptr->decode) (&parms);
 4063|      0|    } else {
 4064|      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]
  |  |  ------------------
  ------------------
 4065|      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]
  |  |  ------------------
  ------------------
 4066|      0|        snmp_log(LOG_WARNING, "security service %ld can't decode packets\n",
 4067|      0|                 msg_sec_model);
 4068|      0|        return (-1);
 4069|      0|    }
 4070|       |
 4071|      0|    if (ret_val != SNMPERR_SUCCESS) {
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (4071:9): [True: 0, False: 0]
  ------------------
 4072|      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]
  |  |  ------------------
  ------------------
 4073|       |        /*
 4074|       |         * Parse as much as possible -- though I don't see the point? [jbpn].  
 4075|       |         */
 4076|      0|        if (cp) {
  ------------------
  |  Branch (4076:13): [True: 0, False: 0]
  ------------------
 4077|      0|            cp = snmpv3_scopedPDU_parse(pdu, cp, &pdu_buf_len);
 4078|      0|        }
 4079|      0|        if (cp) {
  ------------------
  |  Branch (4079:13): [True: 0, False: 0]
  ------------------
 4080|      0|            DEBUGPRINTPDUTYPE("recv", *cp);
  ------------------
  |  |  418|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4081|      0|            snmp_pdu_parse(pdu, cp, &pdu_buf_len);
 4082|      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]
  |  |  ------------------
  ------------------
 4083|      0|        } else {
 4084|      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]
  |  |  ------------------
  ------------------
 4085|      0|        }
 4086|       |
 4087|      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]
  |  |  ------------------
  ------------------
 4088|      0|        return ret_val;
 4089|      0|    }
 4090|       |
 4091|       |    /*
 4092|       |     * parse plaintext ScopedPDU sequence 
 4093|       |     */
 4094|      0|    *length = pdu_buf_len;
 4095|      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]
  |  |  ------------------
  ------------------
 4096|      0|    data = snmpv3_scopedPDU_parse(pdu, cp, length);
 4097|      0|    if (data == NULL) {
  ------------------
  |  Branch (4097:9): [True: 0, False: 0]
  ------------------
 4098|      0|        snmp_log(LOG_WARNING, "security service %ld error parsing ScopedPDU\n",
 4099|      0|                 msg_sec_model);
 4100|      0|        ERROR_MSG("error parsing PDU");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4101|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4102|      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]
  |  |  ------------------
  ------------------
 4103|      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]
  |  |  ------------------
  ------------------
 4104|      0|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 4105|      0|    }
 4106|       |
 4107|       |    /*
 4108|       |     * parse the PDU.  
 4109|       |     */
 4110|      0|    if (after_header != NULL) {
  ------------------
  |  Branch (4110:9): [True: 0, False: 0]
  ------------------
 4111|      0|        *after_header = data;
 4112|      0|        tmp_buf_len = *length;
 4113|      0|    }
 4114|       |
 4115|      0|    DEBUGPRINTPDUTYPE("recv", *data);
  ------------------
  |  |  418|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4116|      0|    ret = snmp_pdu_parse(pdu, data, length);
 4117|      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]
  |  |  ------------------
  ------------------
 4118|       |
 4119|      0|    if (after_header != NULL) {
  ------------------
  |  Branch (4119:9): [True: 0, False: 0]
  ------------------
 4120|      0|        *length = tmp_buf_len;
 4121|      0|    }
 4122|       |
 4123|      0|    if (ret != SNMPERR_SUCCESS) {
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (4123:9): [True: 0, False: 0]
  ------------------
 4124|      0|        snmp_log(LOG_WARNING, "security service %ld error parsing ScopedPDU\n",
 4125|      0|                 msg_sec_model);
 4126|      0|        ERROR_MSG("error parsing PDU");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4127|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4128|      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]
  |  |  ------------------
  ------------------
 4129|      0|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 4130|      0|    }
 4131|       |
 4132|      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]
  |  |  ------------------
  ------------------
 4133|      0|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 4134|      0|}                               /* end snmpv3_parse() */
snmp_parse:
 4659|  2.68k|{
 4660|  2.68k|    int             rc;
 4661|       |
 4662|  2.68k|    rc = _snmp_parse(slp, pss, pdu, data, length);
 4663|  2.68k|    if (rc) {
  ------------------
  |  Branch (4663:9): [True: 2.54k, False: 132]
  ------------------
 4664|  2.54k|        if (!pss->s_snmp_errno) {
  ------------------
  |  Branch (4664:13): [True: 2.45k, False: 93]
  ------------------
 4665|  2.45k|            pss->s_snmp_errno = SNMPERR_BAD_PARSE;
  ------------------
  |  |  230|  2.45k|#define SNMPERR_BAD_PARSE		(-13)
  ------------------
 4666|  2.45k|        }
 4667|  2.54k|        SET_SNMP_ERROR(pss->s_snmp_errno);
  ------------------
  |  |   56|  2.54k|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 4668|  2.54k|    }
 4669|       |
 4670|  2.68k|    return rc;
 4671|  2.68k|}
snmp_pdu_parse:
 4675|  1.36k|{
 4676|  1.36k|    u_char          type;
 4677|  1.36k|    u_char          msg_type;
 4678|  1.36k|    u_char         *var_val;
 4679|  1.36k|    size_t          len;
 4680|  1.36k|    size_t          four;
 4681|  1.36k|    netsnmp_variable_list *vp = NULL, *vplast = NULL;
 4682|  1.36k|    oid             objid[MAX_OID_LEN];
 4683|  1.36k|    u_char         *p;
 4684|       |
 4685|       |    /*
 4686|       |     * Get the PDU type 
 4687|       |     */
 4688|  1.36k|    data = asn_parse_header(data, length, &msg_type);
 4689|  1.36k|    if (data == NULL)
  ------------------
  |  Branch (4689:9): [True: 17, False: 1.34k]
  ------------------
 4690|     17|        return -1;
 4691|  1.34k|    DEBUGMSGTL(("dumpv_recv","    Command %s\n", snmp_pdu_type(msg_type)));
  ------------------
  |  |   66|  1.34k|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  1.34k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1.34k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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.34k]
  |  |  ------------------
  ------------------
 4692|  1.34k|    pdu->command = msg_type;
 4693|  1.34k|    pdu->flags &= (~UCD_MSG_FLAG_RESPONSE_PDU);
  ------------------
  |  |  311|  1.34k|#define UCD_MSG_FLAG_RESPONSE_PDU            0x100
  ------------------
 4694|       |
 4695|       |    /*
 4696|       |     * get the fields in the PDU preceding the variable-bindings sequence
 4697|       |     */
 4698|  1.34k|    switch (pdu->command) {
 4699|  1.04k|    case SNMP_MSG_TRAP:
  ------------------
  |  |  135|  1.04k|#define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   92|  1.04k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   96|  1.04k|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4699:5): [True: 1.04k, False: 298]
  ------------------
 4700|       |        /*
 4701|       |         * enterprise 
 4702|       |         */
 4703|  1.04k|        pdu->enterprise_length = MAX_OID_LEN;
  ------------------
  |  |  106|  1.04k|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
 4704|  1.04k|        data = asn_parse_objid(data, length, &type, objid,
 4705|  1.04k|                               &pdu->enterprise_length);
 4706|  1.04k|        if (data == NULL)
  ------------------
  |  Branch (4706:13): [True: 208, False: 840]
  ------------------
 4707|    208|            return -1;
 4708|    840|        pdu->enterprise = netsnmp_memdup(objid,
 4709|    840|                                         pdu->enterprise_length * sizeof(oid));
 4710|    840|        if (pdu->enterprise == NULL) {
  ------------------
  |  Branch (4710:13): [True: 0, False: 840]
  ------------------
 4711|      0|            return -1;
 4712|      0|        }
 4713|       |
 4714|       |        /*
 4715|       |         * agent-addr 
 4716|       |         */
 4717|    840|        four = 4;
 4718|    840|        data = asn_parse_string(data, length, &type,
 4719|    840|                                (u_char *) pdu->agent_addr, &four);
 4720|    840|        if (data == NULL)
  ------------------
  |  Branch (4720:13): [True: 91, False: 749]
  ------------------
 4721|     91|            return -1;
 4722|       |
 4723|       |        /*
 4724|       |         * generic trap 
 4725|       |         */
 4726|    749|        data = asn_parse_int(data, length, &type, (long *) &pdu->trap_type,
 4727|    749|                             sizeof(pdu->trap_type));
 4728|    749|        if (data == NULL)
  ------------------
  |  Branch (4728:13): [True: 6, False: 743]
  ------------------
 4729|      6|            return -1;
 4730|       |        /*
 4731|       |         * specific trap 
 4732|       |         */
 4733|    743|        data =
 4734|    743|            asn_parse_int(data, length, &type,
 4735|    743|                          (long *) &pdu->specific_type,
 4736|    743|                          sizeof(pdu->specific_type));
 4737|    743|        if (data == NULL)
  ------------------
  |  Branch (4737:13): [True: 4, False: 739]
  ------------------
 4738|      4|            return -1;
 4739|       |
 4740|       |        /*
 4741|       |         * timestamp  
 4742|       |         */
 4743|    739|        data = asn_parse_unsigned_int(data, length, &type, &pdu->time,
 4744|    739|                                      sizeof(pdu->time));
 4745|    739|        if (data == NULL)
  ------------------
  |  Branch (4745:13): [True: 172, False: 567]
  ------------------
 4746|    172|            return -1;
 4747|       |
 4748|    567|        break;
 4749|       |
 4750|    567|    case SNMP_MSG_RESPONSE:
  ------------------
  |  |  127|     60|#define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   92|     60|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   96|     60|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4750:5): [True: 60, False: 1.28k]
  ------------------
 4751|     85|    case SNMP_MSG_REPORT:
  ------------------
  |  |  147|     85|#define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   92|     85|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   96|     85|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4751:5): [True: 25, False: 1.32k]
  ------------------
 4752|     85|        pdu->flags |= UCD_MSG_FLAG_RESPONSE_PDU;
  ------------------
  |  |  311|     85|#define UCD_MSG_FLAG_RESPONSE_PDU            0x100
  ------------------
 4753|     85|        NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2408|     85|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 4754|       |
 4755|    106|    case SNMP_MSG_TRAP2:
  ------------------
  |  |  142|    106|#define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   92|    106|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   96|    106|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4755:5): [True: 21, False: 1.32k]
  ------------------
 4756|    126|    case SNMP_MSG_INFORM:
  ------------------
  |  |  141|    126|#define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   92|    126|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   96|    126|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4756:5): [True: 20, False: 1.32k]
  ------------------
 4757|    126|#ifndef NETSNMP_NOTIFY_ONLY
 4758|    152|    case SNMP_MSG_GET:
  ------------------
  |  |  125|    152|#define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  ------------------
  |  |  |  |   92|    152|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  ------------------
  |  |  |  |   96|    152|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4758:5): [True: 26, False: 1.32k]
  ------------------
 4759|    172|    case SNMP_MSG_GETNEXT:
  ------------------
  |  |  126|    172|#define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   92|    172|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   96|    172|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4759:5): [True: 20, False: 1.32k]
  ------------------
 4760|    232|    case SNMP_MSG_GETBULK:
  ------------------
  |  |  140|    232|#define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  ------------------
  |  |  |  |   92|    232|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  ------------------
  |  |  |  |   96|    232|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4760:5): [True: 60, False: 1.28k]
  ------------------
 4761|    232|#endif /* ! NETSNMP_NOTIFY_ONLY */
 4762|    232|#ifndef NETSNMP_NO_WRITE_SUPPORT
 4763|    290|    case SNMP_MSG_SET:
  ------------------
  |  |  129|    290|#define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  ------------------
  |  |  |  |   92|    290|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  ------------------
  |  |  |  |   96|    290|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4763:5): [True: 58, False: 1.28k]
  ------------------
 4764|    290|#endif /* !NETSNMP_NO_WRITE_SUPPORT */
 4765|       |        /*
 4766|       |         * PDU is not an SNMPv1 TRAP 
 4767|       |         */
 4768|       |
 4769|       |        /*
 4770|       |         * request id 
 4771|       |         */
 4772|    290|        DEBUGDUMPHEADER("recv", "request_id");
  ------------------
  |  |   79|    290|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    290|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 290]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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: 290]
  |  |  ------------------
  ------------------
 4773|    290|        data = asn_parse_int(data, length, &type, &pdu->reqid,
 4774|    290|                             sizeof(pdu->reqid));
 4775|    290|        DEBUGINDENTLESS();
  ------------------
  |  |   75|    290|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    290|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 290]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 290]
  |  |  ------------------
  ------------------
 4776|    290|        if (data == NULL) {
  ------------------
  |  Branch (4776:13): [True: 9, False: 281]
  ------------------
 4777|      9|            return -1;
 4778|      9|        }
 4779|       |
 4780|       |        /*
 4781|       |         * error status (getbulk non-repeaters) 
 4782|       |         */
 4783|    281|        DEBUGDUMPHEADER("recv", "error status");
  ------------------
  |  |   79|    281|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    281|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 281]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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: 281]
  |  |  ------------------
  ------------------
 4784|    281|        data = asn_parse_int(data, length, &type, &pdu->errstat,
 4785|    281|                             sizeof(pdu->errstat));
 4786|    281|        DEBUGINDENTLESS();
  ------------------
  |  |   75|    281|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    281|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 281]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 281]
  |  |  ------------------
  ------------------
 4787|    281|        if (data == NULL) {
  ------------------
  |  Branch (4787:13): [True: 4, False: 277]
  ------------------
 4788|      4|            return -1;
 4789|      4|        }
 4790|       |
 4791|       |        /*
 4792|       |         * error index (getbulk max-repetitions) 
 4793|       |         */
 4794|    277|        DEBUGDUMPHEADER("recv", "error index");
  ------------------
  |  |   79|    277|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    277|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 277]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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: 277]
  |  |  ------------------
  ------------------
 4795|    277|        data = asn_parse_int(data, length, &type, &pdu->errindex,
 4796|    277|                             sizeof(pdu->errindex));
 4797|    277|        DEBUGINDENTLESS();
  ------------------
  |  |   75|    277|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    277|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 277]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 277]
  |  |  ------------------
  ------------------
 4798|    277|        if (data == NULL) {
  ------------------
  |  Branch (4798:13): [True: 1, False: 276]
  ------------------
 4799|      1|            return -1;
 4800|      1|        }
 4801|    276|	break;
 4802|       |
 4803|    276|    default:
  ------------------
  |  Branch (4803:5): [True: 8, False: 1.33k]
  ------------------
 4804|      8|        snmp_log(LOG_ERR, "Bad PDU type received: 0x%.2x\n", pdu->command);
 4805|      8|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      8|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4806|      8|        return -1;
 4807|  1.34k|    }
 4808|       |
 4809|       |    /*
 4810|       |     * get header for variable-bindings sequence 
 4811|       |     */
 4812|    843|    DEBUGDUMPSECTION("recv", "VarBindList");
  ------------------
  |  |   81|    843|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    843|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 843]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 843]
  |  |  ------------------
  ------------------
 4813|    843|    data = asn_parse_sequence(data, length, &type,
 4814|    843|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   84|    843|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   96|    843|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 4815|    843|                              "varbinds");
 4816|    843|    if (data == NULL)
  ------------------
  |  Branch (4816:9): [True: 120, False: 723]
  ------------------
 4817|    120|        goto fail;
 4818|       |
 4819|       |    /*
 4820|       |     * get each varBind sequence 
 4821|       |     */
 4822|  17.5k|    while ((int) *length > 0) {
  ------------------
  |  Branch (4822:12): [True: 17.4k, False: 132]
  ------------------
 4823|  17.4k|        vp = SNMP_MALLOC_TYPEDEF(netsnmp_variable_list);
  ------------------
  |  |   73|  17.4k|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
 4824|  17.4k|        if (NULL == vp)
  ------------------
  |  Branch (4824:13): [True: 0, False: 17.4k]
  ------------------
 4825|      0|            goto fail;
 4826|       |
 4827|  17.4k|        vp->name_length = MAX_OID_LEN;
  ------------------
  |  |  106|  17.4k|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
 4828|  17.4k|        DEBUGDUMPSECTION("recv", "VarBind");
  ------------------
  |  |   81|  17.4k|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  17.4k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 17.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 17.4k]
  |  |  ------------------
  ------------------
 4829|  17.4k|        data = snmp_parse_var_op(data, objid, &vp->name_length, &vp->type,
 4830|  17.4k|                                 &vp->val_len, &var_val, length);
 4831|  17.4k|        if (data == NULL)
  ------------------
  |  Branch (4831:13): [True: 374, False: 17.0k]
  ------------------
 4832|    374|            goto fail;
 4833|  17.0k|        if (snmp_set_var_objid(vp, objid, vp->name_length))
  ------------------
  |  Branch (4833:13): [True: 0, False: 17.0k]
  ------------------
 4834|      0|            goto fail;
 4835|       |
 4836|  17.0k|        len = SNMP_MAX_PACKET_LEN;
  ------------------
  |  |   49|  17.0k|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
 4837|  17.0k|        DEBUGDUMPHEADER("recv", "Value");
  ------------------
  |  |   79|  17.0k|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  17.0k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 17.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      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.0k]
  |  |  ------------------
  ------------------
 4838|  17.0k|        switch ((short) vp->type) {
 4839|  1.38k|        case ASN_INTEGER:
  ------------------
  |  |   75|  1.38k|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (4839:9): [True: 1.38k, False: 15.6k]
  ------------------
 4840|  1.38k|            vp->val.integer = (long *) vp->buf;
 4841|  1.38k|            vp->val_len = sizeof(long);
 4842|  1.38k|            p = asn_parse_int(var_val, &len, &vp->type,
 4843|  1.38k|                          (long *) vp->val.integer,
 4844|  1.38k|                          sizeof(*vp->val.integer));
 4845|  1.38k|            if (!p)
  ------------------
  |  Branch (4845:17): [True: 6, False: 1.37k]
  ------------------
 4846|      6|                goto fail;
 4847|  1.37k|            break;
 4848|  1.37k|        case ASN_COUNTER:
  ------------------
  |  |   89|    989|#define ASN_COUNTER	(ASN_APPLICATION | 1)
  |  |  ------------------
  |  |  |  |   91|    989|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4848:9): [True: 989, False: 16.0k]
  ------------------
 4849|  1.70k|        case ASN_GAUGE:
  ------------------
  |  |   90|  1.70k|#define ASN_GAUGE	(ASN_APPLICATION | 2)
  |  |  ------------------
  |  |  |  |   91|  1.70k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4849:9): [True: 711, False: 16.3k]
  ------------------
 4850|  2.33k|        case ASN_TIMETICKS:
  ------------------
  |  |   92|  2.33k|#define ASN_TIMETICKS   (ASN_APPLICATION | 3)
  |  |  ------------------
  |  |  |  |   91|  2.33k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4850:9): [True: 634, False: 16.4k]
  ------------------
 4851|  2.98k|        case ASN_UINTEGER:
  ------------------
  |  |  100|  2.98k|#define ASN_UINTEGER    (ASN_APPLICATION | 7)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|  2.98k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4851:9): [True: 653, False: 16.4k]
  ------------------
 4852|  2.98k|            vp->val.integer = (long *) vp->buf;
 4853|  2.98k|            vp->val_len = sizeof(u_long);
 4854|  2.98k|            p = asn_parse_unsigned_int(var_val, &len, &vp->type,
 4855|  2.98k|                                   (u_long *) vp->val.integer,
 4856|  2.98k|                                   vp->val_len);
 4857|  2.98k|            if (!p)
  ------------------
  |  Branch (4857:17): [True: 17, False: 2.97k]
  ------------------
 4858|     17|                goto fail;
 4859|  2.97k|            break;
 4860|  2.97k|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 4861|  2.97k|        case ASN_OPAQUE_COUNTER64:
  ------------------
  |  |  156|    827|#define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  136|    827|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  146|    827|#define ASN_APP_COUNTER64 (ASN_APPLICATION | 6)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    827|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4861:9): [True: 827, False: 16.2k]
  ------------------
 4862|  1.67k|        case ASN_OPAQUE_U64:
  ------------------
  |  |  192|  1.67k|#define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  136|  1.67k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  150|  1.67k|#define ASN_APP_U64 (ASN_APPLICATION | 11)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.67k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4862:9): [True: 850, False: 16.2k]
  ------------------
 4863|  1.67k|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 4864|  3.05k|        case ASN_COUNTER64:
  ------------------
  |  |   99|  3.05k|#define ASN_COUNTER64   (ASN_APPLICATION | 6)
  |  |  ------------------
  |  |  |  |   91|  3.05k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4864:9): [True: 1.37k, False: 15.6k]
  ------------------
 4865|  3.05k|            vp->val.counter64 = (struct counter64 *) vp->buf;
 4866|  3.05k|            vp->val_len = sizeof(struct counter64);
 4867|  3.05k|            p = asn_parse_unsigned_int64(var_val, &len, &vp->type,
 4868|  3.05k|                                     (struct counter64 *) vp->val.
 4869|  3.05k|                                     counter64, vp->val_len);
 4870|  3.05k|            if (!p)
  ------------------
  |  Branch (4870:17): [True: 38, False: 3.01k]
  ------------------
 4871|     38|                goto fail;
 4872|  3.01k|            break;
 4873|  3.01k|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 4874|  3.01k|        case ASN_OPAQUE_FLOAT:
  ------------------
  |  |  165|    693|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|    693|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|    693|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    693|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4874:9): [True: 693, False: 16.3k]
  ------------------
 4875|    693|            vp->val.floatVal = (float *) vp->buf;
 4876|    693|            vp->val_len = sizeof(float);
 4877|    693|            p = asn_parse_float(var_val, &len, &vp->type,
 4878|    693|                            vp->val.floatVal, vp->val_len);
 4879|    693|            if (!p)
  ------------------
  |  Branch (4879:17): [True: 40, False: 653]
  ------------------
 4880|     40|                goto fail;
 4881|    653|            break;
 4882|    917|        case ASN_OPAQUE_DOUBLE:
  ------------------
  |  |  174|    917|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|    917|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|    917|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    917|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4882:9): [True: 917, False: 16.1k]
  ------------------
 4883|    917|            vp->val.doubleVal = (double *) vp->buf;
 4884|    917|            vp->val_len = sizeof(double);
 4885|    917|            p = asn_parse_double(var_val, &len, &vp->type,
 4886|    917|                             vp->val.doubleVal, vp->val_len);
 4887|    917|            if (!p)
  ------------------
  |  Branch (4887:17): [True: 45, False: 872]
  ------------------
 4888|     45|                goto fail;
 4889|    872|            break;
 4890|  1.27k|        case ASN_OPAQUE_I64:
  ------------------
  |  |  183|  1.27k|#define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  136|  1.27k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  149|  1.27k|#define ASN_APP_I64 (ASN_APPLICATION | 10)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.27k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4890:9): [True: 1.27k, False: 15.7k]
  ------------------
 4891|  1.27k|            vp->val.counter64 = (struct counter64 *) vp->buf;
 4892|  1.27k|            vp->val_len = sizeof(struct counter64);
 4893|  1.27k|            p = asn_parse_signed_int64(var_val, &len, &vp->type,
 4894|  1.27k|                                   (struct counter64 *) vp->val.counter64,
 4895|  1.27k|                                   sizeof(*vp->val.counter64));
 4896|       |
 4897|  1.27k|            if (!p)
  ------------------
  |  Branch (4897:17): [True: 46, False: 1.22k]
  ------------------
 4898|     46|                goto fail;
 4899|  1.22k|            break;
 4900|  1.22k|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 4901|  1.22k|        case ASN_IPADDRESS:
  ------------------
  |  |   88|    256|#define ASN_IPADDRESS   (ASN_APPLICATION | 0)
  |  |  ------------------
  |  |  |  |   91|    256|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4901:9): [True: 256, False: 16.8k]
  ------------------
 4902|    256|            if (vp->val_len != 4)
  ------------------
  |  Branch (4902:17): [True: 3, False: 253]
  ------------------
 4903|      3|                goto fail;
 4904|    253|            NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2408|    253|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 4905|  1.30k|        case ASN_OCTET_STR:
  ------------------
  |  |   78|  1.30k|#define ASN_OCTET_STR	    0x04U
  ------------------
  |  Branch (4905:9): [True: 1.04k, False: 16.0k]
  ------------------
 4906|  2.62k|        case ASN_OPAQUE:
  ------------------
  |  |   93|  2.62k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  2.62k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4906:9): [True: 1.32k, False: 15.7k]
  ------------------
 4907|  3.29k|        case ASN_NSAP:
  ------------------
  |  |   98|  3.29k|#define ASN_NSAP	(ASN_APPLICATION | 5)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|  3.29k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4907:9): [True: 668, False: 16.4k]
  ------------------
 4908|  3.29k|            if (vp->val_len < sizeof(vp->buf)) {
  ------------------
  |  Branch (4908:17): [True: 3.04k, False: 247]
  ------------------
 4909|  3.04k|                vp->val.string = (u_char *) vp->buf;
 4910|  3.04k|            } else {
 4911|    247|                vp->val.string = (u_char *) malloc(vp->val_len);
 4912|    247|            }
 4913|  3.29k|            if (vp->val.string == NULL) {
  ------------------
  |  Branch (4913:17): [True: 0, False: 3.29k]
  ------------------
 4914|      0|                goto fail;
 4915|      0|            }
 4916|  3.29k|            p = asn_parse_string(var_val, &len, &vp->type, vp->val.string,
 4917|  3.29k|                             &vp->val_len);
 4918|  3.29k|            if (!p)
  ------------------
  |  Branch (4918:17): [True: 0, False: 3.29k]
  ------------------
 4919|      0|                goto fail;
 4920|  3.29k|            break;
 4921|  3.29k|        case ASN_OBJECT_ID:
  ------------------
  |  |   81|    799|#define ASN_OBJECT_ID	    0x06U
  ------------------
  |  Branch (4921:9): [True: 799, False: 16.2k]
  ------------------
 4922|    799|            vp->val_len = MAX_OID_LEN;
  ------------------
  |  |  106|    799|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
 4923|    799|            p = asn_parse_objid(var_val, &len, &vp->type, objid, &vp->val_len);
 4924|    799|            if (!p)
  ------------------
  |  Branch (4924:17): [True: 2, False: 797]
  ------------------
 4925|      2|                goto fail;
 4926|    797|            vp->val_len *= sizeof(oid);
 4927|    797|            vp->val.objid = netsnmp_memdup(objid, vp->val_len);
 4928|    797|            if (vp->val.objid == NULL)
  ------------------
  |  Branch (4928:17): [True: 0, False: 797]
  ------------------
 4929|      0|                goto fail;
 4930|    797|            break;
 4931|    797|        case SNMP_NOSUCHOBJECT:
  ------------------
  |  |  201|    361|#define SNMP_NOSUCHOBJECT    (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) /* 80=128 */
  |  |  ------------------
  |  |  |  |   92|    361|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_NOSUCHOBJECT    (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) /* 80=128 */
  |  |  ------------------
  |  |  |  |   95|    361|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (4931:9): [True: 361, False: 16.7k]
  ------------------
 4932|  1.01k|        case SNMP_NOSUCHINSTANCE:
  ------------------
  |  |  202|  1.01k|#define SNMP_NOSUCHINSTANCE  (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* 81=129 */
  |  |  ------------------
  |  |  |  |   92|  1.01k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_NOSUCHINSTANCE  (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* 81=129 */
  |  |  ------------------
  |  |  |  |   95|  1.01k|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (4932:9): [True: 654, False: 16.4k]
  ------------------
 4933|  1.47k|        case SNMP_ENDOFMIBVIEW:
  ------------------
  |  |  203|  1.47k|#define SNMP_ENDOFMIBVIEW    (ASN_CONTEXT | ASN_PRIMITIVE | 0x2) /* 82=130 */
  |  |  ------------------
  |  |  |  |   92|  1.47k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_ENDOFMIBVIEW    (ASN_CONTEXT | ASN_PRIMITIVE | 0x2) /* 82=130 */
  |  |  ------------------
  |  |  |  |   95|  1.47k|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (4933:9): [True: 464, False: 16.6k]
  ------------------
 4934|  1.93k|        case ASN_NULL:
  ------------------
  |  |   79|  1.93k|#define ASN_NULL	    0x05U
  ------------------
  |  Branch (4934:9): [True: 452, False: 16.6k]
  ------------------
 4935|  1.93k|            break;
 4936|    726|        case ASN_BIT_STR:
  ------------------
  |  |   77|    726|#define ASN_BIT_STR	    0x03U
  ------------------
  |  Branch (4936:9): [True: 726, False: 16.3k]
  ------------------
 4937|    726|            vp->val.bitstring = (u_char *) malloc(vp->val_len);
 4938|    726|            if (vp->val.bitstring == NULL) {
  ------------------
  |  Branch (4938:17): [True: 0, False: 726]
  ------------------
 4939|      0|                goto fail;
 4940|      0|            }
 4941|    726|            p = asn_parse_bitstring(var_val, &len, &vp->type,
 4942|    726|                                vp->val.bitstring, &vp->val_len);
 4943|    726|            if (!p)
  ------------------
  |  Branch (4943:17): [True: 7, False: 719]
  ------------------
 4944|      7|                goto fail;
 4945|    719|            break;
 4946|    719|        default:
  ------------------
  |  Branch (4946:9): [True: 13, False: 17.0k]
  ------------------
 4947|     13|            snmp_log(LOG_ERR, "bad type returned (%x)\n", vp->type);
 4948|     13|            goto fail;
 4949|      0|            break;
 4950|  17.0k|        }
 4951|  16.8k|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|  16.8k|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  16.8k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 16.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 16.8k]
  |  |  ------------------
  ------------------
 4952|       |
 4953|  16.8k|        if (NULL == vplast) {
  ------------------
  |  Branch (4953:13): [True: 564, False: 16.2k]
  ------------------
 4954|    564|            pdu->variables = vp;
 4955|  16.2k|        } else {
 4956|  16.2k|            vplast->next_variable = vp;
 4957|  16.2k|        }
 4958|  16.8k|        vplast = vp;
 4959|  16.8k|        vp = NULL;
 4960|  16.8k|    }
 4961|    132|    return 0;
 4962|       |
 4963|    711|  fail:
 4964|    711|    {
 4965|    711|        const char *errstr = snmp_api_errstring(SNMPERR_SUCCESS);
  ------------------
  |  |  217|    711|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 4966|    711|        DEBUGMSGTL(("recv", "error while parsing VarBindList:%s\n", errstr));
  ------------------
  |  |   66|    711|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    711|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 711]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 711]
  |  |  ------------------
  ------------------
 4967|    711|    }
 4968|       |    /** if we were parsing a var, remove it from the pdu and free it */
 4969|    711|    if (vp)
  ------------------
  |  Branch (4969:9): [True: 591, False: 120]
  ------------------
 4970|    591|        snmp_free_var(vp);
 4971|       |
 4972|    711|    return -1;
 4973|    723|}
snmp_free_var_internals:
 5569|  17.4k|{
 5570|  17.4k|    if (!var)
  ------------------
  |  Branch (5570:9): [True: 0, False: 17.4k]
  ------------------
 5571|      0|        return;
 5572|       |
 5573|  17.4k|    if (var->name != var->name_loc)
  ------------------
  |  Branch (5573:9): [True: 374, False: 17.0k]
  ------------------
 5574|    374|        SNMP_FREE(var->name);
  ------------------
  |  |   62|    374|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 374]
  |  |  |  Branch (62:66): [Folded, False: 374]
  |  |  ------------------
  ------------------
 5575|  17.4k|    if (var->val.string != var->buf)
  ------------------
  |  Branch (5575:9): [True: 4.09k, False: 13.3k]
  ------------------
 5576|  4.09k|        SNMP_FREE(var->val.string);
  ------------------
  |  |   62|  4.09k|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 1.77k, False: 2.32k]
  |  |  |  Branch (62:66): [Folded, False: 4.09k]
  |  |  ------------------
  ------------------
 5577|  17.4k|    if (var->data) {
  ------------------
  |  Branch (5577:9): [True: 0, False: 17.4k]
  ------------------
 5578|      0|        if (var->dataFreeHook) {
  ------------------
  |  Branch (5578:13): [True: 0, False: 0]
  ------------------
 5579|      0|            var->dataFreeHook(var->data);
 5580|      0|            var->data = NULL;
 5581|      0|        } else {
 5582|       |            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]
  |  |  ------------------
  ------------------
 5583|      0|        }
 5584|      0|    }
 5585|  17.4k|}
snmp_free_var:
 5589|  17.4k|{
 5590|  17.4k|    snmp_free_var_internals(var);
 5591|  17.4k|    free(var);
 5592|  17.4k|}
snmp_free_varbind:
 5596|  5.36k|{
 5597|  5.36k|    netsnmp_variable_list *ptr;
 5598|  22.2k|    while (var) {
  ------------------
  |  Branch (5598:12): [True: 16.8k, False: 5.36k]
  ------------------
 5599|  16.8k|        ptr = var->next_variable;
 5600|  16.8k|        snmp_free_var(var);
 5601|  16.8k|        var = ptr;
 5602|  16.8k|    }
 5603|  5.36k|}
snmp_free_pdu:
 5610|  5.36k|{
 5611|  5.36k|    struct snmp_secmod_def *sptr;
 5612|       |
 5613|  5.36k|    if (!pdu)
  ------------------
  |  Branch (5613:9): [True: 0, False: 5.36k]
  ------------------
 5614|      0|        return;
 5615|       |
 5616|  5.36k|    free_securityStateRef(pdu);
 5617|       |
 5618|  5.36k|    sptr = find_sec_mod(pdu->securityModel);
 5619|  5.36k|    if (sptr && sptr->pdu_free)
  ------------------
  |  Branch (5619:9): [True: 0, False: 5.36k]
  |  Branch (5619:17): [True: 0, False: 0]
  ------------------
 5620|      0|        (*sptr->pdu_free)(pdu);
 5621|       |
 5622|  5.36k|    snmp_free_varbind(pdu->variables);
 5623|  5.36k|    free(pdu->enterprise);
 5624|  5.36k|    free(pdu->community);
 5625|  5.36k|    free(pdu->contextEngineID);
 5626|  5.36k|    free(pdu->securityEngineID);
 5627|  5.36k|    free(pdu->contextName);
 5628|  5.36k|    free(pdu->securityName);
 5629|  5.36k|    free(pdu->transport_data);
 5630|  5.36k|    free(pdu);
 5631|  5.36k|}
snmp_increment_statistic:
 8022|  3.91k|{
 8023|  3.91k|    if (which >= 0 && which < NETSNMP_STAT_MAX_STATS) {
  ------------------
  |  |  743|  3.91k|#define  NETSNMP_STAT_MAX_STATS              (STAT_TLSTM_STATS_END+1)
  |  |  ------------------
  |  |  |  |  739|  3.91k|#define  STAT_TLSTM_STATS_END          STAT_TLSTM_SNMPTLSTMSESSIONINVALIDCACHES
  |  |  |  |  ------------------
  |  |  |  |  |  |  736|  3.91k|#define  STAT_TLSTM_SNMPTLSTMSESSIONINVALIDCACHES              56
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (8023:9): [True: 3.91k, False: 0]
  |  Branch (8023:23): [True: 3.91k, False: 0]
  ------------------
 8024|  3.91k|        statistics[which]++;
 8025|  3.91k|        return statistics[which];
 8026|  3.91k|    }
 8027|      0|    return 0;
 8028|  3.91k|}
snmp_api.c:free_securityStateRef:
 4138|  5.36k|{
 4139|  5.36k|    struct snmp_secmod_def *sptr;
 4140|       |
 4141|  5.36k|    if (!pdu->securityStateRef)
  ------------------
  |  Branch (4141:9): [True: 5.36k, False: 0]
  ------------------
 4142|  5.36k|        return;
 4143|       |
 4144|      0|    sptr = find_sec_mod(pdu->securityModel);
 4145|      0|    if (sptr) {
  ------------------
  |  Branch (4145:9): [True: 0, False: 0]
  ------------------
 4146|      0|        if (sptr->pdu_free_state_ref) {
  ------------------
  |  Branch (4146:13): [True: 0, False: 0]
  ------------------
 4147|      0|            (*sptr->pdu_free_state_ref) (pdu->securityStateRef);
 4148|      0|        } else {
 4149|      0|            snmp_log(LOG_ERR,
 4150|      0|                     "Security Model %d can't free state references\n",
 4151|      0|                     pdu->securityModel);
 4152|      0|	}
 4153|      0|    } else {
 4154|      0|	snmp_log(LOG_ERR,
 4155|      0|		 "Can't find security model to free ptr: %d\n",
 4156|      0|		 pdu->securityModel);
 4157|      0|    }
 4158|       |    pdu->securityStateRef = NULL;
 4159|      0|}
snmp_api.c:_snmp_parse:
 4364|  2.68k|{
 4365|  2.68k|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 4366|  2.68k|    u_char          community[COMMUNITY_MAX_LEN];
 4367|  2.68k|    size_t          community_length = COMMUNITY_MAX_LEN;
  ------------------
  |  |   41|  2.68k|#define COMMUNITY_MAX_LEN	256
  ------------------
 4368|  2.68k|#endif
 4369|  2.68k|    int             result = -1;
 4370|       |
 4371|  2.68k|    static const oid snmpEngineIDoid[]   = { 1,3,6,1,6,3,10,2,1,1,0};
 4372|  2.68k|    static size_t   snmpEngineIDoid_len = 11;
 4373|       |
 4374|  2.68k|    static char     ourEngineID[SNMP_SEC_PARAM_BUF_SIZE];
 4375|  2.68k|    static size_t   ourEngineID_len = sizeof(ourEngineID);
 4376|       |
 4377|  2.68k|    netsnmp_pdu    *pdu2 = NULL;
 4378|       |
 4379|  2.68k|    session->s_snmp_errno = 0;
 4380|  2.68k|    session->s_errno = 0;
 4381|       |
 4382|       |    /*
 4383|       |     * Ensure all incoming PDUs have a unique means of identification 
 4384|       |     * (This is not restricted to AgentX handling,
 4385|       |     * though that is where the need becomes visible)   
 4386|       |     */
 4387|  2.68k|    pdu->transid = snmp_get_next_transid();
 4388|       |
 4389|  2.68k|    if (session->version != SNMP_DEFAULT_VERSION) {
  ------------------
  |  |  123|  2.68k|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  |  Branch (4389:9): [True: 2.68k, False: 0]
  ------------------
 4390|  2.68k|        pdu->version = session->version;
 4391|  2.68k|    } else {
 4392|      0|        pdu->version = snmp_parse_version(data, length);
 4393|      0|    }
 4394|       |
 4395|  2.68k|    switch (pdu->version) {
 4396|      0|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 4397|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 4398|  2.68k|    case SNMP_VERSION_1:
  ------------------
  |  |  107|  2.68k|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (4398:5): [True: 2.68k, False: 0]
  ------------------
 4399|  2.68k|#endif
 4400|  2.68k|#ifndef NETSNMP_DISABLE_SNMPV2C
 4401|  2.68k|    case SNMP_VERSION_2c:
  ------------------
  |  |  110|  2.68k|#define SNMP_VERSION_2c    1
  ------------------
  |  Branch (4401:5): [True: 0, False: 2.68k]
  ------------------
 4402|  2.68k|#endif
 4403|  2.68k|        NETSNMP_RUNTIME_PROTOCOL_CHECK_V1V2(pdu->version,unsupported_version);
  ------------------
  |  |  220|  2.68k|#define NETSNMP_RUNTIME_PROTOCOL_CHECK_V1V2(pc_ver, pc_target) do {    \
  |  |  221|  2.68k|        if (NETSNMP_RUNTIME_PROTOCOL_SKIP_V1(pc_ver) ||                \
  |  |  ------------------
  |  |  |  |  205|  5.36k|    ((pc_ver) == SNMP_VERSION_1 &&                                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |  107|  5.36k|#define SNMP_VERSION_1	   0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (205:6): [True: 2.68k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  206|  5.36k|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|  2.68k|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (206:6): [True: 0, False: 2.68k]
  |  |  |  |  ------------------
  |  |  |  |  207|  2.68k|                            NETSNMP_DS_LIB_DISABLE_V1))
  |  |  |  |  ------------------
  |  |  |  |  |  |  103|  2.68k|#define NETSNMP_DS_LIB_DISABLE_V1          43 /* disable SNMPv1 */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  222|  2.68k|            NETSNMP_RUNTIME_PROTOCOL_SKIP_V2(pc_ver)) {                \
  |  |  ------------------
  |  |  |  |  215|  2.68k|    ((pc_ver) == SNMP_VERSION_2c &&                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  5.36k|#define SNMP_VERSION_2c    1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (215:6): [True: 0, False: 2.68k]
  |  |  |  |  ------------------
  |  |  |  |  216|  2.68k|     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.68k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (226:13): [Folded, False: 2.68k]
  |  |  ------------------
  ------------------
 4404|  2.68k|        DEBUGMSGTL(("snmp_api", "Parsing SNMPv%ld message...\n",
  ------------------
  |  |   66|  2.68k|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.68k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.68k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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.68k]
  |  |  ------------------
  ------------------
 4405|  2.68k|                    (1 + pdu->version)));
 4406|       |
 4407|       |        /*
 4408|       |         * authenticates message and returns length if valid 
 4409|       |         */
 4410|  2.68k|#ifndef NETSNMP_DISABLE_SNMPV1
 4411|  2.68k|        if (pdu->version == SNMP_VERSION_1) {
  ------------------
  |  |  107|  2.68k|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (4411:13): [True: 2.68k, False: 0]
  ------------------
 4412|  2.68k|            DEBUGDUMPSECTION("recv", "SNMPv1 message\n");
  ------------------
  |  |   81|  2.68k|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.68k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.68k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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.68k]
  |  |  ------------------
  ------------------
 4413|  2.68k|        } else {
 4414|      0|#endif
 4415|      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]
  |  |  ------------------
  ------------------
 4416|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 4417|      0|        }
 4418|  2.68k|#endif
 4419|  2.68k|        data = snmp_comstr_parse(data, &length,
 4420|  2.68k|                                 community, &community_length,
 4421|  2.68k|                                 &pdu->version);
 4422|  2.68k|        if (data == NULL)
  ------------------
  |  Branch (4422:13): [True: 1.22k, False: 1.45k]
  ------------------
 4423|  1.22k|            return -1;
 4424|       |
 4425|  1.45k|        if (pdu->version != session->version &&
  ------------------
  |  Branch (4425:13): [True: 93, False: 1.36k]
  ------------------
 4426|     93|            session->version != SNMP_DEFAULT_VERSION) {
  ------------------
  |  |  123|     93|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  |  Branch (4426:13): [True: 93, False: 0]
  ------------------
 4427|     93|            session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  231|     93|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 4428|     93|            return -1;
 4429|     93|        }
 4430|       |
 4431|       |        /*
 4432|       |         * maybe get the community string. 
 4433|       |         */
 4434|  1.36k|        pdu->securityLevel = SNMP_SEC_LEVEL_NOAUTH;
  ------------------
  |  |  299|  1.36k|#define SNMP_SEC_LEVEL_NOAUTH		1
  ------------------
 4435|  1.36k|        pdu->securityModel = 
 4436|  1.36k|#ifndef NETSNMP_DISABLE_SNMPV1
 4437|  1.36k|            (pdu->version == SNMP_VERSION_1) ? SNMP_SEC_MODEL_SNMPv1 : 
  ------------------
  |  |  107|  1.36k|#define SNMP_VERSION_1	   0
  ------------------
                          (pdu->version == SNMP_VERSION_1) ? SNMP_SEC_MODEL_SNMPv1 : 
  ------------------
  |  |  293|  1.36k|#define SNMP_SEC_MODEL_SNMPv1		1
  ------------------
  |  Branch (4437:13): [True: 1.36k, False: 0]
  ------------------
 4438|  1.36k|#endif
 4439|  1.36k|                                               SNMP_SEC_MODEL_SNMPv2c;
  ------------------
  |  |  294|  1.36k|#define SNMP_SEC_MODEL_SNMPv2c		2
  ------------------
 4440|  1.36k|        SNMP_FREE(pdu->community);
  ------------------
  |  |   62|  1.36k|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 1.36k]
  |  |  |  Branch (62:66): [Folded, False: 1.36k]
  |  |  ------------------
  ------------------
 4441|  1.36k|        pdu->community_len = 0;
 4442|  1.36k|        pdu->community = (u_char *) 0;
 4443|  1.36k|        if (community_length) {
  ------------------
  |  Branch (4443:13): [True: 46, False: 1.31k]
  ------------------
 4444|     46|            pdu->community_len = community_length;
 4445|     46|            pdu->community = netsnmp_memdup(community, community_length);
 4446|     46|            if (pdu->community == NULL) {
  ------------------
  |  Branch (4446:17): [True: 0, False: 46]
  ------------------
 4447|      0|                session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 4448|      0|                return -1;
 4449|      0|            }
 4450|     46|        }
 4451|  1.36k|        if (session->authenticator) {
  ------------------
  |  Branch (4451:13): [True: 0, False: 1.36k]
  ------------------
 4452|      0|            data = session->authenticator(data, &length,
 4453|      0|                                          community, community_length);
 4454|      0|            if (data == NULL) {
  ------------------
  |  Branch (4454:17): [True: 0, False: 0]
  ------------------
 4455|      0|                session->s_snmp_errno = SNMPERR_AUTHENTICATION_FAILURE;
  ------------------
  |  |  252|      0|#define SNMPERR_AUTHENTICATION_FAILURE 	(-35)
  ------------------
 4456|      0|                return -1;
 4457|      0|            }
 4458|      0|        }
 4459|       |
 4460|  1.36k|        DEBUGDUMPSECTION("recv", "PDU");
  ------------------
  |  |   81|  1.36k|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  1.36k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1.36k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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.36k]
  |  |  ------------------
  ------------------
 4461|  1.36k|        result = snmp_pdu_parse(pdu, data, &length);
 4462|  1.36k|        if (result < 0) {
  ------------------
  |  Branch (4462:13): [True: 1.23k, False: 132]
  ------------------
 4463|       |            /*
 4464|       |             * This indicates a parse error.  
 4465|       |             */
 4466|  1.23k|            snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|  1.23k|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4467|  1.23k|        }
 4468|  1.36k|        DEBUGINDENTADD(-6);
  ------------------
  |  |   73|  1.36k|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  1.36k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1.36k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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.36k]
  |  |  ------------------
  ------------------
 4469|  1.36k|        break;
 4470|      0|#endif /* support for community based SNMP */
 4471|       |
 4472|      0|    case SNMP_VERSION_3:
  ------------------
  |  |  113|      0|#define SNMP_VERSION_3     3
  ------------------
  |  Branch (4472:5): [True: 0, False: 2.68k]
  ------------------
 4473|      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]
  |  |  ------------------
  ------------------
 4474|      0|        result = snmpv3_parse(pdu, data, &length, NULL, session);
 4475|      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]
  |  |  ------------------
  ------------------
 4476|      0|                    "Parsed SNMPv3 message (secName:%s, secLevel:%s): %s\n",
 4477|      0|                    pdu->securityName, secLevelName[pdu->securityLevel],
 4478|      0|                    snmp_api_errstring(result)));
 4479|       |
 4480|      0|        if (result == SNMPERR_USM_UNKNOWNSECURITYNAME) {
  ------------------
  |  |  260|      0|#define SNMPERR_USM_UNKNOWNSECURITYNAME		(-43)
  ------------------
  |  Branch (4480:13): [True: 0, False: 0]
  ------------------
 4481|      0|            snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
  ------------------
  |  |   19|      0|#define SNMP_CALLBACK_APPLICATION 1
  ------------------
 4482|      0|                                SNMPD_CALLBACK_AUTH_FAILURE, pdu);
  ------------------
  |  |   21|      0|#define SNMPD_CALLBACK_AUTH_FAILURE             17
  ------------------
 4483|      0|        }
 4484|       |        
 4485|      0|        if (result) {
  ------------------
  |  Branch (4485:13): [True: 0, False: 0]
  ------------------
 4486|      0|            struct snmp_secmod_def *secmod =
 4487|      0|                find_sec_mod(pdu->securityModel);
 4488|      0|            if (!slp) {
  ------------------
  |  Branch (4488:17): [True: 0, False: 0]
  ------------------
 4489|      0|                session->s_snmp_errno = result;
 4490|      0|            } else {
 4491|       |                /*
 4492|       |                 * Call the security model to special handle any errors
 4493|       |                 */
 4494|       |
 4495|      0|                if (secmod && secmod->handle_report) {
  ------------------
  |  Branch (4495:21): [True: 0, False: 0]
  |  Branch (4495:31): [True: 0, False: 0]
  ------------------
 4496|      0|                    (*secmod->handle_report)(slp, slp->transport, session,
 4497|      0|                                             result, pdu);
 4498|      0|                }
 4499|      0|            }
 4500|      0|            free_securityStateRef(pdu);
 4501|      0|        }
 4502|       |
 4503|       |        /* Implement RFC5343 here for two reasons:
 4504|       |           1) From a security perspective it handles this otherwise
 4505|       |              always approved request earlier.  It bypasses the need
 4506|       |              for authorization to the snmpEngineID scalar, which is
 4507|       |              what is what RFC3415 appendix A species as ok.  Note
 4508|       |              that we haven't bypassed authentication since if there
 4509|       |              was an authentication error it would have been handled
 4510|       |              above in the if(result) part at the latest.
 4511|       |           2) From an application point of view if we let this request
 4512|       |              get all the way to the application, it'd require that
 4513|       |              all application types supporting discovery also fire up
 4514|       |              a minimal agent in order to handle just this request
 4515|       |              which seems like overkill.  Though there is no other
 4516|       |              application types that currently need discovery (NRs
 4517|       |              accept notifications from contextEngineIDs that derive
 4518|       |              from the NO not the NR).  Also a lame excuse for doing
 4519|       |              it here.
 4520|       |           3) Less important technically, but the net-snmp agent
 4521|       |              doesn't currently handle registrations of different
 4522|       |              engineIDs either and it would have been a lot more work
 4523|       |              to implement there since we'd need to support that
 4524|       |              first. :-/ Supporting multiple context engineIDs should
 4525|       |              be done anyway, so it's not a valid excuse here.
 4526|       |           4) There is a lot less to do if we trump the agent at this
 4527|       |              point; IE, the agent does a lot more unnecessary
 4528|       |              processing when the only thing that should ever be in
 4529|       |              this context by definition is the single scalar.
 4530|       |        */
 4531|       |
 4532|       |        /* special RFC5343 engineID discovery engineID check */
 4533|      0|        if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (4533:13): [True: 0, False: 0]
  ------------------
 4534|      0|                                    NETSNMP_DS_LIB_NO_DISCOVERY) &&
  ------------------
  |  |   98|      0|#define NETSNMP_DS_LIB_NO_DISCOVERY        38 /* don't support RFC5343 contextEngineID discovery */
  ------------------
 4535|      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 (4535:13): [True: 0, False: 0]
  ------------------
 4536|      0|            NULL                    != pdu->contextEngineID &&
  ------------------
  |  Branch (4536:13): [True: 0, False: 0]
  ------------------
 4537|      0|            pdu->contextEngineIDLen == 5 &&
  ------------------
  |  Branch (4537:13): [True: 0, False: 0]
  ------------------
 4538|      0|            pdu->contextEngineID[0] == 0x80 &&
  ------------------
  |  Branch (4538:13): [True: 0, False: 0]
  ------------------
 4539|      0|            pdu->contextEngineID[1] == 0x00 &&
  ------------------
  |  Branch (4539:13): [True: 0, False: 0]
  ------------------
 4540|      0|            pdu->contextEngineID[2] == 0x00 &&
  ------------------
  |  Branch (4540:13): [True: 0, False: 0]
  ------------------
 4541|      0|            pdu->contextEngineID[3] == 0x00 &&
  ------------------
  |  Branch (4541:13): [True: 0, False: 0]
  ------------------
 4542|      0|            pdu->contextEngineID[4] == 0x06) {
  ------------------
  |  Branch (4542:13): [True: 0, False: 0]
  ------------------
 4543|       |
 4544|       |            /* define a result so it doesn't get past us at this point
 4545|       |               and gets dropped by future parts of the stack */
 4546|      0|            result = SNMPERR_JUST_A_CONTEXT_PROBE;
  ------------------
  |  |  283|      0|#define SNMPERR_JUST_A_CONTEXT_PROBE    (-66)
  ------------------
 4547|       |
 4548|      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]
  |  |  ------------------
  ------------------
 4549|       |            /* ensure exactly one variable */
 4550|      0|            if (NULL != pdu->variables &&
  ------------------
  |  Branch (4550:17): [True: 0, False: 0]
  ------------------
 4551|      0|                NULL == pdu->variables->next_variable &&
  ------------------
  |  Branch (4551:17): [True: 0, False: 0]
  ------------------
 4552|       |
 4553|       |                /* if it's a GET, match it exactly */
 4554|      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 (4554:19): [True: 0, False: 0]
  ------------------
 4555|      0|                  snmp_oid_compare(snmpEngineIDoid,
  ------------------
  |  Branch (4555:19): [True: 0, False: 0]
  ------------------
 4556|      0|                                   snmpEngineIDoid_len,
 4557|      0|                                   pdu->variables->name,
 4558|      0|                                   pdu->variables->name_length) == 0)
 4559|       |                 /* if it's a GETNEXT ensure it's less than the engineID oid */
 4560|      0|                 ||
 4561|      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 (4561:19): [True: 0, False: 0]
  ------------------
 4562|      0|                  snmp_oid_compare(snmpEngineIDoid,
  ------------------
  |  Branch (4562:19): [True: 0, False: 0]
  ------------------
 4563|      0|                                   snmpEngineIDoid_len,
 4564|      0|                                   pdu->variables->name,
 4565|      0|                                   pdu->variables->name_length) > 0)
 4566|      0|                    )) {
 4567|       |
 4568|      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]
  |  |  ------------------
  ------------------
 4569|      0|                            "  One correct variable found\n"));
 4570|       |
 4571|       |                /* Note: we're explicitly not handling a GETBULK.  Deal. */
 4572|       |
 4573|       |                /* set up the response */
 4574|      0|                pdu2 = snmp_clone_pdu(pdu);
 4575|       |
 4576|       |                /* free the current varbind */
 4577|      0|                snmp_free_varbind(pdu2->variables);
 4578|       |
 4579|       |                /* set the variables */
 4580|      0|                pdu2->variables = NULL;
 4581|      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
  |  |  ------------------
  ------------------
 4582|      0|                pdu2->errstat = 0;
 4583|      0|                pdu2->errindex = 0;
 4584|       |
 4585|      0|                ourEngineID_len =
 4586|      0|                    snmpv3_get_engineID((u_char*)ourEngineID, ourEngineID_len);
 4587|      0|                if (0 != ourEngineID_len) {
  ------------------
  |  Branch (4587:21): [True: 0, False: 0]
  ------------------
 4588|       |
 4589|      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]
  |  |  ------------------
  ------------------
 4590|      0|                                "  responding with our engineID\n"));
 4591|       |
 4592|      0|                    snmp_pdu_add_variable(pdu2,
 4593|      0|                                          snmpEngineIDoid, snmpEngineIDoid_len,
 4594|      0|                                          ASN_OCTET_STR,
  ------------------
  |  |   78|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
 4595|      0|                                          ourEngineID, ourEngineID_len);
 4596|       |                    
 4597|       |                    /* send the response */
 4598|      0|                    if (0 == snmp_sess_send(slp, pdu2)) {
  ------------------
  |  Branch (4598:25): [True: 0, False: 0]
  ------------------
 4599|       |
 4600|      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]
  |  |  ------------------
  ------------------
 4601|      0|                                    "  sent it off!\n"));
 4602|       |
 4603|      0|                        snmp_free_pdu(pdu2);
 4604|       |                        
 4605|      0|                        snmp_log(LOG_ERR, "sending a response to the context engineID probe failed\n");
 4606|      0|                    }
 4607|      0|                } else {
 4608|      0|                    snmp_log(LOG_ERR, "failed to get our own engineID!\n");
 4609|      0|                }
 4610|      0|            } else {
 4611|      0|                snmp_log(LOG_WARNING,
 4612|      0|                         "received an odd context engineID probe\n");
 4613|      0|            }
 4614|      0|        }
 4615|       |
 4616|      0|        break;
 4617|      0|    case SNMPERR_BAD_VERSION:
  ------------------
  |  |  231|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
  |  Branch (4617:5): [True: 0, False: 2.68k]
  ------------------
 4618|      0|        ERROR_MSG("error parsing snmp message version");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4619|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4620|      0|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  231|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 4621|      0|        break;
 4622|       |
 4623|      0|        unsupported_version:  /* goto label */
 4624|      0|    case SNMP_VERSION_sec:
  ------------------
  |  |  118|      0|#define SNMP_VERSION_sec   128  /* not (will never be) supported by this code */
  ------------------
  |  Branch (4624:5): [True: 0, False: 2.68k]
  ------------------
 4625|      0|    case SNMP_VERSION_2u:
  ------------------
  |  |  112|      0|#define SNMP_VERSION_2u    2    /* not (will never be) supported by this code */
  ------------------
  |  Branch (4625:5): [True: 0, False: 2.68k]
  ------------------
 4626|      0|    case SNMP_VERSION_2star:
  ------------------
  |  |  120|      0|#define SNMP_VERSION_2star 130  /* not (will never be) supported by this code */
  ------------------
  |  Branch (4626:5): [True: 0, False: 2.68k]
  ------------------
 4627|      0|    case SNMP_VERSION_2p:
  ------------------
  |  |  119|      0|#define SNMP_VERSION_2p	   129  /* no longer supported by this code (> 4.0) */
  ------------------
  |  Branch (4627:5): [True: 0, False: 2.68k]
  ------------------
 4628|      0|    default:
  ------------------
  |  Branch (4628:5): [True: 0, False: 2.68k]
  ------------------
 4629|      0|        ERROR_MSG("unsupported snmp message version");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4630|      0|        snmp_increment_statistic(STAT_SNMPINBADVERSIONS);
  ------------------
  |  |  667|      0|#define  STAT_SNMPINBADVERSIONS              11
  ------------------
 4631|       |
 4632|       |        /*
 4633|       |         * need better way to determine OS independent
 4634|       |         * INT32_MAX value, for now hardcode
 4635|       |         */
 4636|      0|        if (pdu->version < 0 || pdu->version > 2147483647) {
  ------------------
  |  Branch (4636:13): [True: 0, False: 0]
  |  Branch (4636:33): [True: 0, False: 0]
  ------------------
 4637|      0|            snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4638|      0|        }
 4639|      0|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  231|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 4640|      0|        break;
 4641|  2.68k|    }
 4642|       |
 4643|  1.36k|    return result;
 4644|  2.68k|}

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

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

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

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

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;
  ------------------
  |  |  218|      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;
  ------------------
  |  |  279|      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;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  113|      0|    }
  114|      2|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|      2|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  115|      2|}
find_sec_mod:
  160|  5.42k|{
  161|  5.42k|    struct snmp_secmod_list *sptr;
  162|       |
  163|  10.8k|    for (sptr = registered_services; sptr; sptr = sptr->next) {
  ------------------
  |  Branch (163:38): [True: 5.42k, False: 5.42k]
  ------------------
  164|  5.42k|        if (sptr->securityModel == secmod) {
  ------------------
  |  Branch (164:13): [True: 0, False: 5.42k]
  ------------------
  165|      0|            return sptr->secDef;
  166|      0|        }
  167|  5.42k|    }
  168|       |    /*
  169|       |     * not registered 
  170|       |     */
  171|  5.42k|    return NULL;
  172|  5.42k|}

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

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

