asn_parse_nlength:
  327|  92.5k|{
  328|  92.5k|    int len_len;
  329|       |
  330|  92.5k|    if (pkt_len < 1)
  ------------------
  |  Branch (330:9): [True: 0, False: 92.5k]
  ------------------
  331|      0|        return NULL;               /* always too short */
  332|       |
  333|  92.5k|    if (NULL == pkt || NULL == data_len)
  ------------------
  |  Branch (333:9): [True: 0, False: 92.5k]
  |  Branch (333:24): [True: 0, False: 92.5k]
  ------------------
  334|      0|        return NULL;
  335|       |
  336|  92.5k|    *data_len = 0;
  337|       |
  338|  92.5k|    if (*pkt & 0x80) {
  ------------------
  |  Branch (338:9): [True: 11.8k, False: 80.7k]
  ------------------
  339|       |        /*
  340|       |         * long length; first byte is length of length (after masking high bit)
  341|       |         */
  342|  11.8k|        len_len = (int) ((*pkt & ~0x80) + 1);
  343|  11.8k|        if (pkt_len < len_len)
  ------------------
  |  Branch (343:13): [True: 131, False: 11.6k]
  ------------------
  344|    131|            return NULL;           /* still too short for length and data */
  345|       |
  346|       |        /* now we know we have enough data to parse length */
  347|  11.6k|        if (NULL == asn_parse_length(pkt, data_len))
  ------------------
  |  Branch (347:13): [True: 346, False: 11.3k]
  ------------------
  348|    346|            return NULL;           /* propagate error from asn_parse_length */
  349|  80.7k|    } else {
  350|       |        /*
  351|       |         * short length; first byte is the length
  352|       |         */
  353|  80.7k|        len_len = 1;
  354|  80.7k|        *data_len = *pkt;
  355|  80.7k|    }
  356|       |
  357|  92.0k|    if ((*data_len + len_len) > pkt_len)
  ------------------
  |  Branch (357:9): [True: 1.09k, False: 90.9k]
  ------------------
  358|  1.09k|        return NULL;
  359|       |
  360|  90.9k|    return (pkt + len_len);
  361|  92.0k|}
asn_parse_int:
  563|  9.44k|{
  564|       |    /*
  565|       |     * ASN.1 integer ::= 0x02 asnlength byte {byte}*
  566|       |     */
  567|  9.44k|    static const char *errpre = "parse int";
  568|  9.44k|    register u_char *bufp = data;
  569|  9.44k|    u_long          asn_length;
  570|  9.44k|    int             i;
  571|  9.44k|    union {
  572|  9.44k|        long          l;
  573|  9.44k|        unsigned char b[sizeof(long)];
  574|  9.44k|    } value;
  575|       |
  576|  9.44k|    if (NULL == data || NULL == datalength || NULL == type || NULL == intp) {
  ------------------
  |  Branch (576:9): [True: 0, False: 9.44k]
  |  Branch (576:25): [True: 0, False: 9.44k]
  |  Branch (576:47): [True: 0, False: 9.44k]
  |  Branch (576:63): [True: 0, False: 9.44k]
  ------------------
  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.44k|    if (intsize != sizeof(long)) {
  ------------------
  |  Branch (581:9): [True: 0, False: 9.44k]
  ------------------
  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.44k|    if (*datalength < 2) {
  ------------------
  |  Branch (587:9): [True: 77, False: 9.37k]
  ------------------
  588|     77|        _asn_short_err(errpre, *datalength, 2);
  589|     77|        return NULL;
  590|     77|    }
  591|       |
  592|  9.37k|    *type = *bufp++;
  593|  9.37k|    if (*type != ASN_INTEGER) {
  ------------------
  |  |   75|  9.37k|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (593:9): [True: 36, False: 9.33k]
  ------------------
  594|     36|        _asn_type_err(errpre, *type);
  595|     36|        return NULL;
  596|     36|    }
  597|       |
  598|  9.33k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
  599|  9.33k|    if (NULL == bufp) {
  ------------------
  |  Branch (599:9): [True: 299, False: 9.03k]
  ------------------
  600|    299|        _asn_short_err(errpre, *datalength - 1, asn_length);
  601|    299|        return NULL;
  602|    299|    }
  603|       |
  604|  9.03k|    if ((size_t) asn_length > intsize || (int) asn_length == 0) {
  ------------------
  |  Branch (604:9): [True: 35, False: 9.00k]
  |  Branch (604:42): [True: 23, False: 8.97k]
  ------------------
  605|     58|        _asn_length_err(errpre, (size_t) asn_length, intsize);
  606|     58|        return NULL;
  607|     58|    }
  608|       |
  609|  8.97k|    *datalength -= (int) asn_length + (bufp - data);
  610|       |
  611|  8.97k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|  8.97k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  8.97k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 8.97k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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.97k]
  |  |  ------------------
  ------------------
  612|       |
  613|  8.97k|    memset(&value.b, *bufp & 0x80 ? 0xff : 0, sizeof(value.b));
  ------------------
  |  Branch (613:22): [True: 1.76k, False: 7.21k]
  ------------------
  614|  8.97k|    if (NETSNMP_BIGENDIAN) {
  ------------------
  |  | 2390|  8.97k|#  define NETSNMP_BIGENDIAN 0
  |  |  ------------------
  |  |  |  Branch (2390:29): [Folded, False: 8.97k]
  |  |  ------------------
  ------------------
  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.97k|    } else {
  618|  24.2k|        for (i = asn_length - 1; asn_length--; i--)
  ------------------
  |  Branch (618:34): [True: 15.2k, False: 8.97k]
  ------------------
  619|  15.2k|            value.b[i] = *bufp++;
  620|  8.97k|    }
  621|       |
  622|  8.97k|    CHECK_OVERFLOW_S(value.l, 1);
  ------------------
  |  |  214|  8.97k|#define CHECK_OVERFLOW_S(x,y) do {                                      \
  |  |  215|  8.97k|        if (x > INT32_MAX) {                                            \
  |  |  ------------------
  |  |  |  Branch (215:13): [True: 446, False: 8.53k]
  |  |  ------------------
  |  |  216|    446|            DEBUGMSG(("asn","truncating signed value %ld to 32 bits (%d)\n",(long)(x),y)); \
  |  |  ------------------
  |  |  |  |   61|    446|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|    446|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 446]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 446]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  217|    446|            x &= 0xffffffff;                                            \
  |  |  218|  8.53k|        } else if (x < INT32_MIN) {                                     \
  |  |  ------------------
  |  |  |  Branch (218:20): [True: 425, False: 8.10k]
  |  |  ------------------
  |  |  219|    425|            DEBUGMSG(("asn","truncating signed value %ld to 32 bits (%d)\n",(long)(x),y)); \
  |  |  ------------------
  |  |  |  |   61|    425|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|    425|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 425]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 425]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  220|    425|            x = 0 - (x & 0xffffffff);                                   \
  |  |  221|    425|        }                                                               \
  |  |  222|  8.97k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (222:13): [Folded, False: 8.97k]
  |  |  ------------------
  ------------------
  623|       |
  624|  8.97k|    DEBUGMSG(("dumpv_recv", "  Integer:\t%ld (0x%.2lX)\n", value.l, value.l));
  ------------------
  |  |   61|  8.97k|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|  8.97k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 8.97k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 8.97k]
  |  |  ------------------
  ------------------
  625|       |
  626|  8.97k|    *intp = value.l;
  627|  8.97k|    return bufp;
  628|  9.03k|}
asn_parse_unsigned_int:
  656|  3.73k|{
  657|       |    /*
  658|       |     * ASN.1 integer ::= 0x02 asnlength byte {byte}*
  659|       |     */
  660|  3.73k|    static const char *errpre = "parse uint";
  661|  3.73k|    register u_char *bufp = data;
  662|  3.73k|    u_long          asn_length;
  663|  3.73k|    register u_long value = 0;
  664|       |
  665|  3.73k|    if (NULL == data || NULL == datalength || NULL == type || NULL == intp) {
  ------------------
  |  Branch (665:9): [True: 0, False: 3.73k]
  |  Branch (665:25): [True: 0, False: 3.73k]
  |  Branch (665:47): [True: 0, False: 3.73k]
  |  Branch (665:63): [True: 0, False: 3.73k]
  ------------------
  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.73k|    if (intsize != sizeof(long)) {
  ------------------
  |  Branch (670:9): [True: 0, False: 3.73k]
  ------------------
  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.73k|    if (*datalength < 2) {
  ------------------
  |  Branch (676:9): [True: 2, False: 3.73k]
  ------------------
  677|      2|        _asn_short_err(errpre, *datalength, 2);
  678|      2|        return NULL;
  679|      2|    }
  680|       |
  681|  3.73k|    *type = *bufp++;
  682|  3.73k|    if (*type != ASN_COUNTER && *type != ASN_GAUGE && *type != ASN_TIMETICKS
  ------------------
  |  |   89|  7.46k|#define ASN_COUNTER	(ASN_APPLICATION | 1)
  |  |  ------------------
  |  |  |  |   91|  3.73k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if (*type != ASN_COUNTER && *type != ASN_GAUGE && *type != ASN_TIMETICKS
  ------------------
  |  |   90|  6.42k|#define ASN_GAUGE	(ASN_APPLICATION | 2)
  |  |  ------------------
  |  |  |  |   91|  2.68k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if (*type != ASN_COUNTER && *type != ASN_GAUGE && *type != ASN_TIMETICKS
  ------------------
  |  |   92|  5.53k|#define ASN_TIMETICKS   (ASN_APPLICATION | 3)
  |  |  ------------------
  |  |  |  |   91|  1.80k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (682:9): [True: 2.68k, False: 1.04k]
  |  Branch (682:33): [True: 1.80k, False: 886]
  |  Branch (682:55): [True: 956, False: 845]
  ------------------
  683|    956|            && *type != ASN_UINTEGER) {
  ------------------
  |  |  100|    956|#define ASN_UINTEGER    (ASN_APPLICATION | 7)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|    956|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (683:16): [True: 17, False: 939]
  ------------------
  684|     17|        _asn_type_err(errpre, *type);
  685|     17|        return NULL;
  686|     17|    }
  687|       |
  688|  3.71k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
  689|  3.71k|    if (NULL == bufp) {
  ------------------
  |  Branch (689:9): [True: 132, False: 3.58k]
  ------------------
  690|    132|        _asn_short_err(errpre, *datalength - 1, asn_length);
  691|    132|        return NULL;
  692|    132|    }
  693|       |
  694|  3.58k|    if ((asn_length > (intsize + 1)) || ((int) asn_length == 0) ||
  ------------------
  |  Branch (694:9): [True: 14, False: 3.57k]
  |  Branch (694:41): [True: 15, False: 3.55k]
  ------------------
  695|  3.55k|        ((asn_length == intsize + 1) && *bufp != 0x00)) {
  ------------------
  |  Branch (695:10): [True: 302, False: 3.25k]
  |  Branch (695:41): [True: 9, False: 293]
  ------------------
  696|     38|        _asn_length_err(errpre, (size_t) asn_length, intsize);
  697|     38|        return NULL;
  698|     38|    }
  699|  3.54k|    *datalength -= (int) asn_length + (bufp - data);
  700|       |
  701|  3.54k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|  3.54k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  3.54k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3.54k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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.54k]
  |  |  ------------------
  ------------------
  702|       |
  703|  13.4k|    while (asn_length--)
  ------------------
  |  Branch (703:12): [True: 9.93k, False: 3.54k]
  ------------------
  704|  9.93k|        value = (value << 8) | *bufp++;
  705|       |
  706|  3.54k|    CHECK_OVERFLOW_U(value,2);
  ------------------
  |  |  224|  3.54k|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|  3.54k|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 883, False: 2.66k]
  |  |  ------------------
  |  |  226|    883|            x &= 0xffffffff;                                            \
  |  |  227|    883|            DEBUGMSG(("asn","truncating unsigned value to 32 bits (%d)\n",y)); \
  |  |  ------------------
  |  |  |  |   61|    883|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|    883|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 883]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 883]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  228|    883|        }                                                               \
  |  |  229|  3.54k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 3.54k]
  |  |  ------------------
  ------------------
  707|       |
  708|  3.54k|    DEBUGMSG(("dumpv_recv", "  UInteger:\t%ld (0x%.2lX)\n", value, value));
  ------------------
  |  |   61|  3.54k|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|  3.54k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3.54k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 3.54k]
  |  |  ------------------
  ------------------
  709|       |
  710|  3.54k|    *intp = value;
  711|  3.54k|    return bufp;
  712|  3.58k|}
