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

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

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

snmp_get_next_transid:
  485|  2.71k|{
  486|  2.71k|    long            retVal;
  487|  2.71k|    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_TRANSID);
  ------------------
  |  |   79|  2.71k|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded - Ignored]
  |  |  ------------------
  ------------------
  488|  2.71k|    retVal = 1 + Transid;       /*MTCRITICAL_RESOURCE */
  489|  2.71k|    if (!retVal)
  ------------------
  |  Branch (489:9): [True: 0, False: 2.71k]
  ------------------
  490|      0|        retVal = 2;
  491|  2.71k|    Transid = retVal;
  492|  2.71k|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS))
  ------------------
  |  |   48|  2.71k|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS))
  ------------------
  |  |   91|  2.71k|#define NETSNMP_DS_LIB_16BIT_IDS           31   /* restrict requestIDs, etc to 16-bit values */
  ------------------
  |  Branch (492:9): [True: 0, False: 2.71k]
  ------------------
  493|      0|        retVal &= 0x7fff;	/* mask to 15 bits */
  494|  2.71k|    else
  495|  2.71k|        retVal &= 0x7fffffff;	/* mask to 31 bits */
  496|       |
  497|  2.71k|    if (!retVal) {
  ------------------
  |  Branch (497:9): [True: 0, False: 2.71k]
  ------------------
  498|      0|        Transid = retVal = 2;
  499|      0|    }
  500|  2.71k|    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_TRANSID);
  ------------------
  |  |   80|  2.71k|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded - Ignored]
  |  |  ------------------
  ------------------
  501|  2.71k|    return retVal;
  502|  2.71k|}
snmp_set_detail:
  516|  6.56k|{
  517|  6.56k|    if (detail_string != NULL) {
  ------------------
  |  Branch (517:9): [True: 6.56k, False: 0]
  ------------------
  518|  6.56k|        strlcpy(snmp_detail, detail_string, sizeof(snmp_detail));
  519|  6.56k|        snmp_detail_f = 1;
  520|  6.56k|    }
  521|  6.56k|}
