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

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

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

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

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

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

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

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

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

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

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

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

