asn_parse_nlength:
  325|  96.5k|{
  326|  96.5k|    int len_len;
  327|       |
  328|  96.5k|    if (pkt_len < 1)
  ------------------
  |  Branch (328:9): [True: 0, False: 96.5k]
  ------------------
  329|      0|        return NULL;               /* always too short */
  330|       |
  331|  96.5k|    if (NULL == pkt || NULL == data_len)
  ------------------
  |  Branch (331:9): [True: 0, False: 96.5k]
  |  Branch (331:24): [True: 0, False: 96.5k]
  ------------------
  332|      0|        return NULL;
  333|       |
  334|  96.5k|    *data_len = 0;
  335|       |
  336|  96.5k|    if (*pkt & 0x80) {
  ------------------
  |  Branch (336:9): [True: 12.8k, False: 83.7k]
  ------------------
  337|       |        /*
  338|       |         * long length; first byte is length of length (after masking high bit)
  339|       |         */
  340|  12.8k|        len_len = (int) ((*pkt & ~0x80) + 1);
  341|  12.8k|        if (pkt_len < len_len)
  ------------------
  |  Branch (341:13): [True: 129, False: 12.7k]
  ------------------
  342|    129|            return NULL;           /* still too short for length and data */
  343|       |
  344|       |        /* now we know we have enough data to parse length */
  345|  12.7k|        if (NULL == asn_parse_length(pkt, data_len))
  ------------------
  |  Branch (345:13): [True: 380, False: 12.3k]
  ------------------
  346|    380|            return NULL;           /* propagate error from asn_parse_length */
  347|  83.7k|    } else {
  348|       |        /*
  349|       |         * short length; first byte is the length
  350|       |         */
  351|  83.7k|        len_len = 1;
  352|  83.7k|        *data_len = *pkt;
  353|  83.7k|    }
  354|       |
  355|  96.0k|    if ((*data_len + len_len) > pkt_len)
  ------------------
  |  Branch (355:9): [True: 1.02k, False: 95.0k]
  ------------------
  356|  1.02k|        return NULL;
  357|       |
  358|  95.0k|    return (pkt + len_len);
  359|  96.0k|}
asn_parse_int:
  559|  9.50k|{
  560|       |    /*
  561|       |     * ASN.1 integer ::= 0x02 asnlength byte {byte}*
  562|       |     */
  563|  9.50k|    static const char *errpre = "parse int";
  564|  9.50k|    register u_char *bufp = data;
  565|  9.50k|    u_long          asn_length;
  566|  9.50k|    int             i;
  567|  9.50k|    union {
  568|  9.50k|        long          l;
  569|  9.50k|        unsigned char b[sizeof(long)];
  570|  9.50k|    } value;
  571|       |
  572|  9.50k|    if (NULL == data || NULL == datalength || NULL == type || NULL == intp) {
  ------------------
  |  Branch (572:9): [True: 0, False: 9.50k]
  |  Branch (572:25): [True: 0, False: 9.50k]
  |  Branch (572:47): [True: 0, False: 9.50k]
  |  Branch (572:63): [True: 0, False: 9.50k]
  ------------------
  573|      0|        ERROR_MSG("parse int: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  574|      0|        return NULL;
  575|      0|    }
  576|       |
  577|  9.50k|    if (intsize != sizeof(long)) {
  ------------------
  |  Branch (577:9): [True: 0, False: 9.50k]
  ------------------
  578|      0|        _asn_size_err(errpre, intsize, sizeof(long));
  579|      0|        return NULL;
  580|      0|    }
  581|       |
  582|       |    /** need at least 2 bytes to work with: type, length (which might be 0)  */
  583|  9.50k|    if (*datalength < 2) {
  ------------------
  |  Branch (583:9): [True: 81, False: 9.42k]
  ------------------
  584|     81|        _asn_short_err(errpre, *datalength, 2);
  585|     81|        return NULL;
  586|     81|    }
  587|       |
  588|  9.42k|    *type = *bufp++;
  589|  9.42k|    if (*type != ASN_INTEGER) {
  ------------------
  |  |   75|  9.42k|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (589:9): [True: 30, False: 9.39k]
  ------------------
  590|     30|        _asn_type_err(errpre, *type);
  591|     30|        return NULL;
  592|     30|    }
  593|       |
  594|  9.39k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
  595|  9.39k|    if (NULL == bufp) {
  ------------------
  |  Branch (595:9): [True: 310, False: 9.08k]
  ------------------
  596|    310|        _asn_short_err(errpre, *datalength - 1, asn_length);
  597|    310|        return NULL;
  598|    310|    }
  599|       |
  600|  9.08k|    if ((size_t) asn_length > intsize || (int) asn_length == 0) {
  ------------------
  |  Branch (600:9): [True: 30, False: 9.05k]
  |  Branch (600:42): [True: 17, False: 9.03k]
  ------------------
  601|     47|        _asn_length_err(errpre, (size_t) asn_length, intsize);
  602|     47|        return NULL;
  603|     47|    }
  604|       |
  605|  9.03k|    *datalength -= (int) asn_length + (bufp - data);
  606|       |
  607|  9.03k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|  9.03k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  9.03k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 9.03k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  196|      0|        debugmsg("dumpx" token, "dumpx_%s:%*s", token, __DBGINDENT(), ""); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  |  |  197|      0|        __DBGMSGHEX(("dumpx_" token,buf,len)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  |  |  ------------------
  |  |  |  |  198|      0|        if (debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (198:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  199|      0|            debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (199:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  200|      0|            debugmsg("dumpx_" token,"\n"); \
  |  |  |  |  201|      0|        } else { \
  |  |  |  |  202|      0|            debugmsg("dumpx_" token,"  "); \
  |  |  |  |  203|      0|        } \
  |  |  |  |  204|      0|        debugmsg("dumpv" token, "dumpv_%s:%*s", token, __DBGINDENT(), "");
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:60): [Folded, False: 9.03k]
  |  |  ------------------
  ------------------
  608|       |
  609|  9.03k|    memset(&value.b, *bufp & 0x80 ? 0xff : 0, sizeof(value.b));
  ------------------
  |  Branch (609:22): [True: 1.81k, False: 7.21k]
  ------------------
  610|  9.03k|    if (NETSNMP_BIGENDIAN) {
  ------------------
  |  | 2425|  9.03k|#  define NETSNMP_BIGENDIAN 0
  |  |  ------------------
  |  |  |  Branch (2425:29): [Folded, False: 9.03k]
  |  |  ------------------
  ------------------
  611|      0|        for (i = sizeof(long) - asn_length; asn_length--; i++)
  ------------------
  |  Branch (611:45): [True: 0, False: 0]
  ------------------
  612|      0|            value.b[i] = *bufp++;
  613|  9.03k|    } else {
  614|  24.1k|        for (i = asn_length - 1; asn_length--; i--)
  ------------------
  |  Branch (614:34): [True: 15.1k, False: 9.03k]
  ------------------
  615|  15.1k|            value.b[i] = *bufp++;
  616|  9.03k|    }
  617|       |
  618|  9.03k|    CHECK_OVERFLOW_S(value.l, 1);
  ------------------
  |  |  214|  9.03k|#define CHECK_OVERFLOW_S(x,y) do {                                      \
  |  |  215|  9.03k|        if (x > INT32_MAX) {                                            \
  |  |  ------------------
  |  |  |  Branch (215:13): [True: 383, False: 8.65k]
  |  |  ------------------
  |  |  216|    383|            DEBUGMSG(("asn","truncating signed value %ld to 32 bits (%d)\n",(long)(x),y)); \
  |  |  ------------------
  |  |  |  |   61|    383|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|    383|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 383]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 383]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  217|    383|            x &= 0xffffffff;                                            \
  |  |  218|  8.65k|        } else if (x < INT32_MIN) {                                     \
  |  |  ------------------
  |  |  |  Branch (218:20): [True: 430, False: 8.22k]
  |  |  ------------------
  |  |  219|    430|            DEBUGMSG(("asn","truncating signed value %ld to 32 bits (%d)\n",(long)(x),y)); \
  |  |  ------------------
  |  |  |  |   61|    430|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|    430|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 430]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 430]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  220|    430|            x = 0 - (x & 0xffffffff);                                   \
  |  |  221|    430|        }                                                               \
  |  |  222|  9.03k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (222:13): [Folded, False: 9.03k]
  |  |  ------------------
  ------------------
  619|       |
  620|  9.03k|    DEBUGMSG(("dumpv_recv", "  Integer:\t%ld (0x%.2lX)\n", value.l, value.l));
  ------------------
  |  |   61|  9.03k|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|  9.03k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 9.03k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 9.03k]
  |  |  ------------------
  ------------------
  621|       |
  622|  9.03k|    *intp = value.l;
  623|  9.03k|    return bufp;
  624|  9.08k|}
asn_parse_unsigned_int:
  652|  3.69k|{
  653|       |    /*
  654|       |     * ASN.1 integer ::= 0x02 asnlength byte {byte}*
  655|       |     */
  656|  3.69k|    static const char *errpre = "parse uint";
  657|  3.69k|    register u_char *bufp = data;
  658|  3.69k|    u_long          asn_length;
  659|  3.69k|    register u_long value = 0;
  660|       |
  661|  3.69k|    if (NULL == data || NULL == datalength || NULL == type || NULL == intp) {
  ------------------
  |  Branch (661:9): [True: 0, False: 3.69k]
  |  Branch (661:25): [True: 0, False: 3.69k]
  |  Branch (661:47): [True: 0, False: 3.69k]
  |  Branch (661:63): [True: 0, False: 3.69k]
  ------------------
  662|      0|        ERROR_MSG("parse uint: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  663|      0|        return NULL;
  664|      0|    }
  665|       |
  666|  3.69k|    if (intsize != sizeof(long)) {
  ------------------
  |  Branch (666:9): [True: 0, False: 3.69k]
  ------------------
  667|      0|        _asn_size_err(errpre, intsize, sizeof(long));
  668|      0|        return NULL;
  669|      0|    }
  670|       |
  671|       |    /** need at least 2 bytes to work with: type, length (which might be 0)  */
  672|  3.69k|    if (*datalength < 2) {
  ------------------
  |  Branch (672:9): [True: 2, False: 3.69k]
  ------------------
  673|      2|        _asn_short_err(errpre, *datalength, 2);
  674|      2|        return NULL;
  675|      2|    }
  676|       |
  677|  3.69k|    *type = *bufp++;
  678|  3.69k|    if (*type != ASN_COUNTER && *type != ASN_GAUGE && *type != ASN_TIMETICKS
  ------------------
  |  |   89|  7.38k|#define ASN_COUNTER	(ASN_APPLICATION | 1)
  |  |  ------------------
  |  |  |  |   91|  3.69k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if (*type != ASN_COUNTER && *type != ASN_GAUGE && *type != ASN_TIMETICKS
  ------------------
  |  |   90|  6.18k|#define ASN_GAUGE	(ASN_APPLICATION | 2)
  |  |  ------------------
  |  |  |  |   91|  2.49k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if (*type != ASN_COUNTER && *type != ASN_GAUGE && *type != ASN_TIMETICKS
  ------------------
  |  |   92|  5.33k|#define ASN_TIMETICKS   (ASN_APPLICATION | 3)
  |  |  ------------------
  |  |  |  |   91|  1.64k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (678:9): [True: 2.49k, False: 1.20k]
  |  Branch (678:33): [True: 1.64k, False: 854]
  |  Branch (678:55): [True: 902, False: 738]
  ------------------
  679|    902|            && *type != ASN_UINTEGER) {
  ------------------
  |  |  100|    902|#define ASN_UINTEGER    (ASN_APPLICATION | 7)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|    902|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (679:16): [True: 21, False: 881]
  ------------------
  680|     21|        _asn_type_err(errpre, *type);
  681|     21|        return NULL;
  682|     21|    }
  683|       |
  684|  3.67k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
  685|  3.67k|    if (NULL == bufp) {
  ------------------
  |  Branch (685:9): [True: 132, False: 3.54k]
  ------------------
  686|    132|        _asn_short_err(errpre, *datalength - 1, asn_length);
  687|    132|        return NULL;
  688|    132|    }
  689|       |
  690|  3.54k|    if ((asn_length > (intsize + 1)) || ((int) asn_length == 0) ||
  ------------------
  |  Branch (690:9): [True: 16, False: 3.52k]
  |  Branch (690:41): [True: 18, False: 3.50k]
  ------------------
  691|  3.50k|        ((asn_length == intsize + 1) && *bufp != 0x00)) {
  ------------------
  |  Branch (691:10): [True: 338, False: 3.16k]
  |  Branch (691:41): [True: 9, False: 329]
  ------------------
  692|     43|        _asn_length_err(errpre, (size_t) asn_length, intsize);
  693|     43|        return NULL;
  694|     43|    }
  695|  3.49k|    *datalength -= (int) asn_length + (bufp - data);
  696|       |
  697|  3.49k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|  3.49k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  3.49k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3.49k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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.49k]
  |  |  ------------------
  ------------------
  698|       |
  699|  13.7k|    while (asn_length--)
  ------------------
  |  Branch (699:12): [True: 10.2k, False: 3.49k]
  ------------------
  700|  10.2k|        value = (value << 8) | *bufp++;
  701|       |
  702|  3.49k|    CHECK_OVERFLOW_U(value,2);
  ------------------
  |  |  224|  3.49k|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|  3.49k|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 931, False: 2.56k]
  |  |  ------------------
  |  |  226|    931|            x &= 0xffffffff;                                            \
  |  |  227|    931|            DEBUGMSG(("asn","truncating unsigned value to 32 bits (%d)\n",y)); \
  |  |  ------------------
  |  |  |  |   61|    931|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|    931|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 931]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 931]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  228|    931|        }                                                               \
  |  |  229|  3.49k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 3.49k]
  |  |  ------------------
  ------------------
  703|       |
  704|  3.49k|    DEBUGMSG(("dumpv_recv", "  UInteger:\t%ld (0x%.2lX)\n", value, value));
  ------------------
  |  |   61|  3.49k|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|  3.49k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3.49k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 3.49k]
  |  |  ------------------
  ------------------
  705|       |
  706|  3.49k|    *intp = value;
  707|  3.49k|    return bufp;
  708|  3.54k|}
asn_parse_string:
  912|  6.46k|{
  913|  6.46k|    static const char *errpre = "parse string";
  914|  6.46k|    u_char         *bufp = data;
  915|  6.46k|    u_long          asn_length;
  916|       |
  917|  6.46k|    if (NULL == data || NULL == datalength || NULL == type || NULL == str ||
  ------------------
  |  Branch (917:9): [True: 0, False: 6.46k]
  |  Branch (917:25): [True: 0, False: 6.46k]
  |  Branch (917:47): [True: 0, False: 6.46k]
  |  Branch (917:63): [True: 0, False: 6.46k]
  ------------------
  918|  6.46k|        NULL == strlength) {
  ------------------
  |  Branch (918:9): [True: 0, False: 6.46k]
  ------------------
  919|      0|        ERROR_MSG("parse string: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  920|      0|        return NULL;
  921|      0|    }
  922|       |
  923|       |    /** need at least 2 bytes to work with: type, length (which might be 0)  */
  924|  6.46k|    if (*datalength < 2) {
  ------------------
  |  Branch (924:9): [True: 307, False: 6.16k]
  ------------------
  925|    307|        _asn_short_err(errpre, *datalength, 2);
  926|    307|        return NULL;
  927|    307|    }
  928|       |
  929|  6.16k|    *type = *bufp++;
  930|  6.16k|    if (*type != ASN_OCTET_STR && *type != ASN_IPADDRESS && *type != ASN_OPAQUE
  ------------------
  |  |   78|  12.3k|#define ASN_OCTET_STR	    0x04U
  ------------------
                  if (*type != ASN_OCTET_STR && *type != ASN_IPADDRESS && *type != ASN_OPAQUE
  ------------------
  |  |   88|  10.2k|#define ASN_IPADDRESS   (ASN_APPLICATION | 0)
  |  |  ------------------
  |  |  |  |   91|  4.05k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if (*type != ASN_OCTET_STR && *type != ASN_IPADDRESS && *type != ASN_OPAQUE
  ------------------
  |  |   93|  9.61k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  3.45k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (930:9): [True: 4.05k, False: 2.10k]
  |  Branch (930:35): [True: 3.45k, False: 603]
  |  Branch (930:61): [True: 1.63k, False: 1.82k]
  ------------------
  931|  1.63k|            && *type != ASN_NSAP) {
  ------------------
  |  |   98|  1.63k|#define ASN_NSAP	(ASN_APPLICATION | 5)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|  1.63k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (931:16): [True: 409, False: 1.22k]
  ------------------
  932|    409|        _asn_type_err(errpre, *type);
  933|    409|        return NULL;
  934|    409|    }
  935|       |
  936|  5.75k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
  937|  5.75k|    if (NULL == bufp) {
  ------------------
  |  Branch (937:9): [True: 149, False: 5.60k]
  ------------------
  938|    149|        _asn_short_err(errpre, *datalength - 1, asn_length);
  939|    149|        return NULL;
  940|    149|    }
  941|       |
  942|  5.60k|    if (asn_length > *strlength) {
  ------------------
  |  Branch (942:9): [True: 36, False: 5.56k]
  ------------------
  943|     36|        _asn_length_err(errpre, (size_t) asn_length, *strlength);
  944|     36|        return NULL;
  945|     36|    }
  946|       |
  947|  5.56k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|  5.56k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  5.56k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 5.56k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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.56k]
  |  |  ------------------
  ------------------
  948|       |
  949|  5.56k|    memmove(str, bufp, asn_length);
  950|  5.56k|    if (*strlength > asn_length)
  ------------------
  |  Branch (950:9): [True: 2.37k, False: 3.19k]
  ------------------
  951|  2.37k|        str[asn_length] = 0;
  952|  5.56k|    *strlength = asn_length;
  953|  5.56k|    *datalength -= asn_length + (bufp - data);
  954|       |
  955|  5.56k|    DEBUGIF("dumpv_recv") {
  ------------------
  |  |  145|  5.56k|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|  11.1k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 5.56k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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]
  |  |  ------------------
  ------------------
  956|      0|        u_char         *buf = (u_char *) malloc(1 + asn_length);
  957|      0|        size_t          l = (buf != NULL) ? (1 + asn_length) : 0, ol = 0;
  ------------------
  |  Branch (957:29): [True: 0, False: 0]
  ------------------
  958|       |
  959|      0|        if (sprint_realloc_asciistring
  ------------------
  |  Branch (959:13): [True: 0, False: 0]
  ------------------
  960|      0|            (&buf, &l, &ol, 1, str, asn_length)) {
  961|      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]
  |  |  ------------------
  ------------------
  962|      0|        } else {
  963|      0|            if (buf == NULL) {
  ------------------
  |  Branch (963:17): [True: 0, False: 0]
  ------------------
  964|      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]
  |  |  ------------------
  ------------------
  965|      0|            } else {
  966|      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]
  |  |  ------------------
  ------------------
  967|      0|                          buf));
  968|      0|            }
  969|      0|        }
  970|      0|        if (buf != NULL) {
  ------------------
  |  Branch (970:13): [True: 0, False: 0]
  ------------------
  971|      0|            free(buf);
  972|      0|        }
  973|      0|    }
  974|       |
  975|  5.56k|    return bufp + asn_length;
  976|  5.60k|}
