asn_parse_nlength:
  325|  89.5k|{
  326|  89.5k|    int len_len;
  327|       |
  328|  89.5k|    if (pkt_len < 1)
  ------------------
  |  Branch (328:9): [True: 0, False: 89.5k]
  ------------------
  329|      0|        return NULL;               /* always too short */
  330|       |
  331|  89.5k|    if (NULL == pkt || NULL == data_len)
  ------------------
  |  Branch (331:9): [True: 0, False: 89.5k]
  |  Branch (331:24): [True: 0, False: 89.5k]
  ------------------
  332|      0|        return NULL;
  333|       |
  334|  89.5k|    *data_len = 0;
  335|       |
  336|  89.5k|    if (*pkt & 0x80) {
  ------------------
  |  Branch (336:9): [True: 11.5k, False: 77.9k]
  ------------------
  337|       |        /*
  338|       |         * long length; first byte is length of length (after masking high bit)
  339|       |         */
  340|  11.5k|        len_len = (int) ((*pkt & ~0x80) + 1);
  341|  11.5k|        if (pkt_len < len_len)
  ------------------
  |  Branch (341:13): [True: 135, False: 11.4k]
  ------------------
  342|    135|            return NULL;           /* still too short for length and data */
  343|       |
  344|       |        /* now we know we have enough data to parse length */
  345|  11.4k|        if (NULL == asn_parse_length(pkt, data_len))
  ------------------
  |  Branch (345:13): [True: 386, False: 11.0k]
  ------------------
  346|    386|            return NULL;           /* propagate error from asn_parse_length */
  347|  77.9k|    } else {
  348|       |        /*
  349|       |         * short length; first byte is the length
  350|       |         */
  351|  77.9k|        len_len = 1;
  352|  77.9k|        *data_len = *pkt;
  353|  77.9k|    }
  354|       |
  355|  89.0k|    if ((*data_len + len_len) > pkt_len)
  ------------------
  |  Branch (355:9): [True: 985, False: 88.0k]
  ------------------
  356|    985|        return NULL;
  357|       |
  358|  88.0k|    return (pkt + len_len);
  359|  89.0k|}
asn_parse_int:
  557|  9.15k|{
  558|       |    /*
  559|       |     * ASN.1 integer ::= 0x02 asnlength byte {byte}*
  560|       |     */
  561|  9.15k|    static const char *errpre = "parse int";
  562|  9.15k|    register u_char *bufp = data;
  563|  9.15k|    u_long          asn_length;
  564|  9.15k|    int             i;
  565|  9.15k|    union {
  566|  9.15k|        long          l;
  567|  9.15k|        unsigned char b[sizeof(long)];
  568|  9.15k|    } value;
  569|       |
  570|  9.15k|    if (NULL == data || NULL == datalength || NULL == type || NULL == intp) {
  ------------------
  |  Branch (570:9): [True: 0, False: 9.15k]
  |  Branch (570:25): [True: 0, False: 9.15k]
  |  Branch (570:47): [True: 0, False: 9.15k]
  |  Branch (570:63): [True: 0, False: 9.15k]
  ------------------
  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.15k|    if (intsize != sizeof(long)) {
  ------------------
  |  Branch (575:9): [True: 0, False: 9.15k]
  ------------------
  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.15k|    if (*datalength < 2) {
  ------------------
  |  Branch (581:9): [True: 83, False: 9.07k]
  ------------------
  582|     83|        _asn_short_err(errpre, *datalength, 2);
  583|     83|        return NULL;
  584|     83|    }
  585|       |
  586|  9.07k|    *type = *bufp++;
  587|  9.07k|    if (*type != ASN_INTEGER) {
  ------------------
  |  |   75|  9.07k|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (587:9): [True: 33, False: 9.04k]
  ------------------
  588|     33|        _asn_type_err(errpre, *type);
  589|     33|        return NULL;
  590|     33|    }
  591|       |
  592|  9.04k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
  593|  9.04k|    if (NULL == bufp) {
  ------------------
  |  Branch (593:9): [True: 314, False: 8.72k]
  ------------------
  594|    314|        _asn_short_err(errpre, *datalength - 1, asn_length);
  595|    314|        return NULL;
  596|    314|    }
  597|       |
  598|  8.72k|    if ((size_t) asn_length > intsize || (int) asn_length == 0) {
  ------------------
  |  Branch (598:9): [True: 29, False: 8.69k]
  |  Branch (598:42): [True: 17, False: 8.68k]
  ------------------
  599|     46|        _asn_length_err(errpre, (size_t) asn_length, intsize);
  600|     46|        return NULL;
  601|     46|    }
  602|       |
  603|  8.68k|    *datalength -= (int) asn_length + (bufp - data);
  604|       |
  605|  8.68k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|  8.68k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  8.68k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 8.68k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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.68k]
  |  |  ------------------
  ------------------
  606|       |
  607|  8.68k|    memset(&value.b, *bufp & 0x80 ? 0xff : 0, sizeof(value.b));
  ------------------
  |  Branch (607:22): [True: 1.75k, False: 6.93k]
  ------------------
  608|  8.68k|    if (NETSNMP_BIGENDIAN) {
  ------------------
  |  | 2422|  8.68k|#  define NETSNMP_BIGENDIAN 0
  |  |  ------------------
  |  |  |  Branch (2422:29): [Folded, False: 8.68k]
  |  |  ------------------
  ------------------
  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.68k|    } else {
  612|  24.4k|        for (i = asn_length - 1; asn_length--; i--)
  ------------------
  |  Branch (612:34): [True: 15.7k, False: 8.68k]
  ------------------
  613|  15.7k|            value.b[i] = *bufp++;
  614|  8.68k|    }
  615|       |
  616|  8.68k|    CHECK_OVERFLOW_S(value.l, 1);
  ------------------
  |  |  214|  8.68k|#define CHECK_OVERFLOW_S(x,y) do {                                      \
  |  |  215|  8.68k|        if (x > INT32_MAX) {                                            \
  |  |  ------------------
  |  |  |  Branch (215:13): [True: 570, False: 8.11k]
  |  |  ------------------
  |  |  216|    570|            DEBUGMSG(("asn","truncating signed value %ld to 32 bits (%d)\n",(long)(x),y)); \
  |  |  ------------------
  |  |  |  |   61|    570|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|    570|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 570]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 570]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  217|    570|            x &= 0xffffffff;                                            \
  |  |  218|  8.11k|        } else if (x < INT32_MIN) {                                     \
  |  |  ------------------
  |  |  |  Branch (218:20): [True: 442, False: 7.67k]
  |  |  ------------------
  |  |  219|    442|            DEBUGMSG(("asn","truncating signed value %ld to 32 bits (%d)\n",(long)(x),y)); \
  |  |  ------------------
  |  |  |  |   61|    442|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|    442|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 442]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 442]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  220|    442|            x = 0 - (x & 0xffffffff);                                   \
  |  |  221|    442|        }                                                               \
  |  |  222|  8.68k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (222:13): [Folded, False: 8.68k]
  |  |  ------------------
  ------------------
  617|       |
  618|  8.68k|    DEBUGMSG(("dumpv_recv", "  Integer:\t%ld (0x%.2lX)\n", value.l, value.l));
  ------------------
  |  |   61|  8.68k|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|  8.68k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 8.68k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 8.68k]
  |  |  ------------------
  ------------------
  619|       |
  620|  8.68k|    *intp = value.l;
  621|  8.68k|    return bufp;
  622|  8.72k|}
asn_parse_unsigned_int:
  650|  3.37k|{
  651|       |    /*
  652|       |     * ASN.1 integer ::= 0x02 asnlength byte {byte}*
  653|       |     */
  654|  3.37k|    static const char *errpre = "parse uint";
  655|  3.37k|    register u_char *bufp = data;
  656|  3.37k|    u_long          asn_length;
  657|  3.37k|    register u_long value = 0;
  658|       |
  659|  3.37k|    if (NULL == data || NULL == datalength || NULL == type || NULL == intp) {
  ------------------
  |  Branch (659:9): [True: 0, False: 3.37k]
  |  Branch (659:25): [True: 0, False: 3.37k]
  |  Branch (659:47): [True: 0, False: 3.37k]
  |  Branch (659:63): [True: 0, False: 3.37k]
  ------------------
  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.37k|    if (intsize != sizeof(long)) {
  ------------------
  |  Branch (664:9): [True: 0, False: 3.37k]
  ------------------
  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.37k|    if (*datalength < 2) {
  ------------------
  |  Branch (670:9): [True: 2, False: 3.37k]
  ------------------
  671|      2|        _asn_short_err(errpre, *datalength, 2);
  672|      2|        return NULL;
  673|      2|    }
  674|       |
  675|  3.37k|    *type = *bufp++;
  676|  3.37k|    if (*type != ASN_COUNTER && *type != ASN_GAUGE && *type != ASN_TIMETICKS
  ------------------
  |  |   89|  6.74k|#define ASN_COUNTER	(ASN_APPLICATION | 1)
  |  |  ------------------
  |  |  |  |   91|  3.37k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if (*type != ASN_COUNTER && *type != ASN_GAUGE && *type != ASN_TIMETICKS
  ------------------
  |  |   90|  5.72k|#define ASN_GAUGE	(ASN_APPLICATION | 2)
  |  |  ------------------
  |  |  |  |   91|  2.35k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if (*type != ASN_COUNTER && *type != ASN_GAUGE && *type != ASN_TIMETICKS
  ------------------
  |  |   92|  4.94k|#define ASN_TIMETICKS   (ASN_APPLICATION | 3)
  |  |  ------------------
  |  |  |  |   91|  1.56k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (676:9): [True: 2.35k, False: 1.02k]
  |  Branch (676:33): [True: 1.56k, False: 785]
  |  Branch (676:55): [True: 848, False: 720]
  ------------------
  677|    848|            && *type != ASN_UINTEGER) {
  ------------------
  |  |  100|    848|#define ASN_UINTEGER    (ASN_APPLICATION | 7)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|    848|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (677:16): [True: 19, False: 829]
  ------------------
  678|     19|        _asn_type_err(errpre, *type);
  679|     19|        return NULL;
  680|     19|    }
  681|       |
  682|  3.35k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
  683|  3.35k|    if (NULL == bufp) {
  ------------------
  |  Branch (683:9): [True: 122, False: 3.23k]
  ------------------
  684|    122|        _asn_short_err(errpre, *datalength - 1, asn_length);
  685|    122|        return NULL;
  686|    122|    }
  687|       |
  688|  3.23k|    if ((asn_length > (intsize + 1)) || ((int) asn_length == 0) ||
  ------------------
  |  Branch (688:9): [True: 15, False: 3.21k]
  |  Branch (688:41): [True: 17, False: 3.20k]
  ------------------
  689|  3.20k|        ((asn_length == intsize + 1) && *bufp != 0x00)) {
  ------------------
  |  Branch (689:10): [True: 269, False: 2.93k]
  |  Branch (689:41): [True: 8, False: 261]
  ------------------
  690|     40|        _asn_length_err(errpre, (size_t) asn_length, intsize);
  691|     40|        return NULL;
  692|     40|    }
  693|  3.19k|    *datalength -= (int) asn_length + (bufp - data);
  694|       |
  695|  3.19k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|  3.19k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  3.19k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3.19k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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.19k]
  |  |  ------------------
  ------------------
  696|       |
  697|  12.6k|    while (asn_length--)
  ------------------
  |  Branch (697:12): [True: 9.43k, False: 3.19k]
  ------------------
  698|  9.43k|        value = (value << 8) | *bufp++;
  699|       |
  700|  3.19k|    CHECK_OVERFLOW_U(value,2);
  ------------------
  |  |  224|  3.19k|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|  3.19k|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 866, False: 2.32k]
  |  |  ------------------
  |  |  226|    866|            x &= 0xffffffff;                                            \
  |  |  227|    866|            DEBUGMSG(("asn","truncating unsigned value to 32 bits (%d)\n",y)); \
  |  |  ------------------
  |  |  |  |   61|    866|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|    866|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 866]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 866]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  228|    866|        }                                                               \
  |  |  229|  3.19k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 3.19k]
  |  |  ------------------
  ------------------
  701|       |
  702|  3.19k|    DEBUGMSG(("dumpv_recv", "  UInteger:\t%ld (0x%.2lX)\n", value, value));
  ------------------
  |  |   61|  3.19k|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|  3.19k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3.19k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 3.19k]
  |  |  ------------------
  ------------------
  703|       |
  704|  3.19k|    *intp = value;
  705|  3.19k|    return bufp;
  706|  3.23k|}