snmp_api_errstring:
  531|    675|{
  532|    675|    const char     *msg = "";
  533|    675|    static char     msg_buf[SPRINT_MAX_LEN];
  534|       |
  535|    675|    if (snmp_errnumber >= SNMPERR_MAX && snmp_errnumber <= SNMPERR_GENERR) {
  ------------------
  |  |  288|  1.35k|#define SNMPERR_MAX			(-69)
  ------------------
                  if (snmp_errnumber >= SNMPERR_MAX && snmp_errnumber <= SNMPERR_GENERR) {
  ------------------
  |  |  218|    675|#define SNMPERR_GENERR			(-1)
  ------------------
  |  Branch (535:9): [True: 675, False: 0]
  |  Branch (535:42): [True: 0, False: 675]
  ------------------
  536|      0|        msg = api_errors[-snmp_errnumber];
  537|    675|    } else if (snmp_errnumber != SNMPERR_SUCCESS) {
  ------------------
  |  |  217|    675|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (537:16): [True: 0, False: 675]
  ------------------
  538|      0|        msg = NULL;
  539|      0|    }
  540|    675|    if (!msg) {
  ------------------
  |  Branch (540:9): [True: 0, False: 675]
  ------------------
  541|      0|	snprintf(msg_buf, sizeof(msg_buf), "Unknown error: %d", snmp_errnumber);
  542|      0|        msg_buf[sizeof(msg_buf)-1] = '\0';
  543|    675|    } else if (snmp_detail_f) {
  ------------------
  |  Branch (543:16): [True: 675, False: 0]
  ------------------
  544|    675|        snprintf(msg_buf, sizeof(msg_buf), "%s (%s)", msg, snmp_detail);
  545|    675|        msg_buf[sizeof(msg_buf)-1] = '\0';
  546|    675|        snmp_detail_f = 0;
  547|    675|    } else {
  548|      0|        strlcpy(msg_buf, msg, sizeof(msg_buf));
  549|      0|    }
  550|       |
  551|    675|    return (msg_buf);
  552|    675|}
snmpv3_parse:
 3750|  2.71k|{
 3751|  2.71k|    u_char          type, msg_flags;
 3752|  2.71k|    long            ver, msg_sec_model;
 3753|  2.71k|    size_t          max_size_response;
 3754|  2.71k|    u_char          tmp_buf[SNMP_MAX_MSG_SIZE];
 3755|  2.71k|    size_t          tmp_buf_len;
 3756|  2.71k|    u_char          pdu_buf[SNMP_MAX_MSG_SIZE];
 3757|  2.71k|    u_char         *mallocbuf = NULL;
 3758|  2.71k|    size_t          pdu_buf_len = SNMP_MAX_MSG_SIZE;
  ------------------
  |  |  142|  2.71k|#define SNMP_MAX_MSG_SIZE          1472 /* ethernet MTU minus IP/UDP header */
  ------------------
 3759|  2.71k|    u_char         *sec_params;
 3760|  2.71k|    u_char         *msg_data;
 3761|  2.71k|    u_char         *cp;
 3762|  2.71k|    size_t          asn_len, msg_len;
 3763|  2.71k|    int             ret, ret_val;
 3764|  2.71k|    struct snmp_secmod_def *sptr;
 3765|       |
 3766|       |
 3767|  2.71k|    msg_data = data;
 3768|  2.71k|    msg_len = *length;
 3769|       |
 3770|       |
 3771|       |    /*
 3772|       |     * message is an ASN.1 SEQUENCE  
 3773|       |     */
 3774|  2.71k|    DEBUGDUMPSECTION("recv", "SNMPv3 Message");
  ------------------
  |  |   83|  2.71k|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|  2.71k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 2.71k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  193|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  177|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  194|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  195|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:56): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3775|  2.71k|    data = asn_parse_sequence(data, length, &type,
 3776|  2.71k|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR), "message");
  ------------------
  |  |   84|  2.71k|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR), "message");
  ------------------
  |  |   96|  2.71k|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3777|  2.71k|    if (data == NULL) {
  ------------------
  |  Branch (3777:9): [True: 324, False: 2.38k]
  ------------------
 3778|       |        /*
 3779|       |         * error msg detail is set 
 3780|       |         */
 3781|    324|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  681|    324|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3782|    324|        DEBUGINDENTLESS();
  ------------------
  |  |   77|    324|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  146|    324|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 324]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  176|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (77:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3783|    324|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|    324|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3784|    324|    }
 3785|       |
 3786|       |    /*
 3787|       |     * parse msgVersion  
 3788|       |     */
 3789|  2.38k|    DEBUGDUMPHEADER("recv", "SNMP Version Number");
  ------------------
  |  |   81|  2.38k|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|  2.38k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 2.38k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  180|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  177|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  181|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  182|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (184:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  185|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (185:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  187|      0|        } else { \
  |  |  |  |  188|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  189|      0|        } \
  |  |  |  |  190|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:55): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3790|  2.38k|    data = asn_parse_int(data, length, &type, &ver, sizeof(ver));
 3791|  2.38k|    DEBUGINDENTLESS();
  ------------------
  |  |   77|  2.38k|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  146|  2.38k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 2.38k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  176|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (77:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3792|  2.38k|    if (data == NULL) {
  ------------------
  |  Branch (3792:9): [True: 162, False: 2.22k]
  ------------------
 3793|    162|        ERROR_MSG("bad parse of version");
  ------------------
  |  |  190|    162|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3794|    162|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  681|    162|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3795|    162|        DEBUGINDENTLESS();
  ------------------
  |  |   77|    162|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  146|    162|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 162]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  176|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (77:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3796|    162|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|    162|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3797|    162|    }
 3798|  2.22k|    pdu->version = ver;
 3799|       |
 3800|       |    /*
 3801|       |     * parse msgGlobalData sequence  
 3802|       |     */
 3803|  2.22k|    cp = data;
 3804|  2.22k|    asn_len = *length;
 3805|  2.22k|    DEBUGDUMPSECTION("recv", "msgGlobalData");
  ------------------
  |  |   83|  2.22k|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|  2.22k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 2.22k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  193|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  177|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  194|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  195|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:56): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3806|  2.22k|    data = asn_parse_sequence(data, &asn_len, &type,
 3807|  2.22k|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   84|  2.22k|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   96|  2.22k|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3808|  2.22k|                              "msgGlobalData");
 3809|  2.22k|    if (data == NULL) {
  ------------------
  |  Branch (3809:9): [True: 1.84k, False: 379]
  ------------------
 3810|       |        /*
 3811|       |         * error msg detail is set 
 3812|       |         */
 3813|  1.84k|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  681|  1.84k|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3814|  1.84k|        DEBUGINDENTADD(-4);
  ------------------
  |  |   75|  1.84k|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|  1.84k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 1.84k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3815|  1.84k|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|  1.84k|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3816|  1.84k|    }
 3817|    379|    *length -= data - cp;       /* subtract off the length of the header */
 3818|       |
 3819|       |    /*
 3820|       |     * msgID 
 3821|       |     */
 3822|    379|    DEBUGDUMPHEADER("recv", "msgID");
  ------------------
  |  |   81|    379|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|    379|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 379]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  180|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  177|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  181|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  182|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (184:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  185|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (185:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  187|      0|        } else { \
  |  |  |  |  188|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  189|      0|        } \
  |  |  |  |  190|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:55): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3823|    379|    data =
 3824|    379|        asn_parse_int(data, length, &type, &pdu->msgid,
 3825|    379|                      sizeof(pdu->msgid));
 3826|    379|    DEBUGINDENTLESS();
  ------------------
  |  |   77|    379|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  146|    379|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 379]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  176|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (77:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3827|    379|    if (data == NULL || type != ASN_INTEGER) {
  ------------------
  |  |   75|    367|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (3827:9): [True: 12, False: 367]
  |  Branch (3827:25): [True: 0, False: 367]
  ------------------
 3828|     12|        ERROR_MSG("error parsing msgID");
  ------------------
  |  |  190|     12|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3829|     12|        DEBUGINDENTADD(-4);
  ------------------
  |  |   75|     12|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|     12|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 12]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3830|     12|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  681|     12|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3831|     12|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|     12|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3832|     12|    }
 3833|       |
 3834|       |    /*
 3835|       |     * Check the msgID we received is a legal value.  If not, then increment
 3836|       |     * snmpInASNParseErrs and return the appropriate error (see RFC 2572,
 3837|       |     * para. 7.2, section 2 -- note that a bad msgID means that the received
 3838|       |     * message is NOT a serialiization of an SNMPv3Message, since the msgID
 3839|       |     * field is out of bounds).  
 3840|       |     */
 3841|       |
 3842|    367|    if (pdu->msgid < 0 || pdu->msgid > SNMP_MAX_PACKET_LEN) {
  ------------------
  |  |   49|    316|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  |  Branch (3842:9): [True: 51, False: 316]
  |  Branch (3842:27): [True: 4, False: 312]
  ------------------
 3843|     55|        snmp_log(LOG_ERR, "Received bad msgID (%ld %s %s).\n", pdu->msgid,
 3844|     55|                 (pdu->msgid < 0) ? "<" : ">",
  ------------------
  |  Branch (3844:18): [True: 51, False: 4]
  ------------------
 3845|     55|                 (pdu->msgid < 0) ? "0" : "2^31 - 1");
  ------------------
  |  Branch (3845:18): [True: 51, False: 4]
  ------------------
 3846|     55|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  681|     55|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3847|     55|        DEBUGINDENTADD(-4);
  ------------------
  |  |   75|     55|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|     55|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 55]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3848|     55|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|     55|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3849|     55|    }
 3850|       |
 3851|       |    /*
 3852|       |     * msgMaxSize 
 3853|       |     */
 3854|    312|    DEBUGDUMPHEADER("recv:msgMaxSize", "msgMaxSize");
  ------------------
  |  |   81|    312|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|    312|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 312]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  180|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  177|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  181|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  182|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (184:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  185|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (185:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  187|      0|        } else { \
  |  |  |  |  188|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  189|      0|        } \
  |  |  |  |  190|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:55): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3855|    312|    data = asn_parse_int(data, length, &type, &pdu->msgMaxSize,
 3856|    312|                         sizeof(pdu->msgMaxSize));
 3857|    312|    DEBUGINDENTLESS();
  ------------------
  |  |   77|    312|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  146|    312|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 312]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  176|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (77:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3858|    312|    if (data == NULL || type != ASN_INTEGER) {
  ------------------
  |  |   75|    251|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (3858:9): [True: 61, False: 251]
  |  Branch (3858:25): [True: 0, False: 251]
  ------------------
 3859|     61|        ERROR_MSG("error parsing msgMaxSize");
  ------------------
  |  |  190|     61|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3860|     61|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  681|     61|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3861|     61|        DEBUGINDENTADD(-4);
  ------------------
  |  |   75|     61|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|     61|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 61]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3862|     61|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|     61|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3863|     61|    }
 3864|       |
 3865|       |    /*
 3866|       |     * Check the msgMaxSize we received is a legal value.  If not, then
 3867|       |     * increment snmpInASNParseErrs and return the appropriate error (see RFC
 3868|       |     * 2572, para. 7.2, section 2 -- note that a bad msgMaxSize means that the
 3869|       |     * received message is NOT a serialiization of an SNMPv3Message, since the
 3870|       |     * msgMaxSize field is out of bounds).
 3871|       |     */
 3872|       |
 3873|    251|    if (pdu->msgMaxSize < SNMP_MIN_MAX_LEN) {
  ------------------
  |  |   48|    251|#define SNMP_MIN_MAX_LEN    484 /* minimum maximum message size */
  ------------------
  |  Branch (3873:9): [True: 56, False: 195]
  ------------------
 3874|     56|        snmp_log(LOG_ERR, "Received bad msgMaxSize (%lu < 484).\n",
 3875|     56|                 pdu->msgMaxSize);
 3876|     56|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  681|     56|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3877|     56|        DEBUGINDENTADD(-4);
  ------------------
  |  |   75|     56|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|     56|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 56]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3878|     56|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|     56|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3879|    195|    } else if (pdu->msgMaxSize > SNMP_MAX_PACKET_LEN) {
  ------------------
  |  |   49|    195|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  |  Branch (3879:16): [True: 3, False: 192]
  ------------------
 3880|      3|        snmp_log(LOG_ERR, "Received bad msgMaxSize (%lu > 2^31 - 1).\n",
 3881|      3|                 pdu->msgMaxSize);
 3882|      3|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  681|      3|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3883|      3|        DEBUGINDENTADD(-4);
  ------------------
  |  |   75|      3|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3884|      3|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|      3|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3885|    192|    } else {
 3886|    192|        DEBUGMSGTL(("snmpv3_parse:msgMaxSize", "msgMaxSize %lu received\n",
  ------------------
  |  |   68|    192|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|    192|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 192]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (68:70): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3887|    192|                    pdu->msgMaxSize));
 3888|       |        /** don't increase max msg size if we've already got one */
 3889|    192|        if (sess->sndMsgMaxSize < pdu->msgMaxSize) {
  ------------------
  |  Branch (3889:13): [True: 192, False: 0]
  ------------------
 3890|    192|            DEBUGMSGTL(("snmpv3_parse:msgMaxSize",
  ------------------
  |  |   68|    192|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|    192|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 192]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (68:70): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3891|    192|                        "msgMaxSize %" NETSNMP_PRIz "d greater than session max %ld; reducing\n",
 3892|    192|                        sess->sndMsgMaxSize, pdu->msgMaxSize));
 3893|    192|            pdu->msgMaxSize = sess->sndMsgMaxSize;
 3894|    192|        }
 3895|    192|    }
 3896|       |
 3897|       |    /*
 3898|       |     * msgFlags 
 3899|       |     */
 3900|    192|    tmp_buf_len = SNMP_MAX_MSG_SIZE;
  ------------------
  |  |  142|    192|#define SNMP_MAX_MSG_SIZE          1472 /* ethernet MTU minus IP/UDP header */
  ------------------
 3901|    192|    DEBUGDUMPHEADER("recv", "msgFlags");
  ------------------
  |  |   81|    192|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|    192|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 192]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  180|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  177|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  181|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  182|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (184:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  185|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (185:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  187|      0|        } else { \
  |  |  |  |  188|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  189|      0|        } \
  |  |  |  |  190|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:55): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3902|    192|    data = asn_parse_string(data, length, &type, tmp_buf, &tmp_buf_len);
 3903|    192|    DEBUGINDENTLESS();
  ------------------
  |  |   77|    192|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  146|    192|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 192]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  176|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (77:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3904|    192|    if (data == NULL || type != ASN_OCTET_STR || tmp_buf_len != 1) {
  ------------------
  |  |   78|    318|#define ASN_OCTET_STR	    0x04U
  ------------------
  |  Branch (3904:9): [True: 66, False: 126]
  |  Branch (3904:25): [True: 3, False: 123]
  |  Branch (3904:50): [True: 16, False: 107]
  ------------------
 3905|     85|        ERROR_MSG("error parsing msgFlags");
  ------------------
  |  |  190|     85|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3906|     85|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  681|     85|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3907|     85|        DEBUGINDENTADD(-4);
  ------------------
  |  |   75|     85|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|     85|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 85]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3908|     85|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|     85|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3909|     85|    }
 3910|    107|    msg_flags = *tmp_buf;
 3911|    107|    if (msg_flags & SNMP_MSG_FLAG_RPRT_BIT)
  ------------------
  |  |  305|    107|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
  |  Branch (3911:9): [True: 60, False: 47]
  ------------------
 3912|     60|        pdu->flags |= SNMP_MSG_FLAG_RPRT_BIT;
  ------------------
  |  |  305|     60|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
 3913|     47|    else
 3914|     47|        pdu->flags &= (~SNMP_MSG_FLAG_RPRT_BIT);
  ------------------
  |  |  305|     47|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
 3915|       |
 3916|       |    /*
 3917|       |     * msgSecurityModel 
 3918|       |     */
 3919|    107|    DEBUGDUMPHEADER("recv", "msgSecurityModel");
  ------------------
  |  |   81|    107|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|    107|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 107]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  180|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  177|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  181|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  182|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (184:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  185|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (185:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  187|      0|        } else { \
  |  |  |  |  188|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  189|      0|        } \
  |  |  |  |  190|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:55): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3920|    107|    data = asn_parse_int(data, length, &type, &msg_sec_model,
 3921|    107|                         sizeof(msg_sec_model));
 3922|    107|    DEBUGINDENTADD(-4);         /* return from global data indent */
  ------------------
  |  |   75|    107|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|    107|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 107]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3923|    107|    if (data == NULL || type != ASN_INTEGER ||
  ------------------
  |  |   75|    212|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (3923:9): [True: 2, False: 105]
  |  Branch (3923:25): [True: 0, False: 105]
  ------------------
 3924|    107|        msg_sec_model < 1 || msg_sec_model > 0x7fffffff) {
  ------------------
  |  Branch (3924:9): [True: 45, False: 60]
  |  Branch (3924:30): [True: 2, False: 58]
  ------------------
 3925|     49|        ERROR_MSG("error parsing msgSecurityModel");
  ------------------
  |  |  190|     49|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3926|     49|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  681|     49|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3927|     49|        DEBUGINDENTLESS();
  ------------------
  |  |   77|     49|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  146|     49|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 49]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  176|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (77:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3928|     49|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|     49|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3929|     49|    }
 3930|     58|    sptr = find_sec_mod(msg_sec_model);
 3931|     58|    if (!sptr) {
  ------------------
  |  Branch (3931:9): [True: 58, False: 0]
  ------------------
 3932|     58|        snmp_log(LOG_WARNING, "unknown security model: %ld\n",
 3933|     58|                 msg_sec_model);
 3934|     58|        snmp_increment_statistic(STAT_SNMPUNKNOWNSECURITYMODELS);
  ------------------
  |  |  655|     58|#define   STAT_SNMPUNKNOWNSECURITYMODELS     0
  ------------------
 3935|     58|        DEBUGINDENTLESS();
  ------------------
  |  |   77|     58|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  146|     58|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 58]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  176|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (77:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3936|     58|        return SNMPERR_UNKNOWN_SEC_MODEL;
  ------------------
  |  |  247|     58|#define SNMPERR_UNKNOWN_SEC_MODEL 	(-30)
  ------------------
 3937|     58|    }
 3938|      0|    pdu->securityModel = msg_sec_model;
 3939|       |
 3940|      0|    if (msg_flags & SNMP_MSG_FLAG_PRIV_BIT &&
  ------------------
  |  |  304|      0|#define SNMP_MSG_FLAG_PRIV_BIT          0x02
  ------------------
  |  Branch (3940:9): [True: 0, False: 0]
  ------------------
 3941|      0|        !(msg_flags & SNMP_MSG_FLAG_AUTH_BIT)) {
  ------------------
  |  |  303|      0|#define SNMP_MSG_FLAG_AUTH_BIT          0x01
  ------------------
  |  Branch (3941:9): [True: 0, False: 0]
  ------------------
 3942|      0|        ERROR_MSG("invalid message, illegal msgFlags");
  ------------------
  |  |  190|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3943|      0|        snmp_increment_statistic(STAT_SNMPINVALIDMSGS);
  ------------------
  |  |  656|      0|#define   STAT_SNMPINVALIDMSGS               1
  ------------------
 3944|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   77|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  146|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  176|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (77:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3945|      0|        return SNMPERR_INVALID_MSG;
  ------------------
  |  |  248|      0|#define SNMPERR_INVALID_MSG             (-31)
  ------------------
 3946|      0|    }
 3947|      0|    pdu->securityLevel = ((msg_flags & SNMP_MSG_FLAG_AUTH_BIT)
  ------------------
  |  |  303|      0|#define SNMP_MSG_FLAG_AUTH_BIT          0x01
  ------------------
  |  Branch (3947:27): [True: 0, False: 0]
  ------------------
 3948|      0|                          ? ((msg_flags & SNMP_MSG_FLAG_PRIV_BIT)
  ------------------
  |  |  304|      0|#define SNMP_MSG_FLAG_PRIV_BIT          0x02
  ------------------
  |  Branch (3948:30): [True: 0, False: 0]
  ------------------
 3949|      0|                             ? SNMP_SEC_LEVEL_AUTHPRIV
  ------------------
  |  |  301|      0|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
 3950|      0|                             : SNMP_SEC_LEVEL_AUTHNOPRIV)
  ------------------
  |  |  300|      0|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
 3951|      0|                          : SNMP_SEC_LEVEL_NOAUTH);
  ------------------
  |  |  299|      0|#define SNMP_SEC_LEVEL_NOAUTH		1
  ------------------
 3952|       |    /*
 3953|       |     * end of msgGlobalData 
 3954|       |     */
 3955|       |
 3956|       |    /*
 3957|       |     * securtityParameters OCTET STRING begins after msgGlobalData 
 3958|       |     */
 3959|      0|    sec_params = data;
 3960|      0|    pdu->contextEngineID = calloc(1, SNMP_MAX_ENG_SIZE);
  ------------------
  |  |  144|      0|#define SNMP_MAX_ENG_SIZE          32
  ------------------
 3961|      0|    pdu->contextEngineIDLen = SNMP_MAX_ENG_SIZE;
  ------------------
  |  |  144|      0|#define SNMP_MAX_ENG_SIZE          32
  ------------------
 3962|       |
 3963|       |    /*
 3964|       |     * Note: there is no length limit on the msgAuthoritativeEngineID field,
 3965|       |     * although we would EXPECT it to be limited to 32 (the SnmpEngineID TC
 3966|       |     * limit).  We'll use double that here to be on the safe side.  
 3967|       |     */
 3968|       |
 3969|      0|    pdu->securityEngineID = calloc(1, SNMP_MAX_ENG_SIZE * 2);
  ------------------
  |  |  144|      0|#define SNMP_MAX_ENG_SIZE          32
  ------------------
 3970|      0|    pdu->securityEngineIDLen = SNMP_MAX_ENG_SIZE * 2;
  ------------------
  |  |  144|      0|#define SNMP_MAX_ENG_SIZE          32
  ------------------
 3971|      0|    pdu->securityName = calloc(1, SNMP_MAX_SEC_NAME_SIZE);
  ------------------
  |  |  145|      0|#define SNMP_MAX_SEC_NAME_SIZE     256
  ------------------
 3972|      0|    pdu->securityNameLen = SNMP_MAX_SEC_NAME_SIZE;
  ------------------
  |  |  145|      0|#define SNMP_MAX_SEC_NAME_SIZE     256
  ------------------
 3973|       |
 3974|      0|    if ((pdu->securityName == NULL) ||
  ------------------
  |  Branch (3974:9): [True: 0, False: 0]
  ------------------
 3975|      0|        (pdu->securityEngineID == NULL) ||
  ------------------
  |  Branch (3975:9): [True: 0, False: 0]
  ------------------
 3976|      0|        (pdu->contextEngineID == NULL)) {
  ------------------
  |  Branch (3976:9): [True: 0, False: 0]
  ------------------
 3977|      0|        return SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 3978|      0|    }
 3979|       |
 3980|      0|    if (pdu_buf_len < msg_len
  ------------------
  |  Branch (3980:9): [True: 0, False: 0]
  ------------------
 3981|      0|        && pdu->securityLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|      0|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (3981:12): [True: 0, False: 0]
  ------------------
 3982|       |        /*
 3983|       |         * space needed is larger than we have in the default buffer 
 3984|       |         */
 3985|      0|        mallocbuf = calloc(1, msg_len);
 3986|      0|        pdu_buf_len = msg_len;
 3987|      0|        cp = mallocbuf;
 3988|      0|    } else {
 3989|      0|        memset(pdu_buf, 0, pdu_buf_len);
 3990|      0|        cp = pdu_buf;
 3991|      0|    }
 3992|       |
 3993|      0|    DEBUGDUMPSECTION("recv", "SM msgSecurityParameters");
  ------------------
  |  |   83|      0|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  193|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  177|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  194|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  195|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:56): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3994|      0|    if (sptr->decode) {
  ------------------
  |  Branch (3994:9): [True: 0, False: 0]
  ------------------
 3995|      0|        struct snmp_secmod_incoming_params parms;
 3996|      0|        parms.msgProcModel = pdu->msgParseModel;
 3997|      0|        parms.maxMsgSize = pdu->msgMaxSize;
 3998|      0|        parms.secParams = sec_params;
 3999|      0|        parms.secModel = msg_sec_model;
 4000|      0|        parms.secLevel = pdu->securityLevel;
 4001|      0|        parms.wholeMsg = msg_data;
 4002|      0|        parms.wholeMsgLen = msg_len;
 4003|      0|        parms.secEngineID = pdu->securityEngineID;
 4004|      0|        parms.secEngineIDLen = &pdu->securityEngineIDLen;
 4005|      0|        parms.secName = pdu->securityName;
 4006|      0|        parms.secNameLen = &pdu->securityNameLen;
 4007|      0|        parms.scopedPdu = &cp;
 4008|      0|        parms.scopedPduLen = &pdu_buf_len;
 4009|      0|        parms.maxSizeResponse = &max_size_response;
 4010|      0|        parms.secStateRef = &pdu->securityStateRef;
 4011|      0|        parms.sess = sess;
 4012|      0|        parms.pdu = pdu;
 4013|      0|        parms.msg_flags = msg_flags;
 4014|      0|        ret_val = (*sptr->decode) (&parms);
 4015|      0|    } else {
 4016|      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 - Ignored]
  |  |  ------------------
  ------------------
 4017|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   77|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  146|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  176|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (77:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4018|      0|        snmp_log(LOG_WARNING, "security service %ld can't decode packets\n",
 4019|      0|                 msg_sec_model);
 4020|      0|        return (-1);
 4021|      0|    }
 4022|       |
 4023|      0|    if (ret_val != SNMPERR_SUCCESS) {
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (4023:9): [True: 0, False: 0]
  ------------------
 4024|      0|        DEBUGDUMPSECTION("recv", "ScopedPDU");
  ------------------
  |  |   83|      0|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  193|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  177|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  194|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  195|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:56): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4025|       |        /*
 4026|       |         * Parse as much as possible -- though I don't see the point? [jbpn].  
 4027|       |         */
 4028|      0|        if (cp) {
  ------------------
  |  Branch (4028:13): [True: 0, False: 0]
  ------------------
 4029|      0|            cp = snmpv3_scopedPDU_parse(pdu, cp, &pdu_buf_len);
 4030|      0|        }
 4031|      0|        if (cp) {
  ------------------
  |  Branch (4031:13): [True: 0, False: 0]
  ------------------
 4032|      0|            DEBUGPRINTPDUTYPE("recv", *cp);
  ------------------
  |  |  418|      0|    DEBUGDUMPSECTION(token, snmp_pdu_type(type))
  |  |  ------------------
  |  |  |  |   83|      0|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  146|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (146:29): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  193|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  177|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  194|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  |  |  195|      0|        __DBGINDENTMORE()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  175|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (83:56): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4033|      0|            snmp_pdu_parse(pdu, cp, &pdu_buf_len);
 4034|      0|            DEBUGINDENTADD(-8);
  ------------------
  |  |   75|      0|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4035|      0|        } else {
 4036|      0|            DEBUGINDENTADD(-4);
  ------------------
  |  |   75|      0|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4037|      0|        }
 4038|       |
 4039|      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 - Ignored]
  |  |  ------------------
  ------------------
 4040|      0|        return ret_val;
 4041|      0|    }
 4042|       |
 4043|       |    /*
 4044|       |     * parse plaintext ScopedPDU sequence 
 4045|       |     */
 4046|      0|    *length = pdu_buf_len;
 4047|      0|    DEBUGDUMPSECTION("recv", "ScopedPDU");
  ------------------
  |  |   83|      0|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  193|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  177|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  194|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  195|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:56): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4048|      0|    data = snmpv3_scopedPDU_parse(pdu, cp, length);
 4049|      0|    if (data == NULL) {
  ------------------
  |  Branch (4049:9): [True: 0, False: 0]
  ------------------
 4050|      0|        snmp_log(LOG_WARNING, "security service %ld error parsing ScopedPDU\n",
 4051|      0|                 msg_sec_model);
 4052|      0|        ERROR_MSG("error parsing PDU");
  ------------------
  |  |  190|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4053|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  681|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4054|      0|        DEBUGINDENTADD(-4);
  ------------------
  |  |   75|      0|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4055|      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 - Ignored]
  |  |  ------------------
  ------------------
 4056|      0|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 4057|      0|    }
 4058|       |
 4059|       |    /*
 4060|       |     * parse the PDU.  
 4061|       |     */
 4062|      0|    if (after_header != NULL) {
  ------------------
  |  Branch (4062:9): [True: 0, False: 0]
  ------------------
 4063|      0|        *after_header = data;
 4064|      0|        tmp_buf_len = *length;
 4065|      0|    }
 4066|       |
 4067|      0|    DEBUGPRINTPDUTYPE("recv", *data);
  ------------------
  |  |  418|      0|    DEBUGDUMPSECTION(token, snmp_pdu_type(type))
  |  |  ------------------
  |  |  |  |   83|      0|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  146|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (146:29): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  193|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  177|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  194|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  |  |  195|      0|        __DBGINDENTMORE()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  175|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (83:56): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4068|      0|    ret = snmp_pdu_parse(pdu, data, length);
 4069|      0|    DEBUGINDENTADD(-8);
  ------------------
  |  |   75|      0|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4070|       |
 4071|      0|    if (after_header != NULL) {
  ------------------
  |  Branch (4071:9): [True: 0, False: 0]
  ------------------
 4072|      0|        *length = tmp_buf_len;
 4073|      0|    }
 4074|       |
 4075|      0|    if (ret != SNMPERR_SUCCESS) {
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (4075:9): [True: 0, False: 0]
  ------------------
 4076|      0|        snmp_log(LOG_WARNING, "security service %ld error parsing ScopedPDU\n",
 4077|      0|                 msg_sec_model);
 4078|      0|        ERROR_MSG("error parsing PDU");
  ------------------
  |  |  190|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4079|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  681|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4080|      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 - Ignored]
  |  |  ------------------
  ------------------
 4081|      0|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 4082|      0|    }
 4083|       |
 4084|      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 - Ignored]
  |  |  ------------------
  ------------------
 4085|      0|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 4086|      0|}                               /* end snmpv3_parse() */