asn_parse_header:
 1073|  45.1k|{
 1074|  45.1k|    register u_char *bufp;
 1075|  45.1k|    u_long          asn_length = 0;
 1076|  45.1k|    const char      *errpre = "parse header";
 1077|       |
 1078|  45.1k|    if (!data || !datalength || !type) {
  ------------------
  |  Branch (1078:9): [True: 0, False: 45.1k]
  |  Branch (1078:18): [True: 0, False: 45.1k]
  |  Branch (1078:33): [True: 0, False: 45.1k]
  ------------------
 1079|      0|        ERROR_MSG("parse header: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1080|      0|        return NULL;
 1081|      0|    }
 1082|       |
 1083|       |    /** need at least 2 bytes to work with: type, length (which might be 0) */
 1084|  45.1k|    if (*datalength < 2) {
  ------------------
  |  Branch (1084:9): [True: 403, False: 44.7k]
  ------------------
 1085|    403|        _asn_short_err(errpre, *datalength, 2);
 1086|    403|        return NULL;
 1087|    403|    }
 1088|       |
 1089|  44.7k|    bufp = data;
 1090|       |    /*
 1091|       |     * this only works on data types < 30, i.e. no extension octets 
 1092|       |     */
 1093|  44.7k|    if (IS_EXTENSION_ID(*bufp)) {
  ------------------
  |  |  103|  44.7k|#define IS_EXTENSION_ID(byte)	(((byte) & ASN_EXTENSION_ID) == ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|  44.7k|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  |  |               #define IS_EXTENSION_ID(byte)	(((byte) & ASN_EXTENSION_ID) == ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|  44.7k|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  |  |  |  Branch (103:31): [True: 17, False: 44.7k]
  |  |  ------------------
  ------------------
 1094|     17|        ERROR_MSG("can't process ID >= 30");
  ------------------
  |  |  188|     17|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1095|     17|        return NULL;
 1096|     17|    }
 1097|  44.7k|    *type = *bufp++;
 1098|       |
 1099|  44.7k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 1100|  44.7k|    if (NULL == bufp) {
  ------------------
  |  Branch (1100:9): [True: 761, False: 43.9k]
  ------------------
 1101|    761|        _asn_short_err(errpre, *datalength - 1, asn_length);
 1102|    761|        return NULL;
 1103|    761|    }
 1104|       |
 1105|       |#ifdef DUMP_PRINT_HEADERS
 1106|       |    DEBUGDUMPSETUP("recv", data, (bufp - data));
 1107|       |    DEBUGMSG(("dumpv_recv", "  Header: 0x%.2X, len = %d (0x%X)\n", *data,
 1108|       |              asn_length, asn_length));
 1109|       |#else
 1110|       |    /*
 1111|       |     * DEBUGMSGHEXTLI(("recv",data,(bufp-data)));
 1112|       |     * DEBUGMSG(("dumpH_recv","\n"));
 1113|       |     */
 1114|  43.9k|#endif
 1115|       |
 1116|  43.9k|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 1117|       |
 1118|  43.9k|    if ((asn_length > 2) && (*type == ASN_OPAQUE) && (*bufp == ASN_OPAQUE_TAG1)) {
  ------------------
  |  |   93|  32.7k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  32.7k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if ((asn_length > 2) && (*type == ASN_OPAQUE) && (*bufp == ASN_OPAQUE_TAG1)) {
  ------------------
  |  |  131|  4.49k|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|  4.49k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|  4.49k|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
  |  Branch (1118:9): [True: 32.7k, False: 11.1k]
  |  Branch (1118:29): [True: 4.49k, False: 28.2k]
  |  Branch (1118:54): [True: 3.88k, False: 601]
  ------------------
 1119|       |
 1120|       |        /*
 1121|       |         * check if 64-but counter 
 1122|       |         */
 1123|  3.88k|        switch (*(bufp + 1)) {
 1124|    894|        case ASN_OPAQUE_COUNTER64:
  ------------------
  |  |  156|    894|#define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  136|    894|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  146|    894|#define ASN_APP_COUNTER64 (ASN_APPLICATION | 6)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    894|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1124:9): [True: 894, False: 2.99k]
  ------------------
 1125|  1.55k|        case ASN_OPAQUE_U64:
  ------------------
  |  |  192|  1.55k|#define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  136|  1.55k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  150|  1.55k|#define ASN_APP_U64 (ASN_APPLICATION | 11)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.55k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1125:9): [True: 665, False: 3.22k]
  ------------------
 1126|  2.07k|        case ASN_OPAQUE_FLOAT:
  ------------------
  |  |  165|  2.07k|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|  2.07k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|  2.07k|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  2.07k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1126:9): [True: 515, False: 3.37k]
  ------------------
 1127|  2.34k|        case ASN_OPAQUE_DOUBLE:
  ------------------
  |  |  174|  2.34k|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|  2.34k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|  2.34k|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  2.34k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1127:9): [True: 273, False: 3.61k]
  ------------------
 1128|  3.48k|        case ASN_OPAQUE_I64:
  ------------------
  |  |  183|  3.48k|#define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  136|  3.48k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  149|  3.48k|#define ASN_APP_I64 (ASN_APPLICATION | 10)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  3.48k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1128:9): [True: 1.13k, False: 2.75k]
  ------------------
 1129|  3.48k|            *type = *(bufp + 1);
 1130|  3.48k|            break;
 1131|       |
 1132|    407|        default:
  ------------------
  |  Branch (1132:9): [True: 407, False: 3.48k]
  ------------------
 1133|       |            /*
 1134|       |             * just an Opaque 
 1135|       |             */
 1136|    407|            *datalength = (int) asn_length;
 1137|    407|            return bufp;
 1138|  3.88k|        }
 1139|       |        /*
 1140|       |         * value is encoded as special format 
 1141|       |         */
 1142|  3.48k|        *datalength = (int) asn_length;
 1143|  3.48k|        bufp = asn_parse_nlength(bufp+2, *datalength - 2, &asn_length);
 1144|  3.48k|        if (NULL == bufp) {
  ------------------
  |  Branch (1144:13): [True: 35, False: 3.44k]
  ------------------
 1145|     35|            _asn_short_err("parse opaque header", *datalength - 2, asn_length);
 1146|     35|            return NULL;
 1147|     35|        }
 1148|  3.48k|    }
 1149|  43.5k|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 1150|       |
 1151|  43.5k|    *datalength = (int) asn_length;
 1152|       |
 1153|  43.5k|    return bufp;
 1154|  43.9k|}
asn_parse_sequence:
 1173|  26.2k|{                               /* error message prefix */
 1174|  26.2k|    data = asn_parse_header(data, datalength, type);
 1175|  26.2k|    if (data && (*type != expected_type)) {
  ------------------
  |  Branch (1175:9): [True: 25.0k, False: 1.17k]
  |  Branch (1175:17): [True: 1.66k, False: 23.4k]
  ------------------
 1176|  1.66k|        char            ebuf[128];
 1177|  1.66k|        snprintf(ebuf, sizeof(ebuf),
 1178|  1.66k|                 "%s header type %02X: s/b %02X", estr,
 1179|  1.66k|                (u_char) * type, (u_char) expected_type);
 1180|  1.66k|        ERROR_MSG(ebuf);
  ------------------
  |  |  188|  1.66k|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1181|  1.66k|        return NULL;
 1182|  1.66k|    }
 1183|  24.5k|    return data;
 1184|  26.2k|}
asn_parse_length:
 1295|  12.7k|{
 1296|  12.7k|    static const char *errpre = "parse length";
 1297|  12.7k|    char            ebuf[128];
 1298|  12.7k|    register u_char lengthbyte;
 1299|       |
 1300|  12.7k|    if (!data || !length) {
  ------------------
  |  Branch (1300:9): [True: 0, False: 12.7k]
  |  Branch (1300:18): [True: 0, False: 12.7k]
  ------------------
 1301|      0|        ERROR_MSG("parse length: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1302|      0|        return NULL;
 1303|      0|    }
 1304|  12.7k|    lengthbyte = *data;
 1305|       |
 1306|  12.7k|    if (lengthbyte & ASN_LONG_LEN) {
  ------------------
  |  |   98|  12.7k|#define ASN_LONG_LEN	    0x80U
  ------------------
  |  Branch (1306:9): [True: 12.7k, False: 0]
  ------------------
 1307|  12.7k|        lengthbyte &= ~ASN_LONG_LEN;    /* turn MSb off */
  ------------------
  |  |   98|  12.7k|#define ASN_LONG_LEN	    0x80U
  ------------------
 1308|  12.7k|        if (lengthbyte == 0) {
  ------------------
  |  Branch (1308:13): [True: 115, False: 12.5k]
  ------------------
 1309|    115|            snprintf(ebuf, sizeof(ebuf),
 1310|    115|                     "%s: indefinite length not supported", errpre);
 1311|    115|            ERROR_MSG(ebuf);
  ------------------
  |  |  188|    115|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1312|    115|            return NULL;
 1313|    115|        }
 1314|  12.5k|        if (lengthbyte > sizeof(long)) {
  ------------------
  |  Branch (1314:13): [True: 140, False: 12.4k]
  ------------------
 1315|    140|            snprintf(ebuf, sizeof(ebuf),
 1316|    140|                    "%s: data length %d > %lu not supported", errpre,
 1317|    140|                    lengthbyte, (unsigned long)sizeof(long));
 1318|    140|            ERROR_MSG(ebuf);
  ------------------
  |  |  188|    140|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1319|    140|            return NULL;
 1320|    140|        }
 1321|  12.4k|        data++;
 1322|  12.4k|        *length = 0;            /* protect against short lengths */
 1323|  31.1k|        while (lengthbyte--) {
  ------------------
  |  Branch (1323:16): [True: 18.7k, False: 12.4k]
  ------------------
 1324|  18.7k|            *length <<= 8;
 1325|  18.7k|            *length |= *data++;
 1326|  18.7k|        }
 1327|  12.4k|        if ((long) *length < 0) {
  ------------------
  |  Branch (1327:13): [True: 125, False: 12.3k]
  ------------------
 1328|    125|            snprintf(ebuf, sizeof(ebuf),
 1329|    125|                     "%s: negative data length %ld\n", errpre,
 1330|    125|                     (long) *length);
 1331|    125|            ERROR_MSG(ebuf);
  ------------------
  |  |  188|    125|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1332|    125|            return NULL;
 1333|    125|        }
 1334|  12.3k|        return data;
 1335|  12.4k|    } else {                    /* short asnlength */
 1336|      0|        *length = (long) lengthbyte;
 1337|      0|        return data + 1;
 1338|      0|    }
 1339|  12.7k|}
asn_parse_objid:
 1437|  19.4k|{
 1438|  19.4k|    static const char *errpre = "parse objid";
 1439|       |    /*
 1440|       |     * ASN.1 objid ::= 0x06 asnlength subidentifier {subidentifier}*
 1441|       |     * subidentifier ::= {leadingbyte}* lastbyte
 1442|       |     * leadingbyte ::= 1 7bitvalue
 1443|       |     * lastbyte ::= 0 7bitvalue
 1444|       |     */
 1445|  19.4k|    register u_char *bufp = data;
 1446|  19.4k|    register oid   *oidp = objid + 1;
 1447|  19.4k|    register u_long subidentifier;
 1448|  19.4k|    register long   length;
 1449|  19.4k|    u_long          asn_length;
 1450|  19.4k|    size_t          original_length = *objidlength;
 1451|       |
 1452|  19.4k|    if (NULL == data || NULL == datalength || NULL == type || NULL == objid) {
  ------------------
  |  Branch (1452:9): [True: 0, False: 19.4k]
  |  Branch (1452:25): [True: 0, False: 19.4k]
  |  Branch (1452:47): [True: 0, False: 19.4k]
  |  Branch (1452:63): [True: 0, False: 19.4k]
  ------------------
 1453|      0|        ERROR_MSG("parse objid: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1454|      0|        return NULL;
 1455|      0|    }
 1456|       |
 1457|       |    /** need at least 2 bytes to work with: type, length (which might be 0)  */
 1458|  19.4k|    if (*datalength < 2) {
  ------------------
  |  Branch (1458:9): [True: 18, False: 19.4k]
  ------------------
 1459|     18|        _asn_short_err(errpre, *datalength, 2);
 1460|     18|        return NULL;
 1461|     18|    }
 1462|       |
 1463|  19.4k|    *type = *bufp++;
 1464|  19.4k|    if (*type != ASN_OBJECT_ID) {
  ------------------
  |  |   81|  19.4k|#define ASN_OBJECT_ID	    0x06U
  ------------------
  |  Branch (1464:9): [True: 28, False: 19.4k]
  ------------------
 1465|     28|        _asn_type_err(errpre, *type);
 1466|     28|        return NULL;
 1467|     28|    }
 1468|  19.4k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 1469|  19.4k|    if (NULL == bufp) {
  ------------------
  |  Branch (1469:9): [True: 146, False: 19.2k]
  ------------------
 1470|    146|        _asn_short_err(errpre, *datalength - 1, asn_length);
 1471|    146|        return NULL;
 1472|    146|    }
 1473|       |
 1474|  19.2k|    *datalength -= (int) asn_length + (bufp - data);
 1475|       |
 1476|  19.2k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|  19.2k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  19.2k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 19.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  196|      0|        debugmsg("dumpx" token, "dumpx_%s:%*s", token, __DBGINDENT(), ""); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  |  |  197|      0|        __DBGMSGHEX(("dumpx_" token,buf,len)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  |  |  ------------------
  |  |  |  |  198|      0|        if (debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (198:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  199|      0|            debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (199:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  200|      0|            debugmsg("dumpx_" token,"\n"); \
  |  |  |  |  201|      0|        } else { \
  |  |  |  |  202|      0|            debugmsg("dumpx_" token,"  "); \
  |  |  |  |  203|      0|        } \
  |  |  |  |  204|      0|        debugmsg("dumpv" token, "dumpv_%s:%*s", token, __DBGINDENT(), "");
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:60): [Folded, False: 19.2k]
  |  |  ------------------
  ------------------
 1477|       |
 1478|       |    /*
 1479|       |     * Handle invalid object identifier encodings of the form 06 00 robustly 
 1480|       |     */
 1481|  19.2k|    if (asn_length == 0)
  ------------------
  |  Branch (1481:9): [True: 15.9k, False: 3.34k]
  ------------------
 1482|  15.9k|        objid[0] = objid[1] = 0;
 1483|       |
 1484|  19.2k|    length = asn_length;
 1485|  19.2k|    (*objidlength)--;           /* account for expansion of first byte */
 1486|       |
 1487|  36.8k|    while (length > 0 && (*objidlength)-- > 0) {
  ------------------
  |  Branch (1487:12): [True: 17.6k, False: 19.2k]
  |  Branch (1487:26): [True: 17.5k, False: 23]
  ------------------
 1488|  17.5k|        subidentifier = 0;
 1489|  20.0k|        do {                    /* shift and add in low order 7 bits */
 1490|  20.0k|            if (subidentifier > (MAX_SUBID >> 7)) {
  ------------------
  |  |   18|  20.0k|#define MAX_SUBID   0xFFFFFFFFUL
  ------------------
  |  Branch (1490:17): [True: 26, False: 20.0k]
  ------------------
 1491|     26|                ERROR_MSG("subidentifier too large / overflow");
  ------------------
  |  |  188|     26|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1492|     26|                return NULL;
 1493|     26|            }
 1494|  20.0k|            subidentifier =
 1495|  20.0k|                (subidentifier << 7) + (*(u_char *) bufp & ~ASN_BIT8);
  ------------------
  |  |  100|  20.0k|#define ASN_BIT8	    0x80U
  ------------------
 1496|  20.0k|            length--;
 1497|  20.0k|        } while ((*(u_char *) bufp++ & ASN_BIT8) && (length > 0));        /* last byte has high bit clear */
  ------------------
  |  |  100|  20.0k|#define ASN_BIT8	    0x80U
  ------------------
  |  Branch (1497:18): [True: 2.50k, False: 17.5k]
  |  Branch (1497:53): [True: 2.47k, False: 24]
  ------------------
 1498|       |
 1499|  17.5k|	if (length == 0) {
  ------------------
  |  Branch (1499:6): [True: 3.30k, False: 14.2k]
  ------------------
 1500|  3.30k|            u_char *last_byte = bufp - 1;
 1501|  3.30k|            if (*last_byte & ASN_BIT8) {
  ------------------
  |  |  100|  3.30k|#define ASN_BIT8	    0x80U
  ------------------
  |  Branch (1501:17): [True: 24, False: 3.27k]
  ------------------
 1502|       |                /* last byte has high bit set -> wrong BER encoded OID */
 1503|     24|                ERROR_MSG("subidentifier syntax error");
  ------------------
  |  |  188|     24|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1504|     24|                return NULL;
 1505|     24|            }
 1506|  3.30k|        }
 1507|  17.5k|        if (subidentifier > MAX_SUBID) {
  ------------------
  |  |   18|  17.5k|#define MAX_SUBID   0xFFFFFFFFUL
  ------------------
  |  Branch (1507:13): [True: 0, False: 17.5k]
  ------------------
 1508|      0|            ERROR_MSG("subidentifier too large");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1509|      0|            return NULL;
 1510|      0|        }
 1511|  17.5k|        *oidp++ = (oid) subidentifier;
 1512|  17.5k|    }
 1513|       |
 1514|  19.2k|    if (length || oidp < objid + 1) {
  ------------------
  |  Branch (1514:9): [True: 23, False: 19.2k]
  |  Branch (1514:19): [True: 0, False: 19.2k]
  ------------------
 1515|     23|        ERROR_MSG("OID length exceeds buffer size");
  ------------------
  |  |  188|     23|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1516|     23|        *objidlength = original_length;
 1517|     23|        return NULL;
 1518|     23|    }
 1519|       |
 1520|       |    /*
 1521|       |     * The first two subidentifiers are encoded into the first component
 1522|       |     * with the value (X * 40) + Y, where:
 1523|       |     *  X is the value of the first subidentifier.
 1524|       |     *  Y is the value of the second subidentifier.
 1525|       |     */
 1526|  19.2k|    subidentifier = oidp - objid >= 2 ? objid[1] : 0;
  ------------------
  |  Branch (1526:21): [True: 3.27k, False: 15.9k]
  ------------------
 1527|  19.2k|    if (subidentifier == 0x2B) {
  ------------------
  |  Branch (1527:9): [True: 529, False: 18.6k]
  ------------------
 1528|    529|        objid[0] = 1;
 1529|    529|        objid[1] = 3;
 1530|  18.6k|    } else {
 1531|  18.6k|        if (subidentifier < 40) {
  ------------------
  |  Branch (1531:13): [True: 16.4k, False: 2.20k]
  ------------------
 1532|  16.4k|            objid[0] = 0;
 1533|  16.4k|            objid[1] = subidentifier;
 1534|  16.4k|        } else if (subidentifier < 80) {
  ------------------
  |  Branch (1534:20): [True: 1.00k, False: 1.20k]
  ------------------
 1535|  1.00k|            objid[0] = 1;
 1536|  1.00k|            objid[1] = subidentifier - 40;
 1537|  1.20k|        } else {
 1538|  1.20k|            objid[0] = 2;
 1539|  1.20k|            objid[1] = subidentifier - 80;
 1540|  1.20k|        }
 1541|  18.6k|    }
 1542|       |
 1543|  19.2k|    *objidlength = (int) (oidp - objid);
 1544|       |
 1545|  19.2k|    DEBUGMSG(("dumpv_recv", "  ObjID: "));
  ------------------
  |  |   61|  19.2k|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|  19.2k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 19.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 19.2k]
  |  |  ------------------
  ------------------
 1546|  19.2k|    DEBUGMSGOID(("dumpv_recv", objid, *objidlength));
  ------------------
  |  |   67|  19.2k|#define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  19.2k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 19.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  165|      0|#define __DBGMSGOID(x)     debugmsg_oid x
  |  |  ------------------
  |  |  |  Branch (67:71): [Folded, False: 19.2k]
  |  |  ------------------
  ------------------
 1547|  19.2k|    DEBUGMSG(("dumpv_recv", "\n"));
  ------------------
  |  |   61|  19.2k|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|  19.2k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 19.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 19.2k]
  |  |  ------------------
  ------------------
 1548|  19.2k|    return bufp;
 1549|  19.2k|}
asn_parse_bitstring:
 1819|  1.03k|{
 1820|       |    /*
 1821|       |     * bitstring ::= 0x03 asnlength unused {byte}*
 1822|       |     */
 1823|  1.03k|    static const char *errpre = "parse bitstring";
 1824|  1.03k|    register u_char *bufp = data;
 1825|  1.03k|    u_long          asn_length;
 1826|       |
 1827|  1.03k|    if (NULL == data || NULL == datalength || NULL == type ||
  ------------------
  |  Branch (1827:9): [True: 0, False: 1.03k]
  |  Branch (1827:25): [True: 0, False: 1.03k]
  |  Branch (1827:47): [True: 0, False: 1.03k]
  ------------------
 1828|  1.03k|        NULL == str || NULL == strlength) {
  ------------------
  |  Branch (1828:9): [True: 0, False: 1.03k]
  |  Branch (1828:24): [True: 0, False: 1.03k]
  ------------------
 1829|      0|        ERROR_MSG("parse bitstring: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1830|      0|        return NULL;
 1831|      0|    }
 1832|       |
 1833|       |    /** need at least 2 bytes to work with: type, length (which might be 0)  */
 1834|  1.03k|    if (*datalength < 2) {
  ------------------
  |  Branch (1834:9): [True: 0, False: 1.03k]
  ------------------
 1835|      0|        _asn_short_err(errpre, *datalength, 2);
 1836|      0|        return NULL;
 1837|      0|    }
 1838|       |
 1839|  1.03k|    *type = *bufp++;
 1840|  1.03k|    if (*type != ASN_BIT_STR) {
  ------------------
  |  |   77|  1.03k|#define ASN_BIT_STR	    0x03U
  ------------------
  |  Branch (1840:9): [True: 0, False: 1.03k]
  ------------------
 1841|      0|        _asn_type_err(errpre, *type);
 1842|      0|        return NULL;
 1843|      0|    }
 1844|       |
 1845|  1.03k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 1846|  1.03k|    if (NULL == bufp) {
  ------------------
  |  Branch (1846:9): [True: 0, False: 1.03k]
  ------------------
 1847|      0|        _asn_short_err(errpre, *datalength - 1, asn_length);
 1848|      0|        return NULL;
 1849|      0|    }
 1850|       |
 1851|  1.03k|    if ((size_t) asn_length > *strlength) {
  ------------------
  |  Branch (1851:9): [True: 0, False: 1.03k]
  ------------------
 1852|      0|        _asn_length_err(errpre, (size_t) asn_length, *strlength);
 1853|      0|        return NULL;
 1854|      0|    }
 1855|  1.03k|    if (_asn_bitstring_check(errpre, asn_length, *bufp))
  ------------------
  |  Branch (1855:9): [True: 8, False: 1.02k]
  ------------------
 1856|      8|        return NULL;
 1857|       |
 1858|  1.02k|    DEBUGDUMPSETUP("recv", data, bufp - data);
  ------------------
  |  |   83|  1.02k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  1.02k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1.02k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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.02k]
  |  |  ------------------
  ------------------
 1859|  1.02k|    DEBUGMSG(("dumpv_recv", "  Bitstring: "));
  ------------------
  |  |   61|  1.02k|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|  1.02k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1.02k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 1.02k]
  |  |  ------------------
  ------------------
 1860|  1.02k|    DEBUGMSGHEX(("dumpv_recv", data, asn_length));
  ------------------
  |  |   71|  1.02k|#define DEBUGMSGHEX(x)     do {if (_DBG_IF_) {__DBGMSGHEX(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  1.02k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1.02k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGHEX(x)     do {if (_DBG_IF_) {__DBGMSGHEX(x);} }while(0)
  |  |  ------------------
  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  ------------------
  |  |  |  Branch (71:71): [Folded, False: 1.02k]
  |  |  ------------------
  ------------------
 1861|  1.02k|    DEBUGMSG(("dumpv_recv", "\n"));
  ------------------
  |  |   61|  1.02k|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|  1.02k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1.02k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 1.02k]
  |  |  ------------------
  ------------------
 1862|       |
 1863|  1.02k|    memmove(str, bufp, asn_length);
 1864|  1.02k|    *strlength = (int) asn_length;
 1865|  1.02k|    *datalength -= (int) asn_length + (bufp - data);
 1866|  1.02k|    return bufp + asn_length;
 1867|  1.03k|}