asn_parse_string:
  916|  6.05k|{
  917|  6.05k|    static const char *errpre = "parse string";
  918|  6.05k|    u_char         *bufp = data;
  919|  6.05k|    u_long          asn_length;
  920|       |
  921|  6.05k|    if (NULL == data || NULL == datalength || NULL == type || NULL == str ||
  ------------------
  |  Branch (921:9): [True: 0, False: 6.05k]
  |  Branch (921:25): [True: 0, False: 6.05k]
  |  Branch (921:47): [True: 0, False: 6.05k]
  |  Branch (921:63): [True: 0, False: 6.05k]
  ------------------
  922|  6.05k|        NULL == strlength) {
  ------------------
  |  Branch (922:9): [True: 0, False: 6.05k]
  ------------------
  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.05k|    if (*datalength < 2) {
  ------------------
  |  Branch (928:9): [True: 288, False: 5.76k]
  ------------------
  929|    288|        _asn_short_err(errpre, *datalength, 2);
  930|    288|        return NULL;
  931|    288|    }
  932|       |
  933|  5.76k|    *type = *bufp++;
  934|  5.76k|    if (*type != ASN_OCTET_STR && *type != ASN_IPADDRESS && *type != ASN_OPAQUE
  ------------------
  |  |   78|  11.5k|#define ASN_OCTET_STR	    0x04U
  ------------------
                  if (*type != ASN_OCTET_STR && *type != ASN_IPADDRESS && *type != ASN_OPAQUE
  ------------------
  |  |   88|  9.66k|#define ASN_IPADDRESS   (ASN_APPLICATION | 0)
  |  |  ------------------
  |  |  |  |   91|  3.89k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if (*type != ASN_OCTET_STR && *type != ASN_IPADDRESS && *type != ASN_OPAQUE
  ------------------
  |  |   93|  9.06k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  3.29k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (934:9): [True: 3.89k, False: 1.87k]
  |  Branch (934:35): [True: 3.29k, False: 604]
  |  Branch (934:61): [True: 1.67k, False: 1.61k]
  ------------------
  935|  1.67k|            && *type != ASN_NSAP) {
  ------------------
  |  |   98|  1.67k|#define ASN_NSAP	(ASN_APPLICATION | 5)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|  1.67k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (935:16): [True: 416, False: 1.25k]
  ------------------
  936|    416|        _asn_type_err(errpre, *type);
  937|    416|        return NULL;
  938|    416|    }
  939|       |
  940|  5.35k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
  941|  5.35k|    if (NULL == bufp) {
  ------------------
  |  Branch (941:9): [True: 155, False: 5.19k]
  ------------------
  942|    155|        _asn_short_err(errpre, *datalength - 1, asn_length);
  943|    155|        return NULL;
  944|    155|    }
  945|       |
  946|  5.19k|    if (asn_length > *strlength) {
  ------------------
  |  Branch (946:9): [True: 35, False: 5.16k]
  ------------------
  947|     35|        _asn_length_err(errpre, (size_t) asn_length, *strlength);
  948|     35|        return NULL;
  949|     35|    }
  950|       |
  951|  5.16k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|  5.16k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  5.16k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 5.16k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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.16k]
  |  |  ------------------
  ------------------
  952|       |
  953|  5.16k|    memmove(str, bufp, asn_length);
  954|  5.16k|    if (*strlength > asn_length)
  ------------------
  |  Branch (954:9): [True: 2.34k, False: 2.81k]
  ------------------
  955|  2.34k|        str[asn_length] = 0;
  956|  5.16k|    *strlength = asn_length;
  957|  5.16k|    *datalength -= asn_length + (bufp - data);
  958|       |
  959|  5.16k|    DEBUGIF("dumpv_recv") {
  ------------------
  |  |  145|  5.16k|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|  10.3k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 5.16k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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.16k|    return bufp + asn_length;
  980|  5.19k|}
asn_parse_header:
 1077|  43.2k|{
 1078|  43.2k|    register u_char *bufp;
 1079|  43.2k|    u_long          asn_length = 0;
 1080|  43.2k|    const char      *errpre = "parse header";
 1081|       |
 1082|  43.2k|    if (!data || !datalength || !type) {
  ------------------
  |  Branch (1082:9): [True: 0, False: 43.2k]
  |  Branch (1082:18): [True: 0, False: 43.2k]
  |  Branch (1082:33): [True: 0, False: 43.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|  43.2k|    if (*datalength < 2) {
  ------------------
  |  Branch (1088:9): [True: 395, False: 42.8k]
  ------------------
 1089|    395|        _asn_short_err(errpre, *datalength, 2);
 1090|    395|        return NULL;
 1091|    395|    }
 1092|       |
 1093|  42.8k|    bufp = data;
 1094|       |    /*
 1095|       |     * this only works on data types < 30, i.e. no extension octets 
 1096|       |     */
 1097|  42.8k|    if (IS_EXTENSION_ID(*bufp)) {
  ------------------
  |  |  103|  42.8k|#define IS_EXTENSION_ID(byte)	(((byte) & ASN_EXTENSION_ID) == ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|  42.8k|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  |  |               #define IS_EXTENSION_ID(byte)	(((byte) & ASN_EXTENSION_ID) == ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|  42.8k|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  |  |  |  Branch (103:31): [True: 22, False: 42.8k]
  |  |  ------------------
  ------------------
 1098|     22|        ERROR_MSG("can't process ID >= 30");
  ------------------
  |  |  188|     22|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1099|     22|        return NULL;
 1100|     22|    }
 1101|  42.8k|    *type = *bufp++;
 1102|       |
 1103|  42.8k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 1104|  42.8k|    if (NULL == bufp) {
  ------------------
  |  Branch (1104:9): [True: 802, False: 42.0k]
  ------------------
 1105|    802|        _asn_short_err(errpre, *datalength - 1, asn_length);
 1106|    802|        return NULL;
 1107|    802|    }
 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|  42.0k|#endif
 1119|       |
 1120|  42.0k|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 1121|       |
 1122|  42.0k|    if ((asn_length > 2) && (*type == ASN_OPAQUE) && (*bufp == ASN_OPAQUE_TAG1)) {
  ------------------
  |  |   93|  31.3k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  31.3k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if ((asn_length > 2) && (*type == ASN_OPAQUE) && (*bufp == ASN_OPAQUE_TAG1)) {
  ------------------
  |  |  131|  4.20k|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|  4.20k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|  4.20k|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
  |  Branch (1122:9): [True: 31.3k, False: 10.6k]
  |  Branch (1122:29): [True: 4.20k, False: 27.1k]
  |  Branch (1122:54): [True: 3.73k, False: 478]
  ------------------
 1123|       |
 1124|       |        /*
 1125|       |         * check if 64-but counter 
 1126|       |         */
 1127|  3.73k|        switch (*(bufp + 1)) {
 1128|    668|        case ASN_OPAQUE_COUNTER64:
  ------------------
  |  |  156|    668|#define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  136|    668|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  146|    668|#define ASN_APP_COUNTER64 (ASN_APPLICATION | 6)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    668|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1128:9): [True: 668, False: 3.06k]
  ------------------
 1129|  1.51k|        case ASN_OPAQUE_U64:
  ------------------
  |  |  192|  1.51k|#define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  136|  1.51k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  150|  1.51k|#define ASN_APP_U64 (ASN_APPLICATION | 11)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.51k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1129:9): [True: 848, False: 2.88k]
  ------------------
 1130|  1.75k|        case ASN_OPAQUE_FLOAT:
  ------------------
  |  |  165|  1.75k|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|  1.75k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|  1.75k|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.75k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1130:9): [True: 235, False: 3.49k]
  ------------------
 1131|  1.99k|        case ASN_OPAQUE_DOUBLE:
  ------------------
  |  |  174|  1.99k|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|  1.99k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|  1.99k|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.99k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1131:9): [True: 241, False: 3.49k]
  ------------------
 1132|  3.32k|        case ASN_OPAQUE_I64:
  ------------------
  |  |  183|  3.32k|#define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  136|  3.32k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  149|  3.32k|#define ASN_APP_I64 (ASN_APPLICATION | 10)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  3.32k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1132:9): [True: 1.33k, False: 2.39k]
  ------------------
 1133|  3.32k|            *type = *(bufp + 1);
 1134|  3.32k|            break;
 1135|       |
 1136|    404|        default:
  ------------------
  |  Branch (1136:9): [True: 404, False: 3.32k]
  ------------------
 1137|       |            /*
 1138|       |             * just an Opaque 
 1139|       |             */
 1140|    404|            *datalength = (int) asn_length;
 1141|    404|            return bufp;
 1142|  3.73k|        }
 1143|       |        /*
 1144|       |         * value is encoded as special format 
 1145|       |         */
 1146|  3.32k|        *datalength = (int) asn_length;
 1147|  3.32k|        bufp = asn_parse_nlength(bufp+2, *datalength - 2, &asn_length);
 1148|  3.32k|        if (NULL == bufp) {
  ------------------
  |  Branch (1148:13): [True: 38, False: 3.28k]
  ------------------
 1149|     38|            _asn_short_err("parse opaque header", *datalength - 2, asn_length);
 1150|     38|            return NULL;
 1151|     38|        }
 1152|  3.32k|    }
 1153|  41.5k|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 1154|       |
 1155|  41.5k|    *datalength = (int) asn_length;
 1156|       |
 1157|  41.5k|    return bufp;
 1158|  42.0k|}
asn_parse_sequence:
 1177|  25.3k|{                               /* error message prefix */
 1178|  25.3k|    data = asn_parse_header(data, datalength, type);
 1179|  25.3k|    if (data && (*type != expected_type)) {
  ------------------
  |  Branch (1179:9): [True: 24.0k, False: 1.22k]
  |  Branch (1179:17): [True: 1.62k, False: 22.4k]
  ------------------
 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|  23.6k|    return data;
 1189|  25.3k|}
asn_parse_length:
 1302|  11.6k|{
 1303|  11.6k|    static const char *errpre = "parse length";
 1304|  11.6k|    char            ebuf[128];
 1305|  11.6k|    register u_char lengthbyte;
 1306|       |
 1307|  11.6k|    if (!data || !length) {
  ------------------
  |  Branch (1307:9): [True: 0, False: 11.6k]
  |  Branch (1307:18): [True: 0, False: 11.6k]
  ------------------
 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|  11.6k|    lengthbyte = *data;
 1312|       |
 1313|  11.6k|    if (lengthbyte & ASN_LONG_LEN) {
  ------------------
  |  |   98|  11.6k|#define ASN_LONG_LEN	    0x80U
  ------------------
  |  Branch (1313:9): [True: 11.6k, False: 0]
  ------------------
 1314|  11.6k|        lengthbyte &= ~ASN_LONG_LEN;    /* turn MSb off */
  ------------------
  |  |   98|  11.6k|#define ASN_LONG_LEN	    0x80U
  ------------------
 1315|  11.6k|        if (lengthbyte == 0) {
  ------------------
  |  Branch (1315:13): [True: 97, False: 11.5k]
  ------------------
 1316|     97|            snprintf(ebuf, sizeof(ebuf),
 1317|     97|                     "%s: indefinite length not supported", errpre);
 1318|     97|            ebuf[ sizeof(ebuf)-1 ] = 0;
 1319|     97|            ERROR_MSG(ebuf);
  ------------------
  |  |  188|     97|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1320|     97|            return NULL;
 1321|     97|        }
 1322|  11.5k|        if (lengthbyte > sizeof(long)) {
  ------------------
  |  Branch (1322:13): [True: 131, False: 11.4k]
  ------------------
 1323|    131|            snprintf(ebuf, sizeof(ebuf),
 1324|    131|                    "%s: data length %d > %lu not supported", errpre,
 1325|    131|                    lengthbyte, (unsigned long)sizeof(long));
 1326|    131|            ebuf[ sizeof(ebuf)-1 ] = 0;
 1327|    131|            ERROR_MSG(ebuf);
  ------------------
  |  |  188|    131|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1328|    131|            return NULL;
 1329|    131|        }
 1330|  11.4k|        data++;
 1331|  11.4k|        *length = 0;            /* protect against short lengths */
 1332|  29.3k|        while (lengthbyte--) {
  ------------------
  |  Branch (1332:16): [True: 17.8k, False: 11.4k]
  ------------------
 1333|  17.8k|            *length <<= 8;
 1334|  17.8k|            *length |= *data++;
 1335|  17.8k|        }
 1336|  11.4k|        if ((long) *length < 0) {
  ------------------
  |  Branch (1336:13): [True: 118, False: 11.3k]
  ------------------
 1337|    118|            snprintf(ebuf, sizeof(ebuf),
 1338|    118|                     "%s: negative data length %ld\n", errpre,
 1339|    118|                     (long) *length);
 1340|    118|            ebuf[ sizeof(ebuf)-1 ] = 0;
 1341|    118|            ERROR_MSG(ebuf);
  ------------------
  |  |  188|    118|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1342|    118|            return NULL;
 1343|    118|        }
 1344|  11.3k|        return data;
 1345|  11.4k|    } else {                    /* short asnlength */
 1346|      0|        *length = (long) lengthbyte;
 1347|      0|        return data + 1;
 1348|      0|    }
 1349|  11.6k|}
asn_parse_objid:
 1450|  18.4k|{
 1451|  18.4k|    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.4k|    register u_char *bufp = data;
 1459|  18.4k|    register oid   *oidp = objid + 1;
 1460|  18.4k|    register u_long subidentifier;
 1461|  18.4k|    register long   length;
 1462|  18.4k|    u_long          asn_length;
 1463|  18.4k|    size_t          original_length = *objidlength;
 1464|       |
 1465|  18.4k|    if (NULL == data || NULL == datalength || NULL == type || NULL == objid) {
  ------------------
  |  Branch (1465:9): [True: 0, False: 18.4k]
  |  Branch (1465:25): [True: 0, False: 18.4k]
  |  Branch (1465:47): [True: 0, False: 18.4k]
  |  Branch (1465:63): [True: 0, False: 18.4k]
  ------------------
 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.4k|    if (*datalength < 2) {
  ------------------
  |  Branch (1471:9): [True: 22, False: 18.4k]
  ------------------
 1472|     22|        _asn_short_err(errpre, *datalength, 2);
 1473|     22|        return NULL;
 1474|     22|    }
 1475|       |
 1476|  18.4k|    *type = *bufp++;
 1477|  18.4k|    if (*type != ASN_OBJECT_ID) {
  ------------------
  |  |   81|  18.4k|#define ASN_OBJECT_ID	    0x06U
  ------------------
  |  Branch (1477:9): [True: 32, False: 18.4k]
  ------------------
 1478|     32|        _asn_type_err(errpre, *type);
 1479|     32|        return NULL;
 1480|     32|    }
 1481|  18.4k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 1482|  18.4k|    if (NULL == bufp) {
  ------------------
  |  Branch (1482:9): [True: 150, False: 18.2k]
  ------------------
 1483|    150|        _asn_short_err(errpre, *datalength - 1, asn_length);
 1484|    150|        return NULL;
 1485|    150|    }
 1486|       |
 1487|  18.2k|    *datalength -= (int) asn_length + (bufp - data);
 1488|       |
 1489|  18.2k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|  18.2k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  18.2k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 18.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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.2k]
  |  |  ------------------
  ------------------
 1490|       |
 1491|       |    /*
 1492|       |     * Handle invalid object identifier encodings of the form 06 00 robustly 
 1493|       |     */
 1494|  18.2k|    if (asn_length == 0)
  ------------------
  |  Branch (1494:9): [True: 15.4k, False: 2.82k]
  ------------------
 1495|  15.4k|        objid[0] = objid[1] = 0;
 1496|       |
 1497|  18.2k|    length = asn_length;
 1498|  18.2k|    (*objidlength)--;           /* account for expansion of first byte */
 1499|       |
 1500|  33.6k|    while (length > 0 && (*objidlength)-- > 0) {
  ------------------
  |  Branch (1500:12): [True: 15.4k, False: 18.2k]
  |  Branch (1500:26): [True: 15.3k, False: 20]
  ------------------
 1501|  15.3k|        subidentifier = 0;
 1502|  17.7k|        do {                    /* shift and add in low order 7 bits */
 1503|  17.7k|            subidentifier =
 1504|  17.7k|                (subidentifier << 7) + (*(u_char *) bufp & ~ASN_BIT8);
  ------------------
  |  |  100|  17.7k|#define ASN_BIT8	    0x80U
  ------------------
 1505|  17.7k|            length--;
 1506|  17.7k|        } while ((*(u_char *) bufp++ & ASN_BIT8) && (length > 0));        /* last byte has high bit clear */
  ------------------
  |  |  100|  17.7k|#define ASN_BIT8	    0x80U
  ------------------
  |  Branch (1506:18): [True: 2.39k, False: 15.3k]
  |  Branch (1506:53): [True: 2.37k, False: 20]
  ------------------
 1507|       |
 1508|  15.3k|	if (length == 0) {
  ------------------
  |  Branch (1508:6): [True: 2.79k, False: 12.5k]
  ------------------
 1509|  2.79k|            u_char *last_byte = bufp - 1;
 1510|  2.79k|            if (*last_byte & ASN_BIT8) {
  ------------------
  |  |  100|  2.79k|#define ASN_BIT8	    0x80U
  ------------------
  |  Branch (1510:17): [True: 20, False: 2.77k]
  ------------------
 1511|       |                /* last byte has high bit set -> wrong BER encoded OID */
 1512|     20|                ERROR_MSG("subidentifier syntax error");
  ------------------
  |  |  188|     20|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1513|     20|                return NULL;
 1514|     20|            }
 1515|  2.79k|        }
 1516|  15.3k|        if (subidentifier > MAX_SUBID) {
  ------------------
  |  |   18|  15.3k|#define MAX_SUBID   0xFFFFFFFFUL
  ------------------
  |  Branch (1516:13): [True: 9, False: 15.3k]
  ------------------
 1517|      9|            ERROR_MSG("subidentifier too large");
  ------------------
  |  |  188|      9|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1518|      9|            return NULL;
 1519|      9|        }
 1520|  15.3k|        *oidp++ = (oid) subidentifier;
 1521|  15.3k|    }
 1522|       |
 1523|  18.2k|    if (length || oidp < objid + 1) {
  ------------------
  |  Branch (1523:9): [True: 20, False: 18.2k]
  |  Branch (1523:19): [True: 0, False: 18.2k]
  ------------------
 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.2k|    subidentifier = oidp - objid >= 2 ? objid[1] : 0;
  ------------------
  |  Branch (1535:21): [True: 2.77k, False: 15.4k]
  ------------------
 1536|  18.2k|    if (subidentifier == 0x2B) {
  ------------------
  |  Branch (1536:9): [True: 519, False: 17.7k]
  ------------------
 1537|    519|        objid[0] = 1;
 1538|    519|        objid[1] = 3;
 1539|  17.7k|    } else {
 1540|  17.7k|        if (subidentifier < 40) {
  ------------------
  |  Branch (1540:13): [True: 15.9k, False: 1.80k]
  ------------------
 1541|  15.9k|            objid[0] = 0;
 1542|  15.9k|            objid[1] = subidentifier;
 1543|  15.9k|        } else if (subidentifier < 80) {
  ------------------
  |  Branch (1543:20): [True: 941, False: 867]
  ------------------
 1544|    941|            objid[0] = 1;
 1545|    941|            objid[1] = subidentifier - 40;
 1546|    941|        } else {
 1547|    867|            objid[0] = 2;
 1548|    867|            objid[1] = subidentifier - 80;
 1549|    867|        }
 1550|  17.7k|    }
 1551|       |
 1552|  18.2k|    *objidlength = (int) (oidp - objid);
 1553|       |
 1554|  18.2k|    DEBUGMSG(("dumpv_recv", "  ObjID: "));
  ------------------
  |  |   61|  18.2k|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|  18.2k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 18.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 18.2k]
  |  |  ------------------
  ------------------
 1555|  18.2k|    DEBUGMSGOID(("dumpv_recv", objid, *objidlength));
  ------------------
  |  |   67|  18.2k|#define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  18.2k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 18.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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.2k]
  |  |  ------------------
  ------------------
 1556|  18.2k|    DEBUGMSG(("dumpv_recv", "\n"));
  ------------------
  |  |   61|  18.2k|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|  18.2k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 18.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 18.2k]
  |  |  ------------------
  ------------------
 1557|  18.2k|    return bufp;
 1558|  18.2k|}
asn_parse_bitstring:
 1828|    829|{
 1829|       |    /*
 1830|       |     * bitstring ::= 0x03 asnlength unused {byte}*
 1831|       |     */
 1832|    829|    static const char *errpre = "parse bitstring";
 1833|    829|    register u_char *bufp = data;
 1834|    829|    u_long          asn_length;
 1835|       |
 1836|    829|    if (NULL == data || NULL == datalength || NULL == type ||
  ------------------
  |  Branch (1836:9): [True: 0, False: 829]
  |  Branch (1836:25): [True: 0, False: 829]
  |  Branch (1836:47): [True: 0, False: 829]
  ------------------
 1837|    829|        NULL == str || NULL == strlength) {
  ------------------
  |  Branch (1837:9): [True: 0, False: 829]
  |  Branch (1837:24): [True: 0, False: 829]
  ------------------
 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|    829|    if (*datalength < 2) {
  ------------------
  |  Branch (1843:9): [True: 0, False: 829]
  ------------------
 1844|      0|        _asn_short_err(errpre, *datalength, 2);
 1845|      0|        return NULL;
 1846|      0|    }
 1847|       |
 1848|    829|    *type = *bufp++;
 1849|    829|    if (*type != ASN_BIT_STR) {
  ------------------
  |  |   77|    829|#define ASN_BIT_STR	    0x03U
  ------------------
  |  Branch (1849:9): [True: 0, False: 829]
  ------------------
 1850|      0|        _asn_type_err(errpre, *type);
 1851|      0|        return NULL;
 1852|      0|    }
 1853|       |
 1854|    829|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 1855|    829|    if (NULL == bufp) {
  ------------------
  |  Branch (1855:9): [True: 0, False: 829]
  ------------------
 1856|      0|        _asn_short_err(errpre, *datalength - 1, asn_length);
 1857|      0|        return NULL;
 1858|      0|    }
 1859|       |
 1860|    829|    if ((size_t) asn_length > *strlength) {
  ------------------
  |  Branch (1860:9): [True: 0, False: 829]
  ------------------
 1861|      0|        _asn_length_err(errpre, (size_t) asn_length, *strlength);
 1862|      0|        return NULL;
 1863|      0|    }
 1864|    829|    if (_asn_bitstring_check(errpre, asn_length, *bufp))
  ------------------
  |  Branch (1864:9): [True: 6, False: 823]
  ------------------
 1865|      6|        return NULL;
 1866|       |
 1867|    823|    DEBUGDUMPSETUP("recv", data, bufp - data);
  ------------------
  |  |   83|    823|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    823|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 823]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 823]
  |  |  ------------------
  ------------------
 1868|    823|    DEBUGMSG(("dumpv_recv", "  Bitstring: "));
  ------------------
  |  |   61|    823|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    823|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 823]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 823]
  |  |  ------------------
  ------------------
 1869|    823|    DEBUGMSGHEX(("dumpv_recv", data, asn_length));
  ------------------
  |  |   71|    823|#define DEBUGMSGHEX(x)     do {if (_DBG_IF_) {__DBGMSGHEX(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    823|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 823]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGHEX(x)     do {if (_DBG_IF_) {__DBGMSGHEX(x);} }while(0)
  |  |  ------------------
  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  ------------------
  |  |  |  Branch (71:71): [Folded, False: 823]
  |  |  ------------------
  ------------------
 1870|    823|    DEBUGMSG(("dumpv_recv", "\n"));
  ------------------
  |  |   61|    823|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    823|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 823]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 823]
  |  |  ------------------
  ------------------
 1871|       |
 1872|    823|    memmove(str, bufp, asn_length);
 1873|    823|    *strlength = (int) asn_length;
 1874|    823|    *datalength -= (int) asn_length + (bufp - data);
 1875|    823|    return bufp + asn_length;
 1876|    829|}