asn_parse_string:
  910|  6.12k|{
  911|  6.12k|    static const char *errpre = "parse string";
  912|  6.12k|    u_char         *bufp = data;
  913|  6.12k|    u_long          asn_length;
  914|       |
  915|  6.12k|    if (NULL == data || NULL == datalength || NULL == type || NULL == str ||
  ------------------
  |  Branch (915:9): [True: 0, False: 6.12k]
  |  Branch (915:25): [True: 0, False: 6.12k]
  |  Branch (915:47): [True: 0, False: 6.12k]
  |  Branch (915:63): [True: 0, False: 6.12k]
  ------------------
  916|  6.12k|        NULL == strlength) {
  ------------------
  |  Branch (916:9): [True: 0, False: 6.12k]
  ------------------
  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.12k|    if (*datalength < 2) {
  ------------------
  |  Branch (922:9): [True: 300, False: 5.82k]
  ------------------
  923|    300|        _asn_short_err(errpre, *datalength, 2);
  924|    300|        return NULL;
  925|    300|    }
  926|       |
  927|  5.82k|    *type = *bufp++;
  928|  5.82k|    if (*type != ASN_OCTET_STR && *type != ASN_IPADDRESS && *type != ASN_OPAQUE
  ------------------
  |  |   78|  11.6k|#define ASN_OCTET_STR	    0x04U
  ------------------
                  if (*type != ASN_OCTET_STR && *type != ASN_IPADDRESS && *type != ASN_OPAQUE
  ------------------
  |  |   88|  9.67k|#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.07k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  3.25k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (928:9): [True: 3.84k, False: 1.98k]
  |  Branch (928:35): [True: 3.25k, False: 592]
  |  Branch (928:61): [True: 1.58k, False: 1.67k]
  ------------------
  929|  1.58k|            && *type != ASN_NSAP) {
  ------------------
  |  |   98|  1.58k|#define ASN_NSAP	(ASN_APPLICATION | 5)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|  1.58k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (929:16): [True: 412, False: 1.17k]
  ------------------
  930|    412|        _asn_type_err(errpre, *type);
  931|    412|        return NULL;
  932|    412|    }
  933|       |
  934|  5.41k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
  935|  5.41k|    if (NULL == bufp) {
  ------------------
  |  Branch (935:9): [True: 149, False: 5.26k]
  ------------------
  936|    149|        _asn_short_err(errpre, *datalength - 1, asn_length);
  937|    149|        return NULL;
  938|    149|    }
  939|       |
  940|  5.26k|    if (asn_length > *strlength) {
  ------------------
  |  Branch (940:9): [True: 39, False: 5.22k]
  ------------------
  941|     39|        _asn_length_err(errpre, (size_t) asn_length, *strlength);
  942|     39|        return NULL;
  943|     39|    }
  944|       |
  945|  5.22k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|  5.22k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  5.22k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 5.22k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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.22k]
  |  |  ------------------
  ------------------
  946|       |
  947|  5.22k|    memmove(str, bufp, asn_length);
  948|  5.22k|    if (*strlength > asn_length)
  ------------------
  |  Branch (948:9): [True: 2.28k, False: 2.93k]
  ------------------
  949|  2.28k|        str[asn_length] = 0;
  950|  5.22k|    *strlength = asn_length;
  951|  5.22k|    *datalength -= asn_length + (bufp - data);
  952|       |
  953|  5.22k|    DEBUGIF("dumpv_recv") {
  ------------------
  |  |  145|  5.22k|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|  10.4k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 5.22k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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.22k|    return bufp + asn_length;
  974|  5.26k|}
asn_parse_header:
 1071|  41.7k|{
 1072|  41.7k|    register u_char *bufp;
 1073|  41.7k|    u_long          asn_length = 0;
 1074|  41.7k|    const char      *errpre = "parse header";
 1075|       |
 1076|  41.7k|    if (!data || !datalength || !type) {
  ------------------
  |  Branch (1076:9): [True: 0, False: 41.7k]
  |  Branch (1076:18): [True: 0, False: 41.7k]
  |  Branch (1076:33): [True: 0, False: 41.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|  41.7k|    if (*datalength < 2) {
  ------------------
  |  Branch (1082:9): [True: 349, False: 41.4k]
  ------------------
 1083|    349|        _asn_short_err(errpre, *datalength, 2);
 1084|    349|        return NULL;
 1085|    349|    }
 1086|       |
 1087|  41.4k|    bufp = data;
 1088|       |    /*
 1089|       |     * this only works on data types < 30, i.e. no extension octets 
 1090|       |     */
 1091|  41.4k|    if (IS_EXTENSION_ID(*bufp)) {
  ------------------
  |  |  103|  41.4k|#define IS_EXTENSION_ID(byte)	(((byte) & ASN_EXTENSION_ID) == ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|  41.4k|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  |  |               #define IS_EXTENSION_ID(byte)	(((byte) & ASN_EXTENSION_ID) == ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|  41.4k|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  |  |  |  Branch (103:31): [True: 14, False: 41.4k]
  |  |  ------------------
  ------------------
 1092|     14|        ERROR_MSG("can't process ID >= 30");
  ------------------
  |  |  188|     14|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1093|     14|        return NULL;
 1094|     14|    }
 1095|  41.4k|    *type = *bufp++;
 1096|       |
 1097|  41.4k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 1098|  41.4k|    if (NULL == bufp) {
  ------------------
  |  Branch (1098:9): [True: 741, False: 40.6k]
  ------------------
 1099|    741|        _asn_short_err(errpre, *datalength - 1, asn_length);
 1100|    741|        return NULL;
 1101|    741|    }
 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|  40.6k|#endif
 1113|       |
 1114|  40.6k|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 1115|       |
 1116|  40.6k|    if ((asn_length > 2) && (*type == ASN_OPAQUE) && (*bufp == ASN_OPAQUE_TAG1)) {
  ------------------
  |  |   93|  30.6k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  30.6k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if ((asn_length > 2) && (*type == ASN_OPAQUE) && (*bufp == ASN_OPAQUE_TAG1)) {
  ------------------
  |  |  131|  4.20k|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|  4.20k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|  4.20k|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
  |  Branch (1116:9): [True: 30.6k, False: 10.0k]
  |  Branch (1116:29): [True: 4.20k, False: 26.4k]
  |  Branch (1116:54): [True: 3.64k, False: 556]
  ------------------
 1117|       |
 1118|       |        /*
 1119|       |         * check if 64-but counter 
 1120|       |         */
 1121|  3.64k|        switch (*(bufp + 1)) {
 1122|    669|        case ASN_OPAQUE_COUNTER64:
  ------------------
  |  |  156|    669|#define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  136|    669|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  146|    669|#define ASN_APP_COUNTER64 (ASN_APPLICATION | 6)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    669|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1122:9): [True: 669, False: 2.97k]
  ------------------
 1123|  1.36k|        case ASN_OPAQUE_U64:
  ------------------
  |  |  192|  1.36k|#define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  136|  1.36k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  150|  1.36k|#define ASN_APP_U64 (ASN_APPLICATION | 11)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.36k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1123:9): [True: 697, False: 2.94k]
  ------------------
 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: 363, False: 3.28k]
  ------------------
 1125|  1.99k|        case ASN_OPAQUE_DOUBLE:
  ------------------
  |  |  174|  1.99k|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|  1.99k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|  1.99k|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.99k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1125:9): [True: 262, False: 3.38k]
  ------------------
 1126|  3.23k|        case ASN_OPAQUE_I64:
  ------------------
  |  |  183|  3.23k|#define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  136|  3.23k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  149|  3.23k|#define ASN_APP_I64 (ASN_APPLICATION | 10)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  3.23k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1126:9): [True: 1.24k, False: 2.39k]
  ------------------
 1127|  3.23k|            *type = *(bufp + 1);
 1128|  3.23k|            break;
 1129|       |
 1130|    405|        default:
  ------------------
  |  Branch (1130:9): [True: 405, False: 3.23k]
  ------------------
 1131|       |            /*
 1132|       |             * just an Opaque 
 1133|       |             */
 1134|    405|            *datalength = (int) asn_length;
 1135|    405|            return bufp;
 1136|  3.64k|        }
 1137|       |        /*
 1138|       |         * value is encoded as special format 
 1139|       |         */
 1140|  3.23k|        *datalength = (int) asn_length;
 1141|  3.23k|        bufp = asn_parse_nlength(bufp+2, *datalength - 2, &asn_length);
 1142|  3.23k|        if (NULL == bufp) {
  ------------------
  |  Branch (1142:13): [True: 39, False: 3.20k]
  ------------------
 1143|     39|            _asn_short_err("parse opaque header", *datalength - 2, asn_length);
 1144|     39|            return NULL;
 1145|     39|        }
 1146|  3.23k|    }
 1147|  40.2k|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 1148|       |
 1149|  40.2k|    *datalength = (int) asn_length;
 1150|       |
 1151|  40.2k|    return bufp;
 1152|  40.6k|}
asn_parse_sequence:
 1171|  24.4k|{                               /* error message prefix */
 1172|  24.4k|    data = asn_parse_header(data, datalength, type);
 1173|  24.4k|    if (data && (*type != expected_type)) {
  ------------------
  |  Branch (1173:9): [True: 23.3k, False: 1.11k]
  |  Branch (1173:17): [True: 1.60k, False: 21.7k]
  ------------------
 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|  22.8k|    return data;
 1182|  24.4k|}
asn_parse_length:
 1293|  11.4k|{
 1294|  11.4k|    static const char *errpre = "parse length";
 1295|  11.4k|    char            ebuf[128];
 1296|  11.4k|    register u_char lengthbyte;
 1297|       |
 1298|  11.4k|    if (!data || !length) {
  ------------------
  |  Branch (1298:9): [True: 0, False: 11.4k]
  |  Branch (1298:18): [True: 0, False: 11.4k]
  ------------------
 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|  11.4k|    lengthbyte = *data;
 1303|       |
 1304|  11.4k|    if (lengthbyte & ASN_LONG_LEN) {
  ------------------
  |  |   98|  11.4k|#define ASN_LONG_LEN	    0x80U
  ------------------
  |  Branch (1304:9): [True: 11.4k, False: 0]
  ------------------
 1305|  11.4k|        lengthbyte &= ~ASN_LONG_LEN;    /* turn MSb off */
  ------------------
  |  |   98|  11.4k|#define ASN_LONG_LEN	    0x80U
  ------------------
 1306|  11.4k|        if (lengthbyte == 0) {
  ------------------
  |  Branch (1306:13): [True: 116, False: 11.3k]
  ------------------
 1307|    116|            snprintf(ebuf, sizeof(ebuf),
 1308|    116|                     "%s: indefinite length not supported", errpre);
 1309|    116|            ERROR_MSG(ebuf);
  ------------------
  |  |  188|    116|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1310|    116|            return NULL;
 1311|    116|        }
 1312|  11.3k|        if (lengthbyte > sizeof(long)) {
  ------------------
  |  Branch (1312:13): [True: 148, False: 11.1k]
  ------------------
 1313|    148|            snprintf(ebuf, sizeof(ebuf),
 1314|    148|                    "%s: data length %d > %lu not supported", errpre,
 1315|    148|                    lengthbyte, (unsigned long)sizeof(long));
 1316|    148|            ERROR_MSG(ebuf);
  ------------------
  |  |  188|    148|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1317|    148|            return NULL;
 1318|    148|        }
 1319|  11.1k|        data++;
 1320|  11.1k|        *length = 0;            /* protect against short lengths */
 1321|  28.5k|        while (lengthbyte--) {
  ------------------
  |  Branch (1321:16): [True: 17.3k, False: 11.1k]
  ------------------
 1322|  17.3k|            *length <<= 8;
 1323|  17.3k|            *length |= *data++;
 1324|  17.3k|        }
 1325|  11.1k|        if ((long) *length < 0) {
  ------------------
  |  Branch (1325:13): [True: 122, False: 11.0k]
  ------------------
 1326|    122|            snprintf(ebuf, sizeof(ebuf),
 1327|    122|                     "%s: negative data length %ld\n", errpre,
 1328|    122|                     (long) *length);
 1329|    122|            ERROR_MSG(ebuf);
  ------------------
  |  |  188|    122|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1330|    122|            return NULL;
 1331|    122|        }
 1332|  11.0k|        return data;
 1333|  11.1k|    } else {                    /* short asnlength */
 1334|      0|        *length = (long) lengthbyte;
 1335|      0|        return data + 1;
 1336|      0|    }
 1337|  11.4k|}
asn_parse_objid:
 1435|  17.8k|{
 1436|  17.8k|    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|  17.8k|    register u_char *bufp = data;
 1444|  17.8k|    register oid   *oidp = objid + 1;
 1445|  17.8k|    register u_long subidentifier;
 1446|  17.8k|    register long   length;
 1447|  17.8k|    u_long          asn_length;
 1448|  17.8k|    size_t          original_length = *objidlength;
 1449|       |
 1450|  17.8k|    if (NULL == data || NULL == datalength || NULL == type || NULL == objid) {
  ------------------
  |  Branch (1450:9): [True: 0, False: 17.8k]
  |  Branch (1450:25): [True: 0, False: 17.8k]
  |  Branch (1450:47): [True: 0, False: 17.8k]
  |  Branch (1450:63): [True: 0, False: 17.8k]
  ------------------
 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|  17.8k|    if (*datalength < 2) {
  ------------------
  |  Branch (1456:9): [True: 20, False: 17.8k]
  ------------------
 1457|     20|        _asn_short_err(errpre, *datalength, 2);
 1458|     20|        return NULL;
 1459|     20|    }
 1460|       |
 1461|  17.8k|    *type = *bufp++;
 1462|  17.8k|    if (*type != ASN_OBJECT_ID) {
  ------------------
  |  |   81|  17.8k|#define ASN_OBJECT_ID	    0x06U
  ------------------
  |  Branch (1462:9): [True: 27, False: 17.8k]
  ------------------
 1463|     27|        _asn_type_err(errpre, *type);
 1464|     27|        return NULL;
 1465|     27|    }
 1466|  17.8k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 1467|  17.8k|    if (NULL == bufp) {
  ------------------
  |  Branch (1467:9): [True: 141, False: 17.6k]
  ------------------
 1468|    141|        _asn_short_err(errpre, *datalength - 1, asn_length);
 1469|    141|        return NULL;
 1470|    141|    }
 1471|       |
 1472|  17.6k|    *datalength -= (int) asn_length + (bufp - data);
 1473|       |
 1474|  17.6k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|  17.6k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  17.6k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 17.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 17.6k]
  |  |  ------------------
  ------------------
 1475|       |
 1476|       |    /*
 1477|       |     * Handle invalid object identifier encodings of the form 06 00 robustly 
 1478|       |     */
 1479|  17.6k|    if (asn_length == 0)
  ------------------
  |  Branch (1479:9): [True: 14.7k, False: 2.99k]
  ------------------
 1480|  14.7k|        objid[0] = objid[1] = 0;
 1481|       |
 1482|  17.6k|    length = asn_length;
 1483|  17.6k|    (*objidlength)--;           /* account for expansion of first byte */
 1484|       |
 1485|  33.9k|    while (length > 0 && (*objidlength)-- > 0) {
  ------------------
  |  Branch (1485:12): [True: 16.3k, False: 17.6k]
  |  Branch (1485:26): [True: 16.2k, False: 24]
  ------------------
 1486|  16.2k|        subidentifier = 0;
 1487|  18.7k|        do {                    /* shift and add in low order 7 bits */
 1488|  18.7k|            if (subidentifier > (MAX_SUBID >> 7)) {
  ------------------
  |  |   18|  18.7k|#define MAX_SUBID   0xFFFFFFFFUL
  ------------------
  |  Branch (1488:17): [True: 23, False: 18.7k]
  ------------------
 1489|     23|                ERROR_MSG("subidentifier too large / overflow");
  ------------------
  |  |  188|     23|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1490|     23|                return NULL;
 1491|     23|            }
 1492|  18.7k|            subidentifier =
 1493|  18.7k|                (subidentifier << 7) + (*(u_char *) bufp & ~ASN_BIT8);
  ------------------
  |  |  100|  18.7k|#define ASN_BIT8	    0x80U
  ------------------
 1494|  18.7k|            length--;
 1495|  18.7k|        } while ((*(u_char *) bufp++ & ASN_BIT8) && (length > 0));        /* last byte has high bit clear */
  ------------------
  |  |  100|  18.7k|#define ASN_BIT8	    0x80U
  ------------------
  |  Branch (1495:18): [True: 2.49k, False: 16.2k]
  |  Branch (1495:53): [True: 2.46k, False: 29]
  ------------------
 1496|       |
 1497|  16.2k|	if (length == 0) {
  ------------------
  |  Branch (1497:6): [True: 2.94k, False: 13.3k]
  ------------------
 1498|  2.94k|            u_char *last_byte = bufp - 1;
 1499|  2.94k|            if (*last_byte & ASN_BIT8) {
  ------------------
  |  |  100|  2.94k|#define ASN_BIT8	    0x80U
  ------------------
  |  Branch (1499:17): [True: 29, False: 2.91k]
  ------------------
 1500|       |                /* last byte has high bit set -> wrong BER encoded OID */
 1501|     29|                ERROR_MSG("subidentifier syntax error");
  ------------------
  |  |  188|     29|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1502|     29|                return NULL;
 1503|     29|            }
 1504|  2.94k|        }
 1505|  16.2k|        if (subidentifier > MAX_SUBID) {
  ------------------
  |  |   18|  16.2k|#define MAX_SUBID   0xFFFFFFFFUL
  ------------------
  |  Branch (1505:13): [True: 0, False: 16.2k]
  ------------------
 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.2k|        *oidp++ = (oid) subidentifier;
 1510|  16.2k|    }
 1511|       |
 1512|  17.6k|    if (length || oidp < objid + 1) {
  ------------------
  |  Branch (1512:9): [True: 24, False: 17.6k]
  |  Branch (1512:19): [True: 0, False: 17.6k]
  ------------------
 1513|     24|        ERROR_MSG("OID length exceeds buffer size");
  ------------------
  |  |  188|     24|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1514|     24|        *objidlength = original_length;
 1515|     24|        return NULL;
 1516|     24|    }
 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|  17.6k|    subidentifier = oidp - objid >= 2 ? objid[1] : 0;
  ------------------
  |  Branch (1524:21): [True: 2.91k, False: 14.7k]
  ------------------
 1525|  17.6k|    if (subidentifier == 0x2B) {
  ------------------
  |  Branch (1525:9): [True: 499, False: 17.1k]
  ------------------
 1526|    499|        objid[0] = 1;
 1527|    499|        objid[1] = 3;
 1528|  17.1k|    } else {
 1529|  17.1k|        if (subidentifier < 40) {
  ------------------
  |  Branch (1529:13): [True: 15.2k, False: 1.91k]
  ------------------
 1530|  15.2k|            objid[0] = 0;
 1531|  15.2k|            objid[1] = subidentifier;
 1532|  15.2k|        } else if (subidentifier < 80) {
  ------------------
  |  Branch (1532:20): [True: 944, False: 973]
  ------------------
 1533|    944|            objid[0] = 1;
 1534|    944|            objid[1] = subidentifier - 40;
 1535|    973|        } else {
 1536|    973|            objid[0] = 2;
 1537|    973|            objid[1] = subidentifier - 80;
 1538|    973|        }
 1539|  17.1k|    }
 1540|       |
 1541|  17.6k|    *objidlength = (int) (oidp - objid);
 1542|       |
 1543|  17.6k|    DEBUGMSG(("dumpv_recv", "  ObjID: "));
  ------------------
  |  |   61|  17.6k|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|  17.6k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 17.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 17.6k]
  |  |  ------------------
  ------------------
 1544|  17.6k|    DEBUGMSGOID(("dumpv_recv", objid, *objidlength));
  ------------------
  |  |   67|  17.6k|#define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  17.6k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 17.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  165|      0|#define __DBGMSGOID(x)     debugmsg_oid x
  |  |  ------------------
  |  |  |  Branch (67:71): [Folded, False: 17.6k]
  |  |  ------------------
  ------------------
 1545|  17.6k|    DEBUGMSG(("dumpv_recv", "\n"));
  ------------------
  |  |   61|  17.6k|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|  17.6k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 17.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 17.6k]
  |  |  ------------------
  ------------------
 1546|  17.6k|    return bufp;
 1547|  17.6k|}
asn_parse_bitstring:
 1817|    766|{
 1818|       |    /*
 1819|       |     * bitstring ::= 0x03 asnlength unused {byte}*
 1820|       |     */
 1821|    766|    static const char *errpre = "parse bitstring";
 1822|    766|    register u_char *bufp = data;
 1823|    766|    u_long          asn_length;
 1824|       |
 1825|    766|    if (NULL == data || NULL == datalength || NULL == type ||
  ------------------
  |  Branch (1825:9): [True: 0, False: 766]
  |  Branch (1825:25): [True: 0, False: 766]
  |  Branch (1825:47): [True: 0, False: 766]
  ------------------
 1826|    766|        NULL == str || NULL == strlength) {
  ------------------
  |  Branch (1826:9): [True: 0, False: 766]
  |  Branch (1826:24): [True: 0, False: 766]
  ------------------
 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|    766|    if (*datalength < 2) {
  ------------------
  |  Branch (1832:9): [True: 0, False: 766]
  ------------------
 1833|      0|        _asn_short_err(errpre, *datalength, 2);
 1834|      0|        return NULL;
 1835|      0|    }
 1836|       |
 1837|    766|    *type = *bufp++;
 1838|    766|    if (*type != ASN_BIT_STR) {
  ------------------
  |  |   77|    766|#define ASN_BIT_STR	    0x03U
  ------------------
  |  Branch (1838:9): [True: 0, False: 766]
  ------------------
 1839|      0|        _asn_type_err(errpre, *type);
 1840|      0|        return NULL;
 1841|      0|    }
 1842|       |
 1843|    766|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 1844|    766|    if (NULL == bufp) {
  ------------------
  |  Branch (1844:9): [True: 0, False: 766]
  ------------------
 1845|      0|        _asn_short_err(errpre, *datalength - 1, asn_length);
 1846|      0|        return NULL;
 1847|      0|    }
 1848|       |
 1849|    766|    if ((size_t) asn_length > *strlength) {
  ------------------
  |  Branch (1849:9): [True: 0, False: 766]
  ------------------
 1850|      0|        _asn_length_err(errpre, (size_t) asn_length, *strlength);
 1851|      0|        return NULL;
 1852|      0|    }
 1853|    766|    if (_asn_bitstring_check(errpre, asn_length, *bufp))
  ------------------
  |  Branch (1853:9): [True: 8, False: 758]
  ------------------
 1854|      8|        return NULL;
 1855|       |
 1856|    758|    DEBUGDUMPSETUP("recv", data, bufp - data);
  ------------------
  |  |   83|    758|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    758|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 758]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 758]
  |  |  ------------------
  ------------------
 1857|    758|    DEBUGMSG(("dumpv_recv", "  Bitstring: "));
  ------------------
  |  |   61|    758|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    758|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 758]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 758]
  |  |  ------------------
  ------------------
 1858|    758|    DEBUGMSGHEX(("dumpv_recv", data, asn_length));
  ------------------
  |  |   71|    758|#define DEBUGMSGHEX(x)     do {if (_DBG_IF_) {__DBGMSGHEX(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    758|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 758]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGHEX(x)     do {if (_DBG_IF_) {__DBGMSGHEX(x);} }while(0)
  |  |  ------------------
  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  ------------------
  |  |  |  Branch (71:71): [Folded, False: 758]
  |  |  ------------------
  ------------------
 1859|    758|    DEBUGMSG(("dumpv_recv", "\n"));
  ------------------
  |  |   61|    758|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    758|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 758]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 758]
  |  |  ------------------
  ------------------
 1860|       |
 1861|    758|    memmove(str, bufp, asn_length);
 1862|    758|    *strlength = (int) asn_length;
 1863|    758|    *datalength -= (int) asn_length + (bufp - data);
 1864|    758|    return bufp + asn_length;
 1865|    766|}