asn_parse_unsigned_int64:
 1951|  2.86k|{
 1952|       |    /*
 1953|       |     * ASN.1 integer ::= 0x02 asnlength byte {byte}*
 1954|       |     */
 1955|  2.86k|    static const char *errpre = "parse uint64";
 1956|  2.86k|    const int       uint64sizelimit = (4 * 2) + 1;
 1957|  2.86k|    register u_char *bufp = data;
 1958|  2.86k|    u_char         *endp;
 1959|  2.86k|    u_long          asn_length;
 1960|  2.86k|    register u_long low = 0, high = 0;
 1961|       |
 1962|  2.86k|    if (countersize != sizeof(struct counter64)) {
  ------------------
  |  Branch (1962:9): [True: 0, False: 2.86k]
  ------------------
 1963|      0|        _asn_size_err(errpre, countersize, sizeof(struct counter64));
 1964|      0|        return NULL;
 1965|      0|    }
 1966|       |
 1967|  2.86k|    if (NULL == data || NULL == datalength || NULL == type || NULL == cp) {
  ------------------
  |  Branch (1967:9): [True: 0, False: 2.86k]
  |  Branch (1967:25): [True: 0, False: 2.86k]
  |  Branch (1967:47): [True: 0, False: 2.86k]
  |  Branch (1967:63): [True: 0, False: 2.86k]
  ------------------
 1968|      0|        ERROR_MSG("parse uint64: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1969|      0|        return NULL;
 1970|      0|    }
 1971|       |
 1972|       |    /** need at least 2 bytes to work with: type, length (which might be 0)  */
 1973|  2.86k|    if (*datalength < 2) {
  ------------------
  |  Branch (1973:9): [True: 0, False: 2.86k]
  ------------------
 1974|      0|        _asn_short_err(errpre, *datalength, 2);
 1975|      0|        return NULL;
 1976|      0|    }
 1977|       |
 1978|  2.86k|    *type = *bufp++;
 1979|  2.86k|    if (*type != ASN_COUNTER64
  ------------------
  |  |   99|  5.73k|#define ASN_COUNTER64   (ASN_APPLICATION | 6)
  |  |  ------------------
  |  |  |  |   91|  2.86k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (1979:9): [True: 1.54k, False: 1.32k]
  ------------------
 1980|  1.54k|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 1981|  1.54k|            && *type != ASN_OPAQUE
  ------------------
  |  |   93|  1.54k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  1.54k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (1981:16): [True: 6, False: 1.54k]
  ------------------
 1982|  2.86k|#endif
 1983|  2.86k|            ) {
 1984|      6|        _asn_type_err(errpre, *type);
 1985|      6|        return NULL;
 1986|      6|    }
 1987|  2.86k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 1988|  2.86k|    if (NULL == bufp) {
  ------------------
  |  Branch (1988:9): [True: 0, False: 2.86k]
  ------------------
 1989|      0|        _asn_short_err(errpre, *datalength - 1, asn_length);
 1990|      0|        return NULL;
 1991|      0|    }
 1992|  2.86k|    endp = bufp + asn_length;
 1993|       |
 1994|  2.86k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|  2.86k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.86k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.86k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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.86k]
  |  |  ------------------
  ------------------
 1995|  2.86k|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 1996|       |    /** need at least 2 bytes: ASN_OPAQUE_TAG1 and ASN_OPAQUE_<type> */
 1997|  2.86k|    if ((*type == ASN_OPAQUE) && (asn_length < 2)) {
  ------------------
  |  |   93|  2.86k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  2.86k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (1997:9): [True: 1.54k, False: 1.32k]
  |  Branch (1997:34): [True: 0, False: 1.54k]
  ------------------
 1998|      0|        _asn_short_err(errpre, asn_length, 2);
 1999|      0|        return NULL;
 2000|      0|    }
 2001|       |
 2002|       |    /*
 2003|       |     * 64 bit counters as opaque 
 2004|       |     */
 2005|  2.86k|    if ((*type == ASN_OPAQUE) &&
  ------------------
  |  |   93|  2.86k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  2.86k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2005:9): [True: 1.54k, False: 1.32k]
  ------------------
 2006|  1.54k|        (asn_length <= ASN_OPAQUE_COUNTER64_MX_BER_LEN) &&
  ------------------
  |  |  160|  1.54k|#define ASN_OPAQUE_COUNTER64_MX_BER_LEN 12
  ------------------
  |  Branch (2006:9): [True: 1.53k, False: 11]
  ------------------
 2007|  1.53k|        (*bufp == ASN_OPAQUE_TAG1) &&
  ------------------
  |  |  131|  1.53k|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|  1.53k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|  1.53k|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
  |  Branch (2007:9): [True: 1.53k, False: 0]
  ------------------
 2008|  1.53k|        ((*(bufp + 1) == ASN_OPAQUE_COUNTER64) ||
  ------------------
  |  |  156|  1.53k|#define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  136|  1.53k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  146|  1.53k|#define ASN_APP_COUNTER64 (ASN_APPLICATION | 6)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.53k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2008:10): [True: 880, False: 651]
  ------------------
 2009|  1.53k|         (*(bufp + 1) == ASN_OPAQUE_U64))) {
  ------------------
  |  |  192|    651|#define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  136|    651|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  150|    651|#define ASN_APP_U64 (ASN_APPLICATION | 11)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    651|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2009:10): [True: 651, False: 0]
  ------------------
 2010|  1.53k|        size_t          outer_length = asn_length - 2;
 2011|       |
 2012|       |        /*
 2013|       |         * change type to Counter64 or U64 
 2014|       |         */
 2015|  1.53k|        *type = *(bufp + 1);
 2016|       |        /*
 2017|       |         * value is encoded as special format 
 2018|       |         */
 2019|  1.53k|        bufp = asn_parse_nlength(bufp + 2, outer_length, &asn_length);
 2020|  1.53k|        if (NULL == bufp) {
  ------------------
  |  Branch (2020:13): [True: 0, False: 1.53k]
  ------------------
 2021|      0|            _asn_short_err("parse opaque uint64", outer_length, asn_length);
 2022|      0|            return NULL;
 2023|      0|        }
 2024|  1.53k|    }
 2025|  2.86k|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 2026|  2.86k|    if (((int) asn_length > uint64sizelimit) ||
  ------------------
  |  Branch (2026:9): [True: 15, False: 2.84k]
  ------------------
 2027|  2.84k|        (((int) asn_length == uint64sizelimit) && *bufp != 0x00)) {
  ------------------
  |  Branch (2027:10): [True: 292, False: 2.55k]
  |  Branch (2027:51): [True: 9, False: 283]
  ------------------
 2028|     24|        _asn_length_err(errpre, (size_t) asn_length, uint64sizelimit);
 2029|     24|        return NULL;
 2030|     24|    }
 2031|  2.83k|    *datalength -= endp - data;
 2032|  6.97k|    while (asn_length--) {
  ------------------
  |  Branch (2032:12): [True: 4.13k, False: 2.83k]
  ------------------
 2033|  4.13k|        high = ((0x00FFFFFF & high) << 8) | ((low & 0xFF000000U) >> 24);
 2034|  4.13k|        low = ((low & 0x00FFFFFF) << 8) | *bufp++;
 2035|  4.13k|    }
 2036|  2.83k|    bufp = endp;
 2037|       |
 2038|  2.83k|    CHECK_OVERFLOW_U(high,6);
  ------------------
  |  |  224|  2.83k|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|  2.83k|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 0, False: 2.83k]
  |  |  ------------------
  |  |  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.83k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 2.83k]
  |  |  ------------------
  ------------------
 2039|  2.83k|    CHECK_OVERFLOW_U(low,6);
  ------------------
  |  |  224|  2.83k|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|  2.83k|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 0, False: 2.83k]
  |  |  ------------------
  |  |  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.83k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 2.83k]
  |  |  ------------------
  ------------------
 2040|       |
 2041|  2.83k|    cp->low = low;
 2042|  2.83k|    cp->high = high;
 2043|       |
 2044|  2.83k|    DEBUGIF("dumpv_recv") {
  ------------------
  |  |  145|  2.83k|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|  5.67k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.83k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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]
  |  |  ------------------
  ------------------
 2045|      0|        char            i64buf[I64CHARSZ + 1];
 2046|      0|        printU64(i64buf, cp);
 2047|      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]
  |  |  ------------------
  ------------------
 2048|      0|    }
 2049|       |
 2050|  2.83k|    return bufp;
 2051|  2.86k|}
asn_parse_signed_int64:
 2228|  1.14k|{
 2229|  1.14k|    static const char *errpre = "parse int64";
 2230|  1.14k|    const int       int64sizelimit = (4 * 2) + 1;
 2231|  1.14k|    char            ebuf[128];
 2232|  1.14k|    register u_char *bufp = data;
 2233|  1.14k|    u_char         *endp;
 2234|  1.14k|    u_long          asn_length;
 2235|  1.14k|    register u_int  low = 0, high = 0;
 2236|       |
 2237|  1.14k|    if (countersize != sizeof(struct counter64)) {
  ------------------
  |  Branch (2237:9): [True: 0, False: 1.14k]
  ------------------
 2238|      0|        _asn_size_err(errpre, countersize, sizeof(struct counter64));
 2239|      0|        return NULL;
 2240|      0|    }
 2241|       |
 2242|  1.14k|    if (NULL == data || NULL == datalength || NULL == type || NULL == cp) {
  ------------------
  |  Branch (2242:9): [True: 0, False: 1.14k]
  |  Branch (2242:25): [True: 0, False: 1.14k]
  |  Branch (2242:47): [True: 0, False: 1.14k]
  |  Branch (2242:63): [True: 0, False: 1.14k]
  ------------------
 2243|      0|        ERROR_MSG("parse int64: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 2244|      0|        return NULL;
 2245|      0|    }
 2246|       |
 2247|       |    /** need at least 2 bytes to work with: type, length (which might be 0) */
 2248|  1.14k|    if (*datalength < 2) {
  ------------------
  |  Branch (2248:9): [True: 0, False: 1.14k]
  ------------------
 2249|      0|        _asn_short_err(errpre, *datalength, 2);
 2250|      0|        return NULL;
 2251|      0|    }
 2252|       |
 2253|  1.14k|    *type = *bufp++;
 2254|  1.14k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 2255|  1.14k|    if (NULL == bufp) {
  ------------------
  |  Branch (2255:9): [True: 0, False: 1.14k]
  ------------------
 2256|      0|        _asn_short_err(errpre, *datalength - 1, asn_length);
 2257|      0|        return NULL;
 2258|      0|    }
 2259|  1.14k|    endp = bufp + asn_length;
 2260|       |
 2261|       |    /** need at least 2 bytes: ASN_OPAQUE_TAG1 and ASN_OPAQUE_I64 */
 2262|  1.14k|    if (asn_length < 2) {
  ------------------
  |  Branch (2262:9): [True: 11, False: 1.13k]
  ------------------
 2263|     11|        _asn_short_err(errpre, asn_length, 2);
 2264|     11|        return NULL;
 2265|     11|    }
 2266|       |
 2267|  1.13k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|  1.13k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  1.13k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1.13k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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.13k]
  |  |  ------------------
  ------------------
 2268|  1.13k|    if ((*type == ASN_OPAQUE) &&
  ------------------
  |  |   93|  1.13k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  1.13k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2268:9): [True: 1.12k, False: 10]
  ------------------
 2269|  1.12k|        (asn_length <= ASN_OPAQUE_COUNTER64_MX_BER_LEN) &&
  ------------------
  |  |  160|  1.12k|#define ASN_OPAQUE_COUNTER64_MX_BER_LEN 12
  ------------------
  |  Branch (2269:9): [True: 1.11k, False: 15]
  ------------------
 2270|  1.11k|        (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_I64)) {
  ------------------
  |  |  131|  1.11k|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|  1.11k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|  1.11k|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
                      (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_I64)) {
  ------------------
  |  |  183|  1.11k|#define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  136|  1.11k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  149|  1.11k|#define ASN_APP_I64 (ASN_APPLICATION | 10)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.11k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2270:9): [True: 1.11k, False: 0]
  |  Branch (2270:39): [True: 1.11k, False: 0]
  ------------------
 2271|  1.11k|        size_t          outer_length = asn_length - 2;
 2272|       |
 2273|       |        /*
 2274|       |         * change type to Int64 
 2275|       |         */
 2276|  1.11k|        *type = *(bufp + 1);
 2277|       |        /*
 2278|       |         * value is encoded as special format 
 2279|       |         */
 2280|  1.11k|        bufp = asn_parse_nlength(bufp + 2, outer_length, &asn_length);
 2281|  1.11k|        if (NULL == bufp) {
  ------------------
  |  Branch (2281:13): [True: 0, False: 1.11k]
  ------------------
 2282|      0|            _asn_short_err("parse opaque int64", outer_length, asn_length);
 2283|      0|            return NULL;
 2284|      0|        }
 2285|  1.11k|    }
 2286|       |    /*
 2287|       |     * this should always have been true until snmp gets int64 PDU types 
 2288|       |     */
 2289|     25|    else {
 2290|     25|        snprintf(ebuf, sizeof(ebuf),
 2291|     25|                "%s: wrong type: %d, len %d, buf bytes (%02X,%02X)",
 2292|     25|                errpre, *type, (int) asn_length, *bufp, *(bufp + 1));
 2293|     25|        ERROR_MSG(ebuf);
  ------------------
  |  |  188|     25|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 2294|     25|        return NULL;
 2295|     25|    }
 2296|  1.11k|    if (((int) asn_length > int64sizelimit) ||
  ------------------
  |  Branch (2296:9): [True: 0, False: 1.11k]
  ------------------
 2297|  1.11k|        (((int) asn_length == int64sizelimit) && *bufp != 0x00)) {
  ------------------
  |  Branch (2297:10): [True: 206, False: 904]
  |  Branch (2297:50): [True: 2, False: 204]
  ------------------
 2298|      2|        _asn_length_err(errpre, (size_t) asn_length, int64sizelimit);
 2299|      2|        return NULL;
 2300|      2|    }
 2301|  1.10k|    *datalength -= endp - data;
 2302|  1.10k|    if ((asn_length > 0) && (*bufp & 0x80)) {
  ------------------
  |  Branch (2302:9): [True: 757, False: 351]
  |  Branch (2302:29): [True: 235, False: 522]
  ------------------
 2303|    235|        low = 0xFFFFFFFFU;   /* first byte bit 1 means start the data with 1s */
 2304|    235|        high = 0xFFFFFFFFU;
 2305|    235|    }
 2306|       |
 2307|  3.93k|    for ( ; asn_length; asn_length--) {
  ------------------
  |  Branch (2307:13): [True: 2.82k, False: 1.10k]
  ------------------
 2308|  2.82k|        high = ((0x00FFFFFF & high) << 8) | ((low & 0xFF000000U) >> 24);
 2309|  2.82k|        low = ((low & 0x00FFFFFF) << 8) | *bufp++;
 2310|  2.82k|    }
 2311|  1.10k|    bufp = endp;
 2312|       |
 2313|  1.10k|    CHECK_OVERFLOW_U(high,8);
  ------------------
  |  |  224|  1.10k|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|  1.10k|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 0, False: 1.10k]
  |  |  ------------------
  |  |  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.10k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 1.10k]
  |  |  ------------------
  ------------------
 2314|  1.10k|    CHECK_OVERFLOW_U(low,8);
  ------------------
  |  |  224|  1.10k|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|  1.10k|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 0, False: 1.10k]
  |  |  ------------------
  |  |  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.10k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 1.10k]
  |  |  ------------------
  ------------------
 2315|       |
 2316|  1.10k|    cp->low = low;
 2317|  1.10k|    cp->high = high;
 2318|       |
 2319|  1.10k|    DEBUGIF("dumpv_recv") {
  ------------------
  |  |  145|  1.10k|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|  2.21k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1.10k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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]
  |  |  ------------------
  ------------------
 2320|      0|        char            i64buf[I64CHARSZ + 1];
 2321|      0|        printI64(i64buf, cp);
 2322|      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]
  |  |  ------------------
  ------------------
 2323|      0|    }
 2324|       |
 2325|  1.10k|    return bufp;
 2326|  1.11k|}
asn_parse_float:
 2449|    934|{
 2450|    934|    static const char *errpre = "parse float";
 2451|    934|    register u_char *bufp = data;
 2452|    934|    u_long          asn_length;
 2453|    934|    union {
 2454|    934|        float           floatVal;
 2455|    934|        long            longVal;
 2456|    934|        u_char          c[sizeof(float)];
 2457|    934|    } fu;
 2458|       |
 2459|    934|    if (floatsize != sizeof(float)) {
  ------------------
  |  Branch (2459:9): [True: 0, False: 934]
  ------------------
 2460|      0|        _asn_size_err("parse float", floatsize, sizeof(float));
 2461|      0|        return NULL;
 2462|      0|    }
 2463|       |
 2464|    934|    if (NULL == data || NULL == datalength || NULL == type || NULL == floatp) {
  ------------------
  |  Branch (2464:9): [True: 0, False: 934]
  |  Branch (2464:25): [True: 0, False: 934]
  |  Branch (2464:47): [True: 0, False: 934]
  |  Branch (2464:63): [True: 0, False: 934]
  ------------------
 2465|      0|        ERROR_MSG("parse float: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 2466|      0|        return NULL;
 2467|      0|    }
 2468|       |
 2469|       |    /** need at least 2 bytes to work with: type, length (which might be 0)  */
 2470|    934|    if (*datalength < 2) {
  ------------------
  |  Branch (2470:9): [True: 0, False: 934]
  ------------------
 2471|      0|        _asn_short_err(errpre, *datalength, 2);
 2472|      0|        return NULL;
 2473|      0|    }
 2474|       |
 2475|    934|    *type = *bufp++;
 2476|    934|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 2477|    934|    if (NULL == bufp) {
  ------------------
  |  Branch (2477:9): [True: 0, False: 934]
  ------------------
 2478|      0|        _asn_short_err(errpre, *datalength - 1, asn_length);
 2479|      0|        return NULL;
 2480|      0|    }
 2481|       |
 2482|    934|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|    934|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    934|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 934]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 934]
  |  |  ------------------
  ------------------
 2483|       |    /*
 2484|       |     * the float is encoded as an opaque 
 2485|       |     */
 2486|    934|    if ((*type == ASN_OPAQUE) &&
  ------------------
  |  |   93|    934|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|    934|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2486:9): [True: 505, False: 429]
  ------------------
 2487|    505|        (asn_length == ASN_OPAQUE_FLOAT_BER_LEN) &&
  ------------------
  |  |  169|    505|#define ASN_OPAQUE_FLOAT_BER_LEN 7
  ------------------
  |  Branch (2487:9): [True: 493, False: 12]
  ------------------
 2488|    493|        (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_FLOAT)) {
  ------------------
  |  |  131|    493|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|    493|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|    493|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
                      (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_FLOAT)) {
  ------------------
  |  |  165|    493|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|    493|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|    493|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    493|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2488:9): [True: 493, False: 0]
  |  Branch (2488:39): [True: 493, False: 0]
  ------------------
 2489|    493|        size_t          outer_length = asn_length - 2;
 2490|       |
 2491|       |        /*
 2492|       |         * value is encoded as special format 
 2493|       |         */
 2494|    493|        bufp = asn_parse_nlength(bufp + 2, outer_length, &asn_length);
 2495|    493|        if (NULL == bufp) {
  ------------------
  |  Branch (2495:13): [True: 0, False: 493]
  ------------------
 2496|      0|            _asn_short_err("parse opaque float", outer_length, asn_length);
 2497|      0|            return NULL;
 2498|      0|        }
 2499|       |        /*
 2500|       |         * change type to Float 
 2501|       |         */
 2502|    493|        *type = ASN_OPAQUE_FLOAT;
  ------------------
  |  |  165|    493|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|    493|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|    493|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    493|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2503|    493|    }
 2504|       |
 2505|    934|    if (*type != ASN_OPAQUE_FLOAT) {
  ------------------
  |  |  165|    934|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|    934|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|    934|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    934|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2505:9): [True: 12, False: 922]
  ------------------
 2506|     12|        _asn_type_err(errpre, *type);
 2507|     12|        return NULL;
 2508|     12|    }
 2509|       |
 2510|    922|    if (asn_length != sizeof(float)) {
  ------------------
  |  Branch (2510:9): [True: 23, False: 899]
  ------------------
 2511|     23|        _asn_size_err("parse seq float", asn_length, sizeof(float));
 2512|     23|        return NULL;
 2513|     23|    }
 2514|       |
 2515|    899|    *datalength -= (int) asn_length + (bufp - data);
 2516|    899|    memcpy(&fu.c[0], bufp, asn_length);
 2517|    899|    bufp += asn_length;
 2518|       |
 2519|       |    /*
 2520|       |     * correct for endian differences 
 2521|       |     */
 2522|    899|    fu.longVal = ntohl(fu.longVal);
 2523|       |
 2524|    899|    *floatp = fu.floatVal;
 2525|       |
 2526|    899|    DEBUGMSG(("dumpv_recv", "Opaque float: %f\n", *floatp));
  ------------------
  |  |   61|    899|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    899|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 899]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 899]
  |  |  ------------------
  ------------------
 2527|    899|    return bufp;
 2528|    922|}