asn_parse_unsigned_int64:
 1960|  2.77k|{
 1961|       |    /*
 1962|       |     * ASN.1 integer ::= 0x02 asnlength byte {byte}*
 1963|       |     */
 1964|  2.77k|    static const char *errpre = "parse uint64";
 1965|  2.77k|    const int       uint64sizelimit = (4 * 2) + 1;
 1966|  2.77k|    register u_char *bufp = data;
 1967|  2.77k|    u_long          asn_length;
 1968|  2.77k|    register u_long low = 0, high = 0;
 1969|       |
 1970|  2.77k|    if (countersize != sizeof(struct counter64)) {
  ------------------
  |  Branch (1970:9): [True: 0, False: 2.77k]
  ------------------
 1971|      0|        _asn_size_err(errpre, countersize, sizeof(struct counter64));
 1972|      0|        return NULL;
 1973|      0|    }
 1974|       |
 1975|  2.77k|    if (NULL == data || NULL == datalength || NULL == type || NULL == cp) {
  ------------------
  |  Branch (1975:9): [True: 0, False: 2.77k]
  |  Branch (1975:25): [True: 0, False: 2.77k]
  |  Branch (1975:47): [True: 0, False: 2.77k]
  |  Branch (1975:63): [True: 0, False: 2.77k]
  ------------------
 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|  2.77k|    if (*datalength < 2) {
  ------------------
  |  Branch (1981:9): [True: 0, False: 2.77k]
  ------------------
 1982|      0|        _asn_short_err(errpre, *datalength, 2);
 1983|      0|        return NULL;
 1984|      0|    }
 1985|       |
 1986|  2.77k|    *type = *bufp++;
 1987|  2.77k|    if (*type != ASN_COUNTER64
  ------------------
  |  |   99|  5.55k|#define ASN_COUNTER64   (ASN_APPLICATION | 6)
  |  |  ------------------
  |  |  |  |   91|  2.77k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (1987:9): [True: 1.50k, False: 1.27k]
  ------------------
 1988|  1.50k|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 1989|  1.50k|            && *type != ASN_OPAQUE
  ------------------
  |  |   93|  1.50k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  1.50k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (1989:16): [True: 7, False: 1.50k]
  ------------------
 1990|  2.77k|#endif
 1991|  2.77k|            ) {
 1992|      7|        _asn_type_err(errpre, *type);
 1993|      7|        return NULL;
 1994|      7|    }
 1995|  2.77k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 1996|  2.77k|    if (NULL == bufp) {
  ------------------
  |  Branch (1996:9): [True: 0, False: 2.77k]
  ------------------
 1997|      0|        _asn_short_err(errpre, *datalength - 1, asn_length);
 1998|      0|        return NULL;
 1999|      0|    }
 2000|       |
 2001|  2.77k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|  2.77k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.77k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.77k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 2.77k]
  |  |  ------------------
  ------------------
 2002|  2.77k|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 2003|       |    /** need at least 2 bytes: ASN_OPAQUE_TAG1 and ASN_OPAQUE_<type> */
 2004|  2.77k|    if ((*type == ASN_OPAQUE) && (asn_length < 2)) {
  ------------------
  |  |   93|  2.77k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  2.77k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2004:9): [True: 1.50k, False: 1.27k]
  |  Branch (2004:34): [True: 0, False: 1.50k]
  ------------------
 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|  2.77k|    if ((*type == ASN_OPAQUE) &&
  ------------------
  |  |   93|  2.77k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  2.77k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2012:9): [True: 1.50k, False: 1.27k]
  ------------------
 2013|  1.50k|        (asn_length <= ASN_OPAQUE_COUNTER64_MX_BER_LEN) &&
  ------------------
  |  |  160|  1.50k|#define ASN_OPAQUE_COUNTER64_MX_BER_LEN 12
  ------------------
  |  Branch (2013:9): [True: 1.48k, False: 20]
  ------------------
 2014|  1.48k|        (*bufp == ASN_OPAQUE_TAG1) &&
  ------------------
  |  |  131|  1.48k|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|  1.48k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|  1.48k|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
  |  Branch (2014:9): [True: 1.48k, False: 0]
  ------------------
 2015|  1.48k|        ((*(bufp + 1) == ASN_OPAQUE_COUNTER64) ||
  ------------------
  |  |  156|  1.48k|#define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  136|  1.48k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  146|  1.48k|#define ASN_APP_COUNTER64 (ASN_APPLICATION | 6)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.48k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2015:10): [True: 655, False: 825]
  ------------------
 2016|  1.48k|         (*(bufp + 1) == ASN_OPAQUE_U64))) {
  ------------------
  |  |  192|    825|#define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  136|    825|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  150|    825|#define ASN_APP_U64 (ASN_APPLICATION | 11)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    825|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2016:10): [True: 825, False: 0]
  ------------------
 2017|       |        /*
 2018|       |         * change type to Counter64 or U64 
 2019|       |         */
 2020|  1.48k|        *type = *(bufp + 1);
 2021|       |        /*
 2022|       |         * value is encoded as special format 
 2023|       |         */
 2024|  1.48k|        *datalength = asn_length;
 2025|  1.48k|        bufp = asn_parse_nlength(bufp+2, *datalength - 2, &asn_length);
 2026|  1.48k|        if (NULL == bufp) {
  ------------------
  |  Branch (2026:13): [True: 0, False: 1.48k]
  ------------------
 2027|      0|            _asn_short_err("parse opaque uint64", *datalength - 2, asn_length);
 2028|      0|            return NULL;
 2029|      0|        }
 2030|  1.48k|    }
 2031|  2.77k|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 2032|  2.77k|    if (((int) asn_length > uint64sizelimit) ||
  ------------------
  |  Branch (2032:9): [True: 26, False: 2.74k]
  ------------------
 2033|  2.74k|        (((int) asn_length == uint64sizelimit) && *bufp != 0x00)) {
  ------------------
  |  Branch (2033:10): [True: 274, False: 2.47k]
  |  Branch (2033:51): [True: 8, False: 266]
  ------------------
 2034|     34|        _asn_length_err(errpre, (size_t) asn_length, uint64sizelimit);
 2035|     34|        return NULL;
 2036|     34|    }
 2037|  2.73k|    *datalength -= (int) asn_length + (bufp - data);
 2038|  6.57k|    while (asn_length--) {
  ------------------
  |  Branch (2038:12): [True: 3.84k, False: 2.73k]
  ------------------
 2039|  3.84k|        high = ((0x00FFFFFF & high) << 8) | ((low & 0xFF000000U) >> 24);
 2040|  3.84k|        low = ((low & 0x00FFFFFF) << 8) | *bufp++;
 2041|  3.84k|    }
 2042|       |
 2043|  2.73k|    CHECK_OVERFLOW_U(high,6);
  ------------------
  |  |  224|  2.73k|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|  2.73k|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 0, False: 2.73k]
  |  |  ------------------
  |  |  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|  2.73k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 2.73k]
  |  |  ------------------
  ------------------
 2044|  2.73k|    CHECK_OVERFLOW_U(low,6);
  ------------------
  |  |  224|  2.73k|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|  2.73k|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 0, False: 2.73k]
  |  |  ------------------
  |  |  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|  2.73k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 2.73k]
  |  |  ------------------
  ------------------
 2045|       |
 2046|  2.73k|    cp->low = low;
 2047|  2.73k|    cp->high = high;
 2048|       |
 2049|  2.73k|    DEBUGIF("dumpv_recv") {
  ------------------
  |  |  145|  2.73k|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|  5.47k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.73k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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|  2.73k|    return bufp;
 2056|  2.77k|}