snmp_parse:
 4611|  2.71k|{
 4612|  2.71k|    int             rc;
 4613|       |
 4614|  2.71k|    rc = _snmp_parse(slp, pss, pdu, data, length);
 4615|  2.71k|    if (rc) {
  ------------------
  |  Branch (4615:9): [True: 2.51k, False: 199]
  ------------------
 4616|  2.51k|        if (!pss->s_snmp_errno) {
  ------------------
  |  Branch (4616:13): [True: 2.41k, False: 92]
  ------------------
 4617|  2.41k|            pss->s_snmp_errno = SNMPERR_BAD_PARSE;
  ------------------
  |  |  230|  2.41k|#define SNMPERR_BAD_PARSE		(-13)
  ------------------
 4618|  2.41k|        }
 4619|  2.51k|        SET_SNMP_ERROR(pss->s_snmp_errno);
  ------------------
  |  |   56|  2.51k|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 4620|  2.51k|    }
 4621|       |
 4622|  2.71k|    return rc;
 4623|  2.71k|}
snmp_pdu_parse:
 4627|  1.39k|{
 4628|  1.39k|    u_char          type;
 4629|  1.39k|    u_char          msg_type;
 4630|  1.39k|    u_char         *var_val;
 4631|  1.39k|    size_t          len;
 4632|  1.39k|    size_t          four;
 4633|  1.39k|    netsnmp_variable_list *vp = NULL, *vplast = NULL;
 4634|  1.39k|    oid             objid[MAX_OID_LEN];
 4635|  1.39k|    u_char         *p;
 4636|       |
 4637|       |    /*
 4638|       |     * Get the PDU type 
 4639|       |     */
 4640|  1.39k|    data = asn_parse_header(data, length, &msg_type);
 4641|  1.39k|    if (data == NULL)
  ------------------
  |  Branch (4641:9): [True: 19, False: 1.37k]
  ------------------
 4642|     19|        return -1;
 4643|  1.37k|    DEBUGMSGTL(("dumpv_recv","    Command %s\n", snmp_pdu_type(msg_type)));
  ------------------
  |  |   68|  1.37k|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|  1.37k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 1.37k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (68:70): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4644|  1.37k|    pdu->command = msg_type;
 4645|  1.37k|    pdu->flags &= (~UCD_MSG_FLAG_RESPONSE_PDU);
  ------------------
  |  |  311|  1.37k|#define UCD_MSG_FLAG_RESPONSE_PDU            0x100
  ------------------
 4646|       |
 4647|       |    /*
 4648|       |     * get the fields in the PDU preceding the variable-bindings sequence
 4649|       |     */
 4650|  1.37k|    switch (pdu->command) {
 4651|  1.07k|    case SNMP_MSG_TRAP:
  ------------------
  |  |  135|  1.07k|#define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   92|  1.07k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   96|  1.07k|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4651:5): [True: 1.07k, False: 308]
  ------------------
 4652|       |        /*
 4653|       |         * enterprise 
 4654|       |         */
 4655|  1.07k|        pdu->enterprise_length = MAX_OID_LEN;
  ------------------
  |  |  103|  1.07k|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
 4656|  1.07k|        data = asn_parse_objid(data, length, &type, objid,
 4657|  1.07k|                               &pdu->enterprise_length);
 4658|  1.07k|        if (data == NULL)
  ------------------
  |  Branch (4658:13): [True: 207, False: 864]
  ------------------
 4659|    207|            return -1;
 4660|    864|        pdu->enterprise = netsnmp_memdup(objid,
 4661|    864|                                         pdu->enterprise_length * sizeof(oid));
 4662|    864|        if (pdu->enterprise == NULL) {
  ------------------
  |  Branch (4662:13): [True: 0, False: 864]
  ------------------
 4663|      0|            return -1;
 4664|      0|        }
 4665|       |
 4666|       |        /*
 4667|       |         * agent-addr 
 4668|       |         */
 4669|    864|        four = 4;
 4670|    864|        data = asn_parse_string(data, length, &type,
 4671|    864|                                (u_char *) pdu->agent_addr, &four);
 4672|    864|        if (data == NULL)
  ------------------
  |  Branch (4672:13): [True: 101, False: 763]
  ------------------
 4673|    101|            return -1;
 4674|       |
 4675|       |        /*
 4676|       |         * generic trap 
 4677|       |         */
 4678|    763|        data = asn_parse_int(data, length, &type, (long *) &pdu->trap_type,
 4679|    763|                             sizeof(pdu->trap_type));
 4680|    763|        if (data == NULL)
  ------------------
  |  Branch (4680:13): [True: 5, False: 758]
  ------------------
 4681|      5|            return -1;
 4682|       |        /*
 4683|       |         * specific trap 
 4684|       |         */
 4685|    758|        data =
 4686|    758|            asn_parse_int(data, length, &type,
 4687|    758|                          (long *) &pdu->specific_type,
 4688|    758|                          sizeof(pdu->specific_type));
 4689|    758|        if (data == NULL)
  ------------------
  |  Branch (4689:13): [True: 2, False: 756]
  ------------------
 4690|      2|            return -1;
 4691|       |
 4692|       |        /*
 4693|       |         * timestamp  
 4694|       |         */
 4695|    756|        data = asn_parse_unsigned_int(data, length, &type, &pdu->time,
 4696|    756|                                      sizeof(pdu->time));
 4697|    756|        if (data == NULL)
  ------------------
  |  Branch (4697:13): [True: 174, False: 582]
  ------------------
 4698|    174|            return -1;
 4699|       |
 4700|    582|        break;
 4701|       |
 4702|    582|    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 (4702:5): [True: 37, False: 1.34k]
  ------------------
 4703|     52|    case SNMP_MSG_REPORT:
  ------------------
  |  |  147|     52|#define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   92|     52|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   96|     52|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4703:5): [True: 15, False: 1.36k]
  ------------------
 4704|     52|        pdu->flags |= UCD_MSG_FLAG_RESPONSE_PDU;
  ------------------
  |  |  311|     52|#define UCD_MSG_FLAG_RESPONSE_PDU            0x100
  ------------------
 4705|     52|        NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2390|     52|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 4706|       |
 4707|     71|    case SNMP_MSG_TRAP2:
  ------------------
  |  |  142|     71|#define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   92|     71|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   96|     71|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4707:5): [True: 19, False: 1.36k]
  ------------------
 4708|     92|    case SNMP_MSG_INFORM:
  ------------------
  |  |  141|     92|#define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   92|     92|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   96|     92|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4708:5): [True: 21, False: 1.35k]
  ------------------
 4709|     92|#ifndef NETSNMP_NOTIFY_ONLY
 4710|    113|    case SNMP_MSG_GET:
  ------------------
  |  |  125|    113|#define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  ------------------
  |  |  |  |   92|    113|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  ------------------
  |  |  |  |   96|    113|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4710:5): [True: 21, False: 1.35k]
  ------------------
 4711|    202|    case SNMP_MSG_GETNEXT:
  ------------------
  |  |  126|    202|#define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   92|    202|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   96|    202|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4711:5): [True: 89, False: 1.29k]
  ------------------
 4712|    265|    case SNMP_MSG_GETBULK:
  ------------------
  |  |  140|    265|#define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  ------------------
  |  |  |  |   92|    265|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  ------------------
  |  |  |  |   96|    265|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4712:5): [True: 63, False: 1.31k]
  ------------------
 4713|    265|#endif /* ! NETSNMP_NOTIFY_ONLY */
 4714|    265|#ifndef NETSNMP_NO_WRITE_SUPPORT
 4715|    302|    case SNMP_MSG_SET:
  ------------------
  |  |  129|    302|#define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  ------------------
  |  |  |  |   92|    302|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  ------------------
  |  |  |  |   96|    302|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4715:5): [True: 37, False: 1.34k]
  ------------------
 4716|    302|#endif /* !NETSNMP_NO_WRITE_SUPPORT */
 4717|       |        /*
 4718|       |         * PDU is not an SNMPv1 TRAP 
 4719|       |         */
 4720|       |
 4721|       |        /*
 4722|       |         * request id 
 4723|       |         */
 4724|    302|        DEBUGDUMPHEADER("recv", "request_id");
  ------------------
  |  |   81|    302|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|    302|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 302]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  180|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  177|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  181|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  182|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (184:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  185|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (185:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  187|      0|        } else { \
  |  |  |  |  188|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  189|      0|        } \
  |  |  |  |  190|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:55): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4725|    302|        data = asn_parse_int(data, length, &type, &pdu->reqid,
 4726|    302|                             sizeof(pdu->reqid));
 4727|    302|        DEBUGINDENTLESS();
  ------------------
  |  |   77|    302|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  146|    302|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 302]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  176|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (77:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4728|    302|        if (data == NULL) {
  ------------------
  |  Branch (4728:13): [True: 8, False: 294]
  ------------------
 4729|      8|            return -1;
 4730|      8|        }
 4731|       |
 4732|       |        /*
 4733|       |         * error status (getbulk non-repeaters) 
 4734|       |         */
 4735|    294|        DEBUGDUMPHEADER("recv", "error status");
  ------------------
  |  |   81|    294|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|    294|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 294]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  180|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  177|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  181|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  182|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (184:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  185|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (185:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  187|      0|        } else { \
  |  |  |  |  188|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  189|      0|        } \
  |  |  |  |  190|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:55): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4736|    294|        data = asn_parse_int(data, length, &type, &pdu->errstat,
 4737|    294|                             sizeof(pdu->errstat));
 4738|    294|        DEBUGINDENTLESS();
  ------------------
  |  |   77|    294|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  146|    294|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 294]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  176|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (77:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4739|    294|        if (data == NULL) {
  ------------------
  |  Branch (4739:13): [True: 1, False: 293]
  ------------------
 4740|      1|            return -1;
 4741|      1|        }
 4742|       |
 4743|       |        /*
 4744|       |         * error index (getbulk max-repetitions) 
 4745|       |         */
 4746|    293|        DEBUGDUMPHEADER("recv", "error index");
  ------------------
  |  |   81|    293|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|    293|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 293]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  180|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  177|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  181|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  182|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (184:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  185|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (185:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  187|      0|        } else { \
  |  |  |  |  188|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  189|      0|        } \
  |  |  |  |  190|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:55): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4747|    293|        data = asn_parse_int(data, length, &type, &pdu->errindex,
 4748|    293|                             sizeof(pdu->errindex));
 4749|    293|        DEBUGINDENTLESS();
  ------------------
  |  |   77|    293|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  146|    293|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 293]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  176|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (77:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4750|    293|        if (data == NULL) {
  ------------------
  |  Branch (4750:13): [True: 1, False: 292]
  ------------------
 4751|      1|            return -1;
 4752|      1|        }
 4753|    292|	break;
 4754|       |
 4755|    292|    default:
  ------------------
  |  Branch (4755:5): [True: 6, False: 1.37k]
  ------------------
 4756|      6|        snmp_log(LOG_ERR, "Bad PDU type received: 0x%.2x\n", pdu->command);
 4757|      6|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  681|      6|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4758|      6|        return -1;
 4759|  1.37k|    }
 4760|       |
 4761|       |    /*
 4762|       |     * get header for variable-bindings sequence 
 4763|       |     */
 4764|    874|    DEBUGDUMPSECTION("recv", "VarBindList");
  ------------------
  |  |   83|    874|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|    874|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 874]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  193|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  177|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  194|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  195|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:56): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4765|    874|    data = asn_parse_sequence(data, length, &type,
 4766|    874|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   84|    874|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   96|    874|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 4767|    874|                              "varbinds");
 4768|    874|    if (data == NULL)
  ------------------
  |  Branch (4768:9): [True: 119, False: 755]
  ------------------
 4769|    119|        goto fail;
 4770|       |
 4771|       |    /*
 4772|       |     * get each varBind sequence 
 4773|       |     */
 4774|  19.4k|    while ((int) *length > 0) {
  ------------------
  |  Branch (4774:12): [True: 19.2k, False: 199]
  ------------------
 4775|  19.2k|        vp = SNMP_MALLOC_TYPEDEF(netsnmp_variable_list);
  ------------------
  |  |   73|  19.2k|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
 4776|  19.2k|        if (NULL == vp)
  ------------------
  |  Branch (4776:13): [True: 0, False: 19.2k]
  ------------------
 4777|      0|            goto fail;
 4778|       |
 4779|  19.2k|        vp->name_length = MAX_OID_LEN;
  ------------------
  |  |  103|  19.2k|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
 4780|  19.2k|        DEBUGDUMPSECTION("recv", "VarBind");
  ------------------
  |  |   83|  19.2k|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|  19.2k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 19.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  193|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  177|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  194|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  195|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:56): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4781|  19.2k|        data = snmp_parse_var_op(data, objid, &vp->name_length, &vp->type,
 4782|  19.2k|                                 &vp->val_len, &var_val, length);
 4783|  19.2k|        if (data == NULL)
  ------------------
  |  Branch (4783:13): [True: 369, False: 18.9k]
  ------------------
 4784|    369|            goto fail;
 4785|  18.9k|        if (snmp_set_var_objid(vp, objid, vp->name_length))
  ------------------
  |  Branch (4785:13): [True: 0, False: 18.9k]
  ------------------
 4786|      0|            goto fail;
 4787|       |
 4788|  18.9k|        len = SNMP_MAX_PACKET_LEN;
  ------------------
  |  |   49|  18.9k|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
 4789|  18.9k|        DEBUGDUMPHEADER("recv", "Value");
  ------------------
  |  |   81|  18.9k|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|  18.9k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 18.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  180|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  177|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  181|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  182|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (184:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  185|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (185:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  187|      0|        } else { \
  |  |  |  |  188|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  189|      0|        } \
  |  |  |  |  190|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:55): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4790|  18.9k|        switch ((short) vp->type) {
 4791|  1.18k|        case ASN_INTEGER:
  ------------------
  |  |   75|  1.18k|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (4791:9): [True: 1.18k, False: 17.7k]
  ------------------
 4792|  1.18k|            vp->val.integer = (long *) vp->buf;
 4793|  1.18k|            vp->val_len = sizeof(long);
 4794|  1.18k|            p = asn_parse_int(var_val, &len, &vp->type,
 4795|  1.18k|                          (long *) vp->val.integer,
 4796|  1.18k|                          sizeof(*vp->val.integer));
 4797|  1.18k|            if (!p)
  ------------------
  |  Branch (4797:17): [True: 3, False: 1.17k]
  ------------------
 4798|      3|                goto fail;
 4799|  1.17k|            break;
 4800|  1.22k|        case ASN_COUNTER:
  ------------------
  |  |   89|  1.22k|#define ASN_COUNTER	(ASN_APPLICATION | 1)
  |  |  ------------------
  |  |  |  |   91|  1.22k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4800:9): [True: 1.22k, False: 17.6k]
  ------------------
 4801|  1.89k|        case ASN_GAUGE:
  ------------------
  |  |   90|  1.89k|#define ASN_GAUGE	(ASN_APPLICATION | 2)
  |  |  ------------------
  |  |  |  |   91|  1.89k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4801:9): [True: 663, False: 18.2k]
  ------------------
 4802|  2.86k|        case ASN_TIMETICKS:
  ------------------
  |  |   92|  2.86k|#define ASN_TIMETICKS   (ASN_APPLICATION | 3)
  |  |  ------------------
  |  |  |  |   91|  2.86k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4802:9): [True: 974, False: 17.9k]
  ------------------
 4803|  3.36k|        case ASN_UINTEGER:
  ------------------
  |  |  100|  3.36k|#define ASN_UINTEGER    (ASN_APPLICATION | 7)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|  3.36k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4803:9): [True: 495, False: 18.4k]
  ------------------
 4804|  3.36k|            vp->val.integer = (long *) vp->buf;
 4805|  3.36k|            vp->val_len = sizeof(u_long);
 4806|  3.36k|            p = asn_parse_unsigned_int(var_val, &len, &vp->type,
 4807|  3.36k|                                   (u_long *) vp->val.integer,
 4808|  3.36k|                                   vp->val_len);
 4809|  3.36k|            if (!p)
  ------------------
  |  Branch (4809:17): [True: 13, False: 3.34k]
  ------------------
 4810|     13|                goto fail;
 4811|  3.34k|            break;
 4812|  3.34k|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 4813|  3.34k|        case ASN_OPAQUE_COUNTER64:
  ------------------
  |  |  156|    592|#define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  136|    592|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  146|    592|#define ASN_APP_COUNTER64 (ASN_APPLICATION | 6)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    592|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4813:9): [True: 592, False: 18.3k]
  ------------------
 4814|  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 (4814:9): [True: 957, False: 17.9k]
  ------------------
 4815|  1.54k|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 4816|  2.96k|        case ASN_COUNTER64:
  ------------------
  |  |   99|  2.96k|#define ASN_COUNTER64   (ASN_APPLICATION | 6)
  |  |  ------------------
  |  |  |  |   91|  2.96k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4816:9): [True: 1.41k, False: 17.4k]
  ------------------
 4817|  2.96k|            vp->val.counter64 = (struct counter64 *) vp->buf;
 4818|  2.96k|            vp->val_len = sizeof(struct counter64);
 4819|  2.96k|            p = asn_parse_unsigned_int64(var_val, &len, &vp->type,
 4820|  2.96k|                                     (struct counter64 *) vp->val.
 4821|  2.96k|                                     counter64, vp->val_len);
 4822|  2.96k|            if (!p)
  ------------------
  |  Branch (4822:17): [True: 31, False: 2.93k]
  ------------------
 4823|     31|                goto fail;
 4824|  2.93k|            break;
 4825|  2.93k|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 4826|  2.93k|        case ASN_OPAQUE_FLOAT:
  ------------------
  |  |  165|    743|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|    743|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|    743|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    743|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4826:9): [True: 743, False: 18.1k]
  ------------------
 4827|    743|            vp->val.floatVal = (float *) vp->buf;
 4828|    743|            vp->val_len = sizeof(float);
 4829|    743|            p = asn_parse_float(var_val, &len, &vp->type,
 4830|    743|                            vp->val.floatVal, vp->val_len);
 4831|    743|            if (!p)
  ------------------
  |  Branch (4831:17): [True: 37, False: 706]
  ------------------
 4832|     37|                goto fail;
 4833|    706|            break;
 4834|    706|        case ASN_OPAQUE_DOUBLE:
  ------------------
  |  |  174|    694|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|    694|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|    694|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    694|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4834:9): [True: 694, False: 18.2k]
  ------------------
 4835|    694|            vp->val.doubleVal = (double *) vp->buf;
 4836|    694|            vp->val_len = sizeof(double);
 4837|    694|            p = asn_parse_double(var_val, &len, &vp->type,
 4838|    694|                             vp->val.doubleVal, vp->val_len);
 4839|    694|            if (!p)
  ------------------
  |  Branch (4839:17): [True: 38, False: 656]
  ------------------
 4840|     38|                goto fail;
 4841|    656|            break;
 4842|  1.56k|        case ASN_OPAQUE_I64:
  ------------------
  |  |  183|  1.56k|#define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  136|  1.56k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  149|  1.56k|#define ASN_APP_I64 (ASN_APPLICATION | 10)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.56k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4842:9): [True: 1.56k, False: 17.3k]
  ------------------
 4843|  1.56k|            vp->val.counter64 = (struct counter64 *) vp->buf;
 4844|  1.56k|            vp->val_len = sizeof(struct counter64);
 4845|  1.56k|            p = asn_parse_signed_int64(var_val, &len, &vp->type,
 4846|  1.56k|                                   (struct counter64 *) vp->val.counter64,
 4847|  1.56k|                                   sizeof(*vp->val.counter64));
 4848|       |
 4849|  1.56k|            if (!p)
  ------------------
  |  Branch (4849:17): [True: 32, False: 1.52k]
  ------------------
 4850|     32|                goto fail;
 4851|  1.52k|            break;
 4852|  1.52k|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 4853|  1.52k|        case ASN_IPADDRESS:
  ------------------
  |  |   88|    320|#define ASN_IPADDRESS   (ASN_APPLICATION | 0)
  |  |  ------------------
  |  |  |  |   91|    320|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4853:9): [True: 320, False: 18.5k]
  ------------------
 4854|    320|            if (vp->val_len != 4)
  ------------------
  |  Branch (4854:17): [True: 11, False: 309]
  ------------------
 4855|     11|                goto fail;
 4856|    320|            NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2390|    309|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 4857|  1.54k|        case ASN_OCTET_STR:
  ------------------
  |  |   78|  1.54k|#define ASN_OCTET_STR	    0x04U
  ------------------
  |  Branch (4857:9): [True: 1.23k, False: 17.6k]
  ------------------
 4858|  3.41k|        case ASN_OPAQUE:
  ------------------
  |  |   93|  3.41k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  3.41k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4858:9): [True: 1.87k, False: 17.0k]
  ------------------
 4859|  4.48k|        case ASN_NSAP:
  ------------------
  |  |   98|  4.48k|#define ASN_NSAP	(ASN_APPLICATION | 5)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|  4.48k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4859:9): [True: 1.06k, False: 17.8k]
  ------------------
 4860|  4.48k|            if (vp->val_len < sizeof(vp->buf)) {
  ------------------
  |  Branch (4860:17): [True: 4.15k, False: 326]
  ------------------
 4861|  4.15k|                vp->val.string = (u_char *) vp->buf;
 4862|  4.15k|            } else {
 4863|    326|                vp->val.string = (u_char *) malloc(vp->val_len);
 4864|    326|            }
 4865|  4.48k|            if (vp->val.string == NULL) {
  ------------------
  |  Branch (4865:17): [True: 0, False: 4.48k]
  ------------------
 4866|      0|                goto fail;
 4867|      0|            }
 4868|  4.48k|            p = asn_parse_string(var_val, &len, &vp->type, vp->val.string,
 4869|  4.48k|                             &vp->val_len);
 4870|  4.48k|            if (!p)
  ------------------
  |  Branch (4870:17): [True: 0, False: 4.48k]
  ------------------
 4871|      0|                goto fail;
 4872|  4.48k|            break;
 4873|  4.48k|        case ASN_OBJECT_ID:
  ------------------
  |  |   81|  1.05k|#define ASN_OBJECT_ID	    0x06U
  ------------------
  |  Branch (4873:9): [True: 1.05k, False: 17.8k]
  ------------------
 4874|  1.05k|            vp->val_len = MAX_OID_LEN;
  ------------------
  |  |  103|  1.05k|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
 4875|  1.05k|            p = asn_parse_objid(var_val, &len, &vp->type, objid, &vp->val_len);
 4876|  1.05k|            if (!p)
  ------------------
  |  Branch (4876:17): [True: 1, False: 1.05k]
  ------------------
 4877|      1|                goto fail;
 4878|  1.05k|            vp->val_len *= sizeof(oid);
 4879|  1.05k|            vp->val.objid = netsnmp_memdup(objid, vp->val_len);
 4880|  1.05k|            if (vp->val.objid == NULL)
  ------------------
  |  Branch (4880:17): [True: 0, False: 1.05k]
  ------------------
 4881|      0|                goto fail;
 4882|  1.05k|            break;
 4883|  1.05k|        case SNMP_NOSUCHOBJECT:
  ------------------
  |  |  201|    322|#define SNMP_NOSUCHOBJECT    (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) /* 80=128 */
  |  |  ------------------
  |  |  |  |   92|    322|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_NOSUCHOBJECT    (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) /* 80=128 */
  |  |  ------------------
  |  |  |  |   95|    322|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (4883:9): [True: 322, False: 18.5k]
  ------------------
 4884|  1.05k|        case SNMP_NOSUCHINSTANCE:
  ------------------
  |  |  202|  1.05k|#define SNMP_NOSUCHINSTANCE  (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* 81=129 */
  |  |  ------------------
  |  |  |  |   92|  1.05k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_NOSUCHINSTANCE  (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* 81=129 */
  |  |  ------------------
  |  |  |  |   95|  1.05k|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (4884:9): [True: 731, False: 18.1k]
  ------------------
 4885|  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 (4885:9): [True: 580, False: 18.3k]
  ------------------
 4886|  1.92k|        case ASN_NULL:
  ------------------
  |  |   79|  1.92k|#define ASN_NULL	    0x05U
  ------------------
  |  Branch (4886:9): [True: 294, False: 18.6k]
  ------------------
 4887|  1.92k|            break;
 4888|    903|        case ASN_BIT_STR:
  ------------------
  |  |   77|    903|#define ASN_BIT_STR	    0x03U
  ------------------
  |  Branch (4888:9): [True: 903, False: 17.9k]
  ------------------
 4889|    903|            vp->val.bitstring = (u_char *) malloc(vp->val_len);
 4890|    903|            if (vp->val.bitstring == NULL) {
  ------------------
  |  Branch (4890:17): [True: 0, False: 903]
  ------------------
 4891|      0|                goto fail;
 4892|      0|            }
 4893|    903|            p = asn_parse_bitstring(var_val, &len, &vp->type,
 4894|    903|                                vp->val.bitstring, &vp->val_len);
 4895|    903|            if (!p)
  ------------------
  |  Branch (4895:17): [True: 7, False: 896]
  ------------------
 4896|      7|                goto fail;
 4897|    896|            break;
 4898|    896|        default:
  ------------------
  |  Branch (4898:9): [True: 14, False: 18.8k]
  ------------------
 4899|     14|            snmp_log(LOG_ERR, "bad type returned (%x)\n", vp->type);
 4900|     14|            goto fail;
 4901|      0|            break;
 4902|  18.9k|        }
 4903|  18.7k|        DEBUGINDENTADD(-4);
  ------------------
  |  |   75|  18.7k|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|  18.7k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 18.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4904|       |
 4905|  18.7k|        if (NULL == vplast) {
  ------------------
  |  Branch (4905:13): [True: 615, False: 18.0k]
  ------------------
 4906|    615|            pdu->variables = vp;
 4907|  18.0k|        } else {
 4908|  18.0k|            vplast->next_variable = vp;
 4909|  18.0k|        }
 4910|  18.7k|        vplast = vp;
 4911|  18.7k|        vp = NULL;
 4912|  18.7k|    }
 4913|    199|    return 0;
 4914|       |
 4915|    675|  fail:
 4916|    675|    {
 4917|    675|        const char *errstr = snmp_api_errstring(SNMPERR_SUCCESS);
  ------------------
  |  |  217|    675|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 4918|    675|        DEBUGMSGTL(("recv", "error while parsing VarBindList:%s\n", errstr));
  ------------------
  |  |   68|    675|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|    675|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 675]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (68:70): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4919|    675|    }
 4920|       |    /** if we were parsing a var, remove it from the pdu and free it */
 4921|    675|    if (vp)
  ------------------
  |  Branch (4921:9): [True: 556, False: 119]
  ------------------
 4922|    556|        snmp_free_var(vp);
 4923|       |
 4924|    675|    return -1;
 4925|    755|}