asn_parse_double:
 2633|    777|{
 2634|    777|    static const char *errpre = "parse double";
 2635|    777|    register u_char *bufp = data;
 2636|    777|    u_long          asn_length;
 2637|    777|    long            tmp;
 2638|    777|    union {
 2639|    777|        double          doubleVal;
 2640|    777|        int             intVal[2];
 2641|    777|        u_char          c[sizeof(double)];
 2642|    777|    } fu;
 2643|       |
 2644|       |
 2645|    777|    if (doublesize != sizeof(double)) {
  ------------------
  |  Branch (2645:9): [True: 0, False: 777]
  ------------------
 2646|      0|        _asn_size_err("parse double", doublesize, sizeof(double));
 2647|      0|        return NULL;
 2648|      0|    }
 2649|       |
 2650|    777|    if (NULL == data || NULL == datalength || NULL == type || NULL == doublep) {
  ------------------
  |  Branch (2650:9): [True: 0, False: 777]
  |  Branch (2650:25): [True: 0, False: 777]
  |  Branch (2650:47): [True: 0, False: 777]
  |  Branch (2650:63): [True: 0, False: 777]
  ------------------
 2651|      0|        ERROR_MSG("parse double: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 2652|      0|        return NULL;
 2653|      0|    }
 2654|       |
 2655|       |    /** need at least 2 bytes to work with: type, length (which might be 0)  */
 2656|    777|    if (*datalength < 2) {
  ------------------
  |  Branch (2656:9): [True: 0, False: 777]
  ------------------
 2657|      0|        _asn_short_err(errpre, *datalength, 2);
 2658|      0|        return NULL;
 2659|      0|    }
 2660|       |
 2661|    777|    *type = *bufp++;
 2662|    777|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 2663|    777|    if (NULL == bufp) {
  ------------------
  |  Branch (2663:9): [True: 0, False: 777]
  ------------------
 2664|      0|        _asn_short_err(errpre, *datalength - 1, asn_length);
 2665|      0|        return NULL;
 2666|      0|    }
 2667|       |
 2668|    777|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|    777|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    777|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 777]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 777]
  |  |  ------------------
  ------------------
 2669|       |    /*
 2670|       |     * the double is encoded as an opaque 
 2671|       |     */
 2672|       |    /** need at least 2 bytes: ASN_OPAQUE_TAG1 and ASN_OPAQUE_DOUBLE */
 2673|    777|    if ((*type == ASN_OPAQUE) && (asn_length < 2)) {
  ------------------
  |  |   93|    777|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|    777|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2673:9): [True: 263, False: 514]
  |  Branch (2673:34): [True: 0, False: 263]
  ------------------
 2674|      0|        _asn_short_err(errpre, asn_length, 2);
 2675|      0|        return NULL;
 2676|      0|    }
 2677|    777|    if ((*type == ASN_OPAQUE) &&
  ------------------
  |  |   93|    777|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|    777|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2677:9): [True: 263, False: 514]
  ------------------
 2678|    263|        (asn_length == ASN_OPAQUE_DOUBLE_BER_LEN) &&
  ------------------
  |  |  178|    263|#define ASN_OPAQUE_DOUBLE_BER_LEN 11
  ------------------
  |  Branch (2678:9): [True: 245, False: 18]
  ------------------
 2679|    245|        (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_DOUBLE)) {
  ------------------
  |  |  131|    245|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|    245|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|    245|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
                      (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_DOUBLE)) {
  ------------------
  |  |  174|    245|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|    245|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|    245|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    245|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2679:9): [True: 245, False: 0]
  |  Branch (2679:39): [True: 245, False: 0]
  ------------------
 2680|    245|        size_t          outer_length = asn_length - 2;
 2681|       |
 2682|       |        /*
 2683|       |         * value is encoded as special format 
 2684|       |         */
 2685|    245|        bufp = asn_parse_nlength(bufp + 2, outer_length, &asn_length);
 2686|    245|        if (NULL == bufp) {
  ------------------
  |  Branch (2686:13): [True: 0, False: 245]
  ------------------
 2687|      0|            _asn_short_err("parse opaque double", outer_length, asn_length);
 2688|      0|            return NULL;
 2689|      0|        }
 2690|       |
 2691|       |        /*
 2692|       |         * change type to Double 
 2693|       |         */
 2694|    245|        *type = ASN_OPAQUE_DOUBLE;
  ------------------
  |  |  174|    245|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|    245|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|    245|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    245|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2695|    245|    }
 2696|       |
 2697|    777|    if (*type != ASN_OPAQUE_DOUBLE) {
  ------------------
  |  |  174|    777|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|    777|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|    777|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    777|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2697:9): [True: 18, False: 759]
  ------------------
 2698|     18|        _asn_type_err(errpre, *type);
 2699|     18|        return NULL;
 2700|     18|    }
 2701|       |
 2702|    759|    if (asn_length != sizeof(double)) {
  ------------------
  |  Branch (2702:9): [True: 27, False: 732]
  ------------------
 2703|     27|        _asn_size_err("parse seq double", asn_length, sizeof(double));
 2704|     27|        return NULL;
 2705|     27|    }
 2706|    732|    *datalength -= (int) asn_length + (bufp - data);
 2707|    732|    memcpy(&fu.c[0], bufp, asn_length);
 2708|    732|    bufp += asn_length;
 2709|       |
 2710|       |    /*
 2711|       |     * correct for endian differences 
 2712|       |     */
 2713|       |
 2714|    732|    tmp = ntohl(fu.intVal[0]);
 2715|    732|    fu.intVal[0] = ntohl(fu.intVal[1]);
 2716|    732|    fu.intVal[1] = tmp;
 2717|       |
 2718|    732|    *doublep = fu.doubleVal;
 2719|    732|    DEBUGMSG(("dumpv_recv", "  Opaque Double:\t%f\n", *doublep));
  ------------------
  |  |   61|    732|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    732|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 732]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 732]
  |  |  ------------------
  ------------------
 2720|       |
 2721|    732|    return bufp;
 2722|    759|}
asn1.c:_asn_size_err:
  242|     50|{
  243|     50|    char            ebuf[128];
  244|       |
  245|     50|    snprintf(ebuf, sizeof(ebuf),
  246|     50|            "%s size %lu: s/b %lu", str,
  247|     50|	    (unsigned long)wrongsize, (unsigned long)rightsize);
  248|     50|    ERROR_MSG(ebuf);
  ------------------
  |  |  188|     50|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  249|     50|}
asn1.c:_asn_short_err:
  299|  2.35k|{
  300|  2.35k|    char            ebuf[128];
  301|       |
  302|  2.35k|    snprintf(ebuf, sizeof(ebuf), "%s length %lu too short: need %lu", str,
  303|  2.35k|	    (unsigned long)wrongsize, (unsigned long)rightsize);
  304|  2.35k|    ERROR_MSG(ebuf);
  ------------------
  |  |  188|  2.35k|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  305|  2.35k|}
asn1.c:_asn_type_err:
  261|    524|{
  262|    524|    char            ebuf[128];
  263|       |
  264|    524|    snprintf(ebuf, sizeof(ebuf), "%s type %d", str, wrongtype);
  265|    524|    ebuf[ sizeof(ebuf)-1 ] = 0;
  266|    524|    ERROR_MSG(ebuf);
  ------------------
  |  |  188|    524|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  267|    524|}
asn1.c:_asn_length_err:
  280|    152|{
  281|    152|    char            ebuf[128];
  282|       |
  283|    152|    snprintf(ebuf, sizeof(ebuf),
  284|    152|            "%s length %lu too large: exceeds %lu", str,
  285|    152|	    (unsigned long)wrongsize, (unsigned long)rightsize);
  286|    152|    ERROR_MSG(ebuf);
  ------------------
  |  |  188|    152|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  287|    152|}
asn1.c:_asn_bitstring_check:
  515|  1.03k|{
  516|  1.03k|    char            ebuf[128];
  517|       |
  518|  1.03k|    if (asn_length < 1) {
  ------------------
  |  Branch (518:9): [True: 8, False: 1.02k]
  ------------------
  519|      8|        snprintf(ebuf, sizeof(ebuf),
  520|      8|                "%s: length %d too small", str, (int) asn_length);
  521|      8|        ERROR_MSG(ebuf);
  ------------------
  |  |  188|      8|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  522|      8|        return 1;
  523|      8|    }
  524|       |    /*
  525|       |     * if (datum > 7){
  526|       |     * sprintf(ebuf,"%s: datum %d >7: too large", str, (int)(datum));
  527|       |     * ERROR_MSG(ebuf);
  528|       |     * return 1;
  529|       |     * }
  530|       |     */
  531|  1.02k|    return 0;
  532|  1.03k|}

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

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

snmp_get_next_transid:
  498|  2.68k|{
  499|  2.68k|    long            retVal;
  500|  2.68k|    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_TRANSID);
  ------------------
  |  |   79|  2.68k|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded, False: 2.68k]
  |  |  ------------------
  ------------------
  501|  2.68k|    retVal = 1 + Transid;       /*MTCRITICAL_RESOURCE */
  502|  2.68k|    if (!retVal)
  ------------------
  |  Branch (502:9): [True: 0, False: 2.68k]
  ------------------
  503|      0|        retVal = 2;
  504|  2.68k|    Transid = retVal;
  505|  2.68k|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS))
  ------------------
  |  |   48|  2.68k|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS))
  ------------------
  |  |   91|  2.68k|#define NETSNMP_DS_LIB_16BIT_IDS           31   /* restrict requestIDs, etc to 16-bit values */
  ------------------
  |  Branch (505:9): [True: 0, False: 2.68k]
  ------------------
  506|      0|        retVal &= 0x7fff;	/* mask to 15 bits */
  507|  2.68k|    else
  508|  2.68k|        retVal &= 0x7fffffff;	/* mask to 31 bits */
  509|       |
  510|  2.68k|    if (!retVal) {
  ------------------
  |  Branch (510:9): [True: 0, False: 2.68k]
  ------------------
  511|      0|        Transid = retVal = 2;
  512|      0|    }
  513|  2.68k|    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_TRANSID);
  ------------------
  |  |   80|  2.68k|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded, False: 2.68k]
  |  |  ------------------
  ------------------
  514|  2.68k|    return retVal;
  515|  2.68k|}
snmp_set_detail:
  529|  6.60k|{
  530|  6.60k|    if (detail_string != NULL) {
  ------------------
  |  Branch (530:9): [True: 6.60k, False: 0]
  ------------------
  531|  6.60k|        strlcpy(snmp_detail, detail_string, sizeof(snmp_detail));
  532|  6.60k|        snmp_detail_f = 1;
  533|  6.60k|    }
  534|  6.60k|}