asn_parse_signed_int64:
 2233|  1.34k|{
 2234|  1.34k|    static const char *errpre = "parse int64";
 2235|  1.34k|    const int       int64sizelimit = (4 * 2) + 1;
 2236|  1.34k|    char            ebuf[128];
 2237|  1.34k|    register u_char *bufp = data;
 2238|  1.34k|    u_long          asn_length;
 2239|  1.34k|    register u_int  low = 0, high = 0;
 2240|       |
 2241|  1.34k|    if (countersize != sizeof(struct counter64)) {
  ------------------
  |  Branch (2241:9): [True: 0, False: 1.34k]
  ------------------
 2242|      0|        _asn_size_err(errpre, countersize, sizeof(struct counter64));
 2243|      0|        return NULL;
 2244|      0|    }
 2245|       |
 2246|  1.34k|    if (NULL == data || NULL == datalength || NULL == type || NULL == cp) {
  ------------------
  |  Branch (2246:9): [True: 0, False: 1.34k]
  |  Branch (2246:25): [True: 0, False: 1.34k]
  |  Branch (2246:47): [True: 0, False: 1.34k]
  |  Branch (2246:63): [True: 0, False: 1.34k]
  ------------------
 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.34k|    if (*datalength < 2) {
  ------------------
  |  Branch (2252:9): [True: 0, False: 1.34k]
  ------------------
 2253|      0|        _asn_short_err(errpre, *datalength, 2);
 2254|      0|        return NULL;
 2255|      0|    }
 2256|       |
 2257|  1.34k|    *type = *bufp++;
 2258|  1.34k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 2259|  1.34k|    if (NULL == bufp) {
  ------------------
  |  Branch (2259:9): [True: 0, False: 1.34k]
  ------------------
 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.34k|    if (asn_length < 2) {
  ------------------
  |  Branch (2265:9): [True: 12, False: 1.33k]
  ------------------
 2266|     12|        _asn_short_err(errpre, asn_length, 2);
 2267|     12|        return NULL;
 2268|     12|    }
 2269|       |
 2270|  1.33k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|  1.33k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  1.33k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1.33k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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.33k]
  |  |  ------------------
  ------------------
 2271|  1.33k|    if ((*type == ASN_OPAQUE) &&
  ------------------
  |  |   93|  1.33k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  1.33k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2271:9): [True: 1.32k, False: 9]
  ------------------
 2272|  1.32k|        (asn_length <= ASN_OPAQUE_COUNTER64_MX_BER_LEN) &&
  ------------------
  |  |  160|  1.32k|#define ASN_OPAQUE_COUNTER64_MX_BER_LEN 12
  ------------------
  |  Branch (2272:9): [True: 1.30k, False: 16]
  ------------------
 2273|  1.30k|        (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_I64)) {
  ------------------
  |  |  131|  1.30k|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|  1.30k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|  1.30k|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
                      (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_I64)) {
  ------------------
  |  |  183|  1.30k|#define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  136|  1.30k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  149|  1.30k|#define ASN_APP_I64 (ASN_APPLICATION | 10)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.30k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2273:9): [True: 1.30k, False: 0]
  |  Branch (2273:39): [True: 1.30k, False: 0]
  ------------------
 2274|       |        /*
 2275|       |         * change type to Int64 
 2276|       |         */
 2277|  1.30k|        *type = *(bufp + 1);
 2278|       |        /*
 2279|       |         * value is encoded as special format 
 2280|       |         */
 2281|  1.30k|        *datalength = asn_length;
 2282|  1.30k|        bufp = asn_parse_nlength(bufp+2, *datalength - 2, &asn_length);
 2283|  1.30k|        if (NULL == bufp) {
  ------------------
  |  Branch (2283:13): [True: 0, False: 1.30k]
  ------------------
 2284|      0|            _asn_short_err("parse opaque int64", *datalength - 2, asn_length);
 2285|      0|            return NULL;
 2286|      0|        }
 2287|  1.30k|    }
 2288|       |    /*
 2289|       |     * this should always have been true until snmp gets int64 PDU types 
 2290|       |     */
 2291|     25|    else {
 2292|     25|        snprintf(ebuf, sizeof(ebuf),
 2293|     25|                "%s: wrong type: %d, len %d, buf bytes (%02X,%02X)",
 2294|     25|                errpre, *type, (int) asn_length, *bufp, *(bufp + 1));
 2295|     25|        ebuf[ sizeof(ebuf)-1 ] = 0;
 2296|     25|        ERROR_MSG(ebuf);
  ------------------
  |  |  188|     25|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 2297|     25|        return NULL;
 2298|     25|    }
 2299|  1.30k|    if (((int) asn_length > int64sizelimit) ||
  ------------------
  |  Branch (2299:9): [True: 0, False: 1.30k]
  ------------------
 2300|  1.30k|        (((int) asn_length == int64sizelimit) && *bufp != 0x00)) {
  ------------------
  |  Branch (2300:10): [True: 216, False: 1.08k]
  |  Branch (2300:50): [True: 8, False: 208]
  ------------------
 2301|      8|        _asn_length_err(errpre, (size_t) asn_length, int64sizelimit);
 2302|      8|        return NULL;
 2303|      8|    }
 2304|  1.29k|    *datalength -= (int) asn_length + (bufp - data);
 2305|  1.29k|    if ((asn_length > 0) && (*bufp & 0x80)) {
  ------------------
  |  Branch (2305:9): [True: 880, False: 417]
  |  Branch (2305:29): [True: 274, False: 606]
  ------------------
 2306|    274|        low = 0xFFFFFFFFU;   /* first byte bit 1 means start the data with 1s */
 2307|    274|        high = 0xFFFFFF;
 2308|    274|    }
 2309|       |
 2310|  3.99k|    for ( ; asn_length; asn_length--) {
  ------------------
  |  Branch (2310:13): [True: 2.69k, False: 1.29k]
  ------------------
 2311|  2.69k|        high = ((0x00FFFFFF & high) << 8) | ((low & 0xFF000000U) >> 24);
 2312|  2.69k|        low = ((low & 0x00FFFFFF) << 8) | *bufp++;
 2313|  2.69k|    }
 2314|       |
 2315|  1.29k|    CHECK_OVERFLOW_U(high,8);
  ------------------
  |  |  224|  1.29k|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|  1.29k|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 0, False: 1.29k]
  |  |  ------------------
  |  |  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.29k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 1.29k]
  |  |  ------------------
  ------------------
 2316|  1.29k|    CHECK_OVERFLOW_U(low,8);
  ------------------
  |  |  224|  1.29k|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|  1.29k|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 0, False: 1.29k]
  |  |  ------------------
  |  |  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.29k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 1.29k]
  |  |  ------------------
  ------------------
 2317|       |
 2318|  1.29k|    cp->low = low;
 2319|  1.29k|    cp->high = high;
 2320|       |
 2321|  1.29k|    DEBUGIF("dumpv_recv") {
  ------------------
  |  |  145|  1.29k|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|  2.59k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1.29k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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.29k|    return bufp;
 2328|  1.30k|}
asn_parse_float:
 2451|    571|{
 2452|    571|    static const char *errpre = "parse float";
 2453|    571|    register u_char *bufp = data;
 2454|    571|    u_long          asn_length;
 2455|    571|    union {
 2456|    571|        float           floatVal;
 2457|    571|        long            longVal;
 2458|    571|        u_char          c[sizeof(float)];
 2459|    571|    } fu;
 2460|       |
 2461|    571|    if (floatsize != sizeof(float)) {
  ------------------
  |  Branch (2461:9): [True: 0, False: 571]
  ------------------
 2462|      0|        _asn_size_err("parse float", floatsize, sizeof(float));
 2463|      0|        return NULL;
 2464|      0|    }
 2465|       |
 2466|    571|    if (NULL == data || NULL == datalength || NULL == type || NULL == floatp) {
  ------------------
  |  Branch (2466:9): [True: 0, False: 571]
  |  Branch (2466:25): [True: 0, False: 571]
  |  Branch (2466:47): [True: 0, False: 571]
  |  Branch (2466:63): [True: 0, False: 571]
  ------------------
 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|    571|    if (*datalength < 2) {
  ------------------
  |  Branch (2472:9): [True: 0, False: 571]
  ------------------
 2473|      0|        _asn_short_err(errpre, *datalength, 2);
 2474|      0|        return NULL;
 2475|      0|    }
 2476|       |
 2477|    571|    *type = *bufp++;
 2478|    571|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 2479|    571|    if (NULL == bufp) {
  ------------------
  |  Branch (2479:9): [True: 0, False: 571]
  ------------------
 2480|      0|        _asn_short_err(errpre, *datalength - 1, asn_length);
 2481|      0|        return NULL;
 2482|      0|    }
 2483|       |
 2484|    571|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|    571|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    571|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 571]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 571]
  |  |  ------------------
  ------------------
 2485|       |    /*
 2486|       |     * the float is encoded as an opaque 
 2487|       |     */
 2488|    571|    if ((*type == ASN_OPAQUE) &&
  ------------------
  |  |   93|    571|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|    571|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2488:9): [True: 227, False: 344]
  ------------------
 2489|    227|        (asn_length == ASN_OPAQUE_FLOAT_BER_LEN) &&
  ------------------
  |  |  169|    227|#define ASN_OPAQUE_FLOAT_BER_LEN 7
  ------------------
  |  Branch (2489:9): [True: 212, False: 15]
  ------------------
 2490|    212|        (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_FLOAT)) {
  ------------------
  |  |  131|    212|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|    212|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|    212|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
                      (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_FLOAT)) {
  ------------------
  |  |  165|    212|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|    212|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|    212|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    212|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2490:9): [True: 212, False: 0]
  |  Branch (2490:39): [True: 212, False: 0]
  ------------------
 2491|       |
 2492|       |        /*
 2493|       |         * value is encoded as special format 
 2494|       |         */
 2495|    212|        *datalength = asn_length;
 2496|    212|        bufp = asn_parse_nlength(bufp+2, *datalength - 2, &asn_length);
 2497|    212|        if (NULL == bufp) {
  ------------------
  |  Branch (2497:13): [True: 0, False: 212]
  ------------------
 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|    212|        *type = ASN_OPAQUE_FLOAT;
  ------------------
  |  |  165|    212|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|    212|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|    212|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    212|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2505|    212|    }
 2506|       |
 2507|    571|    if (*type != ASN_OPAQUE_FLOAT) {
  ------------------
  |  |  165|    571|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|    571|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|    571|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    571|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2507:9): [True: 15, False: 556]
  ------------------
 2508|     15|        _asn_type_err(errpre, *type);
 2509|     15|        return NULL;
 2510|     15|    }
 2511|       |
 2512|    556|    if (asn_length != sizeof(float)) {
  ------------------
  |  Branch (2512:9): [True: 26, False: 530]
  ------------------
 2513|     26|        _asn_size_err("parse seq float", asn_length, sizeof(float));
 2514|     26|        return NULL;
 2515|     26|    }
 2516|       |
 2517|    530|    *datalength -= (int) asn_length + (bufp - data);
 2518|    530|    memcpy(&fu.c[0], bufp, asn_length);
 2519|       |
 2520|       |    /*
 2521|       |     * correct for endian differences 
 2522|       |     */
 2523|    530|    fu.longVal = ntohl(fu.longVal);
 2524|       |
 2525|    530|    *floatp = fu.floatVal;
 2526|       |
 2527|    530|    DEBUGMSG(("dumpv_recv", "Opaque float: %f\n", *floatp));
  ------------------
  |  |   61|    530|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    530|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 530]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 530]
  |  |  ------------------
  ------------------
 2528|    530|    return bufp;
 2529|    556|}
asn_parse_double:
 2634|    856|{
 2635|    856|    static const char *errpre = "parse double";
 2636|    856|    register u_char *bufp = data;
 2637|    856|    u_long          asn_length;
 2638|    856|    long            tmp;
 2639|    856|    union {
 2640|    856|        double          doubleVal;
 2641|    856|        int             intVal[2];
 2642|    856|        u_char          c[sizeof(double)];
 2643|    856|    } fu;
 2644|       |
 2645|       |
 2646|    856|    if (doublesize != sizeof(double)) {
  ------------------
  |  Branch (2646:9): [True: 0, False: 856]
  ------------------
 2647|      0|        _asn_size_err("parse double", doublesize, sizeof(double));
 2648|      0|        return NULL;
 2649|      0|    }
 2650|       |
 2651|    856|    if (NULL == data || NULL == datalength || NULL == type || NULL == doublep) {
  ------------------
  |  Branch (2651:9): [True: 0, False: 856]
  |  Branch (2651:25): [True: 0, False: 856]
  |  Branch (2651:47): [True: 0, False: 856]
  |  Branch (2651:63): [True: 0, False: 856]
  ------------------
 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|    856|    if (*datalength < 2) {
  ------------------
  |  Branch (2657:9): [True: 0, False: 856]
  ------------------
 2658|      0|        _asn_short_err(errpre, *datalength, 2);
 2659|      0|        return NULL;
 2660|      0|    }
 2661|       |
 2662|    856|    *type = *bufp++;
 2663|    856|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 2664|    856|    if (NULL == bufp) {
  ------------------
  |  Branch (2664:9): [True: 0, False: 856]
  ------------------
 2665|      0|        _asn_short_err(errpre, *datalength - 1, asn_length);
 2666|      0|        return NULL;
 2667|      0|    }
 2668|       |
 2669|    856|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|    856|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    856|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 856]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 856]
  |  |  ------------------
  ------------------
 2670|       |    /*
 2671|       |     * the double is encoded as an opaque 
 2672|       |     */
 2673|       |    /** need at least 2 bytes: ASN_OPAQUE_TAG1 and ASN_OPAQUE_DOUBLE */
 2674|    856|    if ((*type == ASN_OPAQUE) && (asn_length < 2)) {
  ------------------
  |  |   93|    856|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|    856|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2674:9): [True: 233, False: 623]
  |  Branch (2674:34): [True: 0, False: 233]
  ------------------
 2675|      0|        _asn_short_err(errpre, asn_length, 2);
 2676|      0|        return NULL;
 2677|      0|    }
 2678|    856|    if ((*type == ASN_OPAQUE) &&
  ------------------
  |  |   93|    856|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|    856|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2678:9): [True: 233, False: 623]
  ------------------
 2679|    233|        (asn_length == ASN_OPAQUE_DOUBLE_BER_LEN) &&
  ------------------
  |  |  178|    233|#define ASN_OPAQUE_DOUBLE_BER_LEN 11
  ------------------
  |  Branch (2679:9): [True: 213, False: 20]
  ------------------
 2680|    213|        (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_DOUBLE)) {
  ------------------
  |  |  131|    213|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|    213|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|    213|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
                      (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_DOUBLE)) {
  ------------------
  |  |  174|    213|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|    213|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|    213|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    213|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2680:9): [True: 213, False: 0]
  |  Branch (2680:39): [True: 213, False: 0]
  ------------------
 2681|       |
 2682|       |        /*
 2683|       |         * value is encoded as special format 
 2684|       |         */
 2685|    213|        *datalength = asn_length;
 2686|    213|        bufp = asn_parse_nlength(bufp+2, *datalength - 2, &asn_length);
 2687|    213|        if (NULL == bufp) {
  ------------------
  |  Branch (2687:13): [True: 0, False: 213]
  ------------------
 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|    213|        *type = ASN_OPAQUE_DOUBLE;
  ------------------
  |  |  174|    213|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|    213|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|    213|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    213|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2696|    213|    }
 2697|       |
 2698|    856|    if (*type != ASN_OPAQUE_DOUBLE) {
  ------------------
  |  |  174|    856|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|    856|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|    856|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    856|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2698:9): [True: 20, False: 836]
  ------------------
 2699|     20|        _asn_type_err(errpre, *type);
 2700|     20|        return NULL;
 2701|     20|    }
 2702|       |
 2703|    836|    if (asn_length != sizeof(double)) {
  ------------------
  |  Branch (2703:9): [True: 25, False: 811]
  ------------------
 2704|     25|        _asn_size_err("parse seq double", asn_length, sizeof(double));
 2705|     25|        return NULL;
 2706|     25|    }
 2707|    811|    *datalength -= (int) asn_length + (bufp - data);
 2708|    811|    memcpy(&fu.c[0], bufp, asn_length);
 2709|       |
 2710|       |    /*
 2711|       |     * correct for endian differences 
 2712|       |     */
 2713|       |
 2714|    811|    tmp = ntohl(fu.intVal[0]);
 2715|    811|    fu.intVal[0] = ntohl(fu.intVal[1]);
 2716|    811|    fu.intVal[1] = tmp;
 2717|       |
 2718|    811|    *doublep = fu.doubleVal;
 2719|    811|    DEBUGMSG(("dumpv_recv", "  Opaque Double:\t%f\n", *doublep));
  ------------------
  |  |   61|    811|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    811|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 811]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 811]
  |  |  ------------------
  ------------------
 2720|       |
 2721|    811|    return bufp;
 2722|    836|}