snmp_free_var_internals:
 5521|  19.2k|{
 5522|  19.2k|    if (!var)
  ------------------
  |  Branch (5522:9): [True: 0, False: 19.2k]
  ------------------
 5523|      0|        return;
 5524|       |
 5525|  19.2k|    if (var->name != var->name_loc)
  ------------------
  |  Branch (5525:9): [True: 369, False: 18.9k]
  ------------------
 5526|    369|        SNMP_FREE(var->name);
  ------------------
  |  |   62|    369|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 369]
  |  |  |  Branch (62:66): [Folded - Ignored]
  |  |  ------------------
  ------------------
 5527|  19.2k|    if (var->val.string != var->buf)
  ------------------
  |  Branch (5527:9): [True: 4.60k, False: 14.6k]
  ------------------
 5528|  4.60k|        SNMP_FREE(var->val.string);
  ------------------
  |  |   62|  4.60k|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 2.28k, False: 2.32k]
  |  |  |  Branch (62:66): [Folded - Ignored]
  |  |  ------------------
  ------------------
 5529|  19.2k|    if (var->data) {
  ------------------
  |  Branch (5529:9): [True: 0, False: 19.2k]
  ------------------
 5530|      0|        if (var->dataFreeHook) {
  ------------------
  |  Branch (5530:13): [True: 0, False: 0]
  ------------------
 5531|      0|            var->dataFreeHook(var->data);
 5532|      0|            var->data = NULL;
 5533|      0|        } else {
 5534|      0|            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 - Ignored]
  |  |  ------------------
  ------------------
 5535|      0|        }
 5536|      0|    }
 5537|  19.2k|}