snmp_api_errstring:
  544|    705|{
  545|    705|    const char     *msg = "";
  546|    705|    static char     msg_buf[SPRINT_MAX_LEN];
  547|       |
  548|    705|    if (snmp_errnumber >= SNMPERR_MAX && snmp_errnumber <= SNMPERR_GENERR) {
  ------------------
  |  |  255|  1.41k|#define SNMPERR_MAX			(-69)
  ------------------
                  if (snmp_errnumber >= SNMPERR_MAX && snmp_errnumber <= SNMPERR_GENERR) {
  ------------------
  |  |  185|    705|#define SNMPERR_GENERR			(-1)
  ------------------
  |  Branch (548:9): [True: 705, False: 0]
  |  Branch (548:42): [True: 0, False: 705]
  ------------------
  549|      0|        msg = api_errors[-snmp_errnumber];
  550|    705|    } else if (snmp_errnumber != SNMPERR_SUCCESS) {
  ------------------
  |  |  184|    705|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (550:16): [True: 0, False: 705]
  ------------------
  551|      0|        msg = NULL;
  552|      0|    }
  553|    705|    if (!msg) {
  ------------------
  |  Branch (553:9): [True: 0, False: 705]
  ------------------
  554|      0|	snprintf(msg_buf, sizeof(msg_buf), "Unknown error: %d", snmp_errnumber);
  555|      0|        msg_buf[sizeof(msg_buf)-1] = '\0';
  556|    705|    } else if (snmp_detail_f) {
  ------------------
  |  Branch (556:16): [True: 705, False: 0]
  ------------------
  557|    705|        snprintf(msg_buf, sizeof(msg_buf), "%s (%s)", msg, snmp_detail);
  558|    705|        msg_buf[sizeof(msg_buf)-1] = '\0';
  559|    705|        snmp_detail_f = 0;
  560|    705|    } else {
  561|      0|        strlcpy(msg_buf, msg, sizeof(msg_buf));
  562|      0|    }
  563|       |
  564|    705|    return (msg_buf);
  565|    705|}
snmpv3_parse:
 3896|  2.68k|{
 3897|  2.68k|    u_char          type, msg_flags;
 3898|  2.68k|    long            ver, msg_sec_model;
 3899|  2.68k|    size_t          max_size_response;
 3900|  2.68k|    u_char          tmp_buf[SNMP_MAX_MSG_SIZE];
 3901|  2.68k|    size_t          tmp_buf_len;
 3902|  2.68k|    u_char          pdu_buf[SNMP_MAX_MSG_SIZE];
 3903|  2.68k|    u_char         *mallocbuf = NULL;
 3904|  2.68k|    size_t          pdu_buf_len = SNMP_MAX_MSG_SIZE;
  ------------------
  |  |  109|  2.68k|#define SNMP_MAX_MSG_SIZE          1472 /* ethernet MTU minus IP/UDP header */
  ------------------
 3905|  2.68k|    u_char         *sec_params;
 3906|  2.68k|    u_char         *msg_data;
 3907|  2.68k|    u_char         *cp;
 3908|  2.68k|    size_t          asn_len, msg_len;
 3909|  2.68k|    int             ret, ret_val;
 3910|  2.68k|    struct snmp_secmod_def *sptr;
 3911|       |
 3912|       |
 3913|  2.68k|    msg_data = data;
 3914|  2.68k|    msg_len = *length;
 3915|       |
 3916|       |
 3917|       |    /*
 3918|       |     * message is an ASN.1 SEQUENCE  
 3919|       |     */
 3920|  2.68k|    DEBUGDUMPSECTION("recv", "SNMPv3 Message");
  ------------------
  |  |   81|  2.68k|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.68k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.68k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 2.68k]
  |  |  ------------------
  ------------------
 3921|  2.68k|    data = asn_parse_sequence(data, length, &type,
 3922|  2.68k|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR), "message");
  ------------------
  |  |   84|  2.68k|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR), "message");
  ------------------
  |  |   96|  2.68k|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3923|  2.68k|    if (data == NULL) {
  ------------------
  |  Branch (3923:9): [True: 284, False: 2.39k]
  ------------------
 3924|       |        /*
 3925|       |         * error msg detail is set 
 3926|       |         */
 3927|    284|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|    284|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3928|    284|        DEBUGINDENTLESS();
  ------------------
  |  |   75|    284|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    284|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 284]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 284]
  |  |  ------------------
  ------------------
 3929|    284|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|    284|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3930|    284|    }
 3931|       |
 3932|       |    /*
 3933|       |     * parse msgVersion  
 3934|       |     */
 3935|  2.39k|    DEBUGDUMPHEADER("recv", "SNMP Version Number");
  ------------------
  |  |   79|  2.39k|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.39k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.39k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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.39k]
  |  |  ------------------
  ------------------
 3936|  2.39k|    data = asn_parse_int(data, length, &type, &ver, sizeof(ver));
 3937|  2.39k|    DEBUGINDENTLESS();
  ------------------
  |  |   75|  2.39k|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.39k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.39k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 2.39k]
  |  |  ------------------
  ------------------
 3938|  2.39k|    if (data == NULL) {
  ------------------
  |  Branch (3938:9): [True: 177, False: 2.22k]
  ------------------
 3939|    177|        ERROR_MSG("bad parse of version");
  ------------------
  |  |  188|    177|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3940|    177|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|    177|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3941|    177|        DEBUGINDENTLESS();
  ------------------
  |  |   75|    177|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    177|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 177]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 177]
  |  |  ------------------
  ------------------
 3942|    177|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|    177|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3943|    177|    }
 3944|  2.22k|    pdu->version = ver;
 3945|       |
 3946|       |    /*
 3947|       |     * parse msgGlobalData sequence  
 3948|       |     */
 3949|  2.22k|    cp = data;
 3950|  2.22k|    asn_len = *length;
 3951|  2.22k|    DEBUGDUMPSECTION("recv", "msgGlobalData");
  ------------------
  |  |   81|  2.22k|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.22k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.22k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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.22k]
  |  |  ------------------
  ------------------
 3952|  2.22k|    data = asn_parse_sequence(data, &asn_len, &type,
 3953|  2.22k|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   84|  2.22k|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   96|  2.22k|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3954|  2.22k|                              "msgGlobalData");
 3955|  2.22k|    if (data == NULL) {
  ------------------
  |  Branch (3955:9): [True: 1.84k, False: 381]
  ------------------
 3956|       |        /*
 3957|       |         * error msg detail is set 
 3958|       |         */
 3959|  1.84k|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|  1.84k|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3960|  1.84k|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|  1.84k|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  1.84k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1.84k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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.84k]
  |  |  ------------------
  ------------------
 3961|  1.84k|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|  1.84k|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3962|  1.84k|    }
 3963|    381|    *length -= data - cp;       /* subtract off the length of the header */
 3964|       |
 3965|       |    /*
 3966|       |     * msgID 
 3967|       |     */
 3968|    381|    DEBUGDUMPHEADER("recv", "msgID");
  ------------------
  |  |   79|    381|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    381|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 381]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 381]
  |  |  ------------------
  ------------------
 3969|    381|    data =
 3970|    381|        asn_parse_int(data, length, &type, &pdu->msgid,
 3971|    381|                      sizeof(pdu->msgid));
 3972|    381|    DEBUGINDENTLESS();
  ------------------
  |  |   75|    381|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    381|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 381]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 381]
  |  |  ------------------
  ------------------
 3973|    381|    if (data == NULL || type != ASN_INTEGER) {
  ------------------
  |  |   75|    365|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (3973:9): [True: 16, False: 365]
  |  Branch (3973:25): [True: 0, False: 365]
  ------------------
 3974|     16|        ERROR_MSG("error parsing msgID");
  ------------------
  |  |  188|     16|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3975|     16|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|     16|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     16|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 16]
  |  |  ------------------
  ------------------
 3976|     16|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|     16|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3977|     16|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|     16|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3978|     16|    }
 3979|       |
 3980|       |    /*
 3981|       |     * Check the msgID we received is a legal value.  If not, then increment
 3982|       |     * snmpInASNParseErrs and return the appropriate error (see RFC 2572,
 3983|       |     * para. 7.2, section 2 -- note that a bad msgID means that the received
 3984|       |     * message is NOT a serialization of an SNMPv3Message, since the msgID
 3985|       |     * field is out of bounds).  
 3986|       |     */
 3987|       |
 3988|    365|    if (pdu->msgid < 0 || pdu->msgid > SNMP_MAX_PACKET_LEN) {
  ------------------
  |  |   49|    317|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  |  Branch (3988:9): [True: 48, False: 317]
  |  Branch (3988:27): [True: 3, False: 314]
  ------------------
 3989|     51|        snmp_log(LOG_ERR, "Received bad msgID (%ld %s %s).\n", pdu->msgid,
 3990|     51|                 (pdu->msgid < 0) ? "<" : ">",
  ------------------
  |  Branch (3990:18): [True: 48, False: 3]
  ------------------
 3991|     51|                 (pdu->msgid < 0) ? "0" : "2^31 - 1");
  ------------------
  |  Branch (3991:18): [True: 48, False: 3]
  ------------------
 3992|     51|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|     51|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3993|     51|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|     51|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     51|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 51]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 51]
  |  |  ------------------
  ------------------
 3994|     51|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|     51|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3995|     51|    }
 3996|       |
 3997|       |    /*
 3998|       |     * msgMaxSize 
 3999|       |     */
 4000|    314|    DEBUGDUMPHEADER("recv:msgMaxSize", "msgMaxSize");
  ------------------
  |  |   79|    314|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    314|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 314]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 314]
  |  |  ------------------
  ------------------
 4001|    314|    data = asn_parse_int(data, length, &type, &pdu->msgMaxSize,
 4002|    314|                         sizeof(pdu->msgMaxSize));
 4003|    314|    DEBUGINDENTLESS();
  ------------------
  |  |   75|    314|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    314|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 314]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 314]
  |  |  ------------------
  ------------------
 4004|    314|    if (data == NULL || type != ASN_INTEGER) {
  ------------------
  |  |   75|    252|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (4004:9): [True: 62, False: 252]
  |  Branch (4004:25): [True: 0, False: 252]
  ------------------
 4005|     62|        ERROR_MSG("error parsing msgMaxSize");
  ------------------
  |  |  188|     62|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4006|     62|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|     62|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4007|     62|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|     62|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     62|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 62]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 62]
  |  |  ------------------
  ------------------
 4008|     62|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|     62|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 4009|     62|    }
 4010|       |
 4011|       |    /*
 4012|       |     * Check the msgMaxSize we received is a legal value.  If not, then
 4013|       |     * increment snmpInASNParseErrs and return the appropriate error (see RFC
 4014|       |     * 2572, para. 7.2, section 2 -- note that a bad msgMaxSize means that the
 4015|       |     * received message is NOT a serialization of an SNMPv3Message, since the
 4016|       |     * msgMaxSize field is out of bounds).
 4017|       |     */
 4018|       |
 4019|    252|    if (pdu->msgMaxSize < SNMP_MIN_MAX_LEN) {
  ------------------
  |  |   48|    252|#define SNMP_MIN_MAX_LEN    484 /* minimum maximum message size */
  ------------------
  |  Branch (4019:9): [True: 57, False: 195]
  ------------------
 4020|     57|        snmp_log(LOG_ERR, "Received bad msgMaxSize (%lu < 484).\n",
 4021|     57|                 pdu->msgMaxSize);
 4022|     57|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|     57|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4023|     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]
  |  |  ------------------
  ------------------
 4024|     57|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|     57|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 4025|    195|    } else if (pdu->msgMaxSize > SNMP_MAX_PACKET_LEN) {
  ------------------
  |  |   49|    195|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  |  Branch (4025:16): [True: 4, False: 191]
  ------------------
 4026|      4|        snmp_log(LOG_ERR, "Received bad msgMaxSize (%lu > 2^31 - 1).\n",
 4027|      4|                 pdu->msgMaxSize);
 4028|      4|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      4|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4029|      4|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|      4|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
 4030|      4|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|      4|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 4031|    191|    } else {
 4032|    191|        DEBUGMSGTL(("snmpv3_parse:msgMaxSize", "msgMaxSize %lu received\n",
  ------------------
  |  |   66|    191|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    191|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 191]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 191]
  |  |  ------------------
  ------------------
 4033|    191|                    pdu->msgMaxSize));
 4034|       |        /** don't increase max msg size if we've already got one */
 4035|    191|        if (sess->sndMsgMaxSize < pdu->msgMaxSize) {
  ------------------
  |  Branch (4035:13): [True: 191, False: 0]
  ------------------
 4036|    191|            DEBUGMSGTL(("snmpv3_parse:msgMaxSize",
  ------------------
  |  |   66|    191|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    191|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 191]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 191]
  |  |  ------------------
  ------------------
 4037|    191|                        "msgMaxSize %" NETSNMP_PRIz "d greater than session max %ld; reducing\n",
 4038|    191|                        sess->sndMsgMaxSize, pdu->msgMaxSize));
 4039|    191|            pdu->msgMaxSize = sess->sndMsgMaxSize;
 4040|    191|        }
 4041|    191|    }
 4042|       |
 4043|       |    /*
 4044|       |     * msgFlags 
 4045|       |     */
 4046|    191|    tmp_buf_len = SNMP_MAX_MSG_SIZE;
  ------------------
  |  |  109|    191|#define SNMP_MAX_MSG_SIZE          1472 /* ethernet MTU minus IP/UDP header */
  ------------------
 4047|    191|    DEBUGDUMPHEADER("recv", "msgFlags");
  ------------------
  |  |   79|    191|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    191|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 191]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 191]
  |  |  ------------------
  ------------------
 4048|    191|    data = asn_parse_string(data, length, &type, tmp_buf, &tmp_buf_len);
 4049|    191|    DEBUGINDENTLESS();
  ------------------
  |  |   75|    191|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    191|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 191]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 191]
  |  |  ------------------
  ------------------
 4050|    191|    if (data == NULL || type != ASN_OCTET_STR || tmp_buf_len != 1) {
  ------------------
  |  |   78|    321|#define ASN_OCTET_STR	    0x04U
  ------------------
  |  Branch (4050:9): [True: 61, False: 130]
  |  Branch (4050:25): [True: 4, False: 126]
  |  Branch (4050:50): [True: 13, False: 113]
  ------------------
 4051|     78|        ERROR_MSG("error parsing msgFlags");
  ------------------
  |  |  188|     78|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4052|     78|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|     78|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4053|     78|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|     78|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     78|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 78]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 78]
  |  |  ------------------
  ------------------
 4054|     78|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|     78|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 4055|     78|    }
 4056|    113|    msg_flags = *tmp_buf;
 4057|    113|    if (msg_flags & SNMP_MSG_FLAG_RPRT_BIT)
  ------------------
  |  |  305|    113|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
  |  Branch (4057:9): [True: 47, False: 66]
  ------------------
 4058|     47|        pdu->flags |= SNMP_MSG_FLAG_RPRT_BIT;
  ------------------
  |  |  305|     47|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
 4059|     66|    else
 4060|     66|        pdu->flags &= (~SNMP_MSG_FLAG_RPRT_BIT);
  ------------------
  |  |  305|     66|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
 4061|       |
 4062|       |    /*
 4063|       |     * msgSecurityModel 
 4064|       |     */
 4065|    113|    DEBUGDUMPHEADER("recv", "msgSecurityModel");
  ------------------
  |  |   79|    113|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    113|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 113]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 113]
  |  |  ------------------
  ------------------
 4066|    113|    data = asn_parse_int(data, length, &type, &msg_sec_model,
 4067|    113|                         sizeof(msg_sec_model));
 4068|    113|    DEBUGINDENTADD(-4);         /* return from global data indent */
  ------------------
  |  |   73|    113|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    113|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 113]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 113]
  |  |  ------------------
  ------------------
 4069|    113|    if (data == NULL || type != ASN_INTEGER ||
  ------------------
  |  |   75|    222|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (4069:9): [True: 4, False: 109]
  |  Branch (4069:25): [True: 0, False: 109]
  ------------------
 4070|    109|        msg_sec_model < 1 || msg_sec_model > 0x7fffffff) {
  ------------------
  |  Branch (4070:9): [True: 45, False: 64]
  |  Branch (4070:30): [True: 2, False: 62]
  ------------------
 4071|     51|        ERROR_MSG("error parsing msgSecurityModel");
  ------------------
  |  |  188|     51|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4072|     51|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|     51|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4073|     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]
  |  |  ------------------
  ------------------
 4074|     51|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|     51|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 4075|     51|    }
 4076|     62|    sptr = find_sec_mod(msg_sec_model);
 4077|     62|    if (!sptr) {
  ------------------
  |  Branch (4077:9): [True: 62, False: 0]
  ------------------
 4078|     62|        snmp_log(LOG_WARNING, "unknown security model: %ld\n",
 4079|     62|                 msg_sec_model);
 4080|     62|        snmp_increment_statistic(STAT_SNMPUNKNOWNSECURITYMODELS);
  ------------------
  |  |  611|     62|#define   STAT_SNMPUNKNOWNSECURITYMODELS     0
  ------------------
 4081|     62|        DEBUGINDENTLESS();
  ------------------
  |  |   75|     62|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     62|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 62]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 62]
  |  |  ------------------
  ------------------
 4082|     62|        return SNMPERR_UNKNOWN_SEC_MODEL;
  ------------------
  |  |  214|     62|#define SNMPERR_UNKNOWN_SEC_MODEL 	(-30)
  ------------------
 4083|     62|    }
 4084|      0|    pdu->securityModel = msg_sec_model;
 4085|       |
 4086|      0|    if (msg_flags & SNMP_MSG_FLAG_PRIV_BIT &&
  ------------------
  |  |  304|      0|#define SNMP_MSG_FLAG_PRIV_BIT          0x02
  ------------------
  |  Branch (4086:9): [True: 0, False: 0]
  ------------------
 4087|      0|        !(msg_flags & SNMP_MSG_FLAG_AUTH_BIT)) {
  ------------------
  |  |  303|      0|#define SNMP_MSG_FLAG_AUTH_BIT          0x01
  ------------------
  |  Branch (4087:9): [True: 0, False: 0]
  ------------------
 4088|      0|        ERROR_MSG("invalid message, illegal msgFlags");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4089|      0|        snmp_increment_statistic(STAT_SNMPINVALIDMSGS);
  ------------------
  |  |  612|      0|#define   STAT_SNMPINVALIDMSGS               1
  ------------------
 4090|      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]
  |  |  ------------------
  ------------------
 4091|      0|        return SNMPERR_INVALID_MSG;
  ------------------
  |  |  215|      0|#define SNMPERR_INVALID_MSG             (-31)
  ------------------
 4092|      0|    }
 4093|      0|    pdu->securityLevel = ((msg_flags & SNMP_MSG_FLAG_AUTH_BIT)
  ------------------
  |  |  303|      0|#define SNMP_MSG_FLAG_AUTH_BIT          0x01
  ------------------
  |  Branch (4093:27): [True: 0, False: 0]
  ------------------
 4094|      0|                          ? ((msg_flags & SNMP_MSG_FLAG_PRIV_BIT)
  ------------------
  |  |  304|      0|#define SNMP_MSG_FLAG_PRIV_BIT          0x02
  ------------------
  |  Branch (4094:30): [True: 0, False: 0]
  ------------------
 4095|      0|                             ? SNMP_SEC_LEVEL_AUTHPRIV
  ------------------
  |  |  301|      0|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
 4096|      0|                             : SNMP_SEC_LEVEL_AUTHNOPRIV)
  ------------------
  |  |  300|      0|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
 4097|      0|                          : SNMP_SEC_LEVEL_NOAUTH);
  ------------------
  |  |  299|      0|#define SNMP_SEC_LEVEL_NOAUTH		1
  ------------------
 4098|       |    /*
 4099|       |     * end of msgGlobalData 
 4100|       |     */
 4101|       |
 4102|       |    /*
 4103|       |     * securtityParameters OCTET STRING begins after msgGlobalData 
 4104|       |     */
 4105|      0|    sec_params = data;
 4106|      0|    SNMP_FREE(pdu->contextEngineID);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 4107|      0|    pdu->contextEngineID = calloc(1, SNMP_MAX_ENG_SIZE);
  ------------------
  |  |  111|      0|#define SNMP_MAX_ENG_SIZE          32
  ------------------
 4108|      0|    pdu->contextEngineIDLen = SNMP_MAX_ENG_SIZE;
  ------------------
  |  |  111|      0|#define SNMP_MAX_ENG_SIZE          32
  ------------------
 4109|       |
 4110|       |    /*
 4111|       |     * Note: there is no length limit on the msgAuthoritativeEngineID field,
 4112|       |     * although we would EXPECT it to be limited to 32 (the SnmpEngineID TC
 4113|       |     * limit).  We'll use double that here to be on the safe side.  
 4114|       |     */
 4115|       |
 4116|      0|    SNMP_FREE(pdu->securityEngineID);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 4117|      0|    pdu->securityEngineID = calloc(1, SNMP_MAX_ENG_SIZE * 2);
  ------------------
  |  |  111|      0|#define SNMP_MAX_ENG_SIZE          32
  ------------------
 4118|      0|    pdu->securityEngineIDLen = SNMP_MAX_ENG_SIZE * 2;
  ------------------
  |  |  111|      0|#define SNMP_MAX_ENG_SIZE          32
  ------------------
 4119|      0|    SNMP_FREE(pdu->securityName);
  ------------------
  |  |   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]
  |  |  ------------------
  ------------------
 4120|      0|    pdu->securityName = calloc(1, SNMP_MAX_SEC_NAME_SIZE);
  ------------------
  |  |  112|      0|#define SNMP_MAX_SEC_NAME_SIZE     256
  ------------------
 4121|      0|    pdu->securityNameLen = SNMP_MAX_SEC_NAME_SIZE;
  ------------------
  |  |  112|      0|#define SNMP_MAX_SEC_NAME_SIZE     256
  ------------------
 4122|       |
 4123|      0|    if ((pdu->securityName == NULL) ||
  ------------------
  |  Branch (4123:9): [True: 0, False: 0]
  ------------------
 4124|      0|        (pdu->securityEngineID == NULL) ||
  ------------------
  |  Branch (4124:9): [True: 0, False: 0]
  ------------------
 4125|      0|        (pdu->contextEngineID == NULL)) {
  ------------------
  |  Branch (4125:9): [True: 0, False: 0]
  ------------------
 4126|      0|        return SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 4127|      0|    }
 4128|       |
 4129|      0|    if (pdu_buf_len < msg_len
  ------------------
  |  Branch (4129:9): [True: 0, False: 0]
  ------------------
 4130|      0|        && pdu->securityLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|      0|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (4130:12): [True: 0, False: 0]
  ------------------
 4131|       |        /*
 4132|       |         * space needed is larger than we have in the default buffer 
 4133|       |         */
 4134|      0|        mallocbuf = calloc(1, msg_len);
 4135|      0|        if (mallocbuf == NULL)
  ------------------
  |  Branch (4135:13): [True: 0, False: 0]
  ------------------
 4136|      0|            return SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 4137|      0|        pdu_buf_len = msg_len;
 4138|      0|        cp = mallocbuf;
 4139|      0|    } else {
 4140|      0|        memset(pdu_buf, 0, pdu_buf_len);
 4141|      0|        cp = pdu_buf;
 4142|      0|    }
 4143|       |
 4144|      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]
  |  |  ------------------
  ------------------
 4145|      0|    if (sptr->decode) {
  ------------------
  |  Branch (4145:9): [True: 0, False: 0]
  ------------------
 4146|      0|        struct snmp_secmod_incoming_params parms;
 4147|      0|        parms.msgProcModel = pdu->msgParseModel;
 4148|      0|        parms.maxMsgSize = pdu->msgMaxSize;
 4149|      0|        parms.secParams = sec_params;
 4150|      0|        parms.secModel = msg_sec_model;
 4151|      0|        parms.secLevel = pdu->securityLevel;
 4152|      0|        parms.wholeMsg = msg_data;
 4153|      0|        parms.wholeMsgLen = msg_len;
 4154|      0|        parms.secEngineID = pdu->securityEngineID;
 4155|      0|        parms.secEngineIDLen = &pdu->securityEngineIDLen;
 4156|      0|        parms.secName = pdu->securityName;
 4157|      0|        parms.secNameLen = &pdu->securityNameLen;
 4158|      0|        parms.scopedPdu = &cp;
 4159|      0|        parms.scopedPduLen = &pdu_buf_len;
 4160|      0|        parms.maxSizeResponse = &max_size_response;
 4161|      0|        parms.secStateRef = &pdu->securityStateRef;
 4162|      0|        parms.sess = sess;
 4163|      0|        parms.pdu = pdu;
 4164|      0|        parms.msg_flags = msg_flags;
 4165|      0|        ret_val = (*sptr->decode) (&parms);
 4166|      0|    } else {
 4167|      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]
  |  |  ------------------
  ------------------
 4168|      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]
  |  |  ------------------
  ------------------
 4169|      0|        snmp_log(LOG_WARNING, "security service %ld can't decode packets\n",
 4170|      0|                 msg_sec_model);
 4171|      0|        return (-1);
 4172|      0|    }
 4173|       |
 4174|      0|    if (ret_val != SNMPERR_SUCCESS) {
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (4174:9): [True: 0, False: 0]
  ------------------
 4175|      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]
  |  |  ------------------
  ------------------
 4176|       |        /*
 4177|       |         * Parse as much as possible -- though I don't see the point? [jbpn].  
 4178|       |         */
 4179|      0|        if (cp) {
  ------------------
  |  Branch (4179:13): [True: 0, False: 0]
  ------------------
 4180|      0|            cp = snmpv3_scopedPDU_parse(pdu, cp, &pdu_buf_len);
 4181|      0|        }
 4182|      0|        if (cp) {
  ------------------
  |  Branch (4182:13): [True: 0, False: 0]
  ------------------
 4183|      0|            DEBUGPRINTPDUTYPE("recv", *cp);
  ------------------
  |  |  431|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4184|      0|            snmp_pdu_parse(pdu, cp, &pdu_buf_len);
 4185|      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]
  |  |  ------------------
  ------------------
 4186|      0|        } else {
 4187|      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]
  |  |  ------------------
  ------------------
 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 ret_val;
 4192|      0|    }
 4193|       |
 4194|       |    /*
 4195|       |     * parse plaintext ScopedPDU sequence 
 4196|       |     */
 4197|      0|    *length = pdu_buf_len;
 4198|      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]
  |  |  ------------------
  ------------------
 4199|      0|    data = snmpv3_scopedPDU_parse(pdu, cp, length);
 4200|      0|    if (data == NULL) {
  ------------------
  |  Branch (4200:9): [True: 0, False: 0]
  ------------------
 4201|      0|        snmp_log(LOG_WARNING, "security service %ld error parsing ScopedPDU\n",
 4202|      0|                 msg_sec_model);
 4203|      0|        ERROR_MSG("error parsing PDU");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4204|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4205|      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]
  |  |  ------------------
  ------------------
 4206|      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]
  |  |  ------------------
  ------------------
 4207|      0|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 4208|      0|    }
 4209|       |
 4210|       |    /*
 4211|       |     * parse the PDU.  
 4212|       |     */
 4213|      0|    if (after_header != NULL) {
  ------------------
  |  Branch (4213:9): [True: 0, False: 0]
  ------------------
 4214|      0|        *after_header = data;
 4215|      0|        tmp_buf_len = *length;
 4216|      0|    }
 4217|       |
 4218|      0|    DEBUGPRINTPDUTYPE("recv", *data);
  ------------------
  |  |  431|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4219|      0|    ret = snmp_pdu_parse(pdu, data, length);
 4220|      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]
  |  |  ------------------
  ------------------
 4221|       |
 4222|      0|    if (after_header != NULL) {
  ------------------
  |  Branch (4222:9): [True: 0, False: 0]
  ------------------
 4223|      0|        *length = tmp_buf_len;
 4224|      0|    }
 4225|       |
 4226|      0|    if (ret != SNMPERR_SUCCESS) {
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (4226:9): [True: 0, False: 0]
  ------------------
 4227|      0|        snmp_log(LOG_WARNING, "security service %ld error parsing ScopedPDU\n",
 4228|      0|                 msg_sec_model);
 4229|      0|        ERROR_MSG("error parsing PDU");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4230|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4231|      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]
  |  |  ------------------
  ------------------
 4232|      0|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  213|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 4233|      0|    }
 4234|       |
 4235|      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]
  |  |  ------------------
  ------------------
 4236|      0|    return SNMPERR_SUCCESS;
  ------------------
  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 4237|      0|}                               /* end snmpv3_parse() */