asn_parse_unsigned_int64:
 1949|  2.50k|{
 1950|       |    /*
 1951|       |     * ASN.1 integer ::= 0x02 asnlength byte {byte}*
 1952|       |     */
 1953|  2.50k|    static const char *errpre = "parse uint64";
 1954|  2.50k|    const int       uint64sizelimit = (4 * 2) + 1;
 1955|  2.50k|    register u_char *bufp = data;
 1956|  2.50k|    u_long          asn_length;
 1957|  2.50k|    register u_long low = 0, high = 0;
 1958|       |
 1959|  2.50k|    if (countersize != sizeof(struct counter64)) {
  ------------------
  |  Branch (1959:9): [True: 0, False: 2.50k]
  ------------------
 1960|      0|        _asn_size_err(errpre, countersize, sizeof(struct counter64));
 1961|      0|        return NULL;
 1962|      0|    }
 1963|       |
 1964|  2.50k|    if (NULL == data || NULL == datalength || NULL == type || NULL == cp) {
  ------------------
  |  Branch (1964:9): [True: 0, False: 2.50k]
  |  Branch (1964:25): [True: 0, False: 2.50k]
  |  Branch (1964:47): [True: 0, False: 2.50k]
  |  Branch (1964:63): [True: 0, False: 2.50k]
  ------------------
 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.50k|    if (*datalength < 2) {
  ------------------
  |  Branch (1970:9): [True: 0, False: 2.50k]
  ------------------
 1971|      0|        _asn_short_err(errpre, *datalength, 2);
 1972|      0|        return NULL;
 1973|      0|    }
 1974|       |
 1975|  2.50k|    *type = *bufp++;
 1976|  2.50k|    if (*type != ASN_COUNTER64
  ------------------
  |  |   99|  5.01k|#define ASN_COUNTER64   (ASN_APPLICATION | 6)
  |  |  ------------------
  |  |  |  |   91|  2.50k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (1976:9): [True: 1.35k, False: 1.15k]
  ------------------
 1977|  1.35k|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 1978|  1.35k|            && *type != ASN_OPAQUE
  ------------------
  |  |   93|  1.35k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  1.35k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (1978:16): [True: 7, False: 1.35k]
  ------------------
 1979|  2.50k|#endif
 1980|  2.50k|            ) {
 1981|      7|        _asn_type_err(errpre, *type);
 1982|      7|        return NULL;
 1983|      7|    }
 1984|  2.50k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 1985|  2.50k|    if (NULL == bufp) {
  ------------------
  |  Branch (1985:9): [True: 0, False: 2.50k]
  ------------------
 1986|      0|        _asn_short_err(errpre, *datalength - 1, asn_length);
 1987|      0|        return NULL;
 1988|      0|    }
 1989|       |
 1990|  2.50k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|  2.50k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.50k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.50k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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.50k]
  |  |  ------------------
  ------------------
 1991|  2.50k|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 1992|       |    /** need at least 2 bytes: ASN_OPAQUE_TAG1 and ASN_OPAQUE_<type> */
 1993|  2.50k|    if ((*type == ASN_OPAQUE) && (asn_length < 2)) {
  ------------------
  |  |   93|  2.50k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  2.50k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (1993:9): [True: 1.35k, False: 1.15k]
  |  Branch (1993:34): [True: 0, False: 1.35k]
  ------------------
 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.50k|    if ((*type == ASN_OPAQUE) &&
  ------------------
  |  |   93|  2.50k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  2.50k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2001:9): [True: 1.35k, False: 1.15k]
  ------------------
 2002|  1.35k|        (asn_length <= ASN_OPAQUE_COUNTER64_MX_BER_LEN) &&
  ------------------
  |  |  160|  1.35k|#define ASN_OPAQUE_COUNTER64_MX_BER_LEN 12
  ------------------
  |  Branch (2002:9): [True: 1.32k, False: 21]
  ------------------
 2003|  1.32k|        (*bufp == ASN_OPAQUE_TAG1) &&
  ------------------
  |  |  131|  1.32k|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|  1.32k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|  1.32k|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
  |  Branch (2003:9): [True: 1.32k, False: 0]
  ------------------
 2004|  1.32k|        ((*(bufp + 1) == ASN_OPAQUE_COUNTER64) ||
  ------------------
  |  |  156|  1.32k|#define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  136|  1.32k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  146|  1.32k|#define ASN_APP_COUNTER64 (ASN_APPLICATION | 6)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.32k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2004:10): [True: 652, False: 677]
  ------------------
 2005|  1.32k|         (*(bufp + 1) == ASN_OPAQUE_U64))) {
  ------------------
  |  |  192|    677|#define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  136|    677|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  150|    677|#define ASN_APP_U64 (ASN_APPLICATION | 11)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    677|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2005:10): [True: 677, False: 0]
  ------------------
 2006|       |        /*
 2007|       |         * change type to Counter64 or U64 
 2008|       |         */
 2009|  1.32k|        *type = *(bufp + 1);
 2010|       |        /*
 2011|       |         * value is encoded as special format 
 2012|       |         */
 2013|  1.32k|        *datalength = asn_length;
 2014|  1.32k|        bufp = asn_parse_nlength(bufp+2, *datalength - 2, &asn_length);
 2015|  1.32k|        if (NULL == bufp) {
  ------------------
  |  Branch (2015:13): [True: 0, False: 1.32k]
  ------------------
 2016|      0|            _asn_short_err("parse opaque uint64", *datalength - 2, asn_length);
 2017|      0|            return NULL;
 2018|      0|        }
 2019|  1.32k|    }
 2020|  2.50k|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 2021|  2.50k|    if (((int) asn_length > uint64sizelimit) ||
  ------------------
  |  Branch (2021:9): [True: 29, False: 2.47k]
  ------------------
 2022|  2.47k|        (((int) asn_length == uint64sizelimit) && *bufp != 0x00)) {
  ------------------
  |  Branch (2022:10): [True: 258, False: 2.21k]
  |  Branch (2022:51): [True: 10, False: 248]
  ------------------
 2023|     39|        _asn_length_err(errpre, (size_t) asn_length, uint64sizelimit);
 2024|     39|        return NULL;
 2025|     39|    }
 2026|  2.46k|    *datalength -= (int) asn_length + (bufp - data);
 2027|  5.84k|    while (asn_length--) {
  ------------------
  |  Branch (2027:12): [True: 3.38k, False: 2.46k]
  ------------------
 2028|  3.38k|        high = ((0x00FFFFFF & high) << 8) | ((low & 0xFF000000U) >> 24);
 2029|  3.38k|        low = ((low & 0x00FFFFFF) << 8) | *bufp++;
 2030|  3.38k|    }
 2031|       |
 2032|  2.46k|    CHECK_OVERFLOW_U(high,6);
  ------------------
  |  |  224|  2.46k|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|  2.46k|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 0, False: 2.46k]
  |  |  ------------------
  |  |  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.46k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 2.46k]
  |  |  ------------------
  ------------------
 2033|  2.46k|    CHECK_OVERFLOW_U(low,6);
  ------------------
  |  |  224|  2.46k|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|  2.46k|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 0, False: 2.46k]
  |  |  ------------------
  |  |  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.46k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 2.46k]
  |  |  ------------------
  ------------------
 2034|       |
 2035|  2.46k|    cp->low = low;
 2036|  2.46k|    cp->high = high;
 2037|       |
 2038|  2.46k|    DEBUGIF("dumpv_recv") {
  ------------------
  |  |  145|  2.46k|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|  4.92k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.46k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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.46k|    return bufp;
 2045|  2.50k|}