snmp_free_var:
 5541|  19.2k|{
 5542|  19.2k|    snmp_free_var_internals(var);
 5543|  19.2k|    free(var);
 5544|  19.2k|}
snmp_free_varbind:
 5548|  5.42k|{
 5549|  5.42k|    netsnmp_variable_list *ptr;
 5550|  24.1k|    while (var) {
  ------------------
  |  Branch (5550:12): [True: 18.7k, False: 5.42k]
  ------------------
 5551|  18.7k|        ptr = var->next_variable;
 5552|  18.7k|        snmp_free_var(var);
 5553|  18.7k|        var = ptr;
 5554|  18.7k|    }
 5555|  5.42k|}
snmp_free_pdu:
 5562|  5.42k|{
 5563|  5.42k|    struct snmp_secmod_def *sptr;
 5564|       |
 5565|  5.42k|    if (!pdu)
  ------------------
  |  Branch (5565:9): [True: 0, False: 5.42k]
  ------------------
 5566|      0|        return;
 5567|       |
 5568|  5.42k|    free_securityStateRef(pdu);
 5569|       |
 5570|  5.42k|    sptr = find_sec_mod(pdu->securityModel);
 5571|  5.42k|    if (sptr && sptr->pdu_free)
  ------------------
  |  Branch (5571:9): [True: 0, False: 5.42k]
  |  Branch (5571:17): [True: 0, False: 0]
  ------------------
 5572|      0|        (*sptr->pdu_free)(pdu);
 5573|       |
 5574|  5.42k|    snmp_free_varbind(pdu->variables);
 5575|  5.42k|    free(pdu->enterprise);
 5576|  5.42k|    free(pdu->community);
 5577|  5.42k|    free(pdu->contextEngineID);
 5578|  5.42k|    free(pdu->securityEngineID);
 5579|  5.42k|    free(pdu->contextName);
 5580|  5.42k|    free(pdu->securityName);
 5581|  5.42k|    free(pdu->transport_data);
 5582|  5.42k|    free(pdu);
 5583|  5.42k|}
snmp_increment_statistic:
 7980|  3.91k|{
 7981|  3.91k|    if (which >= 0 && which < NETSNMP_STAT_MAX_STATS) {
  ------------------
  |  |  754|  3.91k|#define  NETSNMP_STAT_MAX_STATS              (STAT_TLSTM_STATS_END+1)
  |  |  ------------------
  |  |  |  |  750|  3.91k|#define  STAT_TLSTM_STATS_END          STAT_TLSTM_SNMPTLSTMSESSIONINVALIDCACHES
  |  |  |  |  ------------------
  |  |  |  |  |  |  747|  3.91k|#define  STAT_TLSTM_SNMPTLSTMSESSIONINVALIDCACHES              56
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (7981:9): [True: 3.91k, False: 0]
  |  Branch (7981:23): [True: 3.91k, False: 0]
  ------------------
 7982|  3.91k|        statistics[which]++;
 7983|  3.91k|        return statistics[which];
 7984|  3.91k|    }
 7985|      0|    return 0;
 7986|  3.91k|}