snmp_parse:
 4776|  2.68k|{
 4777|  2.68k|    int             rc;
 4778|       |
 4779|  2.68k|    rc = _snmp_parse(slp, pss, pdu, data, length);
 4780|  2.68k|    if (rc) {
  ------------------
  |  Branch (4780:9): [True: 2.54k, False: 137]
  ------------------
 4781|  2.54k|        if (!pss->s_snmp_errno) {
  ------------------
  |  Branch (4781:13): [True: 2.45k, False: 90]
  ------------------
 4782|  2.45k|            pss->s_snmp_errno = SNMPERR_BAD_PARSE;
  ------------------
  |  |  197|  2.45k|#define SNMPERR_BAD_PARSE		(-13)
  ------------------
 4783|  2.45k|        }
 4784|  2.54k|        SET_SNMP_ERROR(pss->s_snmp_errno);
  ------------------
  |  |   43|  2.54k|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 4785|  2.54k|    }
 4786|       |
 4787|  2.68k|    return rc;
 4788|  2.68k|}
snmp_pdu_parse:
 4792|  1.40k|{
 4793|  1.40k|    u_char          type;
 4794|  1.40k|    u_char          msg_type;
 4795|  1.40k|    u_char         *var_val;
 4796|  1.40k|    size_t          len;
 4797|  1.40k|    size_t          four;
 4798|  1.40k|    netsnmp_variable_list *vp = NULL, *vplast = NULL;
 4799|  1.40k|    oid             objid[MAX_OID_LEN];
 4800|  1.40k|    u_char         *p;
 4801|       |
 4802|       |    /*
 4803|       |     * Get the PDU type 
 4804|       |     */
 4805|  1.40k|    data = asn_parse_header(data, length, &msg_type);
 4806|  1.40k|    if (data == NULL)
  ------------------
  |  Branch (4806:9): [True: 20, False: 1.38k]
  ------------------
 4807|     20|        return -1;
 4808|  1.38k|    DEBUGMSGTL(("dumpv_recv","    Command %s\n", snmp_pdu_type(msg_type)));
  ------------------
  |  |   66|  1.38k|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  1.38k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1.38k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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.38k]
  |  |  ------------------
  ------------------
 4809|  1.38k|    pdu->command = msg_type;
 4810|  1.38k|    pdu->flags &= (~UCD_MSG_FLAG_RESPONSE_PDU);
  ------------------
  |  |  311|  1.38k|#define UCD_MSG_FLAG_RESPONSE_PDU            0x100
  ------------------
 4811|       |
 4812|       |    /*
 4813|       |     * get the fields in the PDU preceding the variable-bindings sequence
 4814|       |     */
 4815|  1.38k|    switch (pdu->command) {
 4816|  1.08k|    case SNMP_MSG_TRAP:
  ------------------
  |  |  135|  1.08k|#define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   92|  1.08k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   96|  1.08k|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4816:5): [True: 1.08k, False: 306]
  ------------------
 4817|       |        /*
 4818|       |         * enterprise 
 4819|       |         */
 4820|  1.08k|        pdu->enterprise_length = MAX_OID_LEN;
  ------------------
  |  |  120|  1.08k|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
 4821|  1.08k|        data = asn_parse_objid(data, length, &type, objid,
 4822|  1.08k|                               &pdu->enterprise_length);
 4823|  1.08k|        if (data == NULL)
  ------------------
  |  Branch (4823:13): [True: 214, False: 866]
  ------------------
 4824|    214|            return -1;
 4825|    866|        SNMP_FREE(pdu->enterprise);
  ------------------
  |  |   62|    866|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 866]
  |  |  |  Branch (62:66): [Folded, False: 866]
  |  |  ------------------
  ------------------
 4826|    866|        pdu->enterprise = netsnmp_memdup(objid,
 4827|    866|                                         pdu->enterprise_length * sizeof(oid));
 4828|    866|        if (pdu->enterprise == NULL) {
  ------------------
  |  Branch (4828:13): [True: 0, False: 866]
  ------------------
 4829|      0|            return -1;
 4830|      0|        }
 4831|       |
 4832|       |        /*
 4833|       |         * agent-addr 
 4834|       |         */
 4835|    866|        four = 4;
 4836|    866|        data = asn_parse_string(data, length, &type,
 4837|    866|                                (u_char *) pdu->agent_addr, &four);
 4838|    866|        if (data == NULL)
  ------------------
  |  Branch (4838:13): [True: 114, False: 752]
  ------------------
 4839|    114|            return -1;
 4840|       |
 4841|       |        /*
 4842|       |         * generic trap 
 4843|       |         */
 4844|    752|        data = asn_parse_int(data, length, &type, (long *) &pdu->trap_type,
 4845|    752|                             sizeof(pdu->trap_type));
 4846|    752|        if (data == NULL)
  ------------------
  |  Branch (4846:13): [True: 7, False: 745]
  ------------------
 4847|      7|            return -1;
 4848|       |        /*
 4849|       |         * specific trap 
 4850|       |         */
 4851|    745|        data =
 4852|    745|            asn_parse_int(data, length, &type,
 4853|    745|                          (long *) &pdu->specific_type,
 4854|    745|                          sizeof(pdu->specific_type));
 4855|    745|        if (data == NULL)
  ------------------
  |  Branch (4855:13): [True: 4, False: 741]
  ------------------
 4856|      4|            return -1;
 4857|       |
 4858|       |        /*
 4859|       |         * timestamp  
 4860|       |         */
 4861|    741|        data = asn_parse_unsigned_int(data, length, &type, &pdu->time,
 4862|    741|                                      sizeof(pdu->time));
 4863|    741|        if (data == NULL)
  ------------------
  |  Branch (4863:13): [True: 181, False: 560]
  ------------------
 4864|    181|            return -1;
 4865|       |
 4866|    560|        break;
 4867|       |
 4868|    560|    case SNMP_MSG_RESPONSE:
  ------------------
  |  |  127|     37|#define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   92|     37|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   96|     37|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4868:5): [True: 37, False: 1.34k]
  ------------------
 4869|     69|    case SNMP_MSG_REPORT:
  ------------------
  |  |  147|     69|#define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   92|     69|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   96|     69|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4869:5): [True: 32, False: 1.35k]
  ------------------
 4870|     69|        pdu->flags |= UCD_MSG_FLAG_RESPONSE_PDU;
  ------------------
  |  |  311|     69|#define UCD_MSG_FLAG_RESPONSE_PDU            0x100
  ------------------
 4871|     69|        NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2443|     69|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 4872|       |
 4873|     93|    case SNMP_MSG_TRAP2:
  ------------------
  |  |  142|     93|#define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   92|     93|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   96|     93|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4873:5): [True: 24, False: 1.36k]
  ------------------
 4874|    116|    case SNMP_MSG_INFORM:
  ------------------
  |  |  141|    116|#define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   92|    116|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   96|    116|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4874:5): [True: 23, False: 1.36k]
  ------------------
 4875|    116|#ifndef NETSNMP_NOTIFY_ONLY
 4876|    146|    case SNMP_MSG_GET:
  ------------------
  |  |  125|    146|#define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  ------------------
  |  |  |  |   92|    146|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  ------------------
  |  |  |  |   96|    146|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4876:5): [True: 30, False: 1.35k]
  ------------------
 4877|    180|    case SNMP_MSG_GETNEXT:
  ------------------
  |  |  126|    180|#define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   92|    180|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   96|    180|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4877:5): [True: 34, False: 1.35k]
  ------------------
 4878|    232|    case SNMP_MSG_GETBULK:
  ------------------
  |  |  140|    232|#define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  ------------------
  |  |  |  |   92|    232|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  ------------------
  |  |  |  |   96|    232|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4878:5): [True: 52, False: 1.33k]
  ------------------
 4879|    232|#endif /* ! NETSNMP_NOTIFY_ONLY */
 4880|    232|#ifndef NETSNMP_NO_WRITE_SUPPORT
 4881|    298|    case SNMP_MSG_SET:
  ------------------
  |  |  129|    298|#define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  ------------------
  |  |  |  |   92|    298|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  ------------------
  |  |  |  |   96|    298|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4881:5): [True: 66, False: 1.32k]
  ------------------
 4882|    298|#endif /* !NETSNMP_NO_WRITE_SUPPORT */
 4883|       |        /*
 4884|       |         * PDU is not an SNMPv1 TRAP 
 4885|       |         */
 4886|       |
 4887|       |        /*
 4888|       |         * request id 
 4889|       |         */
 4890|    298|        DEBUGDUMPHEADER("recv", "request_id");
  ------------------
  |  |   79|    298|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    298|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 298]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 298]
  |  |  ------------------
  ------------------
 4891|    298|        data = asn_parse_int(data, length, &type, &pdu->reqid,
 4892|    298|                             sizeof(pdu->reqid));
 4893|    298|        DEBUGINDENTLESS();
  ------------------
  |  |   75|    298|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    298|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 298]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 298]
  |  |  ------------------
  ------------------
 4894|    298|        if (data == NULL) {
  ------------------
  |  Branch (4894:13): [True: 11, False: 287]
  ------------------
 4895|     11|            return -1;
 4896|     11|        }
 4897|       |
 4898|       |        /*
 4899|       |         * error status (getbulk non-repeaters) 
 4900|       |         */
 4901|    287|        DEBUGDUMPHEADER("recv", "error status");
  ------------------
  |  |   79|    287|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    287|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 287]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 287]
  |  |  ------------------
  ------------------
 4902|    287|        data = asn_parse_int(data, length, &type, &pdu->errstat,
 4903|    287|                             sizeof(pdu->errstat));
 4904|    287|        DEBUGINDENTLESS();
  ------------------
  |  |   75|    287|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    287|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 287]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 287]
  |  |  ------------------
  ------------------
 4905|    287|        if (data == NULL) {
  ------------------
  |  Branch (4905:13): [True: 2, False: 285]
  ------------------
 4906|      2|            return -1;
 4907|      2|        }
 4908|       |
 4909|       |        /*
 4910|       |         * error index (getbulk max-repetitions) 
 4911|       |         */
 4912|    285|        DEBUGDUMPHEADER("recv", "error index");
  ------------------
  |  |   79|    285|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    285|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 285]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 285]
  |  |  ------------------
  ------------------
 4913|    285|        data = asn_parse_int(data, length, &type, &pdu->errindex,
 4914|    285|                             sizeof(pdu->errindex));
 4915|    285|        DEBUGINDENTLESS();
  ------------------
  |  |   75|    285|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|    285|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 285]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 285]
  |  |  ------------------
  ------------------
 4916|    285|        if (data == NULL) {
  ------------------
  |  Branch (4916:13): [True: 3, False: 282]
  ------------------
 4917|      3|            return -1;
 4918|      3|        }
 4919|    282|	break;
 4920|       |
 4921|    282|    default:
  ------------------
  |  Branch (4921:5): [True: 8, False: 1.37k]
  ------------------
 4922|      8|        snmp_log(LOG_ERR, "Bad PDU type received: 0x%.2x\n", pdu->command);
 4923|      8|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      8|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4924|      8|        return -1;
 4925|  1.38k|    }
 4926|       |
 4927|       |    /*
 4928|       |     * get header for variable-bindings sequence 
 4929|       |     */
 4930|    842|    DEBUGDUMPSECTION("recv", "VarBindList");
  ------------------
  |  |   81|    842|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    842|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 842]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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: 842]
  |  |  ------------------
  ------------------
 4931|    842|    data = asn_parse_sequence(data, length, &type,
 4932|    842|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   84|    842|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   96|    842|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 4933|    842|                              "varbinds");
 4934|    842|    if (data == NULL)
  ------------------
  |  Branch (4934:9): [True: 121, False: 721]
  ------------------
 4935|    121|        goto fail;
 4936|       |
 4937|    721|    snmp_free_varbind(pdu->variables);
 4938|    721|    pdu->variables = NULL;
 4939|       |
 4940|       |    /*
 4941|       |     * get each varBind sequence 
 4942|       |     */
 4943|  17.9k|    while ((int) *length > 0) {
  ------------------
  |  Branch (4943:12): [True: 17.8k, False: 137]
  ------------------
 4944|  17.8k|        vp = SNMP_MALLOC_TYPEDEF(netsnmp_variable_list);
  ------------------
  |  |   73|  17.8k|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
 4945|  17.8k|        if (NULL == vp)
  ------------------
  |  Branch (4945:13): [True: 0, False: 17.8k]
  ------------------
 4946|      0|            goto fail;
 4947|       |
 4948|  17.8k|        vp->name_length = MAX_OID_LEN;
  ------------------
  |  |  120|  17.8k|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
 4949|  17.8k|        DEBUGDUMPSECTION("recv", "VarBind");
  ------------------
  |  |   81|  17.8k|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  17.8k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 17.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 17.8k]
  |  |  ------------------
  ------------------
 4950|  17.8k|        data = snmp_parse_var_op(data, objid, &vp->name_length, &vp->type,
 4951|  17.8k|                                 &vp->val_len, &var_val, length);
 4952|  17.8k|        if (data == NULL)
  ------------------
  |  Branch (4952:13): [True: 382, False: 17.4k]
  ------------------
 4953|    382|            goto fail;
 4954|  17.4k|        if (snmp_set_var_objid(vp, objid, vp->name_length))
  ------------------
  |  Branch (4954:13): [True: 0, False: 17.4k]
  ------------------
 4955|      0|            goto fail;
 4956|       |
 4957|  17.4k|        len = SNMP_MAX_PACKET_LEN;
  ------------------
  |  |   49|  17.4k|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
 4958|  17.4k|        DEBUGDUMPHEADER("recv", "Value");
  ------------------
  |  |   79|  17.4k|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  17.4k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 17.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  184|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 17.4k]
  |  |  ------------------
  ------------------
 4959|  17.4k|        switch ((short) vp->type) {
 4960|  1.52k|        case ASN_INTEGER:
  ------------------
  |  |   75|  1.52k|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (4960:9): [True: 1.52k, False: 15.9k]
  ------------------
 4961|  1.52k|            vp->val.integer = (long *) vp->buf;
 4962|  1.52k|            vp->val_len = sizeof(long);
 4963|  1.52k|            p = asn_parse_int(var_val, &len, &vp->type,
 4964|  1.52k|                          (long *) vp->val.integer,
 4965|  1.52k|                          sizeof(*vp->val.integer));
 4966|  1.52k|            if (!p)
  ------------------
  |  Branch (4966:17): [True: 5, False: 1.52k]
  ------------------
 4967|      5|                goto fail;
 4968|  1.52k|            break;
 4969|  1.52k|        case ASN_COUNTER:
  ------------------
  |  |   89|  1.10k|#define ASN_COUNTER	(ASN_APPLICATION | 1)
  |  |  ------------------
  |  |  |  |   91|  1.10k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4969:9): [True: 1.10k, False: 16.3k]
  ------------------
 4970|  1.79k|        case ASN_GAUGE:
  ------------------
  |  |   90|  1.79k|#define ASN_GAUGE	(ASN_APPLICATION | 2)
  |  |  ------------------
  |  |  |  |   91|  1.79k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4970:9): [True: 692, False: 16.7k]
  ------------------
 4971|  2.33k|        case ASN_TIMETICKS:
  ------------------
  |  |   92|  2.33k|#define ASN_TIMETICKS   (ASN_APPLICATION | 3)
  |  |  ------------------
  |  |  |  |   91|  2.33k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4971:9): [True: 538, False: 16.9k]
  ------------------
 4972|  2.95k|        case ASN_UINTEGER:
  ------------------
  |  |  100|  2.95k|#define ASN_UINTEGER    (ASN_APPLICATION | 7)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|  2.95k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4972:9): [True: 623, False: 16.8k]
  ------------------
 4973|  2.95k|            vp->val.integer = (long *) vp->buf;
 4974|  2.95k|            vp->val_len = sizeof(u_long);
 4975|  2.95k|            p = asn_parse_unsigned_int(var_val, &len, &vp->type,
 4976|  2.95k|                                   (u_long *) vp->val.integer,
 4977|  2.95k|                                   vp->val_len);
 4978|  2.95k|            if (!p)
  ------------------
  |  Branch (4978:17): [True: 17, False: 2.93k]
  ------------------
 4979|     17|                goto fail;
 4980|  2.93k|            break;
 4981|  2.93k|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 4982|  2.93k|        case ASN_OPAQUE_COUNTER64:
  ------------------
  |  |  156|    888|#define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  136|    888|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  146|    888|#define ASN_APP_COUNTER64 (ASN_APPLICATION | 6)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    888|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4982:9): [True: 888, False: 16.5k]
  ------------------
 4983|  1.54k|        case ASN_OPAQUE_U64:
  ------------------
  |  |  192|  1.54k|#define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  136|  1.54k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  150|  1.54k|#define ASN_APP_U64 (ASN_APPLICATION | 11)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.54k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4983:9): [True: 660, False: 16.7k]
  ------------------
 4984|  1.54k|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 4985|  2.86k|        case ASN_COUNTER64:
  ------------------
  |  |   99|  2.86k|#define ASN_COUNTER64   (ASN_APPLICATION | 6)
  |  |  ------------------
  |  |  |  |   91|  2.86k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4985:9): [True: 1.32k, False: 16.1k]
  ------------------
 4986|  2.86k|            vp->val.counter64 = (struct counter64 *) vp->buf;
 4987|  2.86k|            vp->val_len = sizeof(struct counter64);
 4988|  2.86k|            p = asn_parse_unsigned_int64(var_val, &len, &vp->type,
 4989|  2.86k|                                     (struct counter64 *) vp->val.
 4990|  2.86k|                                     counter64, vp->val_len);
 4991|  2.86k|            if (!p)
  ------------------
  |  Branch (4991:17): [True: 30, False: 2.83k]
  ------------------
 4992|     30|                goto fail;
 4993|  2.83k|            break;
 4994|  2.83k|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 4995|  2.83k|        case ASN_OPAQUE_FLOAT:
  ------------------
  |  |  165|    934|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|    934|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|    934|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    934|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4995:9): [True: 934, False: 16.5k]
  ------------------
 4996|    934|            vp->val.floatVal = (float *) vp->buf;
 4997|    934|            vp->val_len = sizeof(float);
 4998|    934|            p = asn_parse_float(var_val, &len, &vp->type,
 4999|    934|                            vp->val.floatVal, vp->val_len);
 5000|    934|            if (!p)
  ------------------
  |  Branch (5000:17): [True: 35, False: 899]
  ------------------
 5001|     35|                goto fail;
 5002|    899|            break;
 5003|    899|        case ASN_OPAQUE_DOUBLE:
  ------------------
  |  |  174|    777|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|    777|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|    777|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    777|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (5003:9): [True: 777, False: 16.6k]
  ------------------
 5004|    777|            vp->val.doubleVal = (double *) vp->buf;
 5005|    777|            vp->val_len = sizeof(double);
 5006|    777|            p = asn_parse_double(var_val, &len, &vp->type,
 5007|    777|                             vp->val.doubleVal, vp->val_len);
 5008|    777|            if (!p)
  ------------------
  |  Branch (5008:17): [True: 45, False: 732]
  ------------------
 5009|     45|                goto fail;
 5010|    732|            break;
 5011|  1.14k|        case ASN_OPAQUE_I64:
  ------------------
  |  |  183|  1.14k|#define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  136|  1.14k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  149|  1.14k|#define ASN_APP_I64 (ASN_APPLICATION | 10)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.14k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (5011:9): [True: 1.14k, False: 16.3k]
  ------------------
 5012|  1.14k|            vp->val.counter64 = (struct counter64 *) vp->buf;
 5013|  1.14k|            vp->val_len = sizeof(struct counter64);
 5014|  1.14k|            p = asn_parse_signed_int64(var_val, &len, &vp->type,
 5015|  1.14k|                                   (struct counter64 *) vp->val.counter64,
 5016|  1.14k|                                   sizeof(*vp->val.counter64));
 5017|       |
 5018|  1.14k|            if (!p)
  ------------------
  |  Branch (5018:17): [True: 38, False: 1.10k]
  ------------------
 5019|     38|                goto fail;
 5020|  1.10k|            break;
 5021|  1.10k|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 5022|  1.10k|        case ASN_IPADDRESS:
  ------------------
  |  |   88|    262|#define ASN_IPADDRESS   (ASN_APPLICATION | 0)
  |  |  ------------------
  |  |  |  |   91|    262|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (5022:9): [True: 262, False: 17.1k]
  ------------------
 5023|    262|            if (vp->val_len != 4)
  ------------------
  |  Branch (5023:17): [True: 11, False: 251]
  ------------------
 5024|     11|                goto fail;
 5025|    251|            NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2443|    251|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 5026|  1.11k|        case ASN_OCTET_STR:
  ------------------
  |  |   78|  1.11k|#define ASN_OCTET_STR	    0x04U
  ------------------
  |  Branch (5026:9): [True: 867, False: 16.5k]
  ------------------
 5027|  2.51k|        case ASN_OPAQUE:
  ------------------
  |  |   93|  2.51k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  2.51k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (5027:9): [True: 1.40k, False: 16.0k]
  ------------------
 5028|  3.18k|        case ASN_NSAP:
  ------------------
  |  |   98|  3.18k|#define ASN_NSAP	(ASN_APPLICATION | 5)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|  3.18k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (5028:9): [True: 670, False: 16.7k]
  ------------------
 5029|  3.18k|            if (vp->val_len < sizeof(vp->buf)) {
  ------------------
  |  Branch (5029:17): [True: 2.81k, False: 370]
  ------------------
 5030|  2.81k|                vp->val.string = (u_char *) vp->buf;
 5031|  2.81k|            } else {
 5032|    370|                vp->val.string = (u_char *) malloc(vp->val_len);
 5033|    370|            }
 5034|  3.18k|            if (vp->val.string == NULL) {
  ------------------
  |  Branch (5034:17): [True: 0, False: 3.18k]
  ------------------
 5035|      0|                goto fail;
 5036|      0|            }
 5037|  3.18k|            p = asn_parse_string(var_val, &len, &vp->type, vp->val.string,
 5038|  3.18k|                             &vp->val_len);
 5039|  3.18k|            if (!p)
  ------------------
  |  Branch (5039:17): [True: 0, False: 3.18k]
  ------------------
 5040|      0|                goto fail;
 5041|  3.18k|            break;
 5042|  3.18k|        case ASN_OBJECT_ID:
  ------------------
  |  |   81|    870|#define ASN_OBJECT_ID	    0x06U
  ------------------
  |  Branch (5042:9): [True: 870, False: 16.5k]
  ------------------
 5043|    870|            vp->val_len = MAX_OID_LEN;
  ------------------
  |  |  120|    870|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
 5044|    870|            p = asn_parse_objid(var_val, &len, &vp->type, objid, &vp->val_len);
 5045|    870|            if (!p)
  ------------------
  |  Branch (5045:17): [True: 2, False: 868]
  ------------------
 5046|      2|                goto fail;
 5047|    868|            vp->val_len *= sizeof(oid);
 5048|    868|            vp->val.objid = netsnmp_memdup(objid, vp->val_len);
 5049|    868|            if (vp->val.objid == NULL)
  ------------------
  |  Branch (5049:17): [True: 0, False: 868]
  ------------------
 5050|      0|                goto fail;
 5051|    868|            break;
 5052|    868|        case SNMP_NOSUCHOBJECT:
  ------------------
  |  |  201|    373|#define SNMP_NOSUCHOBJECT    (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) /* 80=128 */
  |  |  ------------------
  |  |  |  |   92|    373|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_NOSUCHOBJECT    (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) /* 80=128 */
  |  |  ------------------
  |  |  |  |   95|    373|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (5052:9): [True: 373, False: 17.0k]
  ------------------
 5053|  1.22k|        case SNMP_NOSUCHINSTANCE:
  ------------------
  |  |  202|  1.22k|#define SNMP_NOSUCHINSTANCE  (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* 81=129 */
  |  |  ------------------
  |  |  |  |   92|  1.22k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_NOSUCHINSTANCE  (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* 81=129 */
  |  |  ------------------
  |  |  |  |   95|  1.22k|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (5053:9): [True: 853, False: 16.5k]
  ------------------
 5054|  1.63k|        case SNMP_ENDOFMIBVIEW:
  ------------------
  |  |  203|  1.63k|#define SNMP_ENDOFMIBVIEW    (ASN_CONTEXT | ASN_PRIMITIVE | 0x2) /* 82=130 */
  |  |  ------------------
  |  |  |  |   92|  1.63k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_ENDOFMIBVIEW    (ASN_CONTEXT | ASN_PRIMITIVE | 0x2) /* 82=130 */
  |  |  ------------------
  |  |  |  |   95|  1.63k|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (5054:9): [True: 412, False: 17.0k]
  ------------------
 5055|  2.12k|        case ASN_NULL:
  ------------------
  |  |   79|  2.12k|#define ASN_NULL	    0x05U
  ------------------
  |  Branch (5055:9): [True: 484, False: 16.9k]
  ------------------
 5056|  2.12k|            break;
 5057|  1.03k|        case ASN_BIT_STR:
  ------------------
  |  |   77|  1.03k|#define ASN_BIT_STR	    0x03U
  ------------------
  |  Branch (5057:9): [True: 1.03k, False: 16.4k]
  ------------------
 5058|  1.03k|            vp->val.bitstring = (u_char *) malloc(vp->val_len);
 5059|  1.03k|            if (vp->val.bitstring == NULL) {
  ------------------
  |  Branch (5059:17): [True: 0, False: 1.03k]
  ------------------
 5060|      0|                goto fail;
 5061|      0|            }
 5062|  1.03k|            p = asn_parse_bitstring(var_val, &len, &vp->type,
 5063|  1.03k|                                vp->val.bitstring, &vp->val_len);
 5064|  1.03k|            if (!p)
  ------------------
  |  Branch (5064:17): [True: 8, False: 1.02k]
  ------------------
 5065|      8|                goto fail;
 5066|  1.02k|            break;
 5067|  1.02k|        default:
  ------------------
  |  Branch (5067:9): [True: 11, False: 17.4k]
  ------------------
 5068|     11|            snmp_log(LOG_ERR, "bad type returned (%x)\n", vp->type);
 5069|     11|            goto fail;
 5070|      0|            break;
 5071|  17.4k|        }
 5072|  17.2k|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|  17.2k|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  17.2k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 17.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 17.2k]
  |  |  ------------------
  ------------------
 5073|       |
 5074|  17.2k|        if (NULL == vplast) {
  ------------------
  |  Branch (5074:13): [True: 575, False: 16.6k]
  ------------------
 5075|    575|            pdu->variables = vp;
 5076|  16.6k|        } else {
 5077|  16.6k|            vplast->next_variable = vp;
 5078|  16.6k|        }
 5079|  17.2k|        vplast = vp;
 5080|  17.2k|        vp = NULL;
 5081|  17.2k|    }
 5082|    137|    return 0;
 5083|       |
 5084|    705|  fail:
 5085|    705|    {
 5086|    705|        const char *errstr = snmp_api_errstring(SNMPERR_SUCCESS);
  ------------------
  |  |  184|    705|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 5087|    705|        DEBUGMSGTL(("recv", "error while parsing VarBindList:%s\n", errstr));
  ------------------
  |  |   66|    705|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    705|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 705]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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: 705]
  |  |  ------------------
  ------------------
 5088|    705|    }
 5089|       |    /** if we were parsing a var, remove it from the pdu and free it */
 5090|    705|    if (vp)
  ------------------
  |  Branch (5090:9): [True: 584, False: 121]
  ------------------
 5091|    584|        snmp_free_var(vp);
 5092|       |
 5093|    705|    return -1;
 5094|    721|}