asn1.c:_asn_size_err:
  242|     51|{
  243|     51|    char            ebuf[128];
  244|       |
  245|     51|    snprintf(ebuf, sizeof(ebuf),
  246|     51|            "%s size %lu: s/b %lu", str,
  247|     51|	    (unsigned long)wrongsize, (unsigned long)rightsize);
  248|     51|    ebuf[ sizeof(ebuf)-1 ] = 0;
  249|     51|    ERROR_MSG(ebuf);
  ------------------
  |  |  188|     51|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  250|     51|}
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|    543|{
  263|    543|    char            ebuf[128];
  264|       |
  265|    543|    snprintf(ebuf, sizeof(ebuf), "%s type %d", str, wrongtype);
  266|    543|    ebuf[ sizeof(ebuf)-1 ] = 0;
  267|    543|    ERROR_MSG(ebuf);
  ------------------
  |  |  188|    543|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  268|    543|}
asn1.c:_asn_length_err:
  281|    173|{
  282|    173|    char            ebuf[128];
  283|       |
  284|    173|    snprintf(ebuf, sizeof(ebuf),
  285|    173|            "%s length %lu too large: exceeds %lu", str,
  286|    173|	    (unsigned long)wrongsize, (unsigned long)rightsize);
  287|    173|    ebuf[ sizeof(ebuf)-1 ] = 0;
  288|    173|    ERROR_MSG(ebuf);
  ------------------
  |  |  188|    173|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  289|    173|}
asn1.c:_asn_bitstring_check:
  518|    829|{
  519|    829|    char            ebuf[128];
  520|       |
  521|    829|    if (asn_length < 1) {
  ------------------
  |  Branch (521:9): [True: 6, False: 823]
  ------------------
  522|      6|        snprintf(ebuf, sizeof(ebuf),
  523|      6|                "%s: length %d too small", str, (int) asn_length);
  524|      6|        ebuf[ sizeof(ebuf)-1 ] = 0;
  525|      6|        ERROR_MSG(ebuf);
  ------------------
  |  |  188|      6|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  526|      6|        return 1;
  527|      6|    }
  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|    823|    return 0;
  536|    829|}

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

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

snmp_get_next_transid:
  485|  2.67k|{
  486|  2.67k|    long            retVal;
  487|  2.67k|    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_TRANSID);
  ------------------
  |  |   79|  2.67k|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded, False: 2.67k]
  |  |  ------------------
  ------------------
  488|  2.67k|    retVal = 1 + Transid;       /*MTCRITICAL_RESOURCE */
  489|  2.67k|    if (!retVal)
  ------------------
  |  Branch (489:9): [True: 0, False: 2.67k]
  ------------------
  490|      0|        retVal = 2;
  491|  2.67k|    Transid = retVal;
  492|  2.67k|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS))
  ------------------
  |  |   48|  2.67k|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS))
  ------------------
  |  |   91|  2.67k|#define NETSNMP_DS_LIB_16BIT_IDS           31   /* restrict requestIDs, etc to 16-bit values */
  ------------------
  |  Branch (492:9): [True: 0, False: 2.67k]
  ------------------
  493|      0|        retVal &= 0x7fff;	/* mask to 15 bits */
  494|  2.67k|    else
  495|  2.67k|        retVal &= 0x7fffffff;	/* mask to 31 bits */
  496|       |
  497|  2.67k|    if (!retVal) {
  ------------------
  |  Branch (497:9): [True: 0, False: 2.67k]
  ------------------
  498|      0|        Transid = retVal = 2;
  499|      0|    }
  500|  2.67k|    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_TRANSID);
  ------------------
  |  |   80|  2.67k|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded, False: 2.67k]
  |  |  ------------------
  ------------------
  501|  2.67k|    return retVal;
  502|  2.67k|}
snmp_set_detail:
  516|  6.58k|{
  517|  6.58k|    if (detail_string != NULL) {
  ------------------
  |  Branch (517:9): [True: 6.58k, False: 0]
  ------------------
  518|  6.58k|        strlcpy(snmp_detail, detail_string, sizeof(snmp_detail));
  519|  6.58k|        snmp_detail_f = 1;
  520|  6.58k|    }
  521|  6.58k|}