snmp_api.c:free_securityStateRef:
 4090|  5.42k|{
 4091|  5.42k|    struct snmp_secmod_def *sptr;
 4092|       |
 4093|  5.42k|    if (!pdu->securityStateRef)
  ------------------
  |  Branch (4093:9): [True: 5.42k, False: 0]
  ------------------
 4094|  5.42k|        return;
 4095|       |
 4096|      0|    sptr = find_sec_mod(pdu->securityModel);
 4097|      0|    if (sptr) {
  ------------------
  |  Branch (4097:9): [True: 0, False: 0]
  ------------------
 4098|      0|        if (sptr->pdu_free_state_ref) {
  ------------------
  |  Branch (4098:13): [True: 0, False: 0]
  ------------------
 4099|      0|            (*sptr->pdu_free_state_ref) (pdu->securityStateRef);
 4100|      0|        } else {
 4101|      0|            snmp_log(LOG_ERR,
 4102|      0|                     "Security Model %d can't free state references\n",
 4103|      0|                     pdu->securityModel);
 4104|      0|	}
 4105|      0|    } else {
 4106|      0|	snmp_log(LOG_ERR,
 4107|      0|		 "Can't find security model to free ptr: %d\n",
 4108|      0|		 pdu->securityModel);
 4109|      0|    }
 4110|      0|    pdu->securityStateRef = NULL;
 4111|      0|}
snmp_api.c:_snmp_parse:
 4316|  2.71k|{
 4317|  2.71k|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 4318|  2.71k|    u_char          community[COMMUNITY_MAX_LEN];
 4319|  2.71k|    size_t          community_length = COMMUNITY_MAX_LEN;
  ------------------
  |  |   41|  2.71k|#define COMMUNITY_MAX_LEN	256
  ------------------
 4320|  2.71k|#endif
 4321|  2.71k|    int             result = -1;
 4322|       |
 4323|  2.71k|    static const oid snmpEngineIDoid[]   = { 1,3,6,1,6,3,10,2,1,1,0};
 4324|  2.71k|    static size_t   snmpEngineIDoid_len = 11;
 4325|       |
 4326|  2.71k|    static char     ourEngineID[SNMP_SEC_PARAM_BUF_SIZE];
 4327|  2.71k|    static size_t   ourEngineID_len = sizeof(ourEngineID);
 4328|       |
 4329|  2.71k|    netsnmp_pdu    *pdu2 = NULL;
 4330|       |
 4331|  2.71k|    session->s_snmp_errno = 0;
 4332|  2.71k|    session->s_errno = 0;
 4333|       |
 4334|       |    /*
 4335|       |     * Ensure all incoming PDUs have a unique means of identification 
 4336|       |     * (This is not restricted to AgentX handling,
 4337|       |     * though that is where the need becomes visible)   
 4338|       |     */
 4339|  2.71k|    pdu->transid = snmp_get_next_transid();
 4340|       |
 4341|  2.71k|    if (session->version != SNMP_DEFAULT_VERSION) {
  ------------------
  |  |  123|  2.71k|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  |  Branch (4341:9): [True: 2.71k, False: 0]
  ------------------
 4342|  2.71k|        pdu->version = session->version;
 4343|  2.71k|    } else {
 4344|      0|        pdu->version = snmp_parse_version(data, length);
 4345|      0|    }
 4346|       |
 4347|  2.71k|    switch (pdu->version) {
 4348|      0|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 4349|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 4350|  2.71k|    case SNMP_VERSION_1:
  ------------------
  |  |  107|  2.71k|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (4350:5): [True: 2.71k, False: 0]
  ------------------
 4351|  2.71k|#endif
 4352|  2.71k|#ifndef NETSNMP_DISABLE_SNMPV2C
 4353|  2.71k|    case SNMP_VERSION_2c:
  ------------------
  |  |  110|  2.71k|#define SNMP_VERSION_2c    1
  ------------------
  |  Branch (4353:5): [True: 0, False: 2.71k]
  ------------------
 4354|  2.71k|#endif
 4355|  2.71k|        NETSNMP_RUNTIME_PROTOCOL_CHECK_V1V2(pdu->version,unsupported_version);
  ------------------
  |  |  220|  2.71k|#define NETSNMP_RUNTIME_PROTOCOL_CHECK_V1V2(pc_ver, pc_target) do {    \
  |  |  221|  2.71k|        if (NETSNMP_RUNTIME_PROTOCOL_SKIP_V1(pc_ver) ||                \
  |  |  ------------------
  |  |  |  |  205|  5.42k|    ((pc_ver) == SNMP_VERSION_1 &&                                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |  107|  5.42k|#define SNMP_VERSION_1	   0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (205:6): [True: 2.71k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  206|  5.42k|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|  2.71k|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (206:6): [True: 0, False: 2.71k]
  |  |  |  |  ------------------
  |  |  |  |  207|  2.71k|                            NETSNMP_DS_LIB_DISABLE_V1))
  |  |  |  |  ------------------
  |  |  |  |  |  |  103|  2.71k|#define NETSNMP_DS_LIB_DISABLE_V1          43 /* disable SNMPv1 */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  222|  2.71k|            NETSNMP_RUNTIME_PROTOCOL_SKIP_V2(pc_ver)) {                \
  |  |  ------------------
  |  |  |  |  215|  2.71k|    ((pc_ver) == SNMP_VERSION_2c &&                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  5.42k|#define SNMP_VERSION_2c    1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (215:6): [True: 0, False: 2.71k]
  |  |  |  |  ------------------
  |  |  |  |  216|  2.71k|     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"));      \
  |  |  ------------------
  |  |  |  |   68|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  146|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (146:29): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (68:70): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  224|      0|            goto pc_target;                                            \
  |  |  225|      0|        }                                                              \
  |  |  226|  2.71k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (226:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4356|  2.71k|        DEBUGMSGTL(("snmp_api", "Parsing SNMPv%ld message...\n",
  ------------------
  |  |   68|  2.71k|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|  2.71k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 2.71k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (68:70): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4357|  2.71k|                    (1 + pdu->version)));
 4358|       |
 4359|       |        /*
 4360|       |         * authenticates message and returns length if valid 
 4361|       |         */
 4362|  2.71k|#ifndef NETSNMP_DISABLE_SNMPV1
 4363|  2.71k|        if (pdu->version == SNMP_VERSION_1) {
  ------------------
  |  |  107|  2.71k|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (4363:13): [True: 2.71k, False: 0]
  ------------------
 4364|  2.71k|            DEBUGDUMPSECTION("recv", "SNMPv1 message\n");
  ------------------
  |  |   83|  2.71k|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|  2.71k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 2.71k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  193|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  177|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  194|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  195|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:56): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4365|  2.71k|        } else {
 4366|      0|#endif
 4367|      0|            DEBUGDUMPSECTION("recv", "SNMPv2c message\n");
  ------------------
  |  |   83|      0|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  193|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  177|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  194|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  195|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:56): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4368|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 4369|      0|        }
 4370|  2.71k|#endif
 4371|  2.71k|        data = snmp_comstr_parse(data, &length,
 4372|  2.71k|                                 community, &community_length,
 4373|  2.71k|                                 &pdu->version);
 4374|  2.71k|        if (data == NULL)
  ------------------
  |  Branch (4374:13): [True: 1.22k, False: 1.49k]
  ------------------
 4375|  1.22k|            return -1;
 4376|       |
 4377|  1.49k|        if (pdu->version != session->version &&
  ------------------
  |  Branch (4377:13): [True: 92, False: 1.39k]
  ------------------
 4378|  1.49k|            session->version != SNMP_DEFAULT_VERSION) {
  ------------------
  |  |  123|     92|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  |  Branch (4378:13): [True: 92, False: 0]
  ------------------
 4379|     92|            session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  231|     92|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 4380|     92|            return -1;
 4381|     92|        }
 4382|       |
 4383|       |        /*
 4384|       |         * maybe get the community string. 
 4385|       |         */
 4386|  1.39k|        pdu->securityLevel = SNMP_SEC_LEVEL_NOAUTH;
  ------------------
  |  |  299|  1.39k|#define SNMP_SEC_LEVEL_NOAUTH		1
  ------------------
 4387|  1.39k|        pdu->securityModel = 
 4388|  1.39k|#ifndef NETSNMP_DISABLE_SNMPV1
 4389|  1.39k|            (pdu->version == SNMP_VERSION_1) ? SNMP_SEC_MODEL_SNMPv1 : 
  ------------------
  |  |  107|  1.39k|#define SNMP_VERSION_1	   0
  ------------------
                          (pdu->version == SNMP_VERSION_1) ? SNMP_SEC_MODEL_SNMPv1 : 
  ------------------
  |  |  293|  1.39k|#define SNMP_SEC_MODEL_SNMPv1		1
  ------------------
  |  Branch (4389:13): [True: 1.39k, False: 0]
  ------------------
 4390|  1.39k|#endif
 4391|  1.39k|                                               SNMP_SEC_MODEL_SNMPv2c;
  ------------------
  |  |  294|  1.39k|#define SNMP_SEC_MODEL_SNMPv2c		2
  ------------------
 4392|  1.39k|        SNMP_FREE(pdu->community);
  ------------------
  |  |   62|  1.39k|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 1.39k]
  |  |  |  Branch (62:66): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4393|  1.39k|        pdu->community_len = 0;
 4394|  1.39k|        pdu->community = (u_char *) 0;
 4395|  1.39k|        if (community_length) {
  ------------------
  |  Branch (4395:13): [True: 39, False: 1.35k]
  ------------------
 4396|     39|            pdu->community_len = community_length;
 4397|     39|            pdu->community = netsnmp_memdup(community, community_length);
 4398|     39|            if (pdu->community == NULL) {
  ------------------
  |  Branch (4398:17): [True: 0, False: 39]
  ------------------
 4399|      0|                session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 4400|      0|                return -1;
 4401|      0|            }
 4402|     39|        }
 4403|  1.39k|        if (session->authenticator) {
  ------------------
  |  Branch (4403:13): [True: 0, False: 1.39k]
  ------------------
 4404|      0|            data = session->authenticator(data, &length,
 4405|      0|                                          community, community_length);
 4406|      0|            if (data == NULL) {
  ------------------
  |  Branch (4406:17): [True: 0, False: 0]
  ------------------
 4407|      0|                session->s_snmp_errno = SNMPERR_AUTHENTICATION_FAILURE;
  ------------------
  |  |  252|      0|#define SNMPERR_AUTHENTICATION_FAILURE 	(-35)
  ------------------
 4408|      0|                return -1;
 4409|      0|            }
 4410|      0|        }
 4411|       |
 4412|  1.39k|        DEBUGDUMPSECTION("recv", "PDU");
  ------------------
  |  |   83|  1.39k|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|  1.39k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 1.39k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  193|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  177|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  194|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  195|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:56): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4413|  1.39k|        result = snmp_pdu_parse(pdu, data, &length);
 4414|  1.39k|        if (result < 0) {
  ------------------
  |  Branch (4414:13): [True: 1.19k, False: 199]
  ------------------
 4415|       |            /*
 4416|       |             * This indicates a parse error.  
 4417|       |             */
 4418|  1.19k|            snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  681|  1.19k|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4419|  1.19k|        }
 4420|  1.39k|        DEBUGINDENTADD(-6);
  ------------------
  |  |   75|  1.39k|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|  1.39k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 1.39k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4421|  1.39k|        break;
 4422|      0|#endif /* support for community based SNMP */
 4423|       |
 4424|      0|    case SNMP_VERSION_3:
  ------------------
  |  |  113|      0|#define SNMP_VERSION_3     3
  ------------------
  |  Branch (4424:5): [True: 0, False: 2.71k]
  ------------------
 4425|      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): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  |  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"));      \
  |  |  ------------------
  |  |  |  |   68|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  146|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (146:29): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (68:70): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  236|      0|            goto pc_target;                                            \
  |  |  237|      0|        }                                                              \
  |  |  238|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (238:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4426|      0|        result = snmpv3_parse(pdu, data, &length, NULL, session);
 4427|      0|        DEBUGMSGTL(("snmp_parse",
  ------------------
  |  |   68|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (68:70): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4428|      0|                    "Parsed SNMPv3 message (secName:%s, secLevel:%s): %s\n",
 4429|      0|                    pdu->securityName, secLevelName[pdu->securityLevel],
 4430|      0|                    snmp_api_errstring(result)));
 4431|       |
 4432|      0|        if (result == SNMPERR_USM_UNKNOWNSECURITYNAME) {
  ------------------
  |  |  260|      0|#define SNMPERR_USM_UNKNOWNSECURITYNAME		(-43)
  ------------------
  |  Branch (4432:13): [True: 0, False: 0]
  ------------------
 4433|      0|            snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
  ------------------
  |  |   19|      0|#define SNMP_CALLBACK_APPLICATION 1
  ------------------
 4434|      0|                                SNMPD_CALLBACK_AUTH_FAILURE, pdu);
  ------------------
  |  |   21|      0|#define SNMPD_CALLBACK_AUTH_FAILURE             17
  ------------------
 4435|      0|        }
 4436|       |        
 4437|      0|        if (result) {
  ------------------
  |  Branch (4437:13): [True: 0, False: 0]
  ------------------
 4438|      0|            struct snmp_secmod_def *secmod =
 4439|      0|                find_sec_mod(pdu->securityModel);
 4440|      0|            if (!slp) {
  ------------------
  |  Branch (4440:17): [True: 0, False: 0]
  ------------------
 4441|      0|                session->s_snmp_errno = result;
 4442|      0|            } else {
 4443|       |                /*
 4444|       |                 * Call the security model to special handle any errors
 4445|       |                 */
 4446|       |
 4447|      0|                if (secmod && secmod->handle_report) {
  ------------------
  |  Branch (4447:21): [True: 0, False: 0]
  |  Branch (4447:31): [True: 0, False: 0]
  ------------------
 4448|      0|                    (*secmod->handle_report)(slp, slp->transport, session,
 4449|      0|                                             result, pdu);
 4450|      0|                }
 4451|      0|            }
 4452|      0|            free_securityStateRef(pdu);
 4453|      0|        }
 4454|       |
 4455|       |        /* Implement RFC5343 here for two reasons:
 4456|       |           1) From a security perspective it handles this otherwise
 4457|       |              always approved request earlier.  It bypasses the need
 4458|       |              for authorization to the snmpEngineID scalar, which is
 4459|       |              what is what RFC3415 appendix A species as ok.  Note
 4460|       |              that we haven't bypassed authentication since if there
 4461|       |              was an authentication eror it would have been handled
 4462|       |              above in the if(result) part at the lastet.
 4463|       |           2) From an application point of view if we let this request
 4464|       |              get all the way to the application, it'd require that
 4465|       |              all application types supporting discovery also fire up
 4466|       |              a minimal agent in order to handle just this request
 4467|       |              which seems like overkill.  Though there is no other
 4468|       |              application types that currently need discovery (NRs
 4469|       |              accept notifications from contextEngineIDs that derive
 4470|       |              from the NO not the NR).  Also a lame excuse for doing
 4471|       |              it here.
 4472|       |           3) Less important technically, but the net-snmp agent
 4473|       |              doesn't currently handle registrations of different
 4474|       |              engineIDs either and it would have been a lot more work
 4475|       |              to implement there since we'd need to support that
 4476|       |              first. :-/ Supporting multiple context engineIDs should
 4477|       |              be done anyway, so it's not a valid excuse here.
 4478|       |           4) There is a lot less to do if we trump the agent at this
 4479|       |              point; IE, the agent does a lot more unnecessary
 4480|       |              processing when the only thing that should ever be in
 4481|       |              this context by definition is the single scalar.
 4482|       |        */
 4483|       |
 4484|       |        /* special RFC5343 engineID discovery engineID check */
 4485|      0|        if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (4485:13): [True: 0, False: 0]
  ------------------
 4486|      0|                                    NETSNMP_DS_LIB_NO_DISCOVERY) &&
  ------------------
  |  |   98|      0|#define NETSNMP_DS_LIB_NO_DISCOVERY        38 /* don't support RFC5343 contextEngineID discovery */
  ------------------
 4487|      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 (4487:13): [True: 0, False: 0]
  ------------------
 4488|      0|            NULL                    != pdu->contextEngineID &&
  ------------------
  |  Branch (4488:13): [True: 0, False: 0]
  ------------------
 4489|      0|            pdu->contextEngineIDLen == 5 &&
  ------------------
  |  Branch (4489:13): [True: 0, False: 0]
  ------------------
 4490|      0|            pdu->contextEngineID[0] == 0x80 &&
  ------------------
  |  Branch (4490:13): [True: 0, False: 0]
  ------------------
 4491|      0|            pdu->contextEngineID[1] == 0x00 &&
  ------------------
  |  Branch (4491:13): [True: 0, False: 0]
  ------------------
 4492|      0|            pdu->contextEngineID[2] == 0x00 &&
  ------------------
  |  Branch (4492:13): [True: 0, False: 0]
  ------------------
 4493|      0|            pdu->contextEngineID[3] == 0x00 &&
  ------------------
  |  Branch (4493:13): [True: 0, False: 0]
  ------------------
 4494|      0|            pdu->contextEngineID[4] == 0x06) {
  ------------------
  |  Branch (4494:13): [True: 0, False: 0]
  ------------------
 4495|       |
 4496|       |            /* define a result so it doesn't get past us at this point
 4497|       |               and gets dropped by future parts of the stack */
 4498|      0|            result = SNMPERR_JUST_A_CONTEXT_PROBE;
  ------------------
  |  |  283|      0|#define SNMPERR_JUST_A_CONTEXT_PROBE    (-66)
  ------------------
 4499|       |
 4500|      0|            DEBUGMSGTL(("snmpv3_contextid", "starting context ID discovery\n"));
  ------------------
  |  |   68|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (68:70): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4501|       |            /* ensure exactly one variable */
 4502|      0|            if (NULL != pdu->variables &&
  ------------------
  |  Branch (4502:17): [True: 0, False: 0]
  ------------------
 4503|      0|                NULL == pdu->variables->next_variable &&
  ------------------
  |  Branch (4503:17): [True: 0, False: 0]
  ------------------
 4504|       |
 4505|       |                /* if it's a GET, match it exactly */
 4506|      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 (4506:19): [True: 0, False: 0]
  ------------------
 4507|      0|                  snmp_oid_compare(snmpEngineIDoid,
  ------------------
  |  Branch (4507:19): [True: 0, False: 0]
  ------------------
 4508|      0|                                   snmpEngineIDoid_len,
 4509|      0|                                   pdu->variables->name,
 4510|      0|                                   pdu->variables->name_length) == 0)
 4511|       |                 /* if it's a GETNEXT ensure it's less than the engineID oid */
 4512|      0|                 ||
 4513|      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 (4513:19): [True: 0, False: 0]
  ------------------
 4514|      0|                  snmp_oid_compare(snmpEngineIDoid,
  ------------------
  |  Branch (4514:19): [True: 0, False: 0]
  ------------------
 4515|      0|                                   snmpEngineIDoid_len,
 4516|      0|                                   pdu->variables->name,
 4517|      0|                                   pdu->variables->name_length) > 0)
 4518|      0|                    )) {
 4519|       |
 4520|      0|                DEBUGMSGTL(("snmpv3_contextid",
  ------------------
  |  |   68|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (68:70): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4521|      0|                            "  One correct variable found\n"));
 4522|       |
 4523|       |                /* Note: we're explictly not handling a GETBULK.  Deal. */
 4524|       |
 4525|       |                /* set up the response */
 4526|      0|                pdu2 = snmp_clone_pdu(pdu);
 4527|       |
 4528|       |                /* free the current varbind */
 4529|      0|                snmp_free_varbind(pdu2->variables);
 4530|       |
 4531|       |                /* set the variables */
 4532|      0|                pdu2->variables = NULL;
 4533|      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
  |  |  ------------------
  ------------------
 4534|      0|                pdu2->errstat = 0;
 4535|      0|                pdu2->errindex = 0;
 4536|       |
 4537|      0|                ourEngineID_len =
 4538|      0|                    snmpv3_get_engineID((u_char*)ourEngineID, ourEngineID_len);
 4539|      0|                if (0 != ourEngineID_len) {
  ------------------
  |  Branch (4539:21): [True: 0, False: 0]
  ------------------
 4540|       |
 4541|      0|                    DEBUGMSGTL(("snmpv3_contextid",
  ------------------
  |  |   68|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (68:70): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4542|      0|                                "  responding with our engineID\n"));
 4543|       |
 4544|      0|                    snmp_pdu_add_variable(pdu2,
 4545|      0|                                          snmpEngineIDoid, snmpEngineIDoid_len,
 4546|      0|                                          ASN_OCTET_STR,
  ------------------
  |  |   78|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
 4547|      0|                                          ourEngineID, ourEngineID_len);
 4548|       |                    
 4549|       |                    /* send the response */
 4550|      0|                    if (0 == snmp_sess_send(slp, pdu2)) {
  ------------------
  |  Branch (4550:25): [True: 0, False: 0]
  ------------------
 4551|       |
 4552|      0|                        DEBUGMSGTL(("snmpv3_contextid",
  ------------------
  |  |   68|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (68:70): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4553|      0|                                    "  sent it off!\n"));
 4554|       |
 4555|      0|                        snmp_free_pdu(pdu2);
 4556|       |                        
 4557|      0|                        snmp_log(LOG_ERR, "sending a response to the context engineID probe failed\n");
 4558|      0|                    }
 4559|      0|                } else {
 4560|      0|                    snmp_log(LOG_ERR, "failed to get our own engineID!\n");
 4561|      0|                }
 4562|      0|            } else {
 4563|      0|                snmp_log(LOG_WARNING,
 4564|      0|                         "received an odd context engineID probe\n");
 4565|      0|            }
 4566|      0|        }
 4567|       |
 4568|      0|        break;
 4569|      0|    case SNMPERR_BAD_VERSION:
  ------------------
  |  |  231|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
  |  Branch (4569:5): [True: 0, False: 2.71k]
  ------------------
 4570|      0|        ERROR_MSG("error parsing snmp message version");
  ------------------
  |  |  190|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4571|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  681|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4572|      0|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  231|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 4573|      0|        break;
 4574|       |
 4575|      0|        unsupported_version:  /* goto label */
 4576|      0|    case SNMP_VERSION_sec:
  ------------------
  |  |  118|      0|#define SNMP_VERSION_sec   128  /* not (will never be) supported by this code */
  ------------------
  |  Branch (4576:5): [True: 0, False: 2.71k]
  ------------------
 4577|      0|    case SNMP_VERSION_2u:
  ------------------
  |  |  112|      0|#define SNMP_VERSION_2u    2    /* not (will never be) supported by this code */
  ------------------
  |  Branch (4577:5): [True: 0, False: 2.71k]
  ------------------
 4578|      0|    case SNMP_VERSION_2star:
  ------------------
  |  |  120|      0|#define SNMP_VERSION_2star 130  /* not (will never be) supported by this code */
  ------------------
  |  Branch (4578:5): [True: 0, False: 2.71k]
  ------------------
 4579|      0|    case SNMP_VERSION_2p:
  ------------------
  |  |  119|      0|#define SNMP_VERSION_2p	   129  /* no longer supported by this code (> 4.0) */
  ------------------
  |  Branch (4579:5): [True: 0, False: 2.71k]
  ------------------
 4580|      0|    default:
  ------------------
  |  Branch (4580:5): [True: 0, False: 2.71k]
  ------------------
 4581|      0|        ERROR_MSG("unsupported snmp message version");
  ------------------
  |  |  190|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4582|      0|        snmp_increment_statistic(STAT_SNMPINBADVERSIONS);
  ------------------
  |  |  678|      0|#define  STAT_SNMPINBADVERSIONS              11
  ------------------
 4583|       |
 4584|       |        /*
 4585|       |         * need better way to determine OS independent
 4586|       |         * INT32_MAX value, for now hardcode
 4587|       |         */
 4588|      0|        if (pdu->version < 0 || pdu->version > 2147483647) {
  ------------------
  |  Branch (4588:13): [True: 0, False: 0]
  |  Branch (4588:33): [True: 0, False: 0]
  ------------------
 4589|      0|            snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  681|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4590|      0|        }
 4591|      0|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  231|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 4592|      0|        break;
 4593|  2.71k|    }
 4594|       |
 4595|  1.39k|    return result;
 4596|  2.71k|}