asn_parse_signed_int64:
 2222|  1.25k|{
 2223|  1.25k|    static const char *errpre = "parse int64";
 2224|  1.25k|    const int       int64sizelimit = (4 * 2) + 1;
 2225|  1.25k|    char            ebuf[128];
 2226|  1.25k|    register u_char *bufp = data;
 2227|  1.25k|    u_long          asn_length;
 2228|  1.25k|    register u_int  low = 0, high = 0;
 2229|       |
 2230|  1.25k|    if (countersize != sizeof(struct counter64)) {
  ------------------
  |  Branch (2230:9): [True: 0, False: 1.25k]
  ------------------
 2231|      0|        _asn_size_err(errpre, countersize, sizeof(struct counter64));
 2232|      0|        return NULL;
 2233|      0|    }
 2234|       |
 2235|  1.25k|    if (NULL == data || NULL == datalength || NULL == type || NULL == cp) {
  ------------------
  |  Branch (2235:9): [True: 0, False: 1.25k]
  |  Branch (2235:25): [True: 0, False: 1.25k]
  |  Branch (2235:47): [True: 0, False: 1.25k]
  |  Branch (2235:63): [True: 0, False: 1.25k]
  ------------------
 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.25k|    if (*datalength < 2) {
  ------------------
  |  Branch (2241:9): [True: 0, False: 1.25k]
  ------------------
 2242|      0|        _asn_short_err(errpre, *datalength, 2);
 2243|      0|        return NULL;
 2244|      0|    }
 2245|       |
 2246|  1.25k|    *type = *bufp++;
 2247|  1.25k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 2248|  1.25k|    if (NULL == bufp) {
  ------------------
  |  Branch (2248:9): [True: 0, False: 1.25k]
  ------------------
 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.25k|    if (asn_length < 2) {
  ------------------
  |  Branch (2254:9): [True: 11, False: 1.24k]
  ------------------
 2255|     11|        _asn_short_err(errpre, asn_length, 2);
 2256|     11|        return NULL;
 2257|     11|    }
 2258|       |
 2259|  1.24k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|  1.24k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  1.24k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1.24k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  196|      0|        debugmsg("dumpx" token, "dumpx_%s:%*s", token, __DBGINDENT(), ""); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  |  |  197|      0|        __DBGMSGHEX(("dumpx_" token,buf,len)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  |  |  ------------------
  |  |  |  |  198|      0|        if (debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (198:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  199|      0|            debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (199:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  200|      0|            debugmsg("dumpx_" token,"\n"); \
  |  |  |  |  201|      0|        } else { \
  |  |  |  |  202|      0|            debugmsg("dumpx_" token,"  "); \
  |  |  |  |  203|      0|        } \
  |  |  |  |  204|      0|        debugmsg("dumpv" token, "dumpv_%s:%*s", token, __DBGINDENT(), "");
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:60): [Folded, False: 1.24k]
  |  |  ------------------
  ------------------
 2260|  1.24k|    if ((*type == ASN_OPAQUE) &&
  ------------------
  |  |   93|  1.24k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  1.24k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2260:9): [True: 1.23k, False: 8]
  ------------------
 2261|  1.23k|        (asn_length <= ASN_OPAQUE_COUNTER64_MX_BER_LEN) &&
  ------------------
  |  |  160|  1.23k|#define ASN_OPAQUE_COUNTER64_MX_BER_LEN 12
  ------------------
  |  Branch (2261:9): [True: 1.21k, False: 15]
  ------------------
 2262|  1.21k|        (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_I64)) {
  ------------------
  |  |  131|  1.21k|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|  1.21k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|  1.21k|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
                      (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_I64)) {
  ------------------
  |  |  183|  1.21k|#define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  136|  1.21k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  149|  1.21k|#define ASN_APP_I64 (ASN_APPLICATION | 10)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.21k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2262:9): [True: 1.21k, False: 0]
  |  Branch (2262:39): [True: 1.21k, False: 0]
  ------------------
 2263|       |        /*
 2264|       |         * change type to Int64 
 2265|       |         */
 2266|  1.21k|        *type = *(bufp + 1);
 2267|       |        /*
 2268|       |         * value is encoded as special format 
 2269|       |         */
 2270|  1.21k|        *datalength = asn_length;
 2271|  1.21k|        bufp = asn_parse_nlength(bufp+2, *datalength - 2, &asn_length);
 2272|  1.21k|        if (NULL == bufp) {
  ------------------
  |  Branch (2272:13): [True: 0, False: 1.21k]
  ------------------
 2273|      0|            _asn_short_err("parse opaque int64", *datalength - 2, asn_length);
 2274|      0|            return NULL;
 2275|      0|        }
 2276|  1.21k|    }
 2277|       |    /*
 2278|       |     * this should always have been true until snmp gets int64 PDU types 
 2279|       |     */
 2280|     23|    else {
 2281|     23|        snprintf(ebuf, sizeof(ebuf),
 2282|     23|                "%s: wrong type: %d, len %d, buf bytes (%02X,%02X)",
 2283|     23|                errpre, *type, (int) asn_length, *bufp, *(bufp + 1));
 2284|     23|        ERROR_MSG(ebuf);
  ------------------
  |  |  188|     23|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 2285|     23|        return NULL;
 2286|     23|    }
 2287|  1.21k|    if (((int) asn_length > int64sizelimit) ||
  ------------------
  |  Branch (2287:9): [True: 0, False: 1.21k]
  ------------------
 2288|  1.21k|        (((int) asn_length == int64sizelimit) && *bufp != 0x00)) {
  ------------------
  |  Branch (2288:10): [True: 215, False: 1.00k]
  |  Branch (2288:50): [True: 9, False: 206]
  ------------------
 2289|      9|        _asn_length_err(errpre, (size_t) asn_length, int64sizelimit);
 2290|      9|        return NULL;
 2291|      9|    }
 2292|  1.20k|    *datalength -= (int) asn_length + (bufp - data);
 2293|  1.20k|    if ((asn_length > 0) && (*bufp & 0x80)) {
  ------------------
  |  Branch (2293:9): [True: 873, False: 336]
  |  Branch (2293:29): [True: 243, False: 630]
  ------------------
 2294|    243|        low = 0xFFFFFFFFU;   /* first byte bit 1 means start the data with 1s */
 2295|    243|        high = 0xFFFFFF;
 2296|    243|    }
 2297|       |
 2298|  4.16k|    for ( ; asn_length; asn_length--) {
  ------------------
  |  Branch (2298:13): [True: 2.96k, False: 1.20k]
  ------------------
 2299|  2.96k|        high = ((0x00FFFFFF & high) << 8) | ((low & 0xFF000000U) >> 24);
 2300|  2.96k|        low = ((low & 0x00FFFFFF) << 8) | *bufp++;
 2301|  2.96k|    }
 2302|       |
 2303|  1.20k|    CHECK_OVERFLOW_U(high,8);
  ------------------
  |  |  224|  1.20k|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|  1.20k|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 0, False: 1.20k]
  |  |  ------------------
  |  |  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.20k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 1.20k]
  |  |  ------------------
  ------------------
 2304|  1.20k|    CHECK_OVERFLOW_U(low,8);
  ------------------
  |  |  224|  1.20k|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|  1.20k|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 0, False: 1.20k]
  |  |  ------------------
  |  |  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.20k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 1.20k]
  |  |  ------------------
  ------------------
 2305|       |
 2306|  1.20k|    cp->low = low;
 2307|  1.20k|    cp->high = high;
 2308|       |
 2309|  1.20k|    DEBUGIF("dumpv_recv") {
  ------------------
  |  |  145|  1.20k|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|  2.41k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1.20k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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.20k|    return bufp;
 2316|  1.21k|}