snmp_api_errstring:
  531|    717|{
  532|    717|    const char     *msg = "";
  533|    717|    static char     msg_buf[SPRINT_MAX_LEN];
  534|       |
  535|    717|    if (snmp_errnumber >= SNMPERR_MAX && snmp_errnumber <= SNMPERR_GENERR) {
  ------------------
  |  |  288|  1.43k|#define SNMPERR_MAX			(-69)
  ------------------
                  if (snmp_errnumber >= SNMPERR_MAX && snmp_errnumber <= SNMPERR_GENERR) {
  ------------------
  |  |  218|    717|#define SNMPERR_GENERR			(-1)
  ------------------
  |  Branch (535:9): [True: 717, False: 0]
  |  Branch (535:42): [True: 0, False: 717]
  ------------------
  536|      0|        msg = api_errors[-snmp_errnumber];
  537|    717|    } else if (snmp_errnumber != SNMPERR_SUCCESS) {
  ------------------
  |  |  217|    717|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (537:16): [True: 0, False: 717]
  ------------------
  538|      0|        msg = NULL;
  539|      0|    }
  540|    717|    if (!msg) {
  ------------------
  |  Branch (540:9): [True: 0, False: 717]
  ------------------
  541|      0|	snprintf(msg_buf, sizeof(msg_buf), "Unknown error: %d", snmp_errnumber);
  542|      0|        msg_buf[sizeof(msg_buf)-1] = '\0';
  543|    717|    } else if (snmp_detail_f) {
  ------------------
  |  Branch (543:16): [True: 717, False: 0]
  ------------------
  544|    717|        snprintf(msg_buf, sizeof(msg_buf), "%s (%s)", msg, snmp_detail);
  545|    717|        msg_buf[sizeof(msg_buf)-1] = '\0';
  546|    717|        snmp_detail_f = 0;
  547|    717|    } else {
  548|      0|        strlcpy(msg_buf, msg, sizeof(msg_buf));
  549|      0|    }
  550|       |
  551|    717|    return (msg_buf);
  552|    717|}
snmpv3_parse:
 3798|  2.67k|{
 3799|  2.67k|    u_char          type, msg_flags;
 3800|  2.67k|    long            ver, msg_sec_model;
 3801|  2.67k|    size_t          max_size_response;
 3802|  2.67k|    u_char          tmp_buf[SNMP_MAX_MSG_SIZE];
 3803|  2.67k|    size_t          tmp_buf_len;
 3804|  2.67k|    u_char          pdu_buf[SNMP_MAX_MSG_SIZE];
 3805|  2.67k|    u_char         *mallocbuf = NULL;
 3806|  2.67k|    size_t          pdu_buf_len = SNMP_MAX_MSG_SIZE;
  ------------------
  |  |  142|  2.67k|#define SNMP_MAX_MSG_SIZE          1472 /* ethernet MTU minus IP/UDP header */
  ------------------
 3807|  2.67k|    u_char         *sec_params;
 3808|  2.67k|    u_char         *msg_data;
 3809|  2.67k|    u_char         *cp;
 3810|  2.67k|    size_t          asn_len, msg_len;
 3811|  2.67k|    int             ret, ret_val;
 3812|  2.67k|    struct snmp_secmod_def *sptr;
 3813|       |
 3814|       |
 3815|  2.67k|    msg_data = data;
 3816|  2.67k|    msg_len = *length;
 3817|       |
 3818|       |
 3819|       |    /*
 3820|       |     * message is an ASN.1 SEQUENCE  
 3821|       |     */
 3822|  2.67k|    DEBUGDUMPSECTION("recv", "SNMPv3 Message");
  ------------------
  |  |   81|  2.67k|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.67k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.67k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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.67k]
  |  |  ------------------
  ------------------
 3823|  2.67k|    data = asn_parse_sequence(data, length, &type,
 3824|  2.67k|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR), "message");
  ------------------
  |  |   84|  2.67k|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR), "message");
  ------------------
  |  |   96|  2.67k|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3825|  2.67k|    if (data == NULL) {
  ------------------
  |  Branch (3825:9): [True: 303, False: 2.36k]
  ------------------
 3826|       |        /*
 3827|       |         * error msg detail is set 
 3828|       |         */
 3829|    303|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|    303|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3830|    303|        DEBUGINDENTLESS();
  ------------------
  |  |   75|    303|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    303|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 303]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 303]
  |  |  ------------------
  ------------------
 3831|    303|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|    303|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3832|    303|    }
 3833|       |
 3834|       |    /*
 3835|       |     * parse msgVersion  
 3836|       |     */
 3837|  2.36k|    DEBUGDUMPHEADER("recv", "SNMP Version Number");
  ------------------
  |  |   79|  2.36k|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.36k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.36k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  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.36k]
  |  |  ------------------
  ------------------
 3838|  2.36k|    data = asn_parse_int(data, length, &type, &ver, sizeof(ver));
 3839|  2.36k|    DEBUGINDENTLESS();
  ------------------
  |  |   75|  2.36k|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.36k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.36k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 2.36k]
  |  |  ------------------
  ------------------
 3840|  2.36k|    if (data == NULL) {
  ------------------
  |  Branch (3840:9): [True: 179, False: 2.18k]
  ------------------
 3841|    179|        ERROR_MSG("bad parse of version");
  ------------------
  |  |  188|    179|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3842|    179|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|    179|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3843|    179|        DEBUGINDENTLESS();
  ------------------
  |  |   75|    179|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    179|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 179]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 179]
  |  |  ------------------
  ------------------
 3844|    179|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|    179|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3845|    179|    }
 3846|  2.18k|    pdu->version = ver;
 3847|       |
 3848|       |    /*
 3849|       |     * parse msgGlobalData sequence  
 3850|       |     */
 3851|  2.18k|    cp = data;
 3852|  2.18k|    asn_len = *length;
 3853|  2.18k|    DEBUGDUMPSECTION("recv", "msgGlobalData");
  ------------------
  |  |   81|  2.18k|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.18k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.18k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 2.18k]
  |  |  ------------------
  ------------------
 3854|  2.18k|    data = asn_parse_sequence(data, &asn_len, &type,
 3855|  2.18k|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   84|  2.18k|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   96|  2.18k|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3856|  2.18k|                              "msgGlobalData");
 3857|  2.18k|    if (data == NULL) {
  ------------------
  |  Branch (3857:9): [True: 1.80k, False: 382]
  ------------------
 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|    382|    *length -= data - cp;       /* subtract off the length of the header */
 3866|       |
 3867|       |    /*
 3868|       |     * msgID 
 3869|       |     */
 3870|    382|    DEBUGDUMPHEADER("recv", "msgID");
  ------------------
  |  |   79|    382|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    382|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 382]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 382]
  |  |  ------------------
  ------------------
 3871|    382|    data =
 3872|    382|        asn_parse_int(data, length, &type, &pdu->msgid,
 3873|    382|                      sizeof(pdu->msgid));
 3874|    382|    DEBUGINDENTLESS();
  ------------------
  |  |   75|    382|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    382|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 382]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 382]
  |  |  ------------------
  ------------------
 3875|    382|    if (data == NULL || type != ASN_INTEGER) {
  ------------------
  |  |   75|    362|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (3875:9): [True: 20, False: 362]
  |  Branch (3875:25): [True: 0, False: 362]
  ------------------
 3876|     20|        ERROR_MSG("error parsing msgID");
  ------------------
  |  |  188|     20|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3877|     20|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|     20|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     20|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 20]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 20]
  |  |  ------------------
  ------------------
 3878|     20|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|     20|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3879|     20|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|     20|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3880|     20|    }
 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|    362|    if (pdu->msgid < 0 || pdu->msgid > SNMP_MAX_PACKET_LEN) {
  ------------------
  |  |   49|    315|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  |  Branch (3890:9): [True: 47, False: 315]
  |  Branch (3890:27): [True: 3, False: 312]
  ------------------
 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|    312|    DEBUGDUMPHEADER("recv:msgMaxSize", "msgMaxSize");
  ------------------
  |  |   79|    312|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    312|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 312]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 312]
  |  |  ------------------
  ------------------
 3903|    312|    data = asn_parse_int(data, length, &type, &pdu->msgMaxSize,
 3904|    312|                         sizeof(pdu->msgMaxSize));
 3905|    312|    DEBUGINDENTLESS();
  ------------------
  |  |   75|    312|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    312|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 312]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 312]
  |  |  ------------------
  ------------------
 3906|    312|    if (data == NULL || type != ASN_INTEGER) {
  ------------------
  |  |   75|    253|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (3906:9): [True: 59, False: 253]
  |  Branch (3906:25): [True: 0, False: 253]
  ------------------
 3907|     59|        ERROR_MSG("error parsing msgMaxSize");
  ------------------
  |  |  188|     59|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3908|     59|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|     59|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3909|     59|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|     59|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     59|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 59]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 59]
  |  |  ------------------
  ------------------
 3910|     59|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|     59|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3911|     59|    }
 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|    253|    if (pdu->msgMaxSize < SNMP_MIN_MAX_LEN) {
  ------------------
  |  |   48|    253|#define SNMP_MIN_MAX_LEN    484 /* minimum maximum message size */
  ------------------
  |  Branch (3921:9): [True: 49, False: 204]
  ------------------
 3922|     49|        snmp_log(LOG_ERR, "Received bad msgMaxSize (%lu < 484).\n",
 3923|     49|                 pdu->msgMaxSize);
 3924|     49|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|     49|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3925|     49|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|     49|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     49|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 49]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 49]
  |  |  ------------------
  ------------------
 3926|     49|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|     49|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3927|    204|    } else if (pdu->msgMaxSize > SNMP_MAX_PACKET_LEN) {
  ------------------
  |  |   49|    204|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  |  Branch (3927:16): [True: 3, False: 201]
  ------------------
 3928|      3|        snmp_log(LOG_ERR, "Received bad msgMaxSize (%lu > 2^31 - 1).\n",
 3929|      3|                 pdu->msgMaxSize);
 3930|      3|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      3|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3931|      3|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|      3|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 3]
  |  |  ------------------
  ------------------
 3932|      3|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|      3|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3933|    201|    } else {
 3934|    201|        DEBUGMSGTL(("snmpv3_parse:msgMaxSize", "msgMaxSize %lu received\n",
  ------------------
  |  |   66|    201|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    201|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 201]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 201]
  |  |  ------------------
  ------------------
 3935|    201|                    pdu->msgMaxSize));
 3936|       |        /** don't increase max msg size if we've already got one */
 3937|    201|        if (sess->sndMsgMaxSize < pdu->msgMaxSize) {
  ------------------
  |  Branch (3937:13): [True: 201, False: 0]
  ------------------
 3938|    201|            DEBUGMSGTL(("snmpv3_parse:msgMaxSize",
  ------------------
  |  |   66|    201|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    201|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 201]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 201]
  |  |  ------------------
  ------------------
 3939|    201|                        "msgMaxSize %" NETSNMP_PRIz "d greater than session max %ld; reducing\n",
 3940|    201|                        sess->sndMsgMaxSize, pdu->msgMaxSize));
 3941|    201|            pdu->msgMaxSize = sess->sndMsgMaxSize;
 3942|    201|        }
 3943|    201|    }
 3944|       |
 3945|       |    /*
 3946|       |     * msgFlags 
 3947|       |     */
 3948|    201|    tmp_buf_len = SNMP_MAX_MSG_SIZE;
  ------------------
  |  |  142|    201|#define SNMP_MAX_MSG_SIZE          1472 /* ethernet MTU minus IP/UDP header */
  ------------------
 3949|    201|    DEBUGDUMPHEADER("recv", "msgFlags");
  ------------------
  |  |   79|    201|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    201|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 201]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 201]
  |  |  ------------------
  ------------------
 3950|    201|    data = asn_parse_string(data, length, &type, tmp_buf, &tmp_buf_len);
 3951|    201|    DEBUGINDENTLESS();
  ------------------
  |  |   75|    201|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    201|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 201]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 201]
  |  |  ------------------
  ------------------
 3952|    201|    if (data == NULL || type != ASN_OCTET_STR || tmp_buf_len != 1) {
  ------------------
  |  |   78|    338|#define ASN_OCTET_STR	    0x04U
  ------------------
  |  Branch (3952:9): [True: 64, False: 137]
  |  Branch (3952:25): [True: 3, False: 134]
  |  Branch (3952:50): [True: 15, False: 119]
  ------------------
 3953|     82|        ERROR_MSG("error parsing msgFlags");
  ------------------
  |  |  188|     82|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3954|     82|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|     82|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3955|     82|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|     82|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     82|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 82]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 82]
  |  |  ------------------
  ------------------
 3956|     82|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|     82|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3957|     82|    }
 3958|    119|    msg_flags = *tmp_buf;
 3959|    119|    if (msg_flags & SNMP_MSG_FLAG_RPRT_BIT)
  ------------------
  |  |  305|    119|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
  |  Branch (3959:9): [True: 57, False: 62]
  ------------------
 3960|     57|        pdu->flags |= SNMP_MSG_FLAG_RPRT_BIT;
  ------------------
  |  |  305|     57|#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|    119|    DEBUGDUMPHEADER("recv", "msgSecurityModel");
  ------------------
  |  |   79|    119|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    119|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 119]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 119]
  |  |  ------------------
  ------------------
 3968|    119|    data = asn_parse_int(data, length, &type, &msg_sec_model,
 3969|    119|                         sizeof(msg_sec_model));
 3970|    119|    DEBUGINDENTADD(-4);         /* return from global data indent */
  ------------------
  |  |   73|    119|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    119|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 119]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 119]
  |  |  ------------------
  ------------------
 3971|    119|    if (data == NULL || type != ASN_INTEGER ||
  ------------------
  |  |   75|    235|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (3971:9): [True: 3, False: 116]
  |  Branch (3971:25): [True: 0, False: 116]
  ------------------
 3972|    116|        msg_sec_model < 1 || msg_sec_model > 0x7fffffff) {
  ------------------
  |  Branch (3972:9): [True: 50, False: 66]
  |  Branch (3972:30): [True: 3, False: 63]
  ------------------
 3973|     56|        ERROR_MSG("error parsing msgSecurityModel");
  ------------------
  |  |  188|     56|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3974|     56|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|     56|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3975|     56|        DEBUGINDENTLESS();
  ------------------
  |  |   75|     56|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     56|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 56]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 56]
  |  |  ------------------
  ------------------
 3976|     56|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|     56|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3977|     56|    }
 3978|     63|    sptr = find_sec_mod(msg_sec_model);
 3979|     63|    if (!sptr) {
  ------------------
  |  Branch (3979:9): [True: 63, False: 0]
  ------------------
 3980|     63|        snmp_log(LOG_WARNING, "unknown security model: %ld\n",
 3981|     63|                 msg_sec_model);
 3982|     63|        snmp_increment_statistic(STAT_SNMPUNKNOWNSECURITYMODELS);
  ------------------
  |  |  644|     63|#define   STAT_SNMPUNKNOWNSECURITYMODELS     0
  ------------------
 3983|     63|        DEBUGINDENTLESS();
  ------------------
  |  |   75|     63|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     63|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 63]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 63]
  |  |  ------------------
  ------------------
 3984|     63|        return SNMPERR_UNKNOWN_SEC_MODEL;
  ------------------
  |  |  247|     63|#define SNMPERR_UNKNOWN_SEC_MODEL 	(-30)
  ------------------
 3985|     63|    }
 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.67k|{
 4660|  2.67k|    int             rc;
 4661|       |
 4662|  2.67k|    rc = _snmp_parse(slp, pss, pdu, data, length);
 4663|  2.67k|    if (rc) {
  ------------------
  |  Branch (4663:9): [True: 2.54k, False: 131]
  ------------------
 4664|  2.54k|        if (!pss->s_snmp_errno) {
  ------------------
  |  Branch (4664:13): [True: 2.45k, False: 86]
  ------------------
 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.67k|    return rc;
 4671|  2.67k|}
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: 19, False: 1.35k]
  ------------------
 4690|     19|        return -1;
 4691|  1.35k|    DEBUGMSGTL(("dumpv_recv","    Command %s\n", snmp_pdu_type(msg_type)));
  ------------------
  |  |   66|  1.35k|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  1.35k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1.35k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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.35k]
  |  |  ------------------
  ------------------
 4692|  1.35k|    pdu->command = msg_type;
 4693|  1.35k|    pdu->flags &= (~UCD_MSG_FLAG_RESPONSE_PDU);
  ------------------
  |  |  311|  1.35k|#define UCD_MSG_FLAG_RESPONSE_PDU            0x100
  ------------------
 4694|       |
 4695|       |    /*
 4696|       |     * get the fields in the PDU preceding the variable-bindings sequence
 4697|       |     */
 4698|  1.35k|    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: 302]
  ------------------
 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: 198, False: 850]
  ------------------
 4707|    198|            return -1;
 4708|    850|        pdu->enterprise = netsnmp_memdup(objid,
 4709|    850|                                         pdu->enterprise_length * sizeof(oid));
 4710|    850|        if (pdu->enterprise == NULL) {
  ------------------
  |  Branch (4710:13): [True: 0, False: 850]
  ------------------
 4711|      0|            return -1;
 4712|      0|        }
 4713|       |
 4714|       |        /*
 4715|       |         * agent-addr 
 4716|       |         */
 4717|    850|        four = 4;
 4718|    850|        data = asn_parse_string(data, length, &type,
 4719|    850|                                (u_char *) pdu->agent_addr, &four);
 4720|    850|        if (data == NULL)
  ------------------
  |  Branch (4720:13): [True: 96, False: 754]
  ------------------
 4721|     96|            return -1;
 4722|       |
 4723|       |        /*
 4724|       |         * generic trap 
 4725|       |         */
 4726|    754|        data = asn_parse_int(data, length, &type, (long *) &pdu->trap_type,
 4727|    754|                             sizeof(pdu->trap_type));
 4728|    754|        if (data == NULL)
  ------------------
  |  Branch (4728:13): [True: 7, False: 747]
  ------------------
 4729|      7|            return -1;
 4730|       |        /*
 4731|       |         * specific trap 
 4732|       |         */
 4733|    747|        data =
 4734|    747|            asn_parse_int(data, length, &type,
 4735|    747|                          (long *) &pdu->specific_type,
 4736|    747|                          sizeof(pdu->specific_type));
 4737|    747|        if (data == NULL)
  ------------------
  |  Branch (4737:13): [True: 4, False: 743]
  ------------------
 4738|      4|            return -1;
 4739|       |
 4740|       |        /*
 4741|       |         * timestamp  
 4742|       |         */
 4743|    743|        data = asn_parse_unsigned_int(data, length, &type, &pdu->time,
 4744|    743|                                      sizeof(pdu->time));
 4745|    743|        if (data == NULL)
  ------------------
  |  Branch (4745:13): [True: 173, False: 570]
  ------------------
 4746|    173|            return -1;
 4747|       |
 4748|    570|        break;
 4749|       |
 4750|    570|    case SNMP_MSG_RESPONSE:
  ------------------
  |  |  127|     66|#define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   92|     66|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   96|     66|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4750:5): [True: 66, False: 1.28k]
  ------------------
 4751|     90|    case SNMP_MSG_REPORT:
  ------------------
  |  |  147|     90|#define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   92|     90|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   96|     90|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4751:5): [True: 24, False: 1.32k]
  ------------------
 4752|     90|        pdu->flags |= UCD_MSG_FLAG_RESPONSE_PDU;
  ------------------
  |  |  311|     90|#define UCD_MSG_FLAG_RESPONSE_PDU            0x100
  ------------------
 4753|     90|        NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2408|     90|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 4754|       |
 4755|    116|    case SNMP_MSG_TRAP2:
  ------------------
  |  |  142|    116|#define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   92|    116|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   96|    116|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4755:5): [True: 26, False: 1.32k]
  ------------------
 4756|    138|    case SNMP_MSG_INFORM:
  ------------------
  |  |  141|    138|#define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   92|    138|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   96|    138|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4756:5): [True: 22, False: 1.32k]
  ------------------
 4757|    138|#ifndef NETSNMP_NOTIFY_ONLY
 4758|    169|    case SNMP_MSG_GET:
  ------------------
  |  |  125|    169|#define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  ------------------
  |  |  |  |   92|    169|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  ------------------
  |  |  |  |   96|    169|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4758:5): [True: 31, False: 1.31k]
  ------------------
 4759|    190|    case SNMP_MSG_GETNEXT:
  ------------------
  |  |  126|    190|#define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   92|    190|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   96|    190|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4759:5): [True: 21, False: 1.32k]
  ------------------
 4760|    249|    case SNMP_MSG_GETBULK:
  ------------------
  |  |  140|    249|#define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  ------------------
  |  |  |  |   92|    249|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  ------------------
  |  |  |  |   96|    249|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4760:5): [True: 59, False: 1.29k]
  ------------------
 4761|    249|#endif /* ! NETSNMP_NOTIFY_ONLY */
 4762|    249|#ifndef NETSNMP_NO_WRITE_SUPPORT
 4763|    294|    case SNMP_MSG_SET:
  ------------------
  |  |  129|    294|#define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  ------------------
  |  |  |  |   92|    294|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  ------------------
  |  |  |  |   96|    294|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4763:5): [True: 45, False: 1.30k]
  ------------------
 4764|    294|#endif /* !NETSNMP_NO_WRITE_SUPPORT */
 4765|       |        /*
 4766|       |         * PDU is not an SNMPv1 TRAP 
 4767|       |         */
 4768|       |
 4769|       |        /*
 4770|       |         * request id 
 4771|       |         */
 4772|    294|        DEBUGDUMPHEADER("recv", "request_id");
  ------------------
  |  |   79|    294|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    294|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 294]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 294]
  |  |  ------------------
  ------------------
 4773|    294|        data = asn_parse_int(data, length, &type, &pdu->reqid,
 4774|    294|                             sizeof(pdu->reqid));
 4775|    294|        DEBUGINDENTLESS();
  ------------------
  |  |   75|    294|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    294|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 294]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 294]
  |  |  ------------------
  ------------------
 4776|    294|        if (data == NULL) {
  ------------------
  |  Branch (4776:13): [True: 9, False: 285]
  ------------------
 4777|      9|            return -1;
 4778|      9|        }
 4779|       |
 4780|       |        /*
 4781|       |         * error status (getbulk non-repeaters) 
 4782|       |         */
 4783|    285|        DEBUGDUMPHEADER("recv", "error status");
  ------------------
  |  |   79|    285|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    285|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 285]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 285]
  |  |  ------------------
  ------------------
 4784|    285|        data = asn_parse_int(data, length, &type, &pdu->errstat,
 4785|    285|                             sizeof(pdu->errstat));
 4786|    285|        DEBUGINDENTLESS();
  ------------------
  |  |   75|    285|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    285|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 285]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 285]
  |  |  ------------------
  ------------------
 4787|    285|        if (data == NULL) {
  ------------------
  |  Branch (4787:13): [True: 6, False: 279]
  ------------------
 4788|      6|            return -1;
 4789|      6|        }
 4790|       |
 4791|       |        /*
 4792|       |         * error index (getbulk max-repetitions) 
 4793|       |         */
 4794|    279|        DEBUGDUMPHEADER("recv", "error index");
  ------------------
  |  |   79|    279|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    279|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 279]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 279]
  |  |  ------------------
  ------------------
 4795|    279|        data = asn_parse_int(data, length, &type, &pdu->errindex,
 4796|    279|                             sizeof(pdu->errindex));
 4797|    279|        DEBUGINDENTLESS();
  ------------------
  |  |   75|    279|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    279|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 279]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 279]
  |  |  ------------------
  ------------------
 4798|    279|        if (data == NULL) {
  ------------------
  |  Branch (4798:13): [True: 1, False: 278]
  ------------------
 4799|      1|            return -1;
 4800|      1|        }
 4801|    278|	break;
 4802|       |
 4803|    278|    default:
  ------------------
  |  Branch (4803:5): [True: 8, False: 1.34k]
  ------------------
 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.35k|    }
 4808|       |
 4809|       |    /*
 4810|       |     * get header for variable-bindings sequence 
 4811|       |     */
 4812|    848|    DEBUGDUMPSECTION("recv", "VarBindList");
  ------------------
  |  |   81|    848|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    848|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 848]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 848]
  |  |  ------------------
  ------------------
 4813|    848|    data = asn_parse_sequence(data, length, &type,
 4814|    848|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   84|    848|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   96|    848|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 4815|    848|                              "varbinds");
 4816|    848|    if (data == NULL)
  ------------------
  |  Branch (4816:9): [True: 121, False: 727]
  ------------------
 4817|    121|        goto fail;
 4818|       |
 4819|       |    /*
 4820|       |     * get each varBind sequence 
 4821|       |     */
 4822|  17.0k|    while ((int) *length > 0) {
  ------------------
  |  Branch (4822:12): [True: 16.9k, False: 131]
  ------------------
 4823|  16.9k|        vp = SNMP_MALLOC_TYPEDEF(netsnmp_variable_list);
  ------------------
  |  |   73|  16.9k|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
 4824|  16.9k|        if (NULL == vp)
  ------------------
  |  Branch (4824:13): [True: 0, False: 16.9k]
  ------------------
 4825|      0|            goto fail;
 4826|       |
 4827|  16.9k|        vp->name_length = MAX_OID_LEN;
  ------------------
  |  |  106|  16.9k|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
 4828|  16.9k|        DEBUGDUMPSECTION("recv", "VarBind");
  ------------------
  |  |   81|  16.9k|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  16.9k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 16.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 16.9k]
  |  |  ------------------
  ------------------
 4829|  16.9k|        data = snmp_parse_var_op(data, objid, &vp->name_length, &vp->type,
 4830|  16.9k|                                 &vp->val_len, &var_val, length);
 4831|  16.9k|        if (data == NULL)
  ------------------
  |  Branch (4831:13): [True: 381, False: 16.5k]
  ------------------
 4832|    381|            goto fail;
 4833|  16.5k|        if (snmp_set_var_objid(vp, objid, vp->name_length))
  ------------------
  |  Branch (4833:13): [True: 0, False: 16.5k]
  ------------------
 4834|      0|            goto fail;
 4835|       |
 4836|  16.5k|        len = SNMP_MAX_PACKET_LEN;
  ------------------
  |  |   49|  16.5k|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
 4837|  16.5k|        DEBUGDUMPHEADER("recv", "Value");
  ------------------
  |  |   79|  16.5k|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  16.5k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 16.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 16.5k]
  |  |  ------------------
  ------------------
 4838|  16.5k|        switch ((short) vp->type) {
 4839|  1.54k|        case ASN_INTEGER:
  ------------------
  |  |   75|  1.54k|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (4839:9): [True: 1.54k, False: 15.0k]
  ------------------
 4840|  1.54k|            vp->val.integer = (long *) vp->buf;
 4841|  1.54k|            vp->val_len = sizeof(long);
 4842|  1.54k|            p = asn_parse_int(var_val, &len, &vp->type,
 4843|  1.54k|                          (long *) vp->val.integer,
 4844|  1.54k|                          sizeof(*vp->val.integer));
 4845|  1.54k|            if (!p)
  ------------------
  |  Branch (4845:17): [True: 3, False: 1.53k]
  ------------------
 4846|      3|                goto fail;
 4847|  1.53k|            break;
 4848|  1.53k|        case ASN_COUNTER:
  ------------------
  |  |   89|    934|#define ASN_COUNTER	(ASN_APPLICATION | 1)
  |  |  ------------------
  |  |  |  |   91|    934|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4848:9): [True: 934, False: 15.6k]
  ------------------
 4849|  1.65k|        case ASN_GAUGE:
  ------------------
  |  |   90|  1.65k|#define ASN_GAUGE	(ASN_APPLICATION | 2)
  |  |  ------------------
  |  |  |  |   91|  1.65k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4849:9): [True: 724, False: 15.8k]
  ------------------
 4850|  2.32k|        case ASN_TIMETICKS:
  ------------------
  |  |   92|  2.32k|#define ASN_TIMETICKS   (ASN_APPLICATION | 3)
  |  |  ------------------
  |  |  |  |   91|  2.32k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4850:9): [True: 664, False: 15.8k]
  ------------------
 4851|  2.99k|        case ASN_UINTEGER:
  ------------------
  |  |  100|  2.99k|#define ASN_UINTEGER    (ASN_APPLICATION | 7)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|  2.99k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4851:9): [True: 670, False: 15.8k]
  ------------------
 4852|  2.99k|            vp->val.integer = (long *) vp->buf;
 4853|  2.99k|            vp->val_len = sizeof(u_long);
 4854|  2.99k|            p = asn_parse_unsigned_int(var_val, &len, &vp->type,
 4855|  2.99k|                                   (u_long *) vp->val.integer,
 4856|  2.99k|                                   vp->val_len);
 4857|  2.99k|            if (!p)
  ------------------
  |  Branch (4857:17): [True: 16, False: 2.97k]
  ------------------
 4858|     16|                goto fail;
 4859|  2.97k|            break;
 4860|  2.97k|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 4861|  2.97k|        case ASN_OPAQUE_COUNTER64:
  ------------------
  |  |  156|    664|#define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  136|    664|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  146|    664|#define ASN_APP_COUNTER64 (ASN_APPLICATION | 6)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    664|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4861:9): [True: 664, False: 15.8k]
  ------------------
 4862|  1.50k|        case ASN_OPAQUE_U64:
  ------------------
  |  |  192|  1.50k|#define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  136|  1.50k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  150|  1.50k|#define ASN_APP_U64 (ASN_APPLICATION | 11)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.50k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4862:9): [True: 843, False: 15.7k]
  ------------------
 4863|  1.50k|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 4864|  2.77k|        case ASN_COUNTER64:
  ------------------
  |  |   99|  2.77k|#define ASN_COUNTER64   (ASN_APPLICATION | 6)
  |  |  ------------------
  |  |  |  |   91|  2.77k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4864:9): [True: 1.27k, False: 15.2k]
  ------------------
 4865|  2.77k|            vp->val.counter64 = (struct counter64 *) vp->buf;
 4866|  2.77k|            vp->val_len = sizeof(struct counter64);
 4867|  2.77k|            p = asn_parse_unsigned_int64(var_val, &len, &vp->type,
 4868|  2.77k|                                     (struct counter64 *) vp->val.
 4869|  2.77k|                                     counter64, vp->val_len);
 4870|  2.77k|            if (!p)
  ------------------
  |  Branch (4870:17): [True: 41, False: 2.73k]
  ------------------
 4871|     41|                goto fail;
 4872|  2.73k|            break;
 4873|  2.73k|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 4874|  2.73k|        case ASN_OPAQUE_FLOAT:
  ------------------
  |  |  165|    571|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|    571|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|    571|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    571|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4874:9): [True: 571, False: 15.9k]
  ------------------
 4875|    571|            vp->val.floatVal = (float *) vp->buf;
 4876|    571|            vp->val_len = sizeof(float);
 4877|    571|            p = asn_parse_float(var_val, &len, &vp->type,
 4878|    571|                            vp->val.floatVal, vp->val_len);
 4879|    571|            if (!p)
  ------------------
  |  Branch (4879:17): [True: 41, False: 530]
  ------------------
 4880|     41|                goto fail;
 4881|    530|            break;
 4882|    856|        case ASN_OPAQUE_DOUBLE:
  ------------------
  |  |  174|    856|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|    856|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|    856|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    856|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4882:9): [True: 856, False: 15.6k]
  ------------------
 4883|    856|            vp->val.doubleVal = (double *) vp->buf;
 4884|    856|            vp->val_len = sizeof(double);
 4885|    856|            p = asn_parse_double(var_val, &len, &vp->type,
 4886|    856|                             vp->val.doubleVal, vp->val_len);
 4887|    856|            if (!p)
  ------------------
  |  Branch (4887:17): [True: 45, False: 811]
  ------------------
 4888|     45|                goto fail;
 4889|    811|            break;
 4890|  1.34k|        case ASN_OPAQUE_I64:
  ------------------
  |  |  183|  1.34k|#define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  136|  1.34k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  149|  1.34k|#define ASN_APP_I64 (ASN_APPLICATION | 10)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.34k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4890:9): [True: 1.34k, False: 15.2k]
  ------------------
 4891|  1.34k|            vp->val.counter64 = (struct counter64 *) vp->buf;
 4892|  1.34k|            vp->val_len = sizeof(struct counter64);
 4893|  1.34k|            p = asn_parse_signed_int64(var_val, &len, &vp->type,
 4894|  1.34k|                                   (struct counter64 *) vp->val.counter64,
 4895|  1.34k|                                   sizeof(*vp->val.counter64));
 4896|       |
 4897|  1.34k|            if (!p)
  ------------------
  |  Branch (4897:17): [True: 45, False: 1.29k]
  ------------------
 4898|     45|                goto fail;
 4899|  1.29k|            break;
 4900|  1.29k|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 4901|  1.29k|        case ASN_IPADDRESS:
  ------------------
  |  |   88|    250|#define ASN_IPADDRESS   (ASN_APPLICATION | 0)
  |  |  ------------------
  |  |  |  |   91|    250|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4901:9): [True: 250, False: 16.2k]
  ------------------
 4902|    250|            if (vp->val_len != 4)
  ------------------
  |  Branch (4902:17): [True: 2, False: 248]
  ------------------
 4903|      2|                goto fail;
 4904|    248|            NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2408|    248|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 4905|    932|        case ASN_OCTET_STR:
  ------------------
  |  |   78|    932|#define ASN_OCTET_STR	    0x04U
  ------------------
  |  Branch (4905:9): [True: 684, False: 15.8k]
  ------------------
 4906|  2.11k|        case ASN_OPAQUE:
  ------------------
  |  |   93|  2.11k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  2.11k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4906:9): [True: 1.17k, False: 15.3k]
  ------------------
 4907|  2.81k|        case ASN_NSAP:
  ------------------
  |  |   98|  2.81k|#define ASN_NSAP	(ASN_APPLICATION | 5)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|  2.81k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4907:9): [True: 705, False: 15.8k]
  ------------------
 4908|  2.81k|            if (vp->val_len < sizeof(vp->buf)) {
  ------------------
  |  Branch (4908:17): [True: 2.58k, False: 227]
  ------------------
 4909|  2.58k|                vp->val.string = (u_char *) vp->buf;
 4910|  2.58k|            } else {
 4911|    227|                vp->val.string = (u_char *) malloc(vp->val_len);
 4912|    227|            }
 4913|  2.81k|            if (vp->val.string == NULL) {
  ------------------
  |  Branch (4913:17): [True: 0, False: 2.81k]
  ------------------
 4914|      0|                goto fail;
 4915|      0|            }
 4916|  2.81k|            p = asn_parse_string(var_val, &len, &vp->type, vp->val.string,
 4917|  2.81k|                             &vp->val_len);
 4918|  2.81k|            if (!p)
  ------------------
  |  Branch (4918:17): [True: 0, False: 2.81k]
  ------------------
 4919|      0|                goto fail;
 4920|  2.81k|            break;
 4921|  2.81k|        case ASN_OBJECT_ID:
  ------------------
  |  |   81|    836|#define ASN_OBJECT_ID	    0x06U
  ------------------
  |  Branch (4921:9): [True: 836, False: 15.7k]
  ------------------
 4922|    836|            vp->val_len = MAX_OID_LEN;
  ------------------
  |  |  106|    836|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
 4923|    836|            p = asn_parse_objid(var_val, &len, &vp->type, objid, &vp->val_len);
 4924|    836|            if (!p)
  ------------------
  |  Branch (4924:17): [True: 3, False: 833]
  ------------------
 4925|      3|                goto fail;
 4926|    833|            vp->val_len *= sizeof(oid);
 4927|    833|            vp->val.objid = netsnmp_memdup(objid, vp->val_len);
 4928|    833|            if (vp->val.objid == NULL)
  ------------------
  |  Branch (4928:17): [True: 0, False: 833]
  ------------------
 4929|      0|                goto fail;
 4930|    833|            break;
 4931|    833|        case SNMP_NOSUCHOBJECT:
  ------------------
  |  |  201|    318|#define SNMP_NOSUCHOBJECT    (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) /* 80=128 */
  |  |  ------------------
  |  |  |  |   92|    318|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_NOSUCHOBJECT    (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) /* 80=128 */
  |  |  ------------------
  |  |  |  |   95|    318|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (4931:9): [True: 318, False: 16.2k]
  ------------------
 4932|  1.05k|        case SNMP_NOSUCHINSTANCE:
  ------------------
  |  |  202|  1.05k|#define SNMP_NOSUCHINSTANCE  (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* 81=129 */
  |  |  ------------------
  |  |  |  |   92|  1.05k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_NOSUCHINSTANCE  (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* 81=129 */
  |  |  ------------------
  |  |  |  |   95|  1.05k|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (4932:9): [True: 741, False: 15.8k]
  ------------------
 4933|  1.58k|        case SNMP_ENDOFMIBVIEW:
  ------------------
  |  |  203|  1.58k|#define SNMP_ENDOFMIBVIEW    (ASN_CONTEXT | ASN_PRIMITIVE | 0x2) /* 82=130 */
  |  |  ------------------
  |  |  |  |   92|  1.58k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_ENDOFMIBVIEW    (ASN_CONTEXT | ASN_PRIMITIVE | 0x2) /* 82=130 */
  |  |  ------------------
  |  |  |  |   95|  1.58k|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (4933:9): [True: 525, False: 16.0k]
  ------------------
 4934|  1.97k|        case ASN_NULL:
  ------------------
  |  |   79|  1.97k|#define ASN_NULL	    0x05U
  ------------------
  |  Branch (4934:9): [True: 388, False: 16.1k]
  ------------------
 4935|  1.97k|            break;
 4936|    829|        case ASN_BIT_STR:
  ------------------
  |  |   77|    829|#define ASN_BIT_STR	    0x03U
  ------------------
  |  Branch (4936:9): [True: 829, False: 15.7k]
  ------------------
 4937|    829|            vp->val.bitstring = (u_char *) malloc(vp->val_len);
 4938|    829|            if (vp->val.bitstring == NULL) {
  ------------------
  |  Branch (4938:17): [True: 0, False: 829]
  ------------------
 4939|      0|                goto fail;
 4940|      0|            }
 4941|    829|            p = asn_parse_bitstring(var_val, &len, &vp->type,
 4942|    829|                                vp->val.bitstring, &vp->val_len);
 4943|    829|            if (!p)
  ------------------
  |  Branch (4943:17): [True: 6, False: 823]
  ------------------
 4944|      6|                goto fail;
 4945|    823|            break;
 4946|    823|        default:
  ------------------
  |  Branch (4946:9): [True: 13, False: 16.5k]
  ------------------
 4947|     13|            snmp_log(LOG_ERR, "bad type returned (%x)\n", vp->type);
 4948|     13|            goto fail;
 4949|      0|            break;
 4950|  16.5k|        }
 4951|  16.3k|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|  16.3k|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  16.3k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 16.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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.3k]
  |  |  ------------------
  ------------------
 4952|       |
 4953|  16.3k|        if (NULL == vplast) {
  ------------------
  |  Branch (4953:13): [True: 562, False: 15.7k]
  ------------------
 4954|    562|            pdu->variables = vp;
 4955|  15.7k|        } else {
 4956|  15.7k|            vplast->next_variable = vp;
 4957|  15.7k|        }
 4958|  16.3k|        vplast = vp;
 4959|  16.3k|        vp = NULL;
 4960|  16.3k|    }
 4961|    131|    return 0;
 4962|       |
 4963|    717|  fail:
 4964|    717|    {
 4965|    717|        const char *errstr = snmp_api_errstring(SNMPERR_SUCCESS);
  ------------------
  |  |  217|    717|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 4966|    717|        DEBUGMSGTL(("recv", "error while parsing VarBindList:%s\n", errstr));
  ------------------
  |  |   66|    717|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    717|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 717]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 717]
  |  |  ------------------
  ------------------
 4967|    717|    }
 4968|       |    /** if we were parsing a var, remove it from the pdu and free it */
 4969|    717|    if (vp)
  ------------------
  |  Branch (4969:9): [True: 596, False: 121]
  ------------------
 4970|    596|        snmp_free_var(vp);
 4971|       |
 4972|    717|    return -1;
 4973|    727|}