snmp_comstr_parse:
  109|  2.71k|{
  110|  2.71k|    u_char          type;
  111|  2.71k|    long            ver;
  112|  2.71k|    size_t          origlen = *slen;
  113|       |
  114|       |    /*
  115|       |     * Message is an ASN.1 SEQUENCE.
  116|       |     */
  117|  2.71k|    data = asn_parse_sequence(data, length, &type,
  118|  2.71k|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   84|  2.71k|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   96|  2.71k|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
  119|  2.71k|                              "auth message");
  120|  2.71k|    if (data == NULL) {
  ------------------
  |  Branch (120:9): [True: 324, False: 2.38k]
  ------------------
  121|    324|        return NULL;
  122|    324|    }
  123|       |
  124|       |    /*
  125|       |     * First field is the version.
  126|       |     */
  127|  2.38k|    DEBUGDUMPHEADER("recv", "SNMP version");
  ------------------
  |  |   81|  2.38k|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|  2.38k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 2.38k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  180|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  177|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  181|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  182|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (184:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  185|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (185:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  187|      0|        } else { \
  |  |  |  |  188|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  189|      0|        } \
  |  |  |  |  190|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:55): [Folded - Ignored]
  |  |  ------------------
  ------------------
  128|  2.38k|    data = asn_parse_int(data, length, &type, &ver, sizeof(ver));
  129|  2.38k|    DEBUGINDENTLESS();
  ------------------
  |  |   77|  2.38k|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  146|  2.38k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 2.38k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  176|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (77:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
  130|  2.38k|    *version = ver;
  131|  2.38k|    if (data == NULL) {
  ------------------
  |  Branch (131:9): [True: 162, False: 2.22k]
  ------------------
  132|    162|        ERROR_MSG("bad parse of version");
  ------------------
  |  |  190|    162|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  133|    162|        return NULL;
  134|    162|    }
  135|       |
  136|       |    /*
  137|       |     * second field is the community string for SNMPv1 & SNMPv2c 
  138|       |     */
  139|  2.22k|    DEBUGDUMPHEADER("recv", "community string");
  ------------------
  |  |   81|  2.22k|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|  2.22k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 2.22k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  180|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  177|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  181|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  182|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (184:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  185|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (185:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  187|      0|        } else { \
  |  |  |  |  188|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  189|      0|        } \
  |  |  |  |  190|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:55): [Folded - Ignored]
  |  |  ------------------
  ------------------
  140|  2.22k|    data = asn_parse_string(data, length, &type, psid, slen);
  141|  2.22k|    DEBUGINDENTLESS();
  ------------------
  |  |   77|  2.22k|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  146|  2.22k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 2.22k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  176|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (77:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
  142|  2.22k|    if (data == NULL) {
  ------------------
  |  Branch (142:9): [True: 734, False: 1.49k]
  ------------------
  143|    734|        ERROR_MSG("bad parse of community");
  ------------------
  |  |  190|    734|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  144|    734|        return NULL;
  145|    734|    }
  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.48k]
  |  |  ------------------
  ------------------
  147|  1.49k|    return (u_char *) data;
  148|       |
  149|  2.22k|}                               /* end snmp_comstr_parse() */

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

snmp_get_do_debugging:
  547|   271k|{
  548|   271k|    return dodebug;
  549|   271k|}

se_add_pair_to_list:
  289|      2|{
  290|      2|    struct snmp_enum_list *lastnode = NULL, *tmp;
  291|       |
  292|      2|    if (!list)
  ------------------
  |  Branch (292:9): [True: 0, False: 2]
  ------------------
  293|      0|        return SE_DNE;
  ------------------
  |  |   45|      0|#define SE_DNE           -2
  ------------------
  294|       |
  295|      2|    tmp = *list;
  296|      2|    while (tmp) {
  ------------------
  |  Branch (296:12): [True: 0, False: 2]
  ------------------
  297|      0|        if (tmp->value == value) {
  ------------------
  |  Branch (297:13): [True: 0, False: 0]
  ------------------
  298|      0|            free(label);
  299|      0|            return (SE_ALREADY_THERE);
  ------------------
  |  |   44|      0|#define SE_ALREADY_THERE 2
  ------------------
  300|      0|        }
  301|      0|        lastnode = tmp;
  302|      0|        tmp = tmp->next;
  303|      0|    }
  304|       |
  305|      2|    if (lastnode) {
  ------------------
  |  Branch (305:9): [True: 0, False: 2]
  ------------------
  306|      0|        lastnode->next = SNMP_MALLOC_STRUCT(snmp_enum_list);
  ------------------
  |  |   69|      0|#define SNMP_MALLOC_STRUCT(s)   (struct s *) calloc(1, sizeof(struct s))
  ------------------
  307|      0|        lastnode = lastnode->next;
  308|      2|    } else {
  309|      2|        (*list) = SNMP_MALLOC_STRUCT(snmp_enum_list);
  ------------------
  |  |   69|      2|#define SNMP_MALLOC_STRUCT(s)   (struct s *) calloc(1, sizeof(struct s))
  ------------------
  310|      2|        lastnode = (*list);
  311|      2|    }
  312|      2|    if (!lastnode) {
  ------------------
  |  Branch (312:9): [True: 0, False: 2]
  ------------------
  313|      0|        free(label);
  314|      0|        return (SE_NOMEM);
  ------------------
  |  |   43|      0|#define SE_NOMEM         1
  ------------------
  315|      0|    }
  316|      2|    lastnode->label = label;
  317|      2|    lastnode->value = value;
  318|      2|    lastnode->next = NULL;
  319|      2|    return (SE_OK);
  ------------------
  |  |   42|      2|#define SE_OK            0
  ------------------
  320|      2|}
se_find_slist:
  352|      2|{
  353|      2|    struct snmp_enum_list **ptr = se_find_slist_ptr(listname);
  354|      2|    return ptr ? *ptr : NULL;
  ------------------
  |  Branch (354:12): [True: 0, False: 2]
  ------------------
  355|      2|}
se_add_pair_to_slist:
  385|      2|{
  386|      2|    struct snmp_enum_list *list = se_find_slist(listname);
  387|      2|    int             created = (list) ? 1 : 0;
  ------------------
  |  Branch (387:31): [True: 0, False: 2]
  ------------------
  388|      2|    int             ret = se_add_pair_to_list(&list, label, value);
  389|       |
  390|      2|    if (!created) {
  ------------------
  |  Branch (390:9): [True: 2, False: 0]
  ------------------
  391|      2|        struct snmp_enum_list_str *sptr =
  392|      2|            SNMP_MALLOC_STRUCT(snmp_enum_list_str);
  ------------------
  |  |   69|      2|#define SNMP_MALLOC_STRUCT(s)   (struct s *) calloc(1, sizeof(struct s))
  ------------------
  393|      2|        if (!sptr) {
  ------------------
  |  Branch (393:13): [True: 0, False: 2]
  ------------------
  394|      0|            free_enum_list(list);
  395|      0|            return SE_NOMEM;
  ------------------
  |  |   43|      0|#define SE_NOMEM         1
  ------------------
  396|      0|        }
  397|      2|        sptr->next = sliststorage;
  398|      2|        sptr->name = strdup(listname);
  399|      2|        if (!sptr->name) {
  ------------------
  |  Branch (399:13): [True: 0, False: 2]
  ------------------
  400|      0|            free(sptr);
  401|      0|            free_enum_list(list);
  402|      0|            return SE_NOMEM;
  ------------------
  |  |   43|      0|#define SE_NOMEM         1
  ------------------
  403|      0|        }
  404|      2|        sptr->list = list;
  405|      2|        sliststorage = sptr;
  406|      2|    }
  407|      2|    return ret;
  408|      2|}
snmp_enum.c:se_find_slist_ptr:
  338|      2|{
  339|      2|    struct snmp_enum_list_str *sptr;
  340|      2|    if (!listname)
  ------------------
  |  Branch (340:9): [True: 0, False: 2]
  ------------------
  341|      0|        return NULL;
  342|       |
  343|      2|    for (sptr = sliststorage; sptr != NULL; sptr = sptr->next)
  ------------------
  |  Branch (343:31): [True: 0, False: 2]
  ------------------
  344|      0|        if (sptr->name && strcmp(sptr->name, listname) == 0)
  ------------------
  |  Branch (344:13): [True: 0, False: 0]
  |  Branch (344:27): [True: 0, False: 0]
  ------------------
  345|      0|            return &sptr->list;
  346|       |
  347|      2|    return NULL;
  348|      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:
 1093|    192|{
 1094|    192|    static int      newline = 1;	 /* MTCRITICAL_RESOURCE */
 1095|    192|    const char     *newline_ptr;
 1096|    192|    char            sbuf[40];
 1097|       |
 1098|    192|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|    192|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1098:9): [True: 0, False: 192]
  ------------------
 1099|    192|                               NETSNMP_DS_LIB_LOG_TIMESTAMP) && newline) {
  ------------------
  |  |   64|    192|#define NETSNMP_DS_LIB_LOG_TIMESTAMP       5
  ------------------
  |  Branch (1099:65): [True: 0, False: 0]
  ------------------
 1100|      0|        sprintf_stamp(NULL, sbuf);
 1101|    192|    } else {
 1102|    192|        strcpy(sbuf, "");
 1103|    192|    }
 1104|       |    /*
 1105|       |     * Remember whether or not the current line ends with a newline for the
 1106|       |     * next call of log_handler_stdouterr().
 1107|       |     */
 1108|    192|    newline_ptr = strrchr(str, '\n');
 1109|    192|    newline = newline_ptr && newline_ptr[1] == 0;
  ------------------
  |  Branch (1109:15): [True: 192, False: 0]
  |  Branch (1109:30): [True: 192, False: 0]
  ------------------
 1110|       |
 1111|    192|    if (logh->imagic)
  ------------------
  |  Branch (1111:9): [True: 0, False: 192]
  ------------------
 1112|      0|       printf(         "%s%s", sbuf, str);
 1113|    192|    else
 1114|    192|       fprintf(stderr, "%s%s", sbuf, str);
 1115|       |
 1116|    192|    return 1;
 1117|    192|}