asn_parse_float:
 2439|    752|{
 2440|    752|    static const char *errpre = "parse float";
 2441|    752|    register u_char *bufp = data;
 2442|    752|    u_long          asn_length;
 2443|    752|    union {
 2444|    752|        float           floatVal;
 2445|    752|        long            longVal;
 2446|    752|        u_char          c[sizeof(float)];
 2447|    752|    } fu;
 2448|       |
 2449|    752|    if (floatsize != sizeof(float)) {
  ------------------
  |  Branch (2449:9): [True: 0, False: 752]
  ------------------
 2450|      0|        _asn_size_err("parse float", floatsize, sizeof(float));
 2451|      0|        return NULL;
 2452|      0|    }
 2453|       |
 2454|    752|    if (NULL == data || NULL == datalength || NULL == type || NULL == floatp) {
  ------------------
  |  Branch (2454:9): [True: 0, False: 752]
  |  Branch (2454:25): [True: 0, False: 752]
  |  Branch (2454:47): [True: 0, False: 752]
  |  Branch (2454:63): [True: 0, False: 752]
  ------------------
 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|    752|    if (*datalength < 2) {
  ------------------
  |  Branch (2460:9): [True: 0, False: 752]
  ------------------
 2461|      0|        _asn_short_err(errpre, *datalength, 2);
 2462|      0|        return NULL;
 2463|      0|    }
 2464|       |
 2465|    752|    *type = *bufp++;
 2466|    752|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 2467|    752|    if (NULL == bufp) {
  ------------------
  |  Branch (2467:9): [True: 0, False: 752]
  ------------------
 2468|      0|        _asn_short_err(errpre, *datalength - 1, asn_length);
 2469|      0|        return NULL;
 2470|      0|    }
 2471|       |
 2472|    752|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|    752|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    752|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 752]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 752]
  |  |  ------------------
  ------------------
 2473|       |    /*
 2474|       |     * the float is encoded as an opaque 
 2475|       |     */
 2476|    752|    if ((*type == ASN_OPAQUE) &&
  ------------------
  |  |   93|    752|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|    752|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2476:9): [True: 356, False: 396]
  ------------------
 2477|    356|        (asn_length == ASN_OPAQUE_FLOAT_BER_LEN) &&
  ------------------
  |  |  169|    356|#define ASN_OPAQUE_FLOAT_BER_LEN 7
  ------------------
  |  Branch (2477:9): [True: 342, False: 14]
  ------------------
 2478|    342|        (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_FLOAT)) {
  ------------------
  |  |  131|    342|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|    342|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|    342|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
                      (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_FLOAT)) {
  ------------------
  |  |  165|    342|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|    342|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|    342|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    342|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2478:9): [True: 342, False: 0]
  |  Branch (2478:39): [True: 342, False: 0]
  ------------------
 2479|       |
 2480|       |        /*
 2481|       |         * value is encoded as special format 
 2482|       |         */
 2483|    342|        *datalength = asn_length;
 2484|    342|        bufp = asn_parse_nlength(bufp+2, *datalength - 2, &asn_length);
 2485|    342|        if (NULL == bufp) {
  ------------------
  |  Branch (2485:13): [True: 0, False: 342]
  ------------------
 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|    342|        *type = ASN_OPAQUE_FLOAT;
  ------------------
  |  |  165|    342|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|    342|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|    342|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    342|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2493|    342|    }
 2494|       |
 2495|    752|    if (*type != ASN_OPAQUE_FLOAT) {
  ------------------
  |  |  165|    752|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|    752|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|    752|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    752|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2495:9): [True: 14, False: 738]
  ------------------
 2496|     14|        _asn_type_err(errpre, *type);
 2497|     14|        return NULL;
 2498|     14|    }
 2499|       |
 2500|    738|    if (asn_length != sizeof(float)) {
  ------------------
  |  Branch (2500:9): [True: 18, False: 720]
  ------------------
 2501|     18|        _asn_size_err("parse seq float", asn_length, sizeof(float));
 2502|     18|        return NULL;
 2503|     18|    }
 2504|       |
 2505|    720|    *datalength -= (int) asn_length + (bufp - data);
 2506|    720|    memcpy(&fu.c[0], bufp, asn_length);
 2507|       |
 2508|       |    /*
 2509|       |     * correct for endian differences 
 2510|       |     */
 2511|    720|    fu.longVal = ntohl(fu.longVal);
 2512|       |
 2513|    720|    *floatp = fu.floatVal;
 2514|       |
 2515|    720|    DEBUGMSG(("dumpv_recv", "Opaque float: %f\n", *floatp));
  ------------------
  |  |   61|    720|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    720|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 720]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 720]
  |  |  ------------------
  ------------------
 2516|    720|    return bufp;
 2517|    738|}
asn_parse_double:
 2622|    815|{
 2623|    815|    static const char *errpre = "parse double";
 2624|    815|    register u_char *bufp = data;
 2625|    815|    u_long          asn_length;
 2626|    815|    long            tmp;
 2627|    815|    union {
 2628|    815|        double          doubleVal;
 2629|    815|        int             intVal[2];
 2630|    815|        u_char          c[sizeof(double)];
 2631|    815|    } fu;
 2632|       |
 2633|       |
 2634|    815|    if (doublesize != sizeof(double)) {
  ------------------
  |  Branch (2634:9): [True: 0, False: 815]
  ------------------
 2635|      0|        _asn_size_err("parse double", doublesize, sizeof(double));
 2636|      0|        return NULL;
 2637|      0|    }
 2638|       |
 2639|    815|    if (NULL == data || NULL == datalength || NULL == type || NULL == doublep) {
  ------------------
  |  Branch (2639:9): [True: 0, False: 815]
  |  Branch (2639:25): [True: 0, False: 815]
  |  Branch (2639:47): [True: 0, False: 815]
  |  Branch (2639:63): [True: 0, False: 815]
  ------------------
 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|    815|    if (*datalength < 2) {
  ------------------
  |  Branch (2645:9): [True: 0, False: 815]
  ------------------
 2646|      0|        _asn_short_err(errpre, *datalength, 2);
 2647|      0|        return NULL;
 2648|      0|    }
 2649|       |
 2650|    815|    *type = *bufp++;
 2651|    815|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 2652|    815|    if (NULL == bufp) {
  ------------------
  |  Branch (2652:9): [True: 0, False: 815]
  ------------------
 2653|      0|        _asn_short_err(errpre, *datalength - 1, asn_length);
 2654|      0|        return NULL;
 2655|      0|    }
 2656|       |
 2657|    815|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|    815|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    815|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 815]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 815]
  |  |  ------------------
  ------------------
 2658|       |    /*
 2659|       |     * the double is encoded as an opaque 
 2660|       |     */
 2661|       |    /** need at least 2 bytes: ASN_OPAQUE_TAG1 and ASN_OPAQUE_DOUBLE */
 2662|    815|    if ((*type == ASN_OPAQUE) && (asn_length < 2)) {
  ------------------
  |  |   93|    815|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|    815|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2662:9): [True: 249, False: 566]
  |  Branch (2662:34): [True: 0, False: 249]
  ------------------
 2663|      0|        _asn_short_err(errpre, asn_length, 2);
 2664|      0|        return NULL;
 2665|      0|    }
 2666|    815|    if ((*type == ASN_OPAQUE) &&
  ------------------
  |  |   93|    815|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|    815|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2666:9): [True: 249, False: 566]
  ------------------
 2667|    249|        (asn_length == ASN_OPAQUE_DOUBLE_BER_LEN) &&
  ------------------
  |  |  178|    249|#define ASN_OPAQUE_DOUBLE_BER_LEN 11
  ------------------
  |  Branch (2667:9): [True: 232, False: 17]
  ------------------
 2668|    232|        (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_DOUBLE)) {
  ------------------
  |  |  131|    232|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|    232|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|    232|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
                      (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_DOUBLE)) {
  ------------------
  |  |  174|    232|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|    232|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|    232|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    232|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2668:9): [True: 232, False: 0]
  |  Branch (2668:39): [True: 232, False: 0]
  ------------------
 2669|       |
 2670|       |        /*
 2671|       |         * value is encoded as special format 
 2672|       |         */
 2673|    232|        *datalength = asn_length;
 2674|    232|        bufp = asn_parse_nlength(bufp+2, *datalength - 2, &asn_length);
 2675|    232|        if (NULL == bufp) {
  ------------------
  |  Branch (2675:13): [True: 0, False: 232]
  ------------------
 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|    232|        *type = ASN_OPAQUE_DOUBLE;
  ------------------
  |  |  174|    232|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|    232|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|    232|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    232|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2684|    232|    }
 2685|       |
 2686|    815|    if (*type != ASN_OPAQUE_DOUBLE) {
  ------------------
  |  |  174|    815|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|    815|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|    815|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    815|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2686:9): [True: 17, False: 798]
  ------------------
 2687|     17|        _asn_type_err(errpre, *type);
 2688|     17|        return NULL;
 2689|     17|    }
 2690|       |
 2691|    798|    if (asn_length != sizeof(double)) {
  ------------------
  |  Branch (2691:9): [True: 29, False: 769]
  ------------------
 2692|     29|        _asn_size_err("parse seq double", asn_length, sizeof(double));
 2693|     29|        return NULL;
 2694|     29|    }
 2695|    769|    *datalength -= (int) asn_length + (bufp - data);
 2696|    769|    memcpy(&fu.c[0], bufp, asn_length);
 2697|       |
 2698|       |    /*
 2699|       |     * correct for endian differences 
 2700|       |     */
 2701|       |
 2702|    769|    tmp = ntohl(fu.intVal[0]);
 2703|    769|    fu.intVal[0] = ntohl(fu.intVal[1]);
 2704|    769|    fu.intVal[1] = tmp;
 2705|       |
 2706|    769|    *doublep = fu.doubleVal;
 2707|    769|    DEBUGMSG(("dumpv_recv", "  Opaque Double:\t%f\n", *doublep));
  ------------------
  |  |   61|    769|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    769|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 769]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 769]
  |  |  ------------------
  ------------------
 2708|       |
 2709|    769|    return bufp;
 2710|    798|}
asn1.c:_asn_size_err:
  242|     47|{
  243|     47|    char            ebuf[128];
  244|       |
  245|     47|    snprintf(ebuf, sizeof(ebuf),
  246|     47|            "%s size %lu: s/b %lu", str,
  247|     47|	    (unsigned long)wrongsize, (unsigned long)rightsize);
  248|     47|    ERROR_MSG(ebuf);
  ------------------
  |  |  188|     47|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  249|     47|}
asn1.c:_asn_short_err:
  299|  2.27k|{
  300|  2.27k|    char            ebuf[128];
  301|       |
  302|  2.27k|    snprintf(ebuf, sizeof(ebuf), "%s length %lu too short: need %lu", str,
  303|  2.27k|	    (unsigned long)wrongsize, (unsigned long)rightsize);
  304|  2.27k|    ERROR_MSG(ebuf);
  ------------------
  |  |  188|  2.27k|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  305|  2.27k|}
asn1.c:_asn_type_err:
  261|    529|{
  262|    529|    char            ebuf[128];
  263|       |
  264|    529|    snprintf(ebuf, sizeof(ebuf), "%s type %d", str, wrongtype);
  265|    529|    ebuf[ sizeof(ebuf)-1 ] = 0;
  266|    529|    ERROR_MSG(ebuf);
  ------------------
  |  |  188|    529|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  267|    529|}
asn1.c:_asn_length_err:
  280|    173|{
  281|    173|    char            ebuf[128];
  282|       |
  283|    173|    snprintf(ebuf, sizeof(ebuf),
  284|    173|            "%s length %lu too large: exceeds %lu", str,
  285|    173|	    (unsigned long)wrongsize, (unsigned long)rightsize);
  286|    173|    ERROR_MSG(ebuf);
  ------------------
  |  |  188|    173|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  287|    173|}