snmp_free_var_internals:
 5569|  16.9k|{
 5570|  16.9k|    if (!var)
  ------------------
  |  Branch (5570:9): [True: 0, False: 16.9k]
  ------------------
 5571|      0|        return;
 5572|       |
 5573|  16.9k|    if (var->name != var->name_loc)
  ------------------
  |  Branch (5573:9): [True: 381, False: 16.5k]
  ------------------
 5574|    381|        SNMP_FREE(var->name);
  ------------------
  |  |   62|    381|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 381]
  |  |  |  Branch (62:66): [Folded, False: 381]
  |  |  ------------------
  ------------------
 5575|  16.9k|    if (var->val.string != var->buf)
  ------------------
  |  Branch (5575:9): [True: 4.26k, False: 12.6k]
  ------------------
 5576|  4.26k|        SNMP_FREE(var->val.string);
  ------------------
  |  |   62|  4.26k|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 1.88k, False: 2.37k]
  |  |  |  Branch (62:66): [Folded, False: 4.26k]
  |  |  ------------------
  ------------------
 5577|  16.9k|    if (var->data) {
  ------------------
  |  Branch (5577:9): [True: 0, False: 16.9k]
  ------------------
 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|  16.9k|}
snmp_free_var:
 5589|  16.9k|{
 5590|  16.9k|    snmp_free_var_internals(var);
 5591|  16.9k|    free(var);
 5592|  16.9k|}