snmp_log_string:
 1284|    192|{
 1285|    192|#ifndef NETSNMP_FEATURE_REMOVE_LOGGING_STDIO
 1286|    192|    static int stderr_enabled = 0;
 1287|    192|    static netsnmp_log_handler lh = { 1, 0, 0, 0, "stderr",
 1288|    192|                                      log_handler_stdouterr, 0, NULL,  NULL,
 1289|    192|                                      NULL };
 1290|    192|#endif /* NETSNMP_FEATURE_REMOVE_LOGGING_STDIO */
 1291|    192|    netsnmp_log_handler *logh;
 1292|       |
 1293|       |    /*
 1294|       |     * We've got to be able to log messages *somewhere*!
 1295|       |     * If you don't want stderr logging, then enable something else.
 1296|       |     */
 1297|    192|    if (0 == logh_enabled) {
  ------------------
  |  Branch (1297:9): [True: 192, False: 0]
  ------------------
 1298|    192|#ifndef NETSNMP_FEATURE_REMOVE_LOGGING_STDIO
 1299|    192|        if (!stderr_enabled) {
  ------------------
  |  Branch (1299:13): [True: 1, False: 191]
  ------------------
 1300|      1|            ++stderr_enabled;
 1301|      1|            netsnmp_set_line_buffering(stderr);
 1302|      1|        }
 1303|    192|        log_handler_stdouterr( &lh, priority, str );
 1304|    192|#endif /* NETSNMP_FEATURE_REMOVE_LOGGING_STDIO */
 1305|       |
 1306|    192|        return;
 1307|    192|    }
 1308|      0|#ifndef NETSNMP_FEATURE_REMOVE_LOGGING_STDIO
 1309|      0|    else if (stderr_enabled) {
  ------------------
  |  Branch (1309:14): [True: 0, False: 0]
  ------------------
 1310|      0|        stderr_enabled = 0;
 1311|      0|        log_handler_stdouterr( &lh, LOG_INFO,
 1312|      0|                               "Log handling defined - disabling stderr\n" );
 1313|      0|    }
 1314|      0|#endif /* NETSNMP_FEATURE_REMOVE_LOGGING_STDIO */
 1315|       |        
 1316|       |
 1317|       |    /*
 1318|       |     * Start at the given priority, and work "upwards"....
 1319|       |     */
 1320|      0|    if (priority > LOG_DEBUG)
  ------------------
  |  Branch (1320:9): [True: 0, False: 0]
  ------------------
 1321|      0|        priority = LOG_DEBUG;
 1322|      0|    logh = logh_priorities[priority];
 1323|      0|    for ( ; logh; logh = logh->next ) {
  ------------------
  |  Branch (1323:13): [True: 0, False: 0]
  ------------------
 1324|       |        /*
 1325|       |         * ... but skipping any handlers with a "maximum priority"
 1326|       |         *     that we have already exceeded. And don't forget to
 1327|       |         *     ensure this logging is turned on (see snmp_disable_stderrlog
 1328|       |         *     and its cohorts).
 1329|       |         */
 1330|      0|        if (logh->enabled && priority <= logh->pri_max)
  ------------------
  |  Branch (1330:13): [True: 0, False: 0]
  |  Branch (1330:30): [True: 0, False: 0]
  ------------------
 1331|      0|            logh->handler( logh, priority, str );
 1332|      0|    }
 1333|      0|}
snmp_vlog:
 1371|    192|{
 1372|    192|    char           *buffer = NULL;
 1373|    192|    int             length;
 1374|       |
 1375|    192|    length = vasprintf(&buffer, format, ap);
 1376|    192|    if (length < 0) {
  ------------------
  |  Branch (1376:9): [True: 0, False: 192]
  ------------------
 1377|      0|        snmp_log_string(LOG_ERR, "Could not format log-string\n");
 1378|      0|        return -1;
 1379|      0|    }
 1380|       |
 1381|    192|    snmp_log_string(priority, buffer);
 1382|    192|    free(buffer);
 1383|    192|    return 0;
 1384|    192|}
snmp_log:
 1395|    192|{
 1396|    192|    va_list         ap;
 1397|    192|    int             ret;
 1398|    192|    va_start(ap, format);
 1399|    192|    ret = snmp_vlog(priority, format, ap);
 1400|    192|    va_end(ap);
 1401|    192|    return (ret);
 1402|    192|}

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

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

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