snmp_free_var_internals:
 5710|  17.8k|{
 5711|  17.8k|    if (!var)
  ------------------
  |  Branch (5711:9): [True: 0, False: 17.8k]
  ------------------
 5712|      0|        return;
 5713|       |
 5714|  17.8k|    if (var->name != var->name_loc)
  ------------------
  |  Branch (5714:9): [True: 382, False: 17.4k]
  ------------------
 5715|    382|        SNMP_FREE(var->name);
  ------------------
  |  |   62|    382|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 382]
  |  |  |  Branch (62:66): [Folded, False: 382]
  |  |  ------------------
  ------------------
 5716|  17.8k|    if (var->val.string != var->buf)
  ------------------
  |  Branch (5716:9): [True: 4.80k, False: 13.0k]
  ------------------
 5717|  4.80k|        SNMP_FREE(var->val.string);
  ------------------
  |  |   62|  4.80k|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 2.27k, False: 2.52k]
  |  |  |  Branch (62:66): [Folded, False: 4.80k]
  |  |  ------------------
  ------------------
 5718|  17.8k|    if (var->data) {
  ------------------
  |  Branch (5718:9): [True: 0, False: 17.8k]
  ------------------
 5719|      0|        if (var->dataFreeHook) {
  ------------------
  |  Branch (5719:13): [True: 0, False: 0]
  ------------------
 5720|      0|            var->dataFreeHook(var->data);
 5721|      0|            var->data = NULL;
 5722|      0|        } else {
 5723|       |            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]
  |  |  ------------------
  ------------------
 5724|      0|        }
 5725|      0|    }
 5726|  17.8k|}
snmp_free_var:
 5730|  17.8k|{
 5731|  17.8k|    snmp_free_var_internals(var);
 5732|  17.8k|    free(var);
 5733|  17.8k|}
snmp_free_varbind:
 5737|  6.08k|{
 5738|  6.08k|    netsnmp_variable_list *ptr;
 5739|  23.3k|    while (var) {
  ------------------
  |  Branch (5739:12): [True: 17.2k, False: 6.08k]
  ------------------
 5740|  17.2k|        ptr = var->next_variable;
 5741|  17.2k|        snmp_free_var(var);
 5742|  17.2k|        var = ptr;
 5743|  17.2k|    }
 5744|  6.08k|}
snmp_free_pdu:
 5751|  5.36k|{
 5752|  5.36k|    struct snmp_secmod_def *sptr;
 5753|       |
 5754|  5.36k|    if (!pdu)
  ------------------
  |  Branch (5754:9): [True: 0, False: 5.36k]
  ------------------
 5755|      0|        return;
 5756|       |
 5757|  5.36k|    free_securityStateRef(pdu);
 5758|       |
 5759|  5.36k|    sptr = find_sec_mod(pdu->securityModel);
 5760|  5.36k|    if (sptr && sptr->pdu_free)
  ------------------
  |  Branch (5760:9): [True: 0, False: 5.36k]
  |  Branch (5760:17): [True: 0, False: 0]
  ------------------
 5761|      0|        (*sptr->pdu_free)(pdu);
 5762|       |
 5763|  5.36k|    snmp_free_varbind(pdu->variables);
 5764|  5.36k|    free(pdu->enterprise);
 5765|  5.36k|    free(pdu->community);
 5766|  5.36k|    free(pdu->contextEngineID);
 5767|  5.36k|    free(pdu->securityEngineID);
 5768|  5.36k|    free(pdu->contextName);
 5769|  5.36k|    free(pdu->securityName);
 5770|  5.36k|    free(pdu->transport_data);
 5771|  5.36k|    free(pdu);
 5772|  5.36k|}
snmp_increment_statistic:
 8415|  3.96k|{
 8416|  3.96k|    if (which >= 0 && which < NETSNMP_STAT_MAX_STATS) {
  ------------------
  |  |  710|  3.96k|#define  NETSNMP_STAT_MAX_STATS              (STAT_TLSTM_STATS_END+1)
  |  |  ------------------
  |  |  |  |  706|  3.96k|#define  STAT_TLSTM_STATS_END          STAT_TLSTM_SNMPTLSTMSESSIONINVALIDCACHES
  |  |  |  |  ------------------
  |  |  |  |  |  |  703|  3.96k|#define  STAT_TLSTM_SNMPTLSTMSESSIONINVALIDCACHES              56
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (8416:9): [True: 3.96k, False: 0]
  |  Branch (8416:23): [True: 3.96k, False: 0]
  ------------------
 8417|  3.96k|        statistics[which]++;
 8418|  3.96k|        return statistics[which];
 8419|  3.96k|    }
 8420|      0|    return 0;
 8421|  3.96k|}
snmp_api.c:free_securityStateRef:
 4241|  5.36k|{
 4242|  5.36k|    struct snmp_secmod_def *sptr;
 4243|       |
 4244|  5.36k|    if (!pdu->securityStateRef)
  ------------------
  |  Branch (4244:9): [True: 5.36k, False: 0]
  ------------------
 4245|  5.36k|        return;
 4246|       |
 4247|      0|    sptr = find_sec_mod(pdu->securityModel);
 4248|      0|    if (sptr) {
  ------------------
  |  Branch (4248:9): [True: 0, False: 0]
  ------------------
 4249|      0|        if (sptr->pdu_free_state_ref) {
  ------------------
  |  Branch (4249:13): [True: 0, False: 0]
  ------------------
 4250|      0|            (*sptr->pdu_free_state_ref) (pdu->securityStateRef);
 4251|      0|        } else {
 4252|      0|            snmp_log(LOG_ERR,
 4253|      0|                     "Security Model %d can't free state references\n",
 4254|      0|                     pdu->securityModel);
 4255|      0|	}
 4256|      0|    } else {
 4257|      0|	snmp_log(LOG_ERR,
 4258|      0|		 "Can't find security model to free ptr: %d\n",
 4259|      0|		 pdu->securityModel);
 4260|      0|    }
 4261|       |    pdu->securityStateRef = NULL;
 4262|      0|}