asn1.c:_asn_bitstring_check:
  513|    766|{
  514|    766|    char            ebuf[128];
  515|       |
  516|    766|    if (asn_length < 1) {
  ------------------
  |  Branch (516:9): [True: 8, False: 758]
  ------------------
  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|    758|    return 0;
  530|    766|}

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

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|    662|{
  554|    662|    const char     *msg = "";
  555|    662|    static char     msg_buf[SPRINT_MAX_LEN];
  556|       |
  557|    662|    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|    662|#define SNMPERR_GENERR			(-1)
  ------------------
  |  Branch (557:9): [True: 662, False: 0]
  |  Branch (557:42): [True: 0, False: 662]
  ------------------
  558|      0|        msg = api_errors[-snmp_errnumber];
  559|    662|    } else if (snmp_errnumber != SNMPERR_SUCCESS) {
  ------------------
  |  |  184|    662|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (559:16): [True: 0, False: 662]
  ------------------
  560|      0|        msg = NULL;
  561|      0|    }
  562|    662|    if (!msg) {
  ------------------
  |  Branch (562:9): [True: 0, False: 662]
  ------------------
  563|      0|	snprintf(msg_buf, sizeof(msg_buf), "Unknown error: %d", snmp_errnumber);
  564|      0|        msg_buf[sizeof(msg_buf)-1] = '\0';
  565|    662|    } else if (snmp_detail_f) {
  ------------------
  |  Branch (565:16): [True: 662, False: 0]
  ------------------
  566|    662|        snprintf(msg_buf, sizeof(msg_buf), "%s (%s)", msg, snmp_detail);
  567|    662|        msg_buf[sizeof(msg_buf)-1] = '\0';
  568|    662|        snmp_detail_f = 0;
  569|    662|    } else {
  570|      0|        strlcpy(msg_buf, msg, sizeof(msg_buf));
  571|      0|    }
  572|       |
  573|    662|    return (msg_buf);
  574|    662|}
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: 281, False: 2.33k]
  ------------------
 3884|       |        /*
 3885|       |         * error msg detail is set 
 3886|       |         */
 3887|    281|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|    281|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3888|    281|        DEBUGINDENTLESS();
  ------------------
  |  |   75|    281|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    281|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 281]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 281]
  |  |  ------------------
  ------------------
 3889|    281|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|    281|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3890|    281|    }
 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: 182, False: 2.15k]
  ------------------
 3899|    182|        ERROR_MSG("bad parse of version");
  ------------------
  |  |  188|    182|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3900|    182|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|    182|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3901|    182|        DEBUGINDENTLESS();
  ------------------
  |  |   75|    182|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    182|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 182]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 182]
  |  |  ------------------
  ------------------
 3902|    182|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|    182|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3903|    182|    }
 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: 383]
  ------------------
 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|    383|    *length -= data - cp;       /* subtract off the length of the header */
 3924|       |
 3925|       |    /*
 3926|       |     * msgID 
 3927|       |     */
 3928|    383|    DEBUGDUMPHEADER("recv", "msgID");
  ------------------
  |  |   79|    383|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    383|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 383]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 383]
  |  |  ------------------
  ------------------
 3929|    383|    data =
 3930|    383|        asn_parse_int(data, length, &type, &pdu->msgid,
 3931|    383|                      sizeof(pdu->msgid));
 3932|    383|    DEBUGINDENTLESS();
  ------------------
  |  |   75|    383|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    383|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 383]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 383]
  |  |  ------------------
  ------------------
 3933|    383|    if (data == NULL || type != ASN_INTEGER) {
  ------------------
  |  |   75|    365|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (3933:9): [True: 18, False: 365]
  |  Branch (3933:25): [True: 0, False: 365]
  ------------------
 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|    365|    if (pdu->msgid < 0 || pdu->msgid > SNMP_MAX_PACKET_LEN) {
  ------------------
  |  |   49|    317|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  |  Branch (3948:9): [True: 48, False: 317]
  |  Branch (3948:27): [True: 4, False: 313]
  ------------------
 3949|     52|        snmp_log(LOG_ERR, "Received bad msgID (%ld %s %s).\n", pdu->msgid,
 3950|     52|                 (pdu->msgid < 0) ? "<" : ">",
  ------------------
  |  Branch (3950:18): [True: 48, False: 4]
  ------------------
 3951|     52|                 (pdu->msgid < 0) ? "0" : "2^31 - 1");
  ------------------
  |  Branch (3951:18): [True: 48, False: 4]
  ------------------
 3952|     52|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|     52|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3953|     52|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|     52|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     52|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 52]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 52]
  |  |  ------------------
  ------------------
 3954|     52|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|     52|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3955|     52|    }
 3956|       |
 3957|       |    /*
 3958|       |     * msgMaxSize 
 3959|       |     */
 3960|    313|    DEBUGDUMPHEADER("recv:msgMaxSize", "msgMaxSize");
  ------------------
  |  |   79|    313|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    313|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 313]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 313]
  |  |  ------------------
  ------------------
 3961|    313|    data = asn_parse_int(data, length, &type, &pdu->msgMaxSize,
 3962|    313|                         sizeof(pdu->msgMaxSize));
 3963|    313|    DEBUGINDENTLESS();
  ------------------
  |  |   75|    313|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    313|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 313]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 313]
  |  |  ------------------
  ------------------
 3964|    313|    if (data == NULL || type != ASN_INTEGER) {
  ------------------
  |  |   75|    250|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (3964:9): [True: 63, False: 250]
  |  Branch (3964:25): [True: 0, False: 250]
  ------------------
 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|    250|    if (pdu->msgMaxSize < SNMP_MIN_MAX_LEN) {
  ------------------
  |  |   48|    250|#define SNMP_MIN_MAX_LEN    484 /* minimum maximum message size */
  ------------------
  |  Branch (3979:9): [True: 57, False: 193]
  ------------------
 3980|     57|        snmp_log(LOG_ERR, "Received bad msgMaxSize (%lu < 484).\n",
 3981|     57|                 pdu->msgMaxSize);
 3982|     57|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|     57|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3983|     57|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|     57|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     57|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 57]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 57]
  |  |  ------------------
  ------------------
 3984|     57|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|     57|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3985|    193|    } else if (pdu->msgMaxSize > SNMP_MAX_PACKET_LEN) {
  ------------------
  |  |   49|    193|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  |  Branch (3985:16): [True: 3, False: 190]
  ------------------
 3986|      3|        snmp_log(LOG_ERR, "Received bad msgMaxSize (%lu > 2^31 - 1).\n",
 3987|      3|                 pdu->msgMaxSize);
 3988|      3|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      3|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3989|      3|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|      3|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 3]
  |  |  ------------------
  ------------------
 3990|      3|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|      3|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3991|    190|    } else {
 3992|    190|        DEBUGMSGTL(("snmpv3_parse:msgMaxSize", "msgMaxSize %lu received\n",
  ------------------
  |  |   66|    190|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    190|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 190]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 190]
  |  |  ------------------
  ------------------
 3993|    190|                    pdu->msgMaxSize));
 3994|       |        /** don't increase max msg size if we've already got one */
 3995|    190|        if (sess->sndMsgMaxSize < pdu->msgMaxSize) {
  ------------------
  |  Branch (3995:13): [True: 190, False: 0]
  ------------------
 3996|    190|            DEBUGMSGTL(("snmpv3_parse:msgMaxSize",
  ------------------
  |  |   66|    190|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    190|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 190]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 190]
  |  |  ------------------
  ------------------
 3997|    190|                        "msgMaxSize %" NETSNMP_PRIz "d greater than session max %ld; reducing\n",
 3998|    190|                        sess->sndMsgMaxSize, pdu->msgMaxSize));
 3999|    190|            pdu->msgMaxSize = sess->sndMsgMaxSize;
 4000|    190|        }
 4001|    190|    }
 4002|       |
 4003|       |    /*
 4004|       |     * msgFlags 
 4005|       |     */
 4006|    190|    tmp_buf_len = SNMP_MAX_MSG_SIZE;
  ------------------
  |  |  109|    190|#define SNMP_MAX_MSG_SIZE          1472 /* ethernet MTU minus IP/UDP header */
  ------------------
 4007|    190|    DEBUGDUMPHEADER("recv", "msgFlags");
  ------------------
  |  |   79|    190|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    190|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 190]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 190]
  |  |  ------------------
  ------------------
 4008|    190|    data = asn_parse_string(data, length, &type, tmp_buf, &tmp_buf_len);
 4009|    190|    DEBUGINDENTLESS();
  ------------------
  |  |   75|    190|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    190|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 190]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 190]
  |  |  ------------------
  ------------------
 4010|    190|    if (data == NULL || type != ASN_OCTET_STR || tmp_buf_len != 1) {
  ------------------
  |  |   78|    318|#define ASN_OCTET_STR	    0x04U
  ------------------
  |  Branch (4010:9): [True: 62, False: 128]
  |  Branch (4010:25): [True: 4, False: 124]
  |  Branch (4010:50): [True: 15, False: 109]
  ------------------
 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|    109|    msg_flags = *tmp_buf;
 4017|    109|    if (msg_flags & SNMP_MSG_FLAG_RPRT_BIT)
  ------------------
  |  |  305|    109|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
  |  Branch (4017:9): [True: 46, False: 63]
  ------------------
 4018|     46|        pdu->flags |= SNMP_MSG_FLAG_RPRT_BIT;
  ------------------
  |  |  305|     46|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
 4019|     63|    else
 4020|     63|        pdu->flags &= (~SNMP_MSG_FLAG_RPRT_BIT);
  ------------------
  |  |  305|     63|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
 4021|       |
 4022|       |    /*
 4023|       |     * msgSecurityModel 
 4024|       |     */
 4025|    109|    DEBUGDUMPHEADER("recv", "msgSecurityModel");
  ------------------
  |  |   79|    109|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    109|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 109]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 109]
  |  |  ------------------
  ------------------
 4026|    109|    data = asn_parse_int(data, length, &type, &msg_sec_model,
 4027|    109|                         sizeof(msg_sec_model));
 4028|    109|    DEBUGINDENTADD(-4);         /* return from global data indent */
  ------------------
  |  |   73|    109|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    109|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 109]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 109]
  |  |  ------------------
  ------------------
 4029|    109|    if (data == NULL || type != ASN_INTEGER ||
  ------------------
  |  |   75|    215|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (4029:9): [True: 3, False: 106]
  |  Branch (4029:25): [True: 0, False: 106]
  ------------------
 4030|    106|        msg_sec_model < 1 || msg_sec_model > 0x7fffffff) {
  ------------------
  |  Branch (4030:9): [True: 45, False: 61]
  |  Branch (4030:30): [True: 3, False: 58]
  ------------------
 4031|     51|        ERROR_MSG("error parsing msgSecurityModel");
  ------------------
  |  |  188|     51|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4032|     51|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|     51|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4033|     51|        DEBUGINDENTLESS();
  ------------------
  |  |   75|     51|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     51|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 51]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 51]
  |  |  ------------------
  ------------------
 4034|     51|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|     51|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 4035|     51|    }
 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: 90]
  ------------------
 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.33k|{
 4735|  1.33k|    u_char          type;
 4736|  1.33k|    u_char          msg_type;
 4737|  1.33k|    u_char         *var_val;
 4738|  1.33k|    size_t          len;
 4739|  1.33k|    size_t          four;
 4740|  1.33k|    netsnmp_variable_list *vp = NULL, *vplast = NULL;
 4741|  1.33k|    oid             objid[MAX_OID_LEN];
 4742|  1.33k|    u_char         *p;
 4743|       |
 4744|       |    /*
 4745|       |     * Get the PDU type 
 4746|       |     */
 4747|  1.33k|    data = asn_parse_header(data, length, &msg_type);
 4748|  1.33k|    if (data == NULL)
  ------------------
  |  Branch (4748:9): [True: 12, False: 1.32k]
  ------------------
 4749|     12|        return -1;
 4750|  1.32k|    DEBUGMSGTL(("dumpv_recv","    Command %s\n", snmp_pdu_type(msg_type)));
  ------------------
  |  |   66|  1.32k|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  1.32k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1.32k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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.32k]
  |  |  ------------------
  ------------------
 4751|  1.32k|    pdu->command = msg_type;
 4752|  1.32k|    pdu->flags &= (~UCD_MSG_FLAG_RESPONSE_PDU);
  ------------------
  |  |  311|  1.32k|#define UCD_MSG_FLAG_RESPONSE_PDU            0x100
  ------------------
 4753|       |
 4754|       |    /*
 4755|       |     * get the fields in the PDU preceding the variable-bindings sequence
 4756|       |     */
 4757|  1.32k|    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: 265]
  ------------------
 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: 217, False: 845]
  ------------------
 4766|    217|            return -1;
 4767|    845|        pdu->enterprise = netsnmp_memdup(objid,
 4768|    845|                                         pdu->enterprise_length * sizeof(oid));
 4769|    845|        if (pdu->enterprise == NULL) {
  ------------------
  |  Branch (4769:13): [True: 0, False: 845]
  ------------------
 4770|      0|            return -1;
 4771|      0|        }
 4772|       |
 4773|       |        /*
 4774|       |         * agent-addr 
 4775|       |         */
 4776|    845|        four = 4;
 4777|    845|        data = asn_parse_string(data, length, &type,
 4778|    845|                                (u_char *) pdu->agent_addr, &four);
 4779|    845|        if (data == NULL)
  ------------------
  |  Branch (4779:13): [True: 113, False: 732]
  ------------------
 4780|    113|            return -1;
 4781|       |
 4782|       |        /*
 4783|       |         * generic trap 
 4784|       |         */
 4785|    732|        data = asn_parse_int(data, length, &type, (long *) &pdu->trap_type,
 4786|    732|                             sizeof(pdu->trap_type));
 4787|    732|        if (data == NULL)
  ------------------
  |  Branch (4787:13): [True: 5, False: 727]
  ------------------
 4788|      5|            return -1;
 4789|       |        /*
 4790|       |         * specific trap 
 4791|       |         */
 4792|    727|        data =
 4793|    727|            asn_parse_int(data, length, &type,
 4794|    727|                          (long *) &pdu->specific_type,
 4795|    727|                          sizeof(pdu->specific_type));
 4796|    727|        if (data == NULL)
  ------------------
  |  Branch (4796:13): [True: 3, False: 724]
  ------------------
 4797|      3|            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: 166, False: 558]
  ------------------
 4805|    166|            return -1;
 4806|       |
 4807|    558|        break;
 4808|       |
 4809|    558|    case SNMP_MSG_RESPONSE:
  ------------------
  |  |  127|     23|#define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   92|     23|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   96|     23|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4809:5): [True: 23, False: 1.30k]
  ------------------
 4810|     54|    case SNMP_MSG_REPORT:
  ------------------
  |  |  147|     54|#define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   92|     54|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   96|     54|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4810:5): [True: 31, False: 1.29k]
  ------------------
 4811|     54|        pdu->flags |= UCD_MSG_FLAG_RESPONSE_PDU;
  ------------------
  |  |  311|     54|#define UCD_MSG_FLAG_RESPONSE_PDU            0x100
  ------------------
 4812|     54|        NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2440|     54|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 4813|       |
 4814|     78|    case SNMP_MSG_TRAP2:
  ------------------
  |  |  142|     78|#define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   92|     78|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   96|     78|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4814:5): [True: 24, False: 1.30k]
  ------------------
 4815|    100|    case SNMP_MSG_INFORM:
  ------------------
  |  |  141|    100|#define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   92|    100|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   96|    100|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4815:5): [True: 22, False: 1.30k]
  ------------------
 4816|    100|#ifndef NETSNMP_NOTIFY_ONLY
 4817|    131|    case SNMP_MSG_GET:
  ------------------
  |  |  125|    131|#define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  ------------------
  |  |  |  |   92|    131|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  ------------------
  |  |  |  |   96|    131|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4817:5): [True: 31, False: 1.29k]
  ------------------
 4818|    168|    case SNMP_MSG_GETNEXT:
  ------------------
  |  |  126|    168|#define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   92|    168|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   96|    168|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4818:5): [True: 37, False: 1.29k]
  ------------------
 4819|    223|    case SNMP_MSG_GETBULK:
  ------------------
  |  |  140|    223|#define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  ------------------
  |  |  |  |   92|    223|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  ------------------
  |  |  |  |   96|    223|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4819:5): [True: 55, False: 1.27k]
  ------------------
 4820|    223|#endif /* ! NETSNMP_NOTIFY_ONLY */
 4821|    223|#ifndef NETSNMP_NO_WRITE_SUPPORT
 4822|    254|    case SNMP_MSG_SET:
  ------------------
  |  |  129|    254|#define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  ------------------
  |  |  |  |   92|    254|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  ------------------
  |  |  |  |   96|    254|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4822:5): [True: 31, False: 1.29k]
  ------------------
 4823|    254|#endif /* !NETSNMP_NO_WRITE_SUPPORT */
 4824|       |        /*
 4825|       |         * PDU is not an SNMPv1 TRAP 
 4826|       |         */
 4827|       |
 4828|       |        /*
 4829|       |         * request id 
 4830|       |         */
 4831|    254|        DEBUGDUMPHEADER("recv", "request_id");
  ------------------
  |  |   79|    254|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    254|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 254]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 254]
  |  |  ------------------
  ------------------
 4832|    254|        data = asn_parse_int(data, length, &type, &pdu->reqid,
 4833|    254|                             sizeof(pdu->reqid));
 4834|    254|        DEBUGINDENTLESS();
  ------------------
  |  |   75|    254|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    254|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 254]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 254]
  |  |  ------------------
  ------------------
 4835|    254|        if (data == NULL) {
  ------------------
  |  Branch (4835:13): [True: 11, False: 243]
  ------------------
 4836|     11|            return -1;
 4837|     11|        }
 4838|       |
 4839|       |        /*
 4840|       |         * error status (getbulk non-repeaters) 
 4841|       |         */
 4842|    243|        DEBUGDUMPHEADER("recv", "error status");
  ------------------
  |  |   79|    243|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    243|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 243]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 243]
  |  |  ------------------
  ------------------
 4843|    243|        data = asn_parse_int(data, length, &type, &pdu->errstat,
 4844|    243|                             sizeof(pdu->errstat));
 4845|    243|        DEBUGINDENTLESS();
  ------------------
  |  |   75|    243|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    243|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 243]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 243]
  |  |  ------------------
  ------------------
 4846|    243|        if (data == NULL) {
  ------------------
  |  Branch (4846:13): [True: 4, False: 239]
  ------------------
 4847|      4|            return -1;
 4848|      4|        }
 4849|       |
 4850|       |        /*
 4851|       |         * error index (getbulk max-repetitions) 
 4852|       |         */
 4853|    239|        DEBUGDUMPHEADER("recv", "error index");
  ------------------
  |  |   79|    239|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    239|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 239]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 239]
  |  |  ------------------
  ------------------
 4854|    239|        data = asn_parse_int(data, length, &type, &pdu->errindex,
 4855|    239|                             sizeof(pdu->errindex));
 4856|    239|        DEBUGINDENTLESS();
  ------------------
  |  |   75|    239|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    239|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 239]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 239]
  |  |  ------------------
  ------------------
 4857|    239|        if (data == NULL) {
  ------------------
  |  Branch (4857:13): [True: 1, False: 238]
  ------------------
 4858|      1|            return -1;
 4859|      1|        }
 4860|    238|	break;
 4861|       |
 4862|    238|    default:
  ------------------
  |  Branch (4862:5): [True: 11, False: 1.31k]
  ------------------
 4863|     11|        snmp_log(LOG_ERR, "Bad PDU type received: 0x%.2x\n", pdu->command);
 4864|     11|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|     11|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4865|     11|        return -1;
 4866|  1.32k|    }
 4867|       |
 4868|       |    /*
 4869|       |     * get header for variable-bindings sequence 
 4870|       |     */
 4871|    796|    DEBUGDUMPSECTION("recv", "VarBindList");
  ------------------
  |  |   81|    796|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    796|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 796]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 796]
  |  |  ------------------
  ------------------
 4872|    796|    data = asn_parse_sequence(data, length, &type,
 4873|    796|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   84|    796|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   96|    796|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 4874|    796|                              "varbinds");
 4875|    796|    if (data == NULL)
  ------------------
  |  Branch (4875:9): [True: 120, False: 676]
  ------------------
 4876|    120|        goto fail;
 4877|       |
 4878|       |    /*
 4879|       |     * get each varBind sequence 
 4880|       |     */
 4881|  16.4k|    while ((int) *length > 0) {
  ------------------
  |  Branch (4881:12): [True: 16.2k, False: 134]
  ------------------
 4882|  16.2k|        vp = SNMP_MALLOC_TYPEDEF(netsnmp_variable_list);
  ------------------
  |  |   73|  16.2k|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
 4883|  16.2k|        if (NULL == vp)
  ------------------
  |  Branch (4883:13): [True: 0, False: 16.2k]
  ------------------
 4884|      0|            goto fail;
 4885|       |
 4886|  16.2k|        vp->name_length = MAX_OID_LEN;
  ------------------
  |  |  120|  16.2k|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
 4887|  16.2k|        DEBUGDUMPSECTION("recv", "VarBind");
  ------------------
  |  |   81|  16.2k|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  16.2k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 16.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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.2k]
  |  |  ------------------
  ------------------
 4888|  16.2k|        data = snmp_parse_var_op(data, objid, &vp->name_length, &vp->type,
 4889|  16.2k|                                 &vp->val_len, &var_val, length);
 4890|  16.2k|        if (data == NULL)
  ------------------
  |  Branch (4890:13): [True: 328, False: 15.9k]
  ------------------
 4891|    328|            goto fail;
 4892|  15.9k|        if (snmp_set_var_objid(vp, objid, vp->name_length))
  ------------------
  |  Branch (4892:13): [True: 0, False: 15.9k]
  ------------------
 4893|      0|            goto fail;
 4894|       |
 4895|  15.9k|        len = SNMP_MAX_PACKET_LEN;
  ------------------
  |  |   49|  15.9k|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
 4896|  15.9k|        DEBUGDUMPHEADER("recv", "Value");
  ------------------
  |  |   79|  15.9k|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  15.9k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 15.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 15.9k]
  |  |  ------------------
  ------------------
 4897|  15.9k|        switch ((short) vp->type) {
 4898|  1.48k|        case ASN_INTEGER:
  ------------------
  |  |   75|  1.48k|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (4898:9): [True: 1.48k, False: 14.4k]
  ------------------
 4899|  1.48k|            vp->val.integer = (long *) vp->buf;
 4900|  1.48k|            vp->val_len = sizeof(long);
 4901|  1.48k|            p = asn_parse_int(var_val, &len, &vp->type,
 4902|  1.48k|                          (long *) vp->val.integer,
 4903|  1.48k|                          sizeof(*vp->val.integer));
 4904|  1.48k|            if (!p)
  ------------------
  |  Branch (4904:17): [True: 4, False: 1.48k]
  ------------------
 4905|      4|                goto fail;
 4906|  1.48k|            break;
 4907|  1.48k|        case ASN_COUNTER:
  ------------------
  |  |   89|    918|#define ASN_COUNTER	(ASN_APPLICATION | 1)
  |  |  ------------------
  |  |  |  |   91|    918|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4907:9): [True: 918, False: 15.0k]
  ------------------
 4908|  1.53k|        case ASN_GAUGE:
  ------------------
  |  |   90|  1.53k|#define ASN_GAUGE	(ASN_APPLICATION | 2)
  |  |  ------------------
  |  |  |  |   91|  1.53k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4908:9): [True: 618, False: 15.3k]
  ------------------
 4909|  2.08k|        case ASN_TIMETICKS:
  ------------------
  |  |   92|  2.08k|#define ASN_TIMETICKS   (ASN_APPLICATION | 3)
  |  |  ------------------
  |  |  |  |   91|  2.08k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4909:9): [True: 546, False: 15.4k]
  ------------------
 4910|  2.65k|        case ASN_UINTEGER:
  ------------------
  |  |  100|  2.65k|#define ASN_UINTEGER    (ASN_APPLICATION | 7)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|  2.65k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4910:9): [True: 570, False: 15.3k]
  ------------------
 4911|  2.65k|            vp->val.integer = (long *) vp->buf;
 4912|  2.65k|            vp->val_len = sizeof(u_long);
 4913|  2.65k|            p = asn_parse_unsigned_int(var_val, &len, &vp->type,
 4914|  2.65k|                                   (u_long *) vp->val.integer,
 4915|  2.65k|                                   vp->val_len);
 4916|  2.65k|            if (!p)
  ------------------
  |  Branch (4916:17): [True: 17, False: 2.63k]
  ------------------
 4917|     17|                goto fail;
 4918|  2.63k|            break;
 4919|  2.63k|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 4920|  2.63k|        case ASN_OPAQUE_COUNTER64:
  ------------------
  |  |  156|    664|#define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  136|    664|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  146|    664|#define ASN_APP_COUNTER64 (ASN_APPLICATION | 6)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    664|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4920:9): [True: 664, False: 15.3k]
  ------------------
 4921|  1.35k|        case ASN_OPAQUE_U64:
  ------------------
  |  |  192|  1.35k|#define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  136|  1.35k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  150|  1.35k|#define ASN_APP_U64 (ASN_APPLICATION | 11)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.35k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4921:9): [True: 693, False: 15.2k]
  ------------------
 4922|  1.35k|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 4923|  2.50k|        case ASN_COUNTER64:
  ------------------
  |  |   99|  2.50k|#define ASN_COUNTER64   (ASN_APPLICATION | 6)
  |  |  ------------------
  |  |  |  |   91|  2.50k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4923:9): [True: 1.15k, False: 14.8k]
  ------------------
 4924|  2.50k|            vp->val.counter64 = (struct counter64 *) vp->buf;
 4925|  2.50k|            vp->val_len = sizeof(struct counter64);
 4926|  2.50k|            p = asn_parse_unsigned_int64(var_val, &len, &vp->type,
 4927|  2.50k|                                     (struct counter64 *) vp->val.
 4928|  2.50k|                                     counter64, vp->val_len);
 4929|  2.50k|            if (!p)
  ------------------
  |  Branch (4929:17): [True: 46, False: 2.46k]
  ------------------
 4930|     46|                goto fail;
 4931|  2.46k|            break;
 4932|  2.46k|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 4933|  2.46k|        case ASN_OPAQUE_FLOAT:
  ------------------
  |  |  165|    752|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|    752|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|    752|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    752|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4933:9): [True: 752, False: 15.2k]
  ------------------
 4934|    752|            vp->val.floatVal = (float *) vp->buf;
 4935|    752|            vp->val_len = sizeof(float);
 4936|    752|            p = asn_parse_float(var_val, &len, &vp->type,
 4937|    752|                            vp->val.floatVal, vp->val_len);
 4938|    752|            if (!p)
  ------------------
  |  Branch (4938:17): [True: 32, False: 720]
  ------------------
 4939|     32|                goto fail;
 4940|    720|            break;
 4941|    815|        case ASN_OPAQUE_DOUBLE:
  ------------------
  |  |  174|    815|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|    815|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|    815|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    815|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4941:9): [True: 815, False: 15.1k]
  ------------------
 4942|    815|            vp->val.doubleVal = (double *) vp->buf;
 4943|    815|            vp->val_len = sizeof(double);
 4944|    815|            p = asn_parse_double(var_val, &len, &vp->type,
 4945|    815|                             vp->val.doubleVal, vp->val_len);
 4946|    815|            if (!p)
  ------------------
  |  Branch (4946:17): [True: 46, False: 769]
  ------------------
 4947|     46|                goto fail;
 4948|    769|            break;
 4949|  1.25k|        case ASN_OPAQUE_I64:
  ------------------
  |  |  183|  1.25k|#define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  136|  1.25k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  149|  1.25k|#define ASN_APP_I64 (ASN_APPLICATION | 10)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.25k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4949:9): [True: 1.25k, False: 14.7k]
  ------------------
 4950|  1.25k|            vp->val.counter64 = (struct counter64 *) vp->buf;
 4951|  1.25k|            vp->val_len = sizeof(struct counter64);
 4952|  1.25k|            p = asn_parse_signed_int64(var_val, &len, &vp->type,
 4953|  1.25k|                                   (struct counter64 *) vp->val.counter64,
 4954|  1.25k|                                   sizeof(*vp->val.counter64));
 4955|       |
 4956|  1.25k|            if (!p)
  ------------------
  |  Branch (4956:17): [True: 43, False: 1.20k]
  ------------------
 4957|     43|                goto fail;
 4958|  1.20k|            break;
 4959|  1.20k|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 4960|  1.20k|        case ASN_IPADDRESS:
  ------------------
  |  |   88|    242|#define ASN_IPADDRESS   (ASN_APPLICATION | 0)
  |  |  ------------------
  |  |  |  |   91|    242|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4960:9): [True: 242, False: 15.7k]
  ------------------
 4961|    242|            if (vp->val_len != 4)
  ------------------
  |  Branch (4961:17): [True: 3, False: 239]
  ------------------
 4962|      3|                goto fail;
 4963|    239|            NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2440|    239|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 4964|  1.05k|        case ASN_OCTET_STR:
  ------------------
  |  |   78|  1.05k|#define ASN_OCTET_STR	    0x04U
  ------------------
  |  Branch (4964:9): [True: 817, False: 15.1k]
  ------------------
 4965|  2.31k|        case ASN_OPAQUE:
  ------------------
  |  |   93|  2.31k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  2.31k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4965:9): [True: 1.26k, False: 14.7k]
  ------------------
 4966|  2.93k|        case ASN_NSAP:
  ------------------
  |  |   98|  2.93k|#define ASN_NSAP	(ASN_APPLICATION | 5)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|  2.93k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4966:9): [True: 621, False: 15.3k]
  ------------------
 4967|  2.93k|            if (vp->val_len < sizeof(vp->buf)) {
  ------------------
  |  Branch (4967:17): [True: 2.71k, False: 219]
  ------------------
 4968|  2.71k|                vp->val.string = (u_char *) vp->buf;
 4969|  2.71k|            } else {
 4970|    219|                vp->val.string = (u_char *) malloc(vp->val_len);
 4971|    219|            }
 4972|  2.93k|            if (vp->val.string == NULL) {
  ------------------
  |  Branch (4972:17): [True: 0, False: 2.93k]
  ------------------
 4973|      0|                goto fail;
 4974|      0|            }
 4975|  2.93k|            p = asn_parse_string(var_val, &len, &vp->type, vp->val.string,
 4976|  2.93k|                             &vp->val_len);
 4977|  2.93k|            if (!p)
  ------------------
  |  Branch (4977:17): [True: 0, False: 2.93k]
  ------------------
 4978|      0|                goto fail;
 4979|  2.93k|            break;
 4980|  2.93k|        case ASN_OBJECT_ID:
  ------------------
  |  |   81|    792|#define ASN_OBJECT_ID	    0x06U
  ------------------
  |  Branch (4980:9): [True: 792, False: 15.1k]
  ------------------
 4981|    792|            vp->val_len = MAX_OID_LEN;
  ------------------
  |  |  120|    792|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
 4982|    792|            p = asn_parse_objid(var_val, &len, &vp->type, objid, &vp->val_len);
 4983|    792|            if (!p)
  ------------------
  |  Branch (4983:17): [True: 2, False: 790]
  ------------------
 4984|      2|                goto fail;
 4985|    790|            vp->val_len *= sizeof(oid);
 4986|    790|            vp->val.objid = netsnmp_memdup(objid, vp->val_len);
 4987|    790|            if (vp->val.objid == NULL)
  ------------------
  |  Branch (4987:17): [True: 0, False: 790]
  ------------------
 4988|      0|                goto fail;
 4989|    790|            break;
 4990|    790|        case SNMP_NOSUCHOBJECT:
  ------------------
  |  |  201|    350|#define SNMP_NOSUCHOBJECT    (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) /* 80=128 */
  |  |  ------------------
  |  |  |  |   92|    350|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_NOSUCHOBJECT    (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) /* 80=128 */
  |  |  ------------------
  |  |  |  |   95|    350|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (4990:9): [True: 350, False: 15.6k]
  ------------------
 4991|  1.03k|        case SNMP_NOSUCHINSTANCE:
  ------------------
  |  |  202|  1.03k|#define SNMP_NOSUCHINSTANCE  (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* 81=129 */
  |  |  ------------------
  |  |  |  |   92|  1.03k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_NOSUCHINSTANCE  (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* 81=129 */
  |  |  ------------------
  |  |  |  |   95|  1.03k|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (4991:9): [True: 680, False: 15.2k]
  ------------------
 4992|  1.56k|        case SNMP_ENDOFMIBVIEW:
  ------------------
  |  |  203|  1.56k|#define SNMP_ENDOFMIBVIEW    (ASN_CONTEXT | ASN_PRIMITIVE | 0x2) /* 82=130 */
  |  |  ------------------
  |  |  |  |   92|  1.56k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_ENDOFMIBVIEW    (ASN_CONTEXT | ASN_PRIMITIVE | 0x2) /* 82=130 */
  |  |  ------------------
  |  |  |  |   95|  1.56k|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (4992:9): [True: 533, False: 15.4k]
  ------------------
 4993|  1.98k|        case ASN_NULL:
  ------------------
  |  |   79|  1.98k|#define ASN_NULL	    0x05U
  ------------------
  |  Branch (4993:9): [True: 425, False: 15.5k]
  ------------------
 4994|  1.98k|            break;
 4995|    766|        case ASN_BIT_STR:
  ------------------
  |  |   77|    766|#define ASN_BIT_STR	    0x03U
  ------------------
  |  Branch (4995:9): [True: 766, False: 15.1k]
  ------------------
 4996|    766|            vp->val.bitstring = (u_char *) malloc(vp->val_len);
 4997|    766|            if (vp->val.bitstring == NULL) {
  ------------------
  |  Branch (4997:17): [True: 0, False: 766]
  ------------------
 4998|      0|                goto fail;
 4999|      0|            }
 5000|    766|            p = asn_parse_bitstring(var_val, &len, &vp->type,
 5001|    766|                                vp->val.bitstring, &vp->val_len);
 5002|    766|            if (!p)
  ------------------
  |  Branch (5002:17): [True: 8, False: 758]
  ------------------
 5003|      8|                goto fail;
 5004|    758|            break;
 5005|    758|        default:
  ------------------
  |  Branch (5005:9): [True: 13, False: 15.9k]
  ------------------
 5006|     13|            snmp_log(LOG_ERR, "bad type returned (%x)\n", vp->type);
 5007|     13|            goto fail;
 5008|      0|            break;
 5009|  15.9k|        }
 5010|  15.7k|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|  15.7k|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  15.7k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 15.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 15.7k]
  |  |  ------------------
  ------------------
 5011|       |
 5012|  15.7k|        if (NULL == vplast) {
  ------------------
  |  Branch (5012:13): [True: 518, False: 15.2k]
  ------------------
 5013|    518|            pdu->variables = vp;
 5014|  15.2k|        } else {
 5015|  15.2k|            vplast->next_variable = vp;
 5016|  15.2k|        }
 5017|  15.7k|        vplast = vp;
 5018|  15.7k|        vp = NULL;
 5019|  15.7k|    }
 5020|    134|    return 0;
 5021|       |
 5022|    662|  fail:
 5023|    662|    {
 5024|    662|        const char *errstr = snmp_api_errstring(SNMPERR_SUCCESS);
  ------------------
  |  |  184|    662|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 5025|    662|        DEBUGMSGTL(("recv", "error while parsing VarBindList:%s\n", errstr));
  ------------------
  |  |   66|    662|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    662|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 662]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 662]
  |  |  ------------------
  ------------------
 5026|    662|    }
 5027|       |    /** if we were parsing a var, remove it from the pdu and free it */
 5028|    662|    if (vp)
  ------------------
  |  Branch (5028:9): [True: 542, False: 120]
  ------------------
 5029|    542|        snmp_free_var(vp);
 5030|       |
 5031|    662|    return -1;
 5032|    676|}