snmp_free_varbind:
 5596|  5.34k|{
 5597|  5.34k|    netsnmp_variable_list *ptr;
 5598|  21.6k|    while (var) {
  ------------------
  |  Branch (5598:12): [True: 16.3k, False: 5.34k]
  ------------------
 5599|  16.3k|        ptr = var->next_variable;
 5600|  16.3k|        snmp_free_var(var);
 5601|  16.3k|        var = ptr;
 5602|  16.3k|    }
 5603|  5.34k|}
snmp_free_pdu:
 5610|  5.34k|{
 5611|  5.34k|    struct snmp_secmod_def *sptr;
 5612|       |
 5613|  5.34k|    if (!pdu)
  ------------------
  |  Branch (5613:9): [True: 0, False: 5.34k]
  ------------------
 5614|      0|        return;
 5615|       |
 5616|  5.34k|    free_securityStateRef(pdu);
 5617|       |
 5618|  5.34k|    sptr = find_sec_mod(pdu->securityModel);
 5619|  5.34k|    if (sptr && sptr->pdu_free)
  ------------------
  |  Branch (5619:9): [True: 0, False: 5.34k]
  |  Branch (5619:17): [True: 0, False: 0]
  ------------------
 5620|      0|        (*sptr->pdu_free)(pdu);
 5621|       |
 5622|  5.34k|    snmp_free_varbind(pdu->variables);
 5623|  5.34k|    free(pdu->enterprise);
 5624|  5.34k|    free(pdu->community);
 5625|  5.34k|    free(pdu->contextEngineID);
 5626|  5.34k|    free(pdu->securityEngineID);
 5627|  5.34k|    free(pdu->contextName);
 5628|  5.34k|    free(pdu->securityName);
 5629|  5.34k|    free(pdu->transport_data);
 5630|  5.34k|    free(pdu);
 5631|  5.34k|}
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.34k|{
 4139|  5.34k|    struct snmp_secmod_def *sptr;
 4140|       |
 4141|  5.34k|    if (!pdu->securityStateRef)
  ------------------
  |  Branch (4141:9): [True: 5.34k, False: 0]
  ------------------
 4142|  5.34k|        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.67k|{
 4365|  2.67k|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 4366|  2.67k|    u_char          community[COMMUNITY_MAX_LEN];
 4367|  2.67k|    size_t          community_length = COMMUNITY_MAX_LEN;
  ------------------
  |  |   41|  2.67k|#define COMMUNITY_MAX_LEN	256
  ------------------
 4368|  2.67k|#endif
 4369|  2.67k|    int             result = -1;
 4370|       |
 4371|  2.67k|    static const oid snmpEngineIDoid[]   = { 1,3,6,1,6,3,10,2,1,1,0};
 4372|  2.67k|    static size_t   snmpEngineIDoid_len = 11;
 4373|       |
 4374|  2.67k|    static char     ourEngineID[SNMP_SEC_PARAM_BUF_SIZE];
 4375|  2.67k|    static size_t   ourEngineID_len = sizeof(ourEngineID);
 4376|       |
 4377|  2.67k|    netsnmp_pdu    *pdu2 = NULL;
 4378|       |
 4379|  2.67k|    session->s_snmp_errno = 0;
 4380|  2.67k|    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.67k|    pdu->transid = snmp_get_next_transid();
 4388|       |
 4389|  2.67k|    if (session->version != SNMP_DEFAULT_VERSION) {
  ------------------
  |  |  123|  2.67k|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  |  Branch (4389:9): [True: 2.67k, False: 0]
  ------------------
 4390|  2.67k|        pdu->version = session->version;
 4391|  2.67k|    } else {
 4392|      0|        pdu->version = snmp_parse_version(data, length);
 4393|      0|    }
 4394|       |
 4395|  2.67k|    switch (pdu->version) {
 4396|      0|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 4397|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 4398|  2.67k|    case SNMP_VERSION_1:
  ------------------
  |  |  107|  2.67k|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (4398:5): [True: 2.67k, False: 0]
  ------------------
 4399|  2.67k|#endif
 4400|  2.67k|#ifndef NETSNMP_DISABLE_SNMPV2C
 4401|  2.67k|    case SNMP_VERSION_2c:
  ------------------
  |  |  110|  2.67k|#define SNMP_VERSION_2c    1
  ------------------
  |  Branch (4401:5): [True: 0, False: 2.67k]
  ------------------
 4402|  2.67k|#endif
 4403|  2.67k|        NETSNMP_RUNTIME_PROTOCOL_CHECK_V1V2(pdu->version,unsupported_version);
  ------------------
  |  |  220|  2.67k|#define NETSNMP_RUNTIME_PROTOCOL_CHECK_V1V2(pc_ver, pc_target) do {    \
  |  |  221|  2.67k|        if (NETSNMP_RUNTIME_PROTOCOL_SKIP_V1(pc_ver) ||                \
  |  |  ------------------
  |  |  |  |  205|  5.34k|    ((pc_ver) == SNMP_VERSION_1 &&                                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |  107|  5.34k|#define SNMP_VERSION_1	   0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (205:6): [True: 2.67k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  206|  5.34k|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|  2.67k|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (206:6): [True: 0, False: 2.67k]
  |  |  |  |  ------------------
  |  |  |  |  207|  2.67k|                            NETSNMP_DS_LIB_DISABLE_V1))
  |  |  |  |  ------------------
  |  |  |  |  |  |  103|  2.67k|#define NETSNMP_DS_LIB_DISABLE_V1          43 /* disable SNMPv1 */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  222|  2.67k|            NETSNMP_RUNTIME_PROTOCOL_SKIP_V2(pc_ver)) {                \
  |  |  ------------------
  |  |  |  |  215|  2.67k|    ((pc_ver) == SNMP_VERSION_2c &&                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  5.34k|#define SNMP_VERSION_2c    1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (215:6): [True: 0, False: 2.67k]
  |  |  |  |  ------------------
  |  |  |  |  216|  2.67k|     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.67k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (226:13): [Folded, False: 2.67k]
  |  |  ------------------
  ------------------
 4404|  2.67k|        DEBUGMSGTL(("snmp_api", "Parsing SNMPv%ld message...\n",
  ------------------
  |  |   66|  2.67k|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.67k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.67k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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.67k]
  |  |  ------------------
  ------------------
 4405|  2.67k|                    (1 + pdu->version)));
 4406|       |
 4407|       |        /*
 4408|       |         * authenticates message and returns length if valid 
 4409|       |         */
 4410|  2.67k|#ifndef NETSNMP_DISABLE_SNMPV1
 4411|  2.67k|        if (pdu->version == SNMP_VERSION_1) {
  ------------------
  |  |  107|  2.67k|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (4411:13): [True: 2.67k, False: 0]
  ------------------
 4412|  2.67k|            DEBUGDUMPSECTION("recv", "SNMPv1 message\n");
  ------------------
  |  |   81|  2.67k|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.67k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.67k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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.67k]
  |  |  ------------------
  ------------------
 4413|  2.67k|        } 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.67k|#endif
 4419|  2.67k|        data = snmp_comstr_parse(data, &length,
 4420|  2.67k|                                 community, &community_length,
 4421|  2.67k|                                 &pdu->version);
 4422|  2.67k|        if (data == NULL)
  ------------------
  |  Branch (4422:13): [True: 1.21k, False: 1.45k]
  ------------------
 4423|  1.21k|            return -1;
 4424|       |
 4425|  1.45k|        if (pdu->version != session->version &&
  ------------------
  |  Branch (4425:13): [True: 86, False: 1.36k]
  ------------------
 4426|     86|            session->version != SNMP_DEFAULT_VERSION) {
  ------------------
  |  |  123|     86|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  |  Branch (4426:13): [True: 86, False: 0]
  ------------------
 4427|     86|            session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  231|     86|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 4428|     86|            return -1;
 4429|     86|        }
 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: 50, False: 1.31k]
  ------------------
 4444|     50|            pdu->community_len = community_length;
 4445|     50|            pdu->community = netsnmp_memdup(community, community_length);
 4446|     50|            if (pdu->community == NULL) {
  ------------------
  |  Branch (4446:17): [True: 0, False: 50]
  ------------------
 4447|      0|                session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 4448|      0|                return -1;
 4449|      0|            }
 4450|     50|        }
 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: 131]
  ------------------
 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.67k]
  ------------------
 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.67k]
  ------------------
 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.67k]
  ------------------
 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.67k]
  ------------------
 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.67k]
  ------------------
 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.67k]
  ------------------
 4628|      0|    default:
  ------------------
  |  Branch (4628:5): [True: 0, False: 2.67k]
  ------------------
 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.67k|    }
 4642|       |
 4643|  1.36k|    return result;
 4644|  2.67k|}

snmp_comstr_parse:
  109|  2.67k|{
  110|  2.67k|    u_char          type;
  111|  2.67k|    long            ver;
  112|  2.67k|    size_t          origlen = *slen;
  113|       |
  114|       |    /*
  115|       |     * Message is an ASN.1 SEQUENCE.
  116|       |     */
  117|  2.67k|    data = asn_parse_sequence(data, length, &type,
  118|  2.67k|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   84|  2.67k|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   96|  2.67k|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
  119|  2.67k|                              "auth message");
  120|  2.67k|    if (data == NULL) {
  ------------------
  |  Branch (120:9): [True: 303, False: 2.36k]
  ------------------
  121|    303|        return NULL;
  122|    303|    }
  123|       |
  124|       |    /*
  125|       |     * First field is the version.
  126|       |     */
  127|  2.36k|    DEBUGDUMPHEADER("recv", "SNMP version");
  ------------------
  |  |   79|  2.36k|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.36k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.36k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  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.36k]
  |  |  ------------------
  ------------------
  128|  2.36k|    data = asn_parse_int(data, length, &type, &ver, sizeof(ver));
  129|  2.36k|    DEBUGINDENTLESS();
  ------------------
  |  |   75|  2.36k|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.36k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.36k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 2.36k]
  |  |  ------------------
  ------------------
  130|  2.36k|    *version = ver;
  131|  2.36k|    if (data == NULL) {
  ------------------
  |  Branch (131:9): [True: 179, False: 2.18k]
  ------------------
  132|    179|        ERROR_MSG("bad parse of version");
  ------------------
  |  |  188|    179|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  133|    179|        return NULL;
  134|    179|    }
  135|       |
  136|       |    /*
  137|       |     * second field is the community string for SNMPv1 & SNMPv2c 
  138|       |     */
  139|  2.18k|    DEBUGDUMPHEADER("recv", "community string");
  ------------------
  |  |   79|  2.18k|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.18k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.18k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  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.18k]
  |  |  ------------------
  ------------------
  140|  2.18k|    data = asn_parse_string(data, length, &type, psid, slen);
  141|  2.18k|    DEBUGINDENTLESS();
  ------------------
  |  |   75|  2.18k|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.18k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.18k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 2.18k]
  |  |  ------------------
  ------------------
  142|  2.18k|    if (data == NULL) {
  ------------------
  |  Branch (142:9): [True: 734, False: 1.45k]
  ------------------
  143|    734|        ERROR_MSG("bad parse of community");
  ------------------
  |  |  188|    734|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  144|    734|        return NULL;
  145|    734|    }
  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.18k|}                               /* end snmp_comstr_parse() */

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

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

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

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

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

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

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