snmp_api.c:_snmp_parse:
 4470|  2.68k|{
 4471|  2.68k|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 4472|  2.68k|    u_char          community[COMMUNITY_MAX_LEN];
 4473|  2.68k|    size_t          community_length = COMMUNITY_MAX_LEN;
  ------------------
  |  |   41|  2.68k|#define COMMUNITY_MAX_LEN	256
  ------------------
 4474|  2.68k|#endif
 4475|  2.68k|    int             result = -1;
 4476|       |
 4477|  2.68k|    static const oid snmpEngineIDoid[]   = { 1,3,6,1,6,3,10,2,1,1,0};
 4478|  2.68k|    static size_t   snmpEngineIDoid_len = 11;
 4479|       |
 4480|  2.68k|    static char     ourEngineID[SNMP_SEC_PARAM_BUF_SIZE];
 4481|  2.68k|    static size_t   ourEngineID_len = sizeof(ourEngineID);
 4482|       |
 4483|  2.68k|    netsnmp_pdu    *pdu2 = NULL;
 4484|       |
 4485|  2.68k|    session->s_snmp_errno = 0;
 4486|  2.68k|    session->s_errno = 0;
 4487|       |
 4488|       |    /*
 4489|       |     * Ensure all incoming PDUs have a unique means of identification 
 4490|       |     * (This is not restricted to AgentX handling,
 4491|       |     * though that is where the need becomes visible)   
 4492|       |     */
 4493|  2.68k|    pdu->transid = snmp_get_next_transid();
 4494|       |
 4495|  2.68k|    if (session->version != SNMP_DEFAULT_VERSION) {
  ------------------
  |  |   90|  2.68k|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  |  Branch (4495:9): [True: 2.68k, False: 0]
  ------------------
 4496|  2.68k|        pdu->version = session->version;
 4497|  2.68k|    } else {
 4498|      0|        pdu->version = snmp_parse_version(data, length);
 4499|      0|    }
 4500|       |
 4501|  2.68k|    switch (pdu->version) {
 4502|      0|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 4503|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 4504|  2.68k|    case SNMP_VERSION_1:
  ------------------
  |  |  107|  2.68k|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (4504:5): [True: 2.68k, False: 0]
  ------------------
 4505|  2.68k|#endif
 4506|  2.68k|#ifndef NETSNMP_DISABLE_SNMPV2C
 4507|  2.68k|    case SNMP_VERSION_2c:
  ------------------
  |  |  110|  2.68k|#define SNMP_VERSION_2c    1
  ------------------
  |  Branch (4507:5): [True: 0, False: 2.68k]
  ------------------
 4508|  2.68k|#endif
 4509|  2.68k|        NETSNMP_RUNTIME_PROTOCOL_CHECK_V1V2(pdu->version,unsupported_version);
  ------------------
  |  |  220|  2.68k|#define NETSNMP_RUNTIME_PROTOCOL_CHECK_V1V2(pc_ver, pc_target) do {    \
  |  |  221|  2.68k|        if (NETSNMP_RUNTIME_PROTOCOL_SKIP_V1(pc_ver) ||                \
  |  |  ------------------
  |  |  |  |  205|  5.36k|    ((pc_ver) == SNMP_VERSION_1 &&                                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |  107|  5.36k|#define SNMP_VERSION_1	   0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (205:6): [True: 2.68k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  206|  5.36k|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|  2.68k|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (206:6): [True: 0, False: 2.68k]
  |  |  |  |  ------------------
  |  |  |  |  207|  2.68k|                            NETSNMP_DS_LIB_DISABLE_V1))
  |  |  |  |  ------------------
  |  |  |  |  |  |  103|  2.68k|#define NETSNMP_DS_LIB_DISABLE_V1          43 /* disable SNMPv1 */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  222|  2.68k|            NETSNMP_RUNTIME_PROTOCOL_SKIP_V2(pc_ver)) {                \
  |  |  ------------------
  |  |  |  |  215|  2.68k|    ((pc_ver) == SNMP_VERSION_2c &&                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  5.36k|#define SNMP_VERSION_2c    1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (215:6): [True: 0, False: 2.68k]
  |  |  |  |  ------------------
  |  |  |  |  216|  2.68k|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (216:6): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  217|      0|                            NETSNMP_DS_LIB_DISABLE_V2c))
  |  |  |  |  ------------------
  |  |  |  |  |  |  104|      0|#define NETSNMP_DS_LIB_DISABLE_V2c         44 /* disable SNMPv2c */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  223|      0|            DEBUGMSGTL(("snmp:protocol:disabled", "enforced\n"));      \
  |  |  ------------------
  |  |  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  224|      0|            goto pc_target;                                            \
  |  |  225|      0|        }                                                              \
  |  |  226|  2.68k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (226:13): [Folded, False: 2.68k]
  |  |  ------------------
  ------------------
 4510|  2.68k|        DEBUGMSGTL(("snmp_api", "Parsing SNMPv%ld message...\n",
  ------------------
  |  |   66|  2.68k|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.68k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.68k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 2.68k]
  |  |  ------------------
  ------------------
 4511|  2.68k|                    (1 + pdu->version)));
 4512|       |
 4513|       |        /*
 4514|       |         * authenticates message and returns length if valid 
 4515|       |         */
 4516|  2.68k|#ifndef NETSNMP_DISABLE_SNMPV1
 4517|  2.68k|        if (pdu->version == SNMP_VERSION_1) {
  ------------------
  |  |  107|  2.68k|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (4517:13): [True: 2.68k, False: 0]
  ------------------
 4518|  2.68k|            DEBUGDUMPSECTION("recv", "SNMPv1 message\n");
  ------------------
  |  |   81|  2.68k|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  2.68k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2.68k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 2.68k]
  |  |  ------------------
  ------------------
 4519|  2.68k|        } else {
 4520|      0|#endif
 4521|      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]
  |  |  ------------------
  ------------------
 4522|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 4523|      0|        }
 4524|  2.68k|#endif
 4525|  2.68k|        data = snmp_comstr_parse(data, &length,
 4526|  2.68k|                                 community, &community_length,
 4527|  2.68k|                                 &pdu->version);
 4528|  2.68k|        if (data == NULL)
  ------------------
  |  Branch (4528:13): [True: 1.18k, False: 1.49k]
  ------------------
 4529|  1.18k|            return -1;
 4530|       |
 4531|  1.49k|        if (pdu->version != session->version &&
  ------------------
  |  Branch (4531:13): [True: 90, False: 1.40k]
  ------------------
 4532|     90|            session->version != SNMP_DEFAULT_VERSION) {
  ------------------
  |  |   90|     90|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  |  Branch (4532:13): [True: 90, False: 0]
  ------------------
 4533|     90|            session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  198|     90|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 4534|     90|            return -1;
 4535|     90|        }
 4536|       |
 4537|       |        /*
 4538|       |         * maybe get the community string. 
 4539|       |         */
 4540|  1.40k|        pdu->securityLevel = SNMP_SEC_LEVEL_NOAUTH;
  ------------------
  |  |  299|  1.40k|#define SNMP_SEC_LEVEL_NOAUTH		1
  ------------------
 4541|  1.40k|        pdu->securityModel = 
 4542|  1.40k|#ifndef NETSNMP_DISABLE_SNMPV1
 4543|  1.40k|            (pdu->version == SNMP_VERSION_1) ? SNMP_SEC_MODEL_SNMPv1 : 
  ------------------
  |  |  107|  1.40k|#define SNMP_VERSION_1	   0
  ------------------
                          (pdu->version == SNMP_VERSION_1) ? SNMP_SEC_MODEL_SNMPv1 : 
  ------------------
  |  |  293|  1.40k|#define SNMP_SEC_MODEL_SNMPv1		1
  ------------------
  |  Branch (4543:13): [True: 1.40k, False: 0]
  ------------------
 4544|  1.40k|#endif
 4545|  1.40k|                                               SNMP_SEC_MODEL_SNMPv2c;
  ------------------
  |  |  294|  1.40k|#define SNMP_SEC_MODEL_SNMPv2c		2
  ------------------
 4546|  1.40k|        SNMP_FREE(pdu->community);
  ------------------
  |  |   62|  1.40k|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 1.40k]
  |  |  |  Branch (62:66): [Folded, False: 1.40k]
  |  |  ------------------
  ------------------
 4547|  1.40k|        pdu->community_len = 0;
 4548|  1.40k|        pdu->community = (u_char *) 0;
 4549|  1.40k|        if (community_length) {
  ------------------
  |  Branch (4549:13): [True: 47, False: 1.35k]
  ------------------
 4550|     47|            pdu->community_len = community_length;
 4551|     47|            pdu->community = netsnmp_memdup(community, community_length);
 4552|     47|            if (pdu->community == NULL) {
  ------------------
  |  Branch (4552:17): [True: 0, False: 47]
  ------------------
 4553|      0|                session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  246|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 4554|      0|                return -1;
 4555|      0|            }
 4556|     47|        }
 4557|  1.40k|        if (session->authenticator) {
  ------------------
  |  Branch (4557:13): [True: 0, False: 1.40k]
  ------------------
 4558|      0|            data = session->authenticator(data, &length,
 4559|      0|                                          community, community_length);
 4560|      0|            if (data == NULL) {
  ------------------
  |  Branch (4560:17): [True: 0, False: 0]
  ------------------
 4561|      0|                session->s_snmp_errno = SNMPERR_AUTHENTICATION_FAILURE;
  ------------------
  |  |  219|      0|#define SNMPERR_AUTHENTICATION_FAILURE 	(-35)
  ------------------
 4562|      0|                return -1;
 4563|      0|            }
 4564|      0|        }
 4565|       |
 4566|  1.40k|        DEBUGDUMPSECTION("recv", "PDU");
  ------------------
  |  |   81|  1.40k|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  1.40k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1.40k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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.40k]
  |  |  ------------------
  ------------------
 4567|  1.40k|        result = snmp_pdu_parse(pdu, data, &length);
 4568|  1.40k|        if (result < 0) {
  ------------------
  |  Branch (4568:13): [True: 1.26k, False: 137]
  ------------------
 4569|       |            /*
 4570|       |             * This indicates a parse error.  
 4571|       |             */
 4572|  1.26k|            snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|  1.26k|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4573|  1.26k|        }
 4574|  1.40k|        DEBUGINDENTADD(-6);
  ------------------
  |  |   73|  1.40k|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  1.40k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1.40k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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.40k]
  |  |  ------------------
  ------------------
 4575|  1.40k|        break;
 4576|      0|#endif /* support for community based SNMP */
 4577|       |
 4578|      0|    case SNMP_VERSION_3:
  ------------------
  |  |  113|      0|#define SNMP_VERSION_3     3
  ------------------
  |  Branch (4578:5): [True: 0, False: 2.68k]
  ------------------
 4579|      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]
  |  |  ------------------
  ------------------
 4580|      0|        result = snmpv3_parse(pdu, data, &length, NULL, session);
 4581|      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 (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4582|      0|                    "Parsed SNMPv3 message (secName:%s, secLevel:%s): %s\n",
 4583|      0|                    pdu->securityName,
 4584|      0|                    (pdu->securityLevel >= 0 && pdu->securityLevel < 4) ?
 4585|      0|                    secLevelName[pdu->securityLevel] : "ERROR: invalid",
 4586|      0|                    snmp_api_errstring(result)));
 4587|       |
 4588|      0|        if (result == SNMPERR_USM_UNKNOWNSECURITYNAME) {
  ------------------
  |  |  227|      0|#define SNMPERR_USM_UNKNOWNSECURITYNAME		(-43)
  ------------------
  |  Branch (4588:13): [True: 0, False: 0]
  ------------------
 4589|      0|            snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
  ------------------
  |  |   19|      0|#define SNMP_CALLBACK_APPLICATION 1
  ------------------
 4590|      0|                                SNMPD_CALLBACK_AUTH_FAILURE, pdu);
  ------------------
  |  |   21|      0|#define SNMPD_CALLBACK_AUTH_FAILURE             17
  ------------------
 4591|      0|        }
 4592|       |        
 4593|      0|        if (result) {
  ------------------
  |  Branch (4593:13): [True: 0, False: 0]
  ------------------
 4594|      0|            struct snmp_secmod_def *secmod =
 4595|      0|                find_sec_mod(pdu->securityModel);
 4596|      0|            if (!slp) {
  ------------------
  |  Branch (4596:17): [True: 0, False: 0]
  ------------------
 4597|      0|                session->s_snmp_errno = result;
 4598|      0|            } else {
 4599|       |                /*
 4600|       |                 * Call the security model to special handle any errors
 4601|       |                 */
 4602|       |
 4603|      0|                if (secmod && secmod->handle_report) {
  ------------------
  |  Branch (4603:21): [True: 0, False: 0]
  |  Branch (4603:31): [True: 0, False: 0]
  ------------------
 4604|      0|                    (*secmod->handle_report)(slp, slp->transport, session,
 4605|      0|                                             result, pdu);
 4606|      0|                }
 4607|      0|            }
 4608|      0|            free_securityStateRef(pdu);
 4609|      0|        }
 4610|       |
 4611|       |        /* Implement RFC5343 here for two reasons:
 4612|       |           1) From a security perspective it handles this otherwise
 4613|       |              always approved request earlier.  It bypasses the need
 4614|       |              for authorization to the snmpEngineID scalar, which is
 4615|       |              what is what RFC3415 appendix A species as ok.  Note
 4616|       |              that we haven't bypassed authentication since if there
 4617|       |              was an authentication error it would have been handled
 4618|       |              above in the if(result) part at the latest.
 4619|       |           2) From an application point of view if we let this request
 4620|       |              get all the way to the application, it'd require that
 4621|       |              all application types supporting discovery also fire up
 4622|       |              a minimal agent in order to handle just this request
 4623|       |              which seems like overkill.  Though there is no other
 4624|       |              application types that currently need discovery (NRs
 4625|       |              accept notifications from contextEngineIDs that derive
 4626|       |              from the NO not the NR).  Also a lame excuse for doing
 4627|       |              it here.
 4628|       |           3) Less important technically, but the net-snmp agent
 4629|       |              doesn't currently handle registrations of different
 4630|       |              engineIDs either and it would have been a lot more work
 4631|       |              to implement there since we'd need to support that
 4632|       |              first. :-/ Supporting multiple context engineIDs should
 4633|       |              be done anyway, so it's not a valid excuse here.
 4634|       |           4) There is a lot less to do if we trump the agent at this
 4635|       |              point; IE, the agent does a lot more unnecessary
 4636|       |              processing when the only thing that should ever be in
 4637|       |              this context by definition is the single scalar.
 4638|       |        */
 4639|       |
 4640|       |        /* special RFC5343 engineID discovery engineID check */
 4641|      0|        if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (4641:13): [True: 0, False: 0]
  ------------------
 4642|      0|                                    NETSNMP_DS_LIB_NO_DISCOVERY) &&
  ------------------
  |  |   98|      0|#define NETSNMP_DS_LIB_NO_DISCOVERY        38 /* don't support RFC5343 contextEngineID discovery */
  ------------------
 4643|      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 (4643:13): [True: 0, False: 0]
  ------------------
 4644|      0|            NULL                    != pdu->contextEngineID &&
  ------------------
  |  Branch (4644:13): [True: 0, False: 0]
  ------------------
 4645|      0|            pdu->contextEngineIDLen == 5 &&
  ------------------
  |  Branch (4645:13): [True: 0, False: 0]
  ------------------
 4646|      0|            pdu->contextEngineID[0] == 0x80 &&
  ------------------
  |  Branch (4646:13): [True: 0, False: 0]
  ------------------
 4647|      0|            pdu->contextEngineID[1] == 0x00 &&
  ------------------
  |  Branch (4647:13): [True: 0, False: 0]
  ------------------
 4648|      0|            pdu->contextEngineID[2] == 0x00 &&
  ------------------
  |  Branch (4648:13): [True: 0, False: 0]
  ------------------
 4649|      0|            pdu->contextEngineID[3] == 0x00 &&
  ------------------
  |  Branch (4649:13): [True: 0, False: 0]
  ------------------
 4650|      0|            pdu->contextEngineID[4] == 0x06) {
  ------------------
  |  Branch (4650:13): [True: 0, False: 0]
  ------------------
 4651|       |
 4652|       |            /* define a result so it doesn't get past us at this point
 4653|       |               and gets dropped by future parts of the stack */
 4654|      0|            result = SNMPERR_JUST_A_CONTEXT_PROBE;
  ------------------
  |  |  250|      0|#define SNMPERR_JUST_A_CONTEXT_PROBE    (-66)
  ------------------
 4655|       |
 4656|      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]
  |  |  ------------------
  ------------------
 4657|       |            /* ensure exactly one variable */
 4658|      0|            if (NULL != pdu->variables &&
  ------------------
  |  Branch (4658:17): [True: 0, False: 0]
  ------------------
 4659|      0|                NULL == pdu->variables->next_variable &&
  ------------------
  |  Branch (4659:17): [True: 0, False: 0]
  ------------------
 4660|       |
 4661|       |                /* if it's a GET, match it exactly */
 4662|      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 (4662:19): [True: 0, False: 0]
  ------------------
 4663|      0|                  snmp_oid_compare(snmpEngineIDoid,
  ------------------
  |  Branch (4663:19): [True: 0, False: 0]
  ------------------
 4664|      0|                                   snmpEngineIDoid_len,
 4665|      0|                                   pdu->variables->name,
 4666|      0|                                   pdu->variables->name_length) == 0)
 4667|       |                 /* if it's a GETNEXT ensure it's less than the engineID oid */
 4668|      0|                 ||
 4669|      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 (4669:19): [True: 0, False: 0]
  ------------------
 4670|      0|                  snmp_oid_compare(snmpEngineIDoid,
  ------------------
  |  Branch (4670:19): [True: 0, False: 0]
  ------------------
 4671|      0|                                   snmpEngineIDoid_len,
 4672|      0|                                   pdu->variables->name,
 4673|      0|                                   pdu->variables->name_length) > 0)
 4674|      0|                    )) {
 4675|       |
 4676|      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]
  |  |  ------------------
  ------------------
 4677|      0|                            "  One correct variable found\n"));
 4678|       |
 4679|       |                /* Note: we're explicitly not handling a GETBULK.  Deal. */
 4680|       |
 4681|       |                /* set up the response */
 4682|      0|                pdu2 = snmp_clone_pdu(pdu);
 4683|      0|                if (NULL == pdu2) {
  ------------------
  |  Branch (4683:21): [True: 0, False: 0]
  ------------------
 4684|      0|                    snmp_log(LOG_ERR, "failed to clone PDU for rfc5343 probe\n");
 4685|      0|                    if (pdu->securityStateRef)
  ------------------
  |  Branch (4685:25): [True: 0, False: 0]
  ------------------
 4686|      0|                        free_securityStateRef(pdu);
 4687|      0|                    return result;
 4688|      0|                }
 4689|       |
 4690|       |                /* free the current varbind */
 4691|      0|                snmp_free_varbind(pdu2->variables);
 4692|       |
 4693|       |                /* set the variables */
 4694|      0|                pdu2->variables = NULL;
 4695|      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
  |  |  ------------------
  ------------------
 4696|      0|                pdu2->errstat = 0;
 4697|      0|                pdu2->errindex = 0;
 4698|       |
 4699|      0|                ourEngineID_len =
 4700|      0|                    snmpv3_get_engineID((u_char*)ourEngineID, ourEngineID_len);
 4701|      0|                if (0 != ourEngineID_len) {
  ------------------
  |  Branch (4701:21): [True: 0, False: 0]
  ------------------
 4702|       |
 4703|      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]
  |  |  ------------------
  ------------------
 4704|      0|                                "  responding with our engineID\n"));
 4705|       |
 4706|      0|                    snmp_pdu_add_variable(pdu2,
 4707|      0|                                          snmpEngineIDoid, snmpEngineIDoid_len,
 4708|      0|                                          ASN_OCTET_STR,
  ------------------
  |  |   78|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
 4709|      0|                                          ourEngineID, ourEngineID_len);
 4710|       |                    
 4711|       |                    /* send the response */
 4712|      0|                    if (0 == snmp_sess_send(slp, pdu2)) {
  ------------------
  |  Branch (4712:25): [True: 0, False: 0]
  ------------------
 4713|       |
 4714|      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]
  |  |  ------------------
  ------------------
 4715|      0|                                    "  sent it off!\n"));
 4716|       |
 4717|      0|                        snmp_free_pdu(pdu2);
 4718|       |                        
 4719|      0|                        snmp_log(LOG_ERR, "sending a response to the context engineID probe failed\n");
 4720|      0|                    }
 4721|      0|                } else {
 4722|      0|                    snmp_log(LOG_ERR, "failed to get our own engineID!\n");
 4723|      0|                    snmp_free_pdu(pdu2);
 4724|      0|                }
 4725|      0|            } else {
 4726|      0|                snmp_log(LOG_WARNING,
 4727|      0|                         "received an odd context engineID probe\n");
 4728|      0|            }
 4729|      0|            if (pdu->securityStateRef)
  ------------------
  |  Branch (4729:17): [True: 0, False: 0]
  ------------------
 4730|      0|                free_securityStateRef(pdu);
 4731|      0|        }
 4732|       |
 4733|      0|        break;
 4734|      0|    case SNMPERR_BAD_VERSION:
  ------------------
  |  |  198|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
  |  Branch (4734:5): [True: 0, False: 2.68k]
  ------------------
 4735|      0|        ERROR_MSG("error parsing snmp message version");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4736|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4737|      0|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  198|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 4738|      0|        break;
 4739|       |
 4740|      0|        unsupported_version:  /* goto label */
 4741|      0|    case SNMP_VERSION_sec:
  ------------------
  |  |  118|      0|#define SNMP_VERSION_sec   128  /* not (will never be) supported by this code */
  ------------------
  |  Branch (4741:5): [True: 0, False: 2.68k]
  ------------------
 4742|      0|    case SNMP_VERSION_2u:
  ------------------
  |  |  112|      0|#define SNMP_VERSION_2u    2    /* not (will never be) supported by this code */
  ------------------
  |  Branch (4742:5): [True: 0, False: 2.68k]
  ------------------
 4743|      0|    case SNMP_VERSION_2star:
  ------------------
  |  |  120|      0|#define SNMP_VERSION_2star 130  /* not (will never be) supported by this code */
  ------------------
  |  Branch (4743:5): [True: 0, False: 2.68k]
  ------------------
 4744|      0|    case SNMP_VERSION_2p:
  ------------------
  |  |  119|      0|#define SNMP_VERSION_2p	   129  /* no longer supported by this code (> 4.0) */
  ------------------
  |  Branch (4744:5): [True: 0, False: 2.68k]
  ------------------
 4745|      0|    default:
  ------------------
  |  Branch (4745:5): [True: 0, False: 2.68k]
  ------------------
 4746|      0|        ERROR_MSG("unsupported snmp message version");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4747|      0|        snmp_increment_statistic(STAT_SNMPINBADVERSIONS);
  ------------------
  |  |  634|      0|#define  STAT_SNMPINBADVERSIONS              11
  ------------------
 4748|       |
 4749|       |        /*
 4750|       |         * need better way to determine OS independent
 4751|       |         * INT32_MAX value, for now hardcode
 4752|       |         */
 4753|      0|        if (pdu->version < 0 || pdu->version > 2147483647) {
  ------------------
  |  Branch (4753:13): [True: 0, False: 0]
  |  Branch (4753:33): [True: 0, False: 0]
  ------------------
 4754|      0|            snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  637|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4755|      0|        }
 4756|      0|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  198|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 4757|      0|        break;
 4758|  2.68k|    }
 4759|       |
 4760|  1.40k|    return result;
 4761|  2.68k|}

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

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

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

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:
 1103|    193|{
 1104|    193|    static int      newline = 1;	 /* MTCRITICAL_RESOURCE */
 1105|    193|    const char     *newline_ptr;
 1106|    193|    char            sbuf[40];
 1107|       |
 1108|    193|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|    193|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1108:9): [True: 0, False: 193]
  ------------------
 1109|    193|                               NETSNMP_DS_LIB_LOG_TIMESTAMP) && newline) {
  ------------------
  |  |   64|    193|#define NETSNMP_DS_LIB_LOG_TIMESTAMP       5
  ------------------
  |  Branch (1109:65): [True: 0, False: 0]
  ------------------
 1110|      0|        snprintf_stamp(NULL, sbuf, sizeof(sbuf));
 1111|    193|    } else {
 1112|    193|        strcpy(sbuf, "");
 1113|    193|    }
 1114|       |    /*
 1115|       |     * Remember whether or not the current line ends with a newline for the
 1116|       |     * next call of log_handler_stdouterr().
 1117|       |     */
 1118|    193|    newline_ptr = strrchr(str, '\n');
 1119|    193|    newline = newline_ptr && newline_ptr[1] == 0;
  ------------------
  |  Branch (1119:15): [True: 193, False: 0]
  |  Branch (1119:30): [True: 193, False: 0]
  ------------------
 1120|       |
 1121|    193|    if (logh->imagic)
  ------------------
  |  Branch (1121:9): [True: 0, False: 193]
  ------------------
 1122|      0|       printf(         "%s%s", sbuf, str);
 1123|    193|    else
 1124|    193|       fprintf(stderr, "%s%s", sbuf, str);
 1125|       |
 1126|    193|    return 1;
 1127|    193|}
snmp_log_string:
 1294|    193|{
 1295|    193|#ifndef NETSNMP_FEATURE_REMOVE_LOGGING_STDIO
 1296|    193|    static int stderr_enabled = 0;
 1297|    193|    static netsnmp_log_handler lh = { 1, 0, 0, 0, "stderr",
 1298|    193|                                      log_handler_stdouterr, 0, NULL,  NULL,
 1299|    193|                                      NULL };
 1300|    193|#endif /* NETSNMP_FEATURE_REMOVE_LOGGING_STDIO */
 1301|    193|    netsnmp_log_handler *logh;
 1302|       |
 1303|       |    /*
 1304|       |     * We've got to be able to log messages *somewhere*!
 1305|       |     * If you don't want stderr logging, then enable something else.
 1306|       |     */
 1307|    193|    if (0 == logh_enabled) {
  ------------------
  |  Branch (1307:9): [True: 193, False: 0]
  ------------------
 1308|    193|#ifndef NETSNMP_FEATURE_REMOVE_LOGGING_STDIO
 1309|    193|        if (!stderr_enabled) {
  ------------------
  |  Branch (1309:13): [True: 1, False: 192]
  ------------------
 1310|      1|            ++stderr_enabled;
 1311|      1|            netsnmp_set_line_buffering(stderr);
 1312|      1|        }
 1313|    193|        log_handler_stdouterr( &lh, priority, str );
 1314|    193|#endif /* NETSNMP_FEATURE_REMOVE_LOGGING_STDIO */
 1315|       |
 1316|    193|        return;
 1317|    193|    }
 1318|      0|#ifndef NETSNMP_FEATURE_REMOVE_LOGGING_STDIO
 1319|      0|    else if (stderr_enabled) {
  ------------------
  |  Branch (1319:14): [True: 0, False: 0]
  ------------------
 1320|      0|        stderr_enabled = 0;
 1321|      0|        log_handler_stdouterr( &lh, LOG_INFO,
 1322|      0|                               "Log handling defined - disabling stderr\n" );
 1323|      0|    }
 1324|      0|#endif /* NETSNMP_FEATURE_REMOVE_LOGGING_STDIO */
 1325|       |        
 1326|       |
 1327|       |    /*
 1328|       |     * Start at the given priority, and work "upwards"....
 1329|       |     */
 1330|      0|    if (priority < LOG_EMERG)
  ------------------
  |  Branch (1330:9): [True: 0, False: 0]
  ------------------
 1331|      0|        priority = LOG_EMERG;
 1332|      0|    else if (priority > LOG_DEBUG)
  ------------------
  |  Branch (1332:14): [True: 0, False: 0]
  ------------------
 1333|      0|        priority = LOG_DEBUG;
 1334|      0|    logh = logh_priorities[priority];
 1335|      0|    for ( ; logh; logh = logh->next ) {
  ------------------
  |  Branch (1335:13): [True: 0, False: 0]
  ------------------
 1336|       |        /*
 1337|       |         * ... but skipping any handlers with a "maximum priority"
 1338|       |         *     that we have already exceeded. And don't forget to
 1339|       |         *     ensure this logging is turned on (see snmp_disable_stderrlog
 1340|       |         *     and its cohorts).
 1341|       |         */
 1342|      0|        if (logh->enabled && priority >= logh->pri_max)
  ------------------
  |  Branch (1342:13): [True: 0, False: 0]
  |  Branch (1342:30): [True: 0, False: 0]
  ------------------
 1343|      0|            logh->handler( logh, priority, str );
 1344|      0|    }
 1345|      0|}
snmp_vlog:
 1383|    193|{
 1384|    193|    char           *buffer = NULL;
 1385|    193|    int             length;
 1386|       |
 1387|    193|    length = vasprintf(&buffer, format, ap);
 1388|    193|    if (length < 0) {
  ------------------
  |  Branch (1388:9): [True: 0, False: 193]
  ------------------
 1389|      0|        snmp_log_string(LOG_ERR, "Could not format log-string\n");
 1390|      0|        return -1;
 1391|      0|    }
 1392|       |
 1393|    193|    snmp_log_string(priority, buffer);
 1394|    193|    free(buffer);
 1395|    193|    return 0;
 1396|    193|}
snmp_log:
 1407|    193|{
 1408|    193|    va_list         ap;
 1409|    193|    int             ret;
 1410|    193|    va_start(ap, format);
 1411|    193|    ret = snmp_vlog(priority, format, ap);
 1412|       |    va_end(ap);
 1413|    193|    return (ret);
 1414|    193|}

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

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

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

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