snmp_free_var_internals:
 5652|  16.2k|{
 5653|  16.2k|    if (!var)
  ------------------
  |  Branch (5653:9): [True: 0, False: 16.2k]
  ------------------
 5654|      0|        return;
 5655|       |
 5656|  16.2k|    if (var->name != var->name_loc)
  ------------------
  |  Branch (5656:9): [True: 328, False: 15.9k]
  ------------------
 5657|    328|        SNMP_FREE(var->name);
  ------------------
  |  |   62|    328|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 328]
  |  |  |  Branch (62:66): [Folded, False: 328]
  |  |  ------------------
  ------------------
 5658|  16.2k|    if (var->val.string != var->buf)
  ------------------
  |  Branch (5658:9): [True: 4.10k, False: 12.1k]
  ------------------
 5659|  4.10k|        SNMP_FREE(var->val.string);
  ------------------
  |  |   62|  4.10k|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 1.77k, False: 2.33k]
  |  |  |  Branch (62:66): [Folded, False: 4.10k]
  |  |  ------------------
  ------------------
 5660|  16.2k|    if (var->data) {
  ------------------
  |  Branch (5660:9): [True: 0, False: 16.2k]
  ------------------
 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.2k|}
snmp_free_var:
 5672|  16.2k|{
 5673|  16.2k|    snmp_free_var_internals(var);
 5674|  16.2k|    free(var);
 5675|  16.2k|}
snmp_free_varbind:
 5679|  5.23k|{
 5680|  5.23k|    netsnmp_variable_list *ptr;
 5681|  20.9k|    while (var) {
  ------------------
  |  Branch (5681:12): [True: 15.7k, False: 5.23k]
  ------------------
 5682|  15.7k|        ptr = var->next_variable;
 5683|  15.7k|        snmp_free_var(var);
 5684|  15.7k|        var = ptr;
 5685|  15.7k|    }
 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.42k]
  ------------------
 4481|  1.18k|            return -1;
 4482|       |
 4483|  1.42k|        if (pdu->version != session->version &&
  ------------------
  |  Branch (4483:13): [True: 90, False: 1.33k]
  ------------------
 4484|     90|            session->version != SNMP_DEFAULT_VERSION) {
  ------------------
  |  |   90|     90|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  |  Branch (4484:13): [True: 90, False: 0]
  ------------------
 4485|     90|            session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  198|     90|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 4486|     90|            return -1;
 4487|     90|        }
 4488|       |
 4489|       |        /*
 4490|       |         * maybe get the community string. 
 4491|       |         */
 4492|  1.33k|        pdu->securityLevel = SNMP_SEC_LEVEL_NOAUTH;
  ------------------
  |  |  299|  1.33k|#define SNMP_SEC_LEVEL_NOAUTH		1
  ------------------
 4493|  1.33k|        pdu->securityModel = 
 4494|  1.33k|#ifndef NETSNMP_DISABLE_SNMPV1
 4495|  1.33k|            (pdu->version == SNMP_VERSION_1) ? SNMP_SEC_MODEL_SNMPv1 : 
  ------------------
  |  |  107|  1.33k|#define SNMP_VERSION_1	   0
  ------------------
                          (pdu->version == SNMP_VERSION_1) ? SNMP_SEC_MODEL_SNMPv1 : 
  ------------------
  |  |  293|  1.33k|#define SNMP_SEC_MODEL_SNMPv1		1
  ------------------
  |  Branch (4495:13): [True: 1.33k, False: 0]
  ------------------
 4496|  1.33k|#endif
 4497|  1.33k|                                               SNMP_SEC_MODEL_SNMPv2c;
  ------------------
  |  |  294|  1.33k|#define SNMP_SEC_MODEL_SNMPv2c		2
  ------------------
 4498|  1.33k|        SNMP_FREE(pdu->community);
  ------------------
  |  |   62|  1.33k|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 1.33k]
  |  |  |  Branch (62:66): [Folded, False: 1.33k]
  |  |  ------------------
  ------------------
 4499|  1.33k|        pdu->community_len = 0;
 4500|  1.33k|        pdu->community = (u_char *) 0;
 4501|  1.33k|        if (community_length) {
  ------------------
  |  Branch (4501:13): [True: 44, False: 1.29k]
  ------------------
 4502|     44|            pdu->community_len = community_length;
 4503|     44|            pdu->community = netsnmp_memdup(community, community_length);
 4504|     44|            if (pdu->community == NULL) {
  ------------------
  |  Branch (4504:17): [True: 0, False: 44]
  ------------------
 4505|      0|                session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 4506|      0|                return -1;
 4507|      0|            }
 4508|     44|        }
 4509|  1.33k|        if (session->authenticator) {
  ------------------
  |  Branch (4509:13): [True: 0, False: 1.33k]
  ------------------
 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.33k|        DEBUGDUMPSECTION("recv", "PDU");
  ------------------
  |  |   81|  1.33k|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  1.33k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1.33k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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.33k]
  |  |  ------------------
  ------------------
 4519|  1.33k|        result = snmp_pdu_parse(pdu, data, &length);
 4520|  1.33k|        if (result < 0) {
  ------------------
  |  Branch (4520:13): [True: 1.20k, False: 134]
  ------------------
 4521|       |            /*
 4522|       |             * This indicates a parse error.  
 4523|       |             */
 4524|  1.20k|            snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|  1.20k|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4525|  1.20k|        }
 4526|  1.33k|        DEBUGINDENTADD(-6);
  ------------------
  |  |   73|  1.33k|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  1.33k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1.33k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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.33k]
  |  |  ------------------
  ------------------
 4527|  1.33k|        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.33k|    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: 281, False: 2.33k]
  ------------------
  121|    281|        return NULL;
  122|    281|    }
  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: 182, False: 2.15k]
  ------------------
  132|    182|        ERROR_MSG("bad parse of version");
  ------------------
  |  |  188|    182|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  133|    182|        return NULL;
  134|    182|    }
  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: 725, False: 1.42k]
  ------------------
  143|    725|        ERROR_MSG("bad parse of community");
  ------------------
  |  |  188|    725|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  144|    725|        return NULL;
  145|    725|    }
  146|  1.42k|    psid[SNMP_MIN(*slen, origlen - 1)] = '\0';
  ------------------
  |  |  111|  1.42k|#define SNMP_MIN(a,b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (111:24): [True: 1, False: 1.42k]
  |  |  ------------------
  ------------------
  147|  1.42k|    return (u_char *) data;
  148|       |
  149|  2.15k|}                               /* end snmp_comstr_parse() */

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

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

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

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.67k|{
  280|  1.67k|    void *to = NULL;
  281|       |
  282|  1.67k|    if (from) {
  ------------------
  |  Branch (282:9): [True: 1.67k, False: 0]
  ------------------
  283|  1.67k|        to = malloc(size);
  284|  1.67k|        if (to)
  ------------------
  |  Branch (284:13): [True: 1.67k, False: 0]
  ------------------
  285|  1.67k|            memcpy(to, from, size);
  286|  1.67k|    }
  287|  1.67k|    return to;
  288|  1.67k|}                               /* 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|}

