asn_parse_nlength:
  327|  89.9k|{
  328|  89.9k|    int len_len;
  329|       |
  330|  89.9k|    if (pkt_len < 1)
  ------------------
  |  Branch (330:9): [True: 0, False: 89.9k]
  ------------------
  331|      0|        return NULL;               /* always too short */
  332|       |
  333|  89.9k|    if (NULL == pkt || NULL == data_len)
  ------------------
  |  Branch (333:9): [True: 0, False: 89.9k]
  |  Branch (333:24): [True: 0, False: 89.9k]
  ------------------
  334|      0|        return NULL;
  335|       |
  336|  89.9k|    *data_len = 0;
  337|       |
  338|  89.9k|    if (*pkt & 0x80) {
  ------------------
  |  Branch (338:9): [True: 12.6k, False: 77.2k]
  ------------------
  339|       |        /*
  340|       |         * long length; first byte is length of length (after masking high bit)
  341|       |         */
  342|  12.6k|        len_len = (int) ((*pkt & ~0x80) + 1);
  343|  12.6k|        if (pkt_len < len_len)
  ------------------
  |  Branch (343:13): [True: 112, False: 12.5k]
  ------------------
  344|    112|            return NULL;           /* still too short for length and data */
  345|       |
  346|       |        /* now we know we have enough data to parse length */
  347|  12.5k|        if (NULL == asn_parse_length(pkt, data_len))
  ------------------
  |  Branch (347:13): [True: 369, False: 12.1k]
  ------------------
  348|    369|            return NULL;           /* propagate error from asn_parse_length */
  349|  77.2k|    } else {
  350|       |        /*
  351|       |         * short length; first byte is the length
  352|       |         */
  353|  77.2k|        len_len = 1;
  354|  77.2k|        *data_len = *pkt;
  355|  77.2k|    }
  356|       |
  357|  89.4k|    if ((*data_len + len_len) > pkt_len)
  ------------------
  |  Branch (357:9): [True: 1.11k, False: 88.3k]
  ------------------
  358|  1.11k|        return NULL;
  359|       |
  360|  88.3k|    return (pkt + len_len);
  361|  89.4k|}
asn_parse_int:
  563|  9.12k|{
  564|       |    /*
  565|       |     * ASN.1 integer ::= 0x02 asnlength byte {byte}*
  566|       |     */
  567|  9.12k|    static const char *errpre = "parse int";
  568|  9.12k|    register u_char *bufp = data;
  569|  9.12k|    u_long          asn_length;
  570|  9.12k|    int             i;
  571|  9.12k|    union {
  572|  9.12k|        long          l;
  573|  9.12k|        unsigned char b[sizeof(long)];
  574|  9.12k|    } value;
  575|       |
  576|  9.12k|    if (NULL == data || NULL == datalength || NULL == type || NULL == intp) {
  ------------------
  |  Branch (576:9): [True: 0, False: 9.12k]
  |  Branch (576:25): [True: 0, False: 9.12k]
  |  Branch (576:47): [True: 0, False: 9.12k]
  |  Branch (576:63): [True: 0, False: 9.12k]
  ------------------
  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.12k|    if (intsize != sizeof(long)) {
  ------------------
  |  Branch (581:9): [True: 0, False: 9.12k]
  ------------------
  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.12k|    if (*datalength < 2) {
  ------------------
  |  Branch (587:9): [True: 81, False: 9.04k]
  ------------------
  588|     81|        _asn_short_err(errpre, *datalength, 2);
  589|     81|        return NULL;
  590|     81|    }
  591|       |
  592|  9.04k|    *type = *bufp++;
  593|  9.04k|    if (*type != ASN_INTEGER) {
  ------------------
  |  |   75|  9.04k|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (593:9): [True: 30, False: 9.01k]
  ------------------
  594|     30|        _asn_type_err(errpre, *type);
  595|     30|        return NULL;
  596|     30|    }
  597|       |
  598|  9.01k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
  599|  9.01k|    if (NULL == bufp) {
  ------------------
  |  Branch (599:9): [True: 287, False: 8.72k]
  ------------------
  600|    287|        _asn_short_err(errpre, *datalength - 1, asn_length);
  601|    287|        return NULL;
  602|    287|    }
  603|       |
  604|  8.72k|    if ((size_t) asn_length > intsize || (int) asn_length == 0) {
  ------------------
  |  Branch (604:9): [True: 34, False: 8.69k]
  |  Branch (604:42): [True: 14, False: 8.67k]
  ------------------
  605|     48|        _asn_length_err(errpre, (size_t) asn_length, intsize);
  606|     48|        return NULL;
  607|     48|    }
  608|       |
  609|  8.67k|    *datalength -= (int) asn_length + (bufp - data);
  610|       |
  611|  8.67k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   85|  8.67k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  146|  8.67k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 8.67k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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.67k|    memset(&value.b, *bufp & 0x80 ? 0xff : 0, sizeof(value.b));
  ------------------
  |  Branch (613:22): [True: 1.94k, False: 6.73k]
  ------------------
  614|  8.67k|    if (NETSNMP_BIGENDIAN) {
  ------------------
  |  | 2363|  8.67k|#  define NETSNMP_BIGENDIAN 0
  |  |  ------------------
  |  |  |  Branch (2363: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.67k|    } else {
  618|  22.9k|        for (i = asn_length - 1; asn_length--; i--)
  ------------------
  |  Branch (618:34): [True: 14.2k, False: 8.67k]
  ------------------
  619|  14.2k|            value.b[i] = *bufp++;
  620|  8.67k|    }
  621|       |
  622|  8.67k|    CHECK_OVERFLOW_S(value.l, 1);
  ------------------
  |  |  214|  8.67k|#define CHECK_OVERFLOW_S(x,y) do {                                      \
  |  |  215|  8.67k|        if (x > INT32_MAX) {                                            \
  |  |  ------------------
  |  |  |  Branch (215:13): [True: 323, False: 8.35k]
  |  |  ------------------
  |  |  216|    323|            DEBUGMSG(("asn","truncating signed value %ld to 32 bits (%d)\n",(long)(x),y)); \
  |  |  ------------------
  |  |  |  |   63|    323|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  146|    323|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (146:29): [True: 0, False: 323]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (63:67): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  217|    323|            x &= 0xffffffff;                                            \
  |  |  218|  8.35k|        } else if (x < INT32_MIN) {                                     \
  |  |  ------------------
  |  |  |  Branch (218:20): [True: 406, False: 7.94k]
  |  |  ------------------
  |  |  219|    406|            DEBUGMSG(("asn","truncating signed value %ld to 32 bits (%d)\n",(long)(x),y)); \
  |  |  ------------------
  |  |  |  |   63|    406|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  146|    406|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (146:29): [True: 0, False: 406]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (63:67): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  220|    406|            x = 0 - (x & 0xffffffff);                                   \
  |  |  221|    406|        }                                                               \
  |  |  222|  8.67k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (222:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  623|       |
  624|  8.67k|    DEBUGMSG(("dumpv_recv", "  Integer:\t%ld (0x%.2lX)\n", value.l, value.l));
  ------------------
  |  |   63|  8.67k|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  146|  8.67k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 8.67k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:67): [Folded - Ignored]
  |  |  ------------------
  ------------------
  625|       |
  626|  8.67k|    *intp = value.l;
  627|  8.67k|    return bufp;
  628|  8.72k|}
asn_parse_unsigned_int:
  656|  3.23k|{
  657|       |    /*
  658|       |     * ASN.1 integer ::= 0x02 asnlength byte {byte}*
  659|       |     */
  660|  3.23k|    static const char *errpre = "parse uint";
  661|  3.23k|    register u_char *bufp = data;
  662|  3.23k|    u_long          asn_length;
  663|  3.23k|    register u_long value = 0;
  664|       |
  665|  3.23k|    if (NULL == data || NULL == datalength || NULL == type || NULL == intp) {
  ------------------
  |  Branch (665:9): [True: 0, False: 3.23k]
  |  Branch (665:25): [True: 0, False: 3.23k]
  |  Branch (665:47): [True: 0, False: 3.23k]
  |  Branch (665:63): [True: 0, False: 3.23k]
  ------------------
  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|  3.23k|    if (intsize != sizeof(long)) {
  ------------------
  |  Branch (670:9): [True: 0, False: 3.23k]
  ------------------
  671|      0|        _asn_size_err(errpre, intsize, sizeof(long));
  672|      0|        return NULL;
  673|      0|    }
  674|       |
  675|       |    /** need at least 2 bytes to work with: type, length (which might be 0)  */
  676|  3.23k|    if (*datalength < 2) {
  ------------------
  |  Branch (676:9): [True: 1, False: 3.23k]
  ------------------
  677|      1|        _asn_short_err(errpre, *datalength, 2);
  678|      1|        return NULL;
  679|      1|    }
  680|       |
  681|  3.23k|    *type = *bufp++;
  682|  3.23k|    if (*type != ASN_COUNTER && *type != ASN_GAUGE && *type != ASN_TIMETICKS
  ------------------
  |  |   89|  6.46k|#define ASN_COUNTER	(ASN_APPLICATION | 1)
  |  |  ------------------
  |  |  |  |   91|  3.23k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if (*type != ASN_COUNTER && *type != ASN_GAUGE && *type != ASN_TIMETICKS
  ------------------
  |  |   90|  5.70k|#define ASN_GAUGE	(ASN_APPLICATION | 2)
  |  |  ------------------
  |  |  |  |   91|  2.47k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if (*type != ASN_COUNTER && *type != ASN_GAUGE && *type != ASN_TIMETICKS
  ------------------
  |  |   92|  5.11k|#define ASN_TIMETICKS   (ASN_APPLICATION | 3)
  |  |  ------------------
  |  |  |  |   91|  1.88k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (682:9): [True: 2.47k, False: 756]
  |  Branch (682:33): [True: 1.88k, False: 591]
  |  Branch (682:55): [True: 866, False: 1.01k]
  ------------------
  683|  3.23k|            && *type != ASN_UINTEGER) {
  ------------------
  |  |  100|    866|#define ASN_UINTEGER    (ASN_APPLICATION | 7)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|    866|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (683:16): [True: 20, False: 846]
  ------------------
  684|     20|        _asn_type_err(errpre, *type);
  685|     20|        return NULL;
  686|     20|    }
  687|       |
  688|  3.21k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
  689|  3.21k|    if (NULL == bufp) {
  ------------------
  |  Branch (689:9): [True: 139, False: 3.07k]
  ------------------
  690|    139|        _asn_short_err(errpre, *datalength - 1, asn_length);
  691|    139|        return NULL;
  692|    139|    }
  693|       |
  694|  3.07k|    if ((asn_length > (intsize + 1)) || ((int) asn_length == 0) ||
  ------------------
  |  Branch (694:9): [True: 6, False: 3.06k]
  |  Branch (694:41): [True: 16, False: 3.04k]
  ------------------
  695|  3.07k|        ((asn_length == intsize + 1) && *bufp != 0x00)) {
  ------------------
  |  Branch (695:10): [True: 305, False: 2.74k]
  |  Branch (695:41): [True: 5, False: 300]
  ------------------
  696|     27|        _asn_length_err(errpre, (size_t) asn_length, intsize);
  697|     27|        return NULL;
  698|     27|    }
  699|  3.04k|    *datalength -= (int) asn_length + (bufp - data);
  700|       |
  701|  3.04k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   85|  3.04k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  146|  3.04k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 3.04k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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|  11.5k|    while (asn_length--)
  ------------------
  |  Branch (703:12): [True: 8.54k, False: 3.04k]
  ------------------
  704|  8.54k|        value = (value << 8) | *bufp++;
  705|       |
  706|  3.04k|    CHECK_OVERFLOW_U(value,2);
  ------------------
  |  |  224|  3.04k|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|  3.04k|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 808, False: 2.23k]
  |  |  ------------------
  |  |  226|    808|            x &= 0xffffffff;                                            \
  |  |  227|    808|            DEBUGMSG(("asn","truncating unsigned value to 32 bits (%d)\n",y)); \
  |  |  ------------------
  |  |  |  |   63|    808|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  146|    808|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (146:29): [True: 0, False: 808]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (63:67): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  228|    808|        }                                                               \
  |  |  229|  3.04k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  707|       |
  708|  3.04k|    DEBUGMSG(("dumpv_recv", "  UInteger:\t%ld (0x%.2lX)\n", value, value));
  ------------------
  |  |   63|  3.04k|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  146|  3.04k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 3.04k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:67): [Folded - Ignored]
  |  |  ------------------
  ------------------
  709|       |
  710|  3.04k|    *intp = value;
  711|  3.04k|    return bufp;
  712|  3.07k|}
asn_parse_string:
  916|  6.20k|{
  917|  6.20k|    static const char *errpre = "parse string";
  918|  6.20k|    u_char         *bufp = data;
  919|  6.20k|    u_long          asn_length;
  920|       |
  921|  6.20k|    if (NULL == data || NULL == datalength || NULL == type || NULL == str ||
  ------------------
  |  Branch (921:9): [True: 0, False: 6.20k]
  |  Branch (921:25): [True: 0, False: 6.20k]
  |  Branch (921:47): [True: 0, False: 6.20k]
  |  Branch (921:63): [True: 0, False: 6.20k]
  ------------------
  922|  6.20k|        NULL == strlength) {
  ------------------
  |  Branch (922:9): [True: 0, False: 6.20k]
  ------------------
  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|  6.20k|    if (*datalength < 2) {
  ------------------
  |  Branch (928:9): [True: 302, False: 5.90k]
  ------------------
  929|    302|        _asn_short_err(errpre, *datalength, 2);
  930|    302|        return NULL;
  931|    302|    }
  932|       |
  933|  5.90k|    *type = *bufp++;
  934|  5.90k|    if (*type != ASN_OCTET_STR && *type != ASN_IPADDRESS && *type != ASN_OPAQUE
  ------------------
  |  |   78|  11.8k|#define ASN_OCTET_STR	    0x04U
  ------------------
                  if (*type != ASN_OCTET_STR && *type != ASN_IPADDRESS && *type != ASN_OPAQUE
  ------------------
  |  |   88|  9.91k|#define ASN_IPADDRESS   (ASN_APPLICATION | 0)
  |  |  ------------------
  |  |  |  |   91|  4.01k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if (*type != ASN_OCTET_STR && *type != ASN_IPADDRESS && *type != ASN_OPAQUE
  ------------------
  |  |   93|  9.19k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  3.29k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (934:9): [True: 4.01k, False: 1.88k]
  |  Branch (934:35): [True: 3.29k, False: 726]
  |  Branch (934:61): [True: 1.46k, False: 1.82k]
  ------------------
  935|  5.90k|            && *type != ASN_NSAP) {
  ------------------
  |  |   98|  1.46k|#define ASN_NSAP	(ASN_APPLICATION | 5)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|  1.46k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (935:16): [True: 430, False: 1.03k]
  ------------------
  936|    430|        _asn_type_err(errpre, *type);
  937|    430|        return NULL;
  938|    430|    }
  939|       |
  940|  5.47k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
  941|  5.47k|    if (NULL == bufp) {
  ------------------
  |  Branch (941:9): [True: 146, False: 5.32k]
  ------------------
  942|    146|        _asn_short_err(errpre, *datalength - 1, asn_length);
  943|    146|        return NULL;
  944|    146|    }
  945|       |
  946|  5.32k|    if (asn_length > *strlength) {
  ------------------
  |  Branch (946:9): [True: 39, False: 5.28k]
  ------------------
  947|     39|        _asn_length_err(errpre, (size_t) asn_length, *strlength);
  948|     39|        return NULL;
  949|     39|    }
  950|       |
  951|  5.28k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   85|  5.28k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  146|  5.28k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 5.28k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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|  5.28k|    memmove(str, bufp, asn_length);
  954|  5.28k|    if (*strlength > asn_length)
  ------------------
  |  Branch (954:9): [True: 2.36k, False: 2.92k]
  ------------------
  955|  2.36k|        str[asn_length] = 0;
  956|  5.28k|    *strlength = asn_length;
  957|  5.28k|    *datalength -= asn_length + (bufp - data);
  958|       |
  959|  5.28k|    DEBUGIF("dumpv_recv") {
  ------------------
  |  |  147|  5.28k|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  146|  10.5k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 5.28k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  215|      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|  5.28k|    return bufp + asn_length;
  980|  5.32k|}
asn_parse_header:
 1077|  42.1k|{
 1078|  42.1k|    register u_char *bufp;
 1079|  42.1k|    u_long          asn_length = 0;
 1080|  42.1k|    const char      *errpre = "parse header";
 1081|       |
 1082|  42.1k|    if (!data || !datalength || !type) {
  ------------------
  |  Branch (1082:9): [True: 0, False: 42.1k]
  |  Branch (1082:18): [True: 0, False: 42.1k]
  |  Branch (1082:33): [True: 0, False: 42.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|  42.1k|    if (*datalength < 2) {
  ------------------
  |  Branch (1088:9): [True: 406, False: 41.7k]
  ------------------
 1089|    406|        _asn_short_err(errpre, *datalength, 2);
 1090|    406|        return NULL;
 1091|    406|    }
 1092|       |
 1093|  41.7k|    bufp = data;
 1094|       |    /*
 1095|       |     * this only works on data types < 30, i.e. no extension octets 
 1096|       |     */
 1097|  41.7k|    if (IS_EXTENSION_ID(*bufp)) {
  ------------------
  |  |  103|  41.7k|#define IS_EXTENSION_ID(byte)	(((byte) & ASN_EXTENSION_ID) == ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|  41.7k|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  |  |               #define IS_EXTENSION_ID(byte)	(((byte) & ASN_EXTENSION_ID) == ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|  41.7k|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  |  |  |  Branch (103:31): [True: 22, False: 41.7k]
  |  |  ------------------
  ------------------
 1098|     22|        ERROR_MSG("can't process ID >= 30");
  ------------------
  |  |  190|     22|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1099|     22|        return NULL;
 1100|     22|    }
 1101|  41.7k|    *type = *bufp++;
 1102|       |
 1103|  41.7k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 1104|  41.7k|    if (NULL == bufp) {
  ------------------
  |  Branch (1104:9): [True: 840, False: 40.8k]
  ------------------
 1105|    840|        _asn_short_err(errpre, *datalength - 1, asn_length);
 1106|    840|        return NULL;
 1107|    840|    }
 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|  40.8k|#endif
 1119|       |
 1120|  40.8k|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 1121|       |
 1122|  40.8k|    if ((asn_length > 2) && (*type == ASN_OPAQUE) && (*bufp == ASN_OPAQUE_TAG1)) {
  ------------------
  |  |   93|  31.3k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  31.3k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if ((asn_length > 2) && (*type == ASN_OPAQUE) && (*bufp == ASN_OPAQUE_TAG1)) {
  ------------------
  |  |  131|  4.23k|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|  4.23k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|  4.23k|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
  |  Branch (1122:9): [True: 31.3k, False: 9.53k]
  |  Branch (1122:29): [True: 4.23k, False: 27.1k]
  |  Branch (1122:54): [True: 3.69k, False: 537]
  ------------------
 1123|       |
 1124|       |        /*
 1125|       |         * check if 64-but counter 
 1126|       |         */
 1127|  3.69k|        switch (*(bufp + 1)) {
 1128|    521|        case ASN_OPAQUE_COUNTER64:
  ------------------
  |  |  156|    521|#define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  136|    521|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  146|    521|#define ASN_APP_COUNTER64 (ASN_APPLICATION | 6)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    521|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1128:9): [True: 521, False: 3.17k]
  ------------------
 1129|  1.28k|        case ASN_OPAQUE_U64:
  ------------------
  |  |  192|  1.28k|#define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  136|  1.28k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  150|  1.28k|#define ASN_APP_U64 (ASN_APPLICATION | 11)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.28k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1129:9): [True: 766, False: 2.93k]
  ------------------
 1130|  1.58k|        case ASN_OPAQUE_FLOAT:
  ------------------
  |  |  165|  1.58k|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|  1.58k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|  1.58k|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.58k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1130:9): [True: 293, False: 3.40k]
  ------------------
 1131|  1.92k|        case ASN_OPAQUE_DOUBLE:
  ------------------
  |  |  174|  1.92k|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|  1.92k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|  1.92k|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.92k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1131:9): [True: 342, False: 3.35k]
  ------------------
 1132|  3.25k|        case ASN_OPAQUE_I64:
  ------------------
  |  |  183|  3.25k|#define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  136|  3.25k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  149|  3.25k|#define ASN_APP_I64 (ASN_APPLICATION | 10)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  3.25k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1132:9): [True: 1.33k, False: 2.36k]
  ------------------
 1133|  3.25k|            *type = *(bufp + 1);
 1134|  3.25k|            break;
 1135|       |
 1136|    444|        default:
  ------------------
  |  Branch (1136:9): [True: 444, False: 3.25k]
  ------------------
 1137|       |            /*
 1138|       |             * just an Opaque 
 1139|       |             */
 1140|    444|            *datalength = (int) asn_length;
 1141|    444|            return bufp;
 1142|  3.69k|        }
 1143|       |        /*
 1144|       |         * value is encoded as special format 
 1145|       |         */
 1146|  3.25k|        *datalength = (int) asn_length;
 1147|  3.25k|        bufp = asn_parse_nlength(bufp+2, *datalength - 2, &asn_length);
 1148|  3.25k|        if (NULL == bufp) {
  ------------------
  |  Branch (1148:13): [True: 38, False: 3.21k]
  ------------------
 1149|     38|            _asn_short_err("parse opaque header", *datalength - 2, asn_length);
 1150|     38|            return NULL;
 1151|     38|        }
 1152|  3.25k|    }
 1153|  40.4k|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 1154|       |
 1155|  40.4k|    *datalength = (int) asn_length;
 1156|       |
 1157|  40.4k|    return bufp;
 1158|  40.8k|}
asn_parse_sequence:
 1177|  24.8k|{                               /* error message prefix */
 1178|  24.8k|    data = asn_parse_header(data, datalength, type);
 1179|  24.8k|    if (data && (*type != expected_type)) {
  ------------------
  |  Branch (1179:9): [True: 23.5k, False: 1.27k]
  |  Branch (1179:17): [True: 1.66k, False: 21.9k]
  ------------------
 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|  23.1k|    return data;
 1189|  24.8k|}
asn_parse_length:
 1302|  12.5k|{
 1303|  12.5k|    static const char *errpre = "parse length";
 1304|  12.5k|    char            ebuf[128];
 1305|  12.5k|    register u_char lengthbyte;
 1306|       |
 1307|  12.5k|    if (!data || !length) {
  ------------------
  |  Branch (1307:9): [True: 0, False: 12.5k]
  |  Branch (1307:18): [True: 0, False: 12.5k]
  ------------------
 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|  12.5k|    lengthbyte = *data;
 1312|       |
 1313|  12.5k|    if (lengthbyte & ASN_LONG_LEN) {
  ------------------
  |  |   98|  12.5k|#define ASN_LONG_LEN	    0x80U
  ------------------
  |  Branch (1313:9): [True: 12.5k, False: 0]
  ------------------
 1314|  12.5k|        lengthbyte &= ~ASN_LONG_LEN;    /* turn MSb off */
  ------------------
  |  |   98|  12.5k|#define ASN_LONG_LEN	    0x80U
  ------------------
 1315|  12.5k|        if (lengthbyte == 0) {
  ------------------
  |  Branch (1315:13): [True: 107, False: 12.4k]
  ------------------
 1316|    107|            snprintf(ebuf, sizeof(ebuf),
 1317|    107|                     "%s: indefinite length not supported", errpre);
 1318|    107|            ebuf[ sizeof(ebuf)-1 ] = 0;
 1319|    107|            ERROR_MSG(ebuf);
  ------------------
  |  |  190|    107|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1320|    107|            return NULL;
 1321|    107|        }
 1322|  12.4k|        if (lengthbyte > sizeof(long)) {
  ------------------
  |  Branch (1322:13): [True: 131, False: 12.3k]
  ------------------
 1323|    131|            snprintf(ebuf, sizeof(ebuf),
 1324|    131|                    "%s: data length %d > %lu not supported", errpre,
 1325|    131|                    lengthbyte, (unsigned long)sizeof(long));
 1326|    131|            ebuf[ sizeof(ebuf)-1 ] = 0;
 1327|    131|            ERROR_MSG(ebuf);
  ------------------
  |  |  190|    131|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1328|    131|            return NULL;
 1329|    131|        }
 1330|  12.3k|        data++;
 1331|  12.3k|        *length = 0;            /* protect against short lengths */
 1332|  30.9k|        while (lengthbyte--) {
  ------------------
  |  Branch (1332:16): [True: 18.6k, False: 12.3k]
  ------------------
 1333|  18.6k|            *length <<= 8;
 1334|  18.6k|            *length |= *data++;
 1335|  18.6k|        }
 1336|  12.3k|        if ((long) *length < 0) {
  ------------------
  |  Branch (1336:13): [True: 131, False: 12.1k]
  ------------------
 1337|    131|            snprintf(ebuf, sizeof(ebuf),
 1338|    131|                     "%s: negative data length %ld\n", errpre,
 1339|    131|                     (long) *length);
 1340|    131|            ebuf[ sizeof(ebuf)-1 ] = 0;
 1341|    131|            ERROR_MSG(ebuf);
  ------------------
  |  |  190|    131|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1342|    131|            return NULL;
 1343|    131|        }
 1344|  12.1k|        return data;
 1345|  12.3k|    } else {                    /* short asnlength */
 1346|      0|        *length = (long) lengthbyte;
 1347|      0|        return data + 1;
 1348|      0|    }
 1349|  12.5k|}
asn_parse_objid:
 1450|  18.0k|{
 1451|  18.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|  18.0k|    register u_char *bufp = data;
 1459|  18.0k|    register oid   *oidp = objid + 1;
 1460|  18.0k|    register u_long subidentifier;
 1461|  18.0k|    register long   length;
 1462|  18.0k|    u_long          asn_length;
 1463|  18.0k|    size_t          original_length = *objidlength;
 1464|       |
 1465|  18.0k|    if (NULL == data || NULL == datalength || NULL == type || NULL == objid) {
  ------------------
  |  Branch (1465:9): [True: 0, False: 18.0k]
  |  Branch (1465:25): [True: 0, False: 18.0k]
  |  Branch (1465:47): [True: 0, False: 18.0k]
  |  Branch (1465:63): [True: 0, False: 18.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|  18.0k|    if (*datalength < 2) {
  ------------------
  |  Branch (1471:9): [True: 14, False: 18.0k]
  ------------------
 1472|     14|        _asn_short_err(errpre, *datalength, 2);
 1473|     14|        return NULL;
 1474|     14|    }
 1475|       |
 1476|  18.0k|    *type = *bufp++;
 1477|  18.0k|    if (*type != ASN_OBJECT_ID) {
  ------------------
  |  |   81|  18.0k|#define ASN_OBJECT_ID	    0x06U
  ------------------
  |  Branch (1477:9): [True: 25, False: 17.9k]
  ------------------
 1478|     25|        _asn_type_err(errpre, *type);
 1479|     25|        return NULL;
 1480|     25|    }
 1481|  17.9k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 1482|  17.9k|    if (NULL == bufp) {
  ------------------
  |  Branch (1482:9): [True: 146, False: 17.8k]
  ------------------
 1483|    146|        _asn_short_err(errpre, *datalength - 1, asn_length);
 1484|    146|        return NULL;
 1485|    146|    }
 1486|       |
 1487|  17.8k|    *datalength -= (int) asn_length + (bufp - data);
 1488|       |
 1489|  17.8k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   85|  17.8k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  146|  17.8k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 17.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 || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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|  17.8k|    if (asn_length == 0)
  ------------------
  |  Branch (1494:9): [True: 15.4k, False: 2.41k]
  ------------------
 1495|  15.4k|        objid[0] = objid[1] = 0;
 1496|       |
 1497|  17.8k|    length = asn_length;
 1498|  17.8k|    (*objidlength)--;           /* account for expansion of first byte */
 1499|       |
 1500|  31.1k|    while (length > 0 && (*objidlength)-- > 0) {
  ------------------
  |  Branch (1500:12): [True: 13.3k, False: 17.7k]
  |  Branch (1500:26): [True: 13.3k, False: 27]
  ------------------
 1501|  13.3k|        subidentifier = 0;
 1502|  15.9k|        do {                    /* shift and add in low order 7 bits */
 1503|  15.9k|            subidentifier =
 1504|  15.9k|                (subidentifier << 7) + (*(u_char *) bufp & ~ASN_BIT8);
  ------------------
  |  |  100|  15.9k|#define ASN_BIT8	    0x80U
  ------------------
 1505|  15.9k|            length--;
 1506|  15.9k|        } while ((*(u_char *) bufp++ & ASN_BIT8) && (length > 0));        /* last byte has high bit clear */
  ------------------
  |  |  100|  15.9k|#define ASN_BIT8	    0x80U
  ------------------
  |  Branch (1506:18): [True: 2.61k, False: 13.2k]
  |  Branch (1506:53): [True: 2.59k, False: 20]
  ------------------
 1507|       |
 1508|  13.3k|	if (length == 0) {
  ------------------
  |  Branch (1508:6): [True: 2.37k, False: 10.9k]
  ------------------
 1509|  2.37k|            u_char *last_byte = bufp - 1;
 1510|  2.37k|            if (*last_byte & ASN_BIT8) {
  ------------------
  |  |  100|  2.37k|#define ASN_BIT8	    0x80U
  ------------------
  |  Branch (1510:17): [True: 20, False: 2.35k]
  ------------------
 1511|       |                /* last byte has high bit set -> wrong BER encoded OID */
 1512|     20|                ERROR_MSG("subidentifier syntax error");
  ------------------
  |  |  190|     20|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1513|     20|                return NULL;
 1514|     20|            }
 1515|  2.37k|        }
 1516|  13.2k|        if (subidentifier > MAX_SUBID) {
  ------------------
  |  |   18|  13.2k|#define MAX_SUBID   0xFFFFFFFFUL
  ------------------
  |  Branch (1516:13): [True: 11, False: 13.2k]
  ------------------
 1517|     11|            ERROR_MSG("subidentifier too large");
  ------------------
  |  |  190|     11|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1518|     11|            return NULL;
 1519|     11|        }
 1520|  13.2k|        *oidp++ = (oid) subidentifier;
 1521|  13.2k|    }
 1522|       |
 1523|  17.8k|    if (length || oidp < objid + 1) {
  ------------------
  |  Branch (1523:9): [True: 27, False: 17.7k]
  |  Branch (1523:19): [True: 0, False: 17.7k]
  ------------------
 1524|     27|        ERROR_MSG("OID length exceeds buffer size");
  ------------------
  |  |  190|     27|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1525|     27|        *objidlength = original_length;
 1526|     27|        return NULL;
 1527|     27|    }
 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|  17.7k|    subidentifier = oidp - objid >= 2 ? objid[1] : 0;
  ------------------
  |  Branch (1535:21): [True: 2.35k, False: 15.4k]
  ------------------
 1536|  17.7k|    if (subidentifier == 0x2B) {
  ------------------
  |  Branch (1536:9): [True: 459, False: 17.3k]
  ------------------
 1537|    459|        objid[0] = 1;
 1538|    459|        objid[1] = 3;
 1539|  17.3k|    } else {
 1540|  17.3k|        if (subidentifier < 40) {
  ------------------
  |  Branch (1540:13): [True: 15.8k, False: 1.47k]
  ------------------
 1541|  15.8k|            objid[0] = 0;
 1542|  15.8k|            objid[1] = subidentifier;
 1543|  15.8k|        } else if (subidentifier < 80) {
  ------------------
  |  Branch (1543:20): [True: 761, False: 718]
  ------------------
 1544|    761|            objid[0] = 1;
 1545|    761|            objid[1] = subidentifier - 40;
 1546|    761|        } else {
 1547|    718|            objid[0] = 2;
 1548|    718|            objid[1] = subidentifier - 80;
 1549|    718|        }
 1550|  17.3k|    }
 1551|       |
 1552|  17.7k|    *objidlength = (int) (oidp - objid);
 1553|       |
 1554|  17.7k|    DEBUGMSG(("dumpv_recv", "  ObjID: "));
  ------------------
  |  |   63|  17.7k|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  146|  17.7k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 17.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:67): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1555|  17.7k|    DEBUGMSGOID(("dumpv_recv", objid, *objidlength));
  ------------------
  |  |   69|  17.7k|#define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|  17.7k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 17.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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|  17.7k|    DEBUGMSG(("dumpv_recv", "\n"));
  ------------------
  |  |   63|  17.7k|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  146|  17.7k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 17.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:67): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1557|  17.7k|    return bufp;
 1558|  17.8k|}
asn_parse_bitstring:
 1827|    801|{
 1828|       |    /*
 1829|       |     * bitstring ::= 0x03 asnlength unused {byte}*
 1830|       |     */
 1831|    801|    static const char *errpre = "parse bitstring";
 1832|    801|    register u_char *bufp = data;
 1833|    801|    u_long          asn_length;
 1834|       |
 1835|    801|    if (NULL == data || NULL == datalength || NULL == type ||
  ------------------
  |  Branch (1835:9): [True: 0, False: 801]
  |  Branch (1835:25): [True: 0, False: 801]
  |  Branch (1835:47): [True: 0, False: 801]
  ------------------
 1836|    801|        NULL == str || NULL == strlength) {
  ------------------
  |  Branch (1836:9): [True: 0, False: 801]
  |  Branch (1836:24): [True: 0, False: 801]
  ------------------
 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|    801|    if (*datalength < 2) {
  ------------------
  |  Branch (1842:9): [True: 0, False: 801]
  ------------------
 1843|      0|        _asn_short_err(errpre, *datalength, 2);
 1844|      0|        return NULL;
 1845|      0|    }
 1846|       |
 1847|    801|    *type = *bufp++;
 1848|    801|    if (*type != ASN_BIT_STR) {
  ------------------
  |  |   77|    801|#define ASN_BIT_STR	    0x03U
  ------------------
  |  Branch (1848:9): [True: 0, False: 801]
  ------------------
 1849|      0|        _asn_type_err(errpre, *type);
 1850|      0|        return NULL;
 1851|      0|    }
 1852|       |
 1853|    801|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 1854|    801|    if (NULL == bufp) {
  ------------------
  |  Branch (1854:9): [True: 0, False: 801]
  ------------------
 1855|      0|        _asn_short_err(errpre, *datalength - 1, asn_length);
 1856|      0|        return NULL;
 1857|      0|    }
 1858|       |
 1859|    801|    if ((size_t) asn_length > *strlength) {
  ------------------
  |  Branch (1859:9): [True: 0, False: 801]
  ------------------
 1860|      0|        _asn_length_err(errpre, (size_t) asn_length, *strlength);
 1861|      0|        return NULL;
 1862|      0|    }
 1863|    801|    if (_asn_bitstring_check(errpre, asn_length, *bufp))
  ------------------
  |  Branch (1863:9): [True: 7, False: 794]
  ------------------
 1864|      7|        return NULL;
 1865|       |
 1866|    794|    DEBUGDUMPSETUP("recv", data, bufp - data);
  ------------------
  |  |   85|    794|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  146|    794|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 794]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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|    794|    DEBUGMSG(("dumpv_recv", "  Bitstring: "));
  ------------------
  |  |   63|    794|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  146|    794|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 794]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:67): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1868|    794|    DEBUGMSGHEX(("dumpv_recv", data, asn_length));
  ------------------
  |  |   73|    794|#define DEBUGMSGHEX(x)     do {if (_DBG_IF_) {__DBGMSGHEX(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|    794|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 794]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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|    794|    DEBUGMSG(("dumpv_recv", "\n"));
  ------------------
  |  |   63|    794|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  146|    794|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 794]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:67): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1870|       |
 1871|    794|    memmove(str, bufp, asn_length);
 1872|    794|    *strlength = (int) asn_length;
 1873|    794|    *datalength -= (int) asn_length + (bufp - data);
 1874|    794|    return bufp + asn_length;
 1875|    801|}
asn_parse_unsigned_int64:
 1959|  2.22k|{
 1960|       |    /*
 1961|       |     * ASN.1 integer ::= 0x02 asnlength byte {byte}*
 1962|       |     */
 1963|  2.22k|    static const char *errpre = "parse uint64";
 1964|  2.22k|    const int       uint64sizelimit = (4 * 2) + 1;
 1965|  2.22k|    register u_char *bufp = data;
 1966|  2.22k|    u_long          asn_length;
 1967|  2.22k|    register u_long low = 0, high = 0;
 1968|       |
 1969|  2.22k|    if (countersize != sizeof(struct counter64)) {
  ------------------
  |  Branch (1969:9): [True: 0, False: 2.22k]
  ------------------
 1970|      0|        _asn_size_err(errpre, countersize, sizeof(struct counter64));
 1971|      0|        return NULL;
 1972|      0|    }
 1973|       |
 1974|  2.22k|    if (NULL == data || NULL == datalength || NULL == type || NULL == cp) {
  ------------------
  |  Branch (1974:9): [True: 0, False: 2.22k]
  |  Branch (1974:25): [True: 0, False: 2.22k]
  |  Branch (1974:47): [True: 0, False: 2.22k]
  |  Branch (1974:63): [True: 0, False: 2.22k]
  ------------------
 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.22k|    if (*datalength < 2) {
  ------------------
  |  Branch (1980:9): [True: 0, False: 2.22k]
  ------------------
 1981|      0|        _asn_short_err(errpre, *datalength, 2);
 1982|      0|        return NULL;
 1983|      0|    }
 1984|       |
 1985|  2.22k|    *type = *bufp++;
 1986|  2.22k|    if (*type != ASN_COUNTER64
  ------------------
  |  |   99|  4.44k|#define ASN_COUNTER64   (ASN_APPLICATION | 6)
  |  |  ------------------
  |  |  |  |   91|  2.22k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (1986:9): [True: 1.26k, False: 954]
  ------------------
 1987|  2.22k|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 1988|  2.22k|            && *type != ASN_OPAQUE
  ------------------
  |  |   93|  1.26k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  1.26k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (1988:16): [True: 6, False: 1.26k]
  ------------------
 1989|  2.22k|#endif
 1990|  2.22k|            ) {
 1991|      6|        _asn_type_err(errpre, *type);
 1992|      6|        return NULL;
 1993|      6|    }
 1994|  2.21k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 1995|  2.21k|    if (NULL == bufp) {
  ------------------
  |  Branch (1995:9): [True: 0, False: 2.21k]
  ------------------
 1996|      0|        _asn_short_err(errpre, *datalength - 1, asn_length);
 1997|      0|        return NULL;
 1998|      0|    }
 1999|       |
 2000|  2.21k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   85|  2.21k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  146|  2.21k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 2.21k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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.21k|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 2002|       |    /** need at least 2 bytes: ASN_OPAQUE_TAG1 and ASN_OPAQUE_<type> */
 2003|  2.21k|    if ((*type == ASN_OPAQUE) && (asn_length < 2)) {
  ------------------
  |  |   93|  2.21k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  2.21k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2003:9): [True: 1.26k, False: 954]
  |  Branch (2003:34): [True: 0, False: 1.26k]
  ------------------
 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.21k|    if ((*type == ASN_OPAQUE) &&
  ------------------
  |  |   93|  2.21k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  2.21k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2011:9): [True: 1.26k, False: 954]
  ------------------
 2012|  2.21k|        (asn_length <= ASN_OPAQUE_COUNTER64_MX_BER_LEN) &&
  ------------------
  |  |  160|  1.26k|#define ASN_OPAQUE_COUNTER64_MX_BER_LEN 12
  ------------------
  |  Branch (2012:9): [True: 1.25k, False: 10]
  ------------------
 2013|  2.21k|        (*bufp == ASN_OPAQUE_TAG1) &&
  ------------------
  |  |  131|  1.25k|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|  1.25k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|  1.25k|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
  |  Branch (2013:9): [True: 1.25k, False: 0]
  ------------------
 2014|  2.21k|        ((*(bufp + 1) == ASN_OPAQUE_COUNTER64) ||
  ------------------
  |  |  156|  1.25k|#define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  136|  1.25k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  146|  1.25k|#define ASN_APP_COUNTER64 (ASN_APPLICATION | 6)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.25k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2014:10): [True: 512, False: 741]
  ------------------
 2015|  1.25k|         (*(bufp + 1) == ASN_OPAQUE_U64))) {
  ------------------
  |  |  192|    741|#define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  136|    741|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  150|    741|#define ASN_APP_U64 (ASN_APPLICATION | 11)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    741|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2015:10): [True: 741, False: 0]
  ------------------
 2016|       |        /*
 2017|       |         * change type to Counter64 or U64 
 2018|       |         */
 2019|  1.25k|        *type = *(bufp + 1);
 2020|       |        /*
 2021|       |         * value is encoded as special format 
 2022|       |         */
 2023|  1.25k|        *datalength = asn_length;
 2024|  1.25k|        bufp = asn_parse_nlength(bufp+2, *datalength - 2, &asn_length);
 2025|  1.25k|        if (NULL == bufp) {
  ------------------
  |  Branch (2025:13): [True: 0, False: 1.25k]
  ------------------
 2026|      0|            _asn_short_err("parse opaque uint64", *datalength - 2, asn_length);
 2027|      0|            return NULL;
 2028|      0|        }
 2029|  1.25k|    }
 2030|  2.21k|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 2031|  2.21k|    if (((int) asn_length > uint64sizelimit) ||
  ------------------
  |  Branch (2031:9): [True: 15, False: 2.20k]
  ------------------
 2032|  2.21k|        (((int) asn_length == uint64sizelimit) && *bufp != 0x00)) {
  ------------------
  |  Branch (2032:10): [True: 358, False: 1.84k]
  |  Branch (2032:51): [True: 10, False: 348]
  ------------------
 2033|     25|        _asn_length_err(errpre, (size_t) asn_length, uint64sizelimit);
 2034|     25|        return NULL;
 2035|     25|    }
 2036|  2.19k|    *datalength -= (int) asn_length + (bufp - data);
 2037|  7.06k|    while (asn_length--) {
  ------------------
  |  Branch (2037:12): [True: 4.87k, False: 2.19k]
  ------------------
 2038|  4.87k|        high = ((0x00FFFFFF & high) << 8) | ((low & 0xFF000000U) >> 24);
 2039|  4.87k|        low = ((low & 0x00FFFFFF) << 8) | *bufp++;
 2040|  4.87k|    }
 2041|       |
 2042|  2.19k|    CHECK_OVERFLOW_U(high,6);
  ------------------
  |  |  224|  2.19k|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|  2.19k|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 0, False: 2.19k]
  |  |  ------------------
  |  |  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.19k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2043|  2.19k|    CHECK_OVERFLOW_U(low,6);
  ------------------
  |  |  224|  2.19k|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|  2.19k|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 0, False: 2.19k]
  |  |  ------------------
  |  |  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.19k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2044|       |
 2045|  2.19k|    cp->low = low;
 2046|  2.19k|    cp->high = high;
 2047|       |
 2048|  2.19k|    DEBUGIF("dumpv_recv") {
  ------------------
  |  |  147|  2.19k|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  146|  4.38k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 2.19k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  215|      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.19k|    return bufp;
 2055|  2.21k|}
asn_parse_signed_int64:
 2232|  1.33k|{
 2233|  1.33k|    static const char *errpre = "parse int64";
 2234|  1.33k|    const int       int64sizelimit = (4 * 2) + 1;
 2235|  1.33k|    char            ebuf[128];
 2236|  1.33k|    register u_char *bufp = data;
 2237|  1.33k|    u_long          asn_length;
 2238|  1.33k|    register u_int  low = 0, high = 0;
 2239|       |
 2240|  1.33k|    if (countersize != sizeof(struct counter64)) {
  ------------------
  |  Branch (2240:9): [True: 0, False: 1.33k]
  ------------------
 2241|      0|        _asn_size_err(errpre, countersize, sizeof(struct counter64));
 2242|      0|        return NULL;
 2243|      0|    }
 2244|       |
 2245|  1.33k|    if (NULL == data || NULL == datalength || NULL == type || NULL == cp) {
  ------------------
  |  Branch (2245:9): [True: 0, False: 1.33k]
  |  Branch (2245:25): [True: 0, False: 1.33k]
  |  Branch (2245:47): [True: 0, False: 1.33k]
  |  Branch (2245:63): [True: 0, False: 1.33k]
  ------------------
 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.33k|    if (*datalength < 2) {
  ------------------
  |  Branch (2251:9): [True: 0, False: 1.33k]
  ------------------
 2252|      0|        _asn_short_err(errpre, *datalength, 2);
 2253|      0|        return NULL;
 2254|      0|    }
 2255|       |
 2256|  1.33k|    *type = *bufp++;
 2257|  1.33k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 2258|  1.33k|    if (NULL == bufp) {
  ------------------
  |  Branch (2258:9): [True: 0, False: 1.33k]
  ------------------
 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.33k|    if (asn_length < 2) {
  ------------------
  |  Branch (2264:9): [True: 6, False: 1.32k]
  ------------------
 2265|      6|        _asn_short_err(errpre, asn_length, 2);
 2266|      6|        return NULL;
 2267|      6|    }
 2268|       |
 2269|  1.32k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   85|  1.32k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  146|  1.32k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 1.32k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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.32k|    if ((*type == ASN_OPAQUE) &&
  ------------------
  |  |   93|  1.32k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  1.32k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2270:9): [True: 1.32k, False: 4]
  ------------------
 2271|  1.32k|        (asn_length <= ASN_OPAQUE_COUNTER64_MX_BER_LEN) &&
  ------------------
  |  |  160|  1.32k|#define ASN_OPAQUE_COUNTER64_MX_BER_LEN 12
  ------------------
  |  Branch (2271:9): [True: 1.30k, False: 14]
  ------------------
 2272|  1.32k|        (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_I64)) {
  ------------------
  |  |  131|  1.30k|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|  1.30k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|  1.30k|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
                      (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_I64)) {
  ------------------
  |  |  183|  1.30k|#define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  136|  1.30k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  149|  1.30k|#define ASN_APP_I64 (ASN_APPLICATION | 10)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.30k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2272:9): [True: 1.30k, False: 0]
  |  Branch (2272:39): [True: 1.30k, False: 0]
  ------------------
 2273|       |        /*
 2274|       |         * change type to Int64 
 2275|       |         */
 2276|  1.30k|        *type = *(bufp + 1);
 2277|       |        /*
 2278|       |         * value is encoded as special format 
 2279|       |         */
 2280|  1.30k|        *datalength = asn_length;
 2281|  1.30k|        bufp = asn_parse_nlength(bufp+2, *datalength - 2, &asn_length);
 2282|  1.30k|        if (NULL == bufp) {
  ------------------
  |  Branch (2282:13): [True: 0, False: 1.30k]
  ------------------
 2283|      0|            _asn_short_err("parse opaque int64", *datalength - 2, asn_length);
 2284|      0|            return NULL;
 2285|      0|        }
 2286|  1.30k|    }
 2287|       |    /*
 2288|       |     * this should always have been true until snmp gets int64 PDU types 
 2289|       |     */
 2290|     18|    else {
 2291|     18|        snprintf(ebuf, sizeof(ebuf),
 2292|     18|                "%s: wrong type: %d, len %d, buf bytes (%02X,%02X)",
 2293|     18|                errpre, *type, (int) asn_length, *bufp, *(bufp + 1));
 2294|     18|        ebuf[ sizeof(ebuf)-1 ] = 0;
 2295|     18|        ERROR_MSG(ebuf);
  ------------------
  |  |  190|     18|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 2296|     18|        return NULL;
 2297|     18|    }
 2298|  1.30k|    if (((int) asn_length > int64sizelimit) ||
  ------------------
  |  Branch (2298:9): [True: 0, False: 1.30k]
  ------------------
 2299|  1.30k|        (((int) asn_length == int64sizelimit) && *bufp != 0x00)) {
  ------------------
  |  Branch (2299:10): [True: 249, False: 1.05k]
  |  Branch (2299:50): [True: 9, False: 240]
  ------------------
 2300|      9|        _asn_length_err(errpre, (size_t) asn_length, int64sizelimit);
 2301|      9|        return NULL;
 2302|      9|    }
 2303|  1.29k|    *datalength -= (int) asn_length + (bufp - data);
 2304|  1.29k|    if ((asn_length > 0) && (*bufp & 0x80)) {
  ------------------
  |  Branch (2304:9): [True: 849, False: 450]
  |  Branch (2304:29): [True: 284, False: 565]
  ------------------
 2305|    284|        low = 0xFFFFFFFFU;   /* first byte bit 1 means start the data with 1s */
 2306|    284|        high = 0xFFFFFF;
 2307|    284|    }
 2308|       |
 2309|  4.25k|    while (asn_length--) {
  ------------------
  |  Branch (2309:12): [True: 2.95k, False: 1.29k]
  ------------------
 2310|  2.95k|        high = ((0x00FFFFFF & high) << 8) | ((low & 0xFF000000U) >> 24);
 2311|  2.95k|        low = ((low & 0x00FFFFFF) << 8) | *bufp++;
 2312|  2.95k|    }
 2313|       |
 2314|  1.29k|    CHECK_OVERFLOW_U(high,8);
  ------------------
  |  |  224|  1.29k|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|  1.29k|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 0, False: 1.29k]
  |  |  ------------------
  |  |  226|      0|            x &= 0xffffffff;                                            \
  |  |  227|      0|            DEBUGMSG(("asn","truncating unsigned value to 32 bits (%d)\n",y)); \
  |  |  ------------------
  |  |  |  |   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.29k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2315|  1.29k|    CHECK_OVERFLOW_U(low,8);
  ------------------
  |  |  224|  1.29k|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|  1.29k|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 0, False: 1.29k]
  |  |  ------------------
  |  |  226|      0|            x &= 0xffffffff;                                            \
  |  |  227|      0|            DEBUGMSG(("asn","truncating unsigned value to 32 bits (%d)\n",y)); \
  |  |  ------------------
  |  |  |  |   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.29k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2316|       |
 2317|  1.29k|    cp->low = low;
 2318|  1.29k|    cp->high = high;
 2319|       |
 2320|  1.29k|    DEBUGIF("dumpv_recv") {
  ------------------
  |  |  147|  1.29k|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  146|  2.59k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 1.29k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  215|      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.29k|    return bufp;
 2327|  1.30k|}
asn_parse_float:
 2450|  1.10k|{
 2451|  1.10k|    static const char *errpre = "parse float";
 2452|  1.10k|    register u_char *bufp = data;
 2453|  1.10k|    u_long          asn_length;
 2454|  1.10k|    union {
 2455|  1.10k|        float           floatVal;
 2456|  1.10k|        long            longVal;
 2457|  1.10k|        u_char          c[sizeof(float)];
 2458|  1.10k|    } fu;
 2459|       |
 2460|  1.10k|    if (floatsize != sizeof(float)) {
  ------------------
  |  Branch (2460:9): [True: 0, False: 1.10k]
  ------------------
 2461|      0|        _asn_size_err("parse float", floatsize, sizeof(float));
 2462|      0|        return NULL;
 2463|      0|    }
 2464|       |
 2465|  1.10k|    if (NULL == data || NULL == datalength || NULL == type || NULL == floatp) {
  ------------------
  |  Branch (2465:9): [True: 0, False: 1.10k]
  |  Branch (2465:25): [True: 0, False: 1.10k]
  |  Branch (2465:47): [True: 0, False: 1.10k]
  |  Branch (2465:63): [True: 0, False: 1.10k]
  ------------------
 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|  1.10k|    if (*datalength < 2) {
  ------------------
  |  Branch (2471:9): [True: 0, False: 1.10k]
  ------------------
 2472|      0|        _asn_short_err(errpre, *datalength, 2);
 2473|      0|        return NULL;
 2474|      0|    }
 2475|       |
 2476|  1.10k|    *type = *bufp++;
 2477|  1.10k|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 2478|  1.10k|    if (NULL == bufp) {
  ------------------
  |  Branch (2478:9): [True: 0, False: 1.10k]
  ------------------
 2479|      0|        _asn_short_err(errpre, *datalength - 1, asn_length);
 2480|      0|        return NULL;
 2481|      0|    }
 2482|       |
 2483|  1.10k|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   85|  1.10k|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  146|  1.10k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 1.10k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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|  1.10k|    if ((*type == ASN_OPAQUE) &&
  ------------------
  |  |   93|  1.10k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  1.10k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2487:9): [True: 285, False: 820]
  ------------------
 2488|  1.10k|        (asn_length == ASN_OPAQUE_FLOAT_BER_LEN) &&
  ------------------
  |  |  169|    285|#define ASN_OPAQUE_FLOAT_BER_LEN 7
  ------------------
  |  Branch (2488:9): [True: 272, False: 13]
  ------------------
 2489|  1.10k|        (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_FLOAT)) {
  ------------------
  |  |  131|    272|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|    272|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|    272|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
                      (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_FLOAT)) {
  ------------------
  |  |  165|    272|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|    272|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|    272|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    272|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2489:9): [True: 272, False: 0]
  |  Branch (2489:39): [True: 272, False: 0]
  ------------------
 2490|       |
 2491|       |        /*
 2492|       |         * value is encoded as special format 
 2493|       |         */
 2494|    272|        *datalength = asn_length;
 2495|    272|        bufp = asn_parse_nlength(bufp+2, *datalength - 2, &asn_length);
 2496|    272|        if (NULL == bufp) {
  ------------------
  |  Branch (2496:13): [True: 0, False: 272]
  ------------------
 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|    272|        *type = ASN_OPAQUE_FLOAT;
  ------------------
  |  |  165|    272|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|    272|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|    272|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    272|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2504|    272|    }
 2505|       |
 2506|  1.10k|    if (*type != ASN_OPAQUE_FLOAT) {
  ------------------
  |  |  165|  1.10k|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|  1.10k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|  1.10k|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.10k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2506:9): [True: 13, False: 1.09k]
  ------------------
 2507|     13|        _asn_type_err(errpre, *type);
 2508|     13|        return NULL;
 2509|     13|    }
 2510|       |
 2511|  1.09k|    if (asn_length != sizeof(float)) {
  ------------------
  |  Branch (2511:9): [True: 17, False: 1.07k]
  ------------------
 2512|     17|        _asn_size_err("parse seq float", asn_length, sizeof(float));
 2513|     17|        return NULL;
 2514|     17|    }
 2515|       |
 2516|  1.07k|    *datalength -= (int) asn_length + (bufp - data);
 2517|  1.07k|    memcpy(&fu.c[0], bufp, asn_length);
 2518|       |
 2519|       |    /*
 2520|       |     * correct for endian differences 
 2521|       |     */
 2522|  1.07k|    fu.longVal = ntohl(fu.longVal);
 2523|       |
 2524|  1.07k|    *floatp = fu.floatVal;
 2525|       |
 2526|  1.07k|    DEBUGMSG(("dumpv_recv", "Opaque float: %f\n", *floatp));
  ------------------
  |  |   63|  1.07k|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  146|  1.07k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 1.07k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:67): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2527|  1.07k|    return bufp;
 2528|  1.09k|}
asn_parse_double:
 2633|    679|{
 2634|    679|    static const char *errpre = "parse double";
 2635|    679|    register u_char *bufp = data;
 2636|    679|    u_long          asn_length;
 2637|    679|    long            tmp;
 2638|    679|    union {
 2639|    679|        double          doubleVal;
 2640|    679|        int             intVal[2];
 2641|    679|        u_char          c[sizeof(double)];
 2642|    679|    } fu;
 2643|       |
 2644|       |
 2645|    679|    if (doublesize != sizeof(double)) {
  ------------------
  |  Branch (2645:9): [True: 0, False: 679]
  ------------------
 2646|      0|        _asn_size_err("parse double", doublesize, sizeof(double));
 2647|      0|        return NULL;
 2648|      0|    }
 2649|       |
 2650|    679|    if (NULL == data || NULL == datalength || NULL == type || NULL == doublep) {
  ------------------
  |  Branch (2650:9): [True: 0, False: 679]
  |  Branch (2650:25): [True: 0, False: 679]
  |  Branch (2650:47): [True: 0, False: 679]
  |  Branch (2650:63): [True: 0, False: 679]
  ------------------
 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|    679|    if (*datalength < 2) {
  ------------------
  |  Branch (2656:9): [True: 0, False: 679]
  ------------------
 2657|      0|        _asn_short_err(errpre, *datalength, 2);
 2658|      0|        return NULL;
 2659|      0|    }
 2660|       |
 2661|    679|    *type = *bufp++;
 2662|    679|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 2663|    679|    if (NULL == bufp) {
  ------------------
  |  Branch (2663:9): [True: 0, False: 679]
  ------------------
 2664|      0|        _asn_short_err(errpre, *datalength - 1, asn_length);
 2665|      0|        return NULL;
 2666|      0|    }
 2667|       |
 2668|    679|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   85|    679|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  146|    679|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 679]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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|    679|    if ((*type == ASN_OPAQUE) && (asn_length < 2)) {
  ------------------
  |  |   93|    679|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|    679|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2673:9): [True: 334, False: 345]
  |  Branch (2673:34): [True: 0, False: 334]
  ------------------
 2674|      0|        _asn_short_err(errpre, asn_length, 2);
 2675|      0|        return NULL;
 2676|      0|    }
 2677|    679|    if ((*type == ASN_OPAQUE) &&
  ------------------
  |  |   93|    679|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|    679|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (2677:9): [True: 334, False: 345]
  ------------------
 2678|    679|        (asn_length == ASN_OPAQUE_DOUBLE_BER_LEN) &&
  ------------------
  |  |  178|    334|#define ASN_OPAQUE_DOUBLE_BER_LEN 11
  ------------------
  |  Branch (2678:9): [True: 311, False: 23]
  ------------------
 2679|    679|        (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_DOUBLE)) {
  ------------------
  |  |  131|    311|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|    311|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|    311|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
                      (*bufp == ASN_OPAQUE_TAG1) && (*(bufp + 1) == ASN_OPAQUE_DOUBLE)) {
  ------------------
  |  |  174|    311|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|    311|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|    311|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    311|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2679:9): [True: 311, False: 0]
  |  Branch (2679:39): [True: 311, False: 0]
  ------------------
 2680|       |
 2681|       |        /*
 2682|       |         * value is encoded as special format 
 2683|       |         */
 2684|    311|        *datalength = asn_length;
 2685|    311|        bufp = asn_parse_nlength(bufp+2, *datalength - 2, &asn_length);
 2686|    311|        if (NULL == bufp) {
  ------------------
  |  Branch (2686:13): [True: 0, False: 311]
  ------------------
 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|    311|        *type = ASN_OPAQUE_DOUBLE;
  ------------------
  |  |  174|    311|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|    311|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|    311|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    311|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2695|    311|    }
 2696|       |
 2697|    679|    if (*type != ASN_OPAQUE_DOUBLE) {
  ------------------
  |  |  174|    679|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|    679|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|    679|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    679|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2697:9): [True: 23, False: 656]
  ------------------
 2698|     23|        _asn_type_err(errpre, *type);
 2699|     23|        return NULL;
 2700|     23|    }
 2701|       |
 2702|    656|    if (asn_length != sizeof(double)) {
  ------------------
  |  Branch (2702:9): [True: 21, False: 635]
  ------------------
 2703|     21|        _asn_size_err("parse seq double", asn_length, sizeof(double));
 2704|     21|        return NULL;
 2705|     21|    }
 2706|    635|    *datalength -= (int) asn_length + (bufp - data);
 2707|    635|    memcpy(&fu.c[0], bufp, asn_length);
 2708|       |
 2709|       |    /*
 2710|       |     * correct for endian differences 
 2711|       |     */
 2712|       |
 2713|    635|    tmp = ntohl(fu.intVal[0]);
 2714|    635|    fu.intVal[0] = ntohl(fu.intVal[1]);
 2715|    635|    fu.intVal[1] = tmp;
 2716|       |
 2717|    635|    *doublep = fu.doubleVal;
 2718|    635|    DEBUGMSG(("dumpv_recv", "  Opaque Double:\t%f\n", *doublep));
  ------------------
  |  |   63|    635|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  146|    635|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 635]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (63:67): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2719|       |
 2720|    635|    return bufp;
 2721|    656|}
asn1.c:_asn_size_err:
  242|     38|{
  243|     38|    char            ebuf[128];
  244|       |
  245|     38|    snprintf(ebuf, sizeof(ebuf),
  246|     38|            "%s size %lu: s/b %lu", str,
  247|     38|	    (unsigned long)wrongsize, (unsigned long)rightsize);
  248|     38|    ebuf[ sizeof(ebuf)-1 ] = 0;
  249|     38|    ERROR_MSG(ebuf);
  ------------------
  |  |  190|     38|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  250|     38|}
asn1.c:_asn_short_err:
  301|  2.40k|{
  302|  2.40k|    char            ebuf[128];
  303|       |
  304|  2.40k|    snprintf(ebuf, sizeof(ebuf), "%s length %lu too short: need %lu", str,
  305|  2.40k|	    (unsigned long)wrongsize, (unsigned long)rightsize);
  306|  2.40k|    ERROR_MSG(ebuf);
  ------------------
  |  |  190|  2.40k|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  307|  2.40k|}
asn1.c:_asn_type_err:
  262|    547|{
  263|    547|    char            ebuf[128];
  264|       |
  265|    547|    snprintf(ebuf, sizeof(ebuf), "%s type %d", str, wrongtype);
  266|    547|    ebuf[ sizeof(ebuf)-1 ] = 0;
  267|    547|    ERROR_MSG(ebuf);
  ------------------
  |  |  190|    547|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  268|    547|}
asn1.c:_asn_length_err:
  281|    148|{
  282|    148|    char            ebuf[128];
  283|       |
  284|    148|    snprintf(ebuf, sizeof(ebuf),
  285|    148|            "%s length %lu too large: exceeds %lu", str,
  286|    148|	    (unsigned long)wrongsize, (unsigned long)rightsize);
  287|    148|    ebuf[ sizeof(ebuf)-1 ] = 0;
  288|    148|    ERROR_MSG(ebuf);
  ------------------
  |  |  190|    148|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  289|    148|}
asn1.c:_asn_bitstring_check:
  518|    801|{
  519|    801|    char            ebuf[128];
  520|       |
  521|    801|    if (asn_length < 1) {
  ------------------
  |  Branch (521:9): [True: 7, False: 794]
  ------------------
  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|    794|    return 0;
  536|    801|}

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

snmp_parse_var_op:
  153|  16.2k|{
  154|  16.2k|    u_char          var_op_type;
  155|  16.2k|    size_t          var_op_len = *listlength;
  156|  16.2k|    u_char         *var_op_start = data;
  157|       |
  158|  16.2k|    data = asn_parse_sequence(data, &var_op_len, &var_op_type,
  159|  16.2k|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR), "var_op");
  ------------------
  |  |   84|  16.2k|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR), "var_op");
  ------------------
  |  |   96|  16.2k|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
  160|  16.2k|    if (data == NULL) {
  ------------------
  |  Branch (160:9): [True: 330, False: 15.9k]
  ------------------
  161|       |        /*
  162|       |         * msg detail is set 
  163|       |         */
  164|    330|        return NULL;
  165|    330|    }
  166|  15.9k|    DEBUGDUMPHEADER("recv", "Name");
  ------------------
  |  |   81|  15.9k|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|  15.9k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 15.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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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|  15.9k|    data =
  168|  15.9k|        asn_parse_objid(data, &var_op_len, &var_op_type, var_name,
  169|  15.9k|                        var_name_len);
  170|  15.9k|    DEBUGINDENTLESS();
  ------------------
  |  |   77|  15.9k|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  146|  15.9k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 15.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  176|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (77:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
  171|  15.9k|    if (data == NULL) {
  ------------------
  |  Branch (171:9): [True: 34, False: 15.9k]
  ------------------
  172|     34|        ERROR_MSG("No OID for variable");
  ------------------
  |  |  190|     34|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  173|     34|        return NULL;
  174|     34|    }
  175|  15.9k|    if (var_op_type !=
  ------------------
  |  Branch (175:9): [True: 0, False: 15.9k]
  ------------------
  176|  15.9k|        (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OBJECT_ID))
  ------------------
  |  |   90|  15.9k|#define ASN_UNIVERSAL	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OBJECT_ID))
  ------------------
  |  |   95|  15.9k|#define ASN_PRIMITIVE	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OBJECT_ID))
  ------------------
  |  |   81|  15.9k|#define ASN_OBJECT_ID	    0x06U
  ------------------
  177|      0|        return NULL;
  178|  15.9k|    *var_val = data;            /* save pointer to this object */
  179|       |    /*
  180|       |     * find out what type of object this is 
  181|       |     */
  182|  15.9k|    data = asn_parse_header(data, &var_op_len, var_val_type);
  183|  15.9k|    if (data == NULL) {
  ------------------
  |  Branch (183:9): [True: 17, False: 15.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|  15.9k|    *var_val_len = var_op_len;
  191|  15.9k|    data += var_op_len;
  192|  15.9k|    *listlength -= (int) (data - var_op_start);
  193|  15.9k|    return data;
  194|  15.9k|}

snmp_get_next_transid:
  485|  2.73k|{
  486|  2.73k|    long            retVal;
  487|  2.73k|    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_TRANSID);
  ------------------
  |  |   79|  2.73k|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded - Ignored]
  |  |  ------------------
  ------------------
  488|  2.73k|    retVal = 1 + Transid;       /*MTCRITICAL_RESOURCE */
  489|  2.73k|    if (!retVal)
  ------------------
  |  Branch (489:9): [True: 0, False: 2.73k]
  ------------------
  490|      0|        retVal = 2;
  491|  2.73k|    Transid = retVal;
  492|  2.73k|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS))
  ------------------
  |  |   48|  2.73k|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS))
  ------------------
  |  |   91|  2.73k|#define NETSNMP_DS_LIB_16BIT_IDS           31   /* restrict requestIDs, etc to 16-bit values */
  ------------------
  |  Branch (492:9): [True: 0, False: 2.73k]
  ------------------
  493|      0|        retVal &= 0x7fff;	/* mask to 15 bits */
  494|  2.73k|    else
  495|  2.73k|        retVal &= 0x7fffffff;	/* mask to 31 bits */
  496|       |
  497|  2.73k|    if (!retVal) {
  ------------------
  |  Branch (497:9): [True: 0, False: 2.73k]
  ------------------
  498|      0|        Transid = retVal = 2;
  499|      0|    }
  500|  2.73k|    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_TRANSID);
  ------------------
  |  |   80|  2.73k|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded - Ignored]
  |  |  ------------------
  ------------------
  501|  2.73k|    return retVal;
  502|  2.73k|}
snmp_set_detail:
  516|  6.63k|{
  517|  6.63k|    if (detail_string != NULL) {
  ------------------
  |  Branch (517:9): [True: 6.63k, False: 0]
  ------------------
  518|  6.63k|        strlcpy(snmp_detail, detail_string, sizeof(snmp_detail));
  519|  6.63k|        snmp_detail_f = 1;
  520|  6.63k|    }
  521|  6.63k|}
snmp_api_errstring:
  531|    690|{
  532|    690|    const char     *msg = "";
  533|    690|    static char     msg_buf[SPRINT_MAX_LEN];
  534|       |
  535|    690|    if (snmp_errnumber >= SNMPERR_MAX && snmp_errnumber <= SNMPERR_GENERR) {
  ------------------
  |  |  286|  1.38k|#define SNMPERR_MAX			(-69)
  ------------------
                  if (snmp_errnumber >= SNMPERR_MAX && snmp_errnumber <= SNMPERR_GENERR) {
  ------------------
  |  |  216|    690|#define SNMPERR_GENERR			(-1)
  ------------------
  |  Branch (535:9): [True: 690, False: 0]
  |  Branch (535:42): [True: 0, False: 690]
  ------------------
  536|      0|        msg = api_errors[-snmp_errnumber];
  537|    690|    } else if (snmp_errnumber != SNMPERR_SUCCESS) {
  ------------------
  |  |  215|    690|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (537:16): [True: 0, False: 690]
  ------------------
  538|      0|        msg = NULL;
  539|      0|    }
  540|    690|    if (!msg) {
  ------------------
  |  Branch (540:9): [True: 0, False: 690]
  ------------------
  541|      0|	snprintf(msg_buf, sizeof(msg_buf), "Unknown error: %d", snmp_errnumber);
  542|      0|        msg_buf[sizeof(msg_buf)-1] = '\0';
  543|    690|    } else if (snmp_detail_f) {
  ------------------
  |  Branch (543:16): [True: 690, False: 0]
  ------------------
  544|    690|        snprintf(msg_buf, sizeof(msg_buf), "%s (%s)", msg, snmp_detail);
  545|    690|        msg_buf[sizeof(msg_buf)-1] = '\0';
  546|    690|        snmp_detail_f = 0;
  547|    690|    } else {
  548|      0|        strlcpy(msg_buf, msg, sizeof(msg_buf));
  549|      0|    }
  550|       |
  551|    690|    return (msg_buf);
  552|    690|}
snmpv3_parse:
 3703|  2.73k|{
 3704|  2.73k|    u_char          type, msg_flags;
 3705|  2.73k|    long            ver, msg_sec_model;
 3706|  2.73k|    size_t          max_size_response;
 3707|  2.73k|    u_char          tmp_buf[SNMP_MAX_MSG_SIZE];
 3708|  2.73k|    size_t          tmp_buf_len;
 3709|  2.73k|    u_char          pdu_buf[SNMP_MAX_MSG_SIZE];
 3710|  2.73k|    u_char         *mallocbuf = NULL;
 3711|  2.73k|    size_t          pdu_buf_len = SNMP_MAX_MSG_SIZE;
  ------------------
  |  |  142|  2.73k|#define SNMP_MAX_MSG_SIZE          1472 /* ethernet MTU minus IP/UDP header */
  ------------------
 3712|  2.73k|    u_char         *sec_params;
 3713|  2.73k|    u_char         *msg_data;
 3714|  2.73k|    u_char         *cp;
 3715|  2.73k|    size_t          asn_len, msg_len;
 3716|  2.73k|    int             ret, ret_val;
 3717|  2.73k|    struct snmp_secmod_def *sptr;
 3718|       |
 3719|       |
 3720|  2.73k|    msg_data = data;
 3721|  2.73k|    msg_len = *length;
 3722|       |
 3723|       |
 3724|       |    /*
 3725|       |     * message is an ASN.1 SEQUENCE  
 3726|       |     */
 3727|  2.73k|    DEBUGDUMPSECTION("recv", "SNMPv3 Message");
  ------------------
  |  |   83|  2.73k|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|  2.73k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 2.73k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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]
  |  |  ------------------
  ------------------
 3728|  2.73k|    data = asn_parse_sequence(data, length, &type,
 3729|  2.73k|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR), "message");
  ------------------
  |  |   84|  2.73k|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR), "message");
  ------------------
  |  |   96|  2.73k|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3730|  2.73k|    if (data == NULL) {
  ------------------
  |  Branch (3730:9): [True: 327, False: 2.40k]
  ------------------
 3731|       |        /*
 3732|       |         * error msg detail is set 
 3733|       |         */
 3734|    327|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  678|    327|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3735|    327|        DEBUGINDENTLESS();
  ------------------
  |  |   77|    327|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  146|    327|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 327]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  176|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (77:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3736|    327|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  244|    327|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3737|    327|    }
 3738|       |
 3739|       |    /*
 3740|       |     * parse msgVersion  
 3741|       |     */
 3742|  2.40k|    DEBUGDUMPHEADER("recv", "SNMP Version Number");
  ------------------
  |  |   81|  2.40k|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|  2.40k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 2.40k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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]
  |  |  ------------------
  ------------------
 3743|  2.40k|    data = asn_parse_int(data, length, &type, &ver, sizeof(ver));
 3744|  2.40k|    DEBUGINDENTLESS();
  ------------------
  |  |   77|  2.40k|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  146|  2.40k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 2.40k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  176|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (77:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3745|  2.40k|    if (data == NULL) {
  ------------------
  |  Branch (3745:9): [True: 175, False: 2.23k]
  ------------------
 3746|    175|        ERROR_MSG("bad parse of version");
  ------------------
  |  |  190|    175|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3747|    175|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  678|    175|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3748|    175|        DEBUGINDENTLESS();
  ------------------
  |  |   77|    175|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  146|    175|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 175]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  176|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (77:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3749|    175|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  244|    175|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3750|    175|    }
 3751|  2.23k|    pdu->version = ver;
 3752|       |
 3753|       |    /*
 3754|       |     * parse msgGlobalData sequence  
 3755|       |     */
 3756|  2.23k|    cp = data;
 3757|  2.23k|    asn_len = *length;
 3758|  2.23k|    DEBUGDUMPSECTION("recv", "msgGlobalData");
  ------------------
  |  |   83|  2.23k|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|  2.23k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 2.23k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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]
  |  |  ------------------
  ------------------
 3759|  2.23k|    data = asn_parse_sequence(data, &asn_len, &type,
 3760|  2.23k|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   84|  2.23k|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   96|  2.23k|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3761|  2.23k|                              "msgGlobalData");
 3762|  2.23k|    if (data == NULL) {
  ------------------
  |  Branch (3762:9): [True: 1.83k, False: 392]
  ------------------
 3763|       |        /*
 3764|       |         * error msg detail is set 
 3765|       |         */
 3766|  1.83k|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  678|  1.83k|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3767|  1.83k|        DEBUGINDENTADD(-4);
  ------------------
  |  |   75|  1.83k|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|  1.83k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 1.83k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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]
  |  |  ------------------
  ------------------
 3768|  1.83k|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  244|  1.83k|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3769|  1.83k|    }
 3770|    392|    *length -= data - cp;       /* subtract off the length of the header */
 3771|       |
 3772|       |    /*
 3773|       |     * msgID 
 3774|       |     */
 3775|    392|    DEBUGDUMPHEADER("recv", "msgID");
  ------------------
  |  |   81|    392|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|    392|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 392]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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]
  |  |  ------------------
  ------------------
 3776|    392|    data =
 3777|    392|        asn_parse_int(data, length, &type, &pdu->msgid,
 3778|    392|                      sizeof(pdu->msgid));
 3779|    392|    DEBUGINDENTLESS();
  ------------------
  |  |   77|    392|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  146|    392|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 392]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  176|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (77:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3780|    392|    if (data == NULL || type != ASN_INTEGER) {
  ------------------
  |  |   75|    378|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (3780:9): [True: 14, False: 378]
  |  Branch (3780:25): [True: 0, False: 378]
  ------------------
 3781|     14|        ERROR_MSG("error parsing msgID");
  ------------------
  |  |  190|     14|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3782|     14|        DEBUGINDENTADD(-4);
  ------------------
  |  |   75|     14|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|     14|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 14]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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]
  |  |  ------------------
  ------------------
 3783|     14|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  678|     14|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3784|     14|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  244|     14|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3785|     14|    }
 3786|       |
 3787|       |    /*
 3788|       |     * Check the msgID we received is a legal value.  If not, then increment
 3789|       |     * snmpInASNParseErrs and return the appropriate error (see RFC 2572,
 3790|       |     * para. 7.2, section 2 -- note that a bad msgID means that the received
 3791|       |     * message is NOT a serialiization of an SNMPv3Message, since the msgID
 3792|       |     * field is out of bounds).  
 3793|       |     */
 3794|       |
 3795|    378|    if (pdu->msgid < 0 || pdu->msgid > SNMP_MAX_PACKET_LEN) {
  ------------------
  |  |   49|    329|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  |  Branch (3795:9): [True: 49, False: 329]
  |  Branch (3795:27): [True: 3, False: 326]
  ------------------
 3796|     52|        snmp_log(LOG_ERR, "Received bad msgID (%ld %s %s).\n", pdu->msgid,
 3797|     52|                 (pdu->msgid < 0) ? "<" : ">",
  ------------------
  |  Branch (3797:18): [True: 49, False: 3]
  ------------------
 3798|     52|                 (pdu->msgid < 0) ? "0" : "2^31 - 1");
  ------------------
  |  Branch (3798:18): [True: 49, False: 3]
  ------------------
 3799|     52|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  678|     52|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3800|     52|        DEBUGINDENTADD(-4);
  ------------------
  |  |   75|     52|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|     52|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 52]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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]
  |  |  ------------------
  ------------------
 3801|     52|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  244|     52|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3802|     52|    }
 3803|       |
 3804|       |    /*
 3805|       |     * msgMaxSize 
 3806|       |     */
 3807|    326|    DEBUGDUMPHEADER("recv:msgMaxSize", "msgMaxSize");
  ------------------
  |  |   81|    326|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|    326|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 326]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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]
  |  |  ------------------
  ------------------
 3808|    326|    data = asn_parse_int(data, length, &type, &pdu->msgMaxSize,
 3809|    326|                         sizeof(pdu->msgMaxSize));
 3810|    326|    DEBUGINDENTLESS();
  ------------------
  |  |   77|    326|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  146|    326|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 326]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  176|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (77:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3811|    326|    if (data == NULL || type != ASN_INTEGER) {
  ------------------
  |  |   75|    266|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (3811:9): [True: 60, False: 266]
  |  Branch (3811:25): [True: 0, False: 266]
  ------------------
 3812|     60|        ERROR_MSG("error parsing msgMaxSize");
  ------------------
  |  |  190|     60|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3813|     60|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  678|     60|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3814|     60|        DEBUGINDENTADD(-4);
  ------------------
  |  |   75|     60|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|     60|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 60]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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|     60|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  244|     60|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3816|     60|    }
 3817|       |
 3818|       |    /*
 3819|       |     * Check the msgMaxSize we received is a legal value.  If not, then
 3820|       |     * increment snmpInASNParseErrs and return the appropriate error (see RFC
 3821|       |     * 2572, para. 7.2, section 2 -- note that a bad msgMaxSize means that the
 3822|       |     * received message is NOT a serialiization of an SNMPv3Message, since the
 3823|       |     * msgMaxSize field is out of bounds).
 3824|       |     */
 3825|       |
 3826|    266|    if (pdu->msgMaxSize < SNMP_MIN_MAX_LEN) {
  ------------------
  |  |   48|    266|#define SNMP_MIN_MAX_LEN    484 /* minimum maximum message size */
  ------------------
  |  Branch (3826:9): [True: 66, False: 200]
  ------------------
 3827|     66|        snmp_log(LOG_ERR, "Received bad msgMaxSize (%lu < 484).\n",
 3828|     66|                 pdu->msgMaxSize);
 3829|     66|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  678|     66|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3830|     66|        DEBUGINDENTADD(-4);
  ------------------
  |  |   75|     66|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 66]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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]
  |  |  ------------------
  ------------------
 3831|     66|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  244|     66|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3832|    200|    } else if (pdu->msgMaxSize > SNMP_MAX_PACKET_LEN) {
  ------------------
  |  |   49|    200|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  |  Branch (3832:16): [True: 2, False: 198]
  ------------------
 3833|      2|        snmp_log(LOG_ERR, "Received bad msgMaxSize (%lu > 2^31 - 1).\n",
 3834|      2|                 pdu->msgMaxSize);
 3835|      2|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  678|      2|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3836|      2|        DEBUGINDENTADD(-4);
  ------------------
  |  |   75|      2|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|      2|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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]
  |  |  ------------------
  ------------------
 3837|      2|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  244|      2|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3838|    198|    } else {
 3839|    198|        DEBUGMSGTL(("snmpv3_parse:msgMaxSize", "msgMaxSize %lu received\n",
  ------------------
  |  |   68|    198|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|    198|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 198]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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]
  |  |  ------------------
  ------------------
 3840|    198|                    pdu->msgMaxSize));
 3841|       |        /** don't increase max msg size if we've already got one */
 3842|    198|        if (sess->sndMsgMaxSize < pdu->msgMaxSize) {
  ------------------
  |  Branch (3842:13): [True: 198, False: 0]
  ------------------
 3843|    198|            DEBUGMSGTL(("snmpv3_parse:msgMaxSize",
  ------------------
  |  |   68|    198|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|    198|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 198]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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]
  |  |  ------------------
  ------------------
 3844|    198|                        "msgMaxSize %" NETSNMP_PRIz "d greater than session max %ld; reducing\n",
 3845|    198|                        sess->sndMsgMaxSize, pdu->msgMaxSize));
 3846|    198|            pdu->msgMaxSize = sess->sndMsgMaxSize;
 3847|    198|        }
 3848|    198|    }
 3849|       |
 3850|       |    /*
 3851|       |     * msgFlags 
 3852|       |     */
 3853|    198|    tmp_buf_len = SNMP_MAX_MSG_SIZE;
  ------------------
  |  |  142|    198|#define SNMP_MAX_MSG_SIZE          1472 /* ethernet MTU minus IP/UDP header */
  ------------------
 3854|    198|    DEBUGDUMPHEADER("recv", "msgFlags");
  ------------------
  |  |   81|    198|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|    198|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 198]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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|    198|    data = asn_parse_string(data, length, &type, tmp_buf, &tmp_buf_len);
 3856|    198|    DEBUGINDENTLESS();
  ------------------
  |  |   77|    198|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  146|    198|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 198]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  176|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (77:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3857|    198|    if (data == NULL || type != ASN_OCTET_STR || tmp_buf_len != 1) {
  ------------------
  |  |   78|    330|#define ASN_OCTET_STR	    0x04U
  ------------------
  |  Branch (3857:9): [True: 66, False: 132]
  |  Branch (3857:25): [True: 2, False: 130]
  |  Branch (3857:50): [True: 18, False: 112]
  ------------------
 3858|     86|        ERROR_MSG("error parsing msgFlags");
  ------------------
  |  |  190|     86|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3859|     86|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  678|     86|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3860|     86|        DEBUGINDENTADD(-4);
  ------------------
  |  |   75|     86|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|     86|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 86]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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]
  |  |  ------------------
  ------------------
 3861|     86|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  244|     86|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3862|     86|    }
 3863|    112|    msg_flags = *tmp_buf;
 3864|    112|    if (msg_flags & SNMP_MSG_FLAG_RPRT_BIT)
  ------------------
  |  |  305|    112|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
  |  Branch (3864:9): [True: 59, False: 53]
  ------------------
 3865|     59|        pdu->flags |= SNMP_MSG_FLAG_RPRT_BIT;
  ------------------
  |  |  305|     59|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
 3866|     53|    else
 3867|     53|        pdu->flags &= (~SNMP_MSG_FLAG_RPRT_BIT);
  ------------------
  |  |  305|     53|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
 3868|       |
 3869|       |    /*
 3870|       |     * msgSecurityModel 
 3871|       |     */
 3872|    112|    DEBUGDUMPHEADER("recv", "msgSecurityModel");
  ------------------
  |  |   81|    112|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|    112|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 112]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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]
  |  |  ------------------
  ------------------
 3873|    112|    data = asn_parse_int(data, length, &type, &msg_sec_model,
 3874|    112|                         sizeof(msg_sec_model));
 3875|    112|    DEBUGINDENTADD(-4);         /* return from global data indent */
  ------------------
  |  |   75|    112|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|    112|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 112]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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]
  |  |  ------------------
  ------------------
 3876|    112|    if (data == NULL || type != ASN_INTEGER ||
  ------------------
  |  |   75|    222|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (3876:9): [True: 2, False: 110]
  |  Branch (3876:25): [True: 0, False: 110]
  ------------------
 3877|    112|        msg_sec_model < 1 || msg_sec_model > 0x7fffffff) {
  ------------------
  |  Branch (3877:9): [True: 47, False: 63]
  |  Branch (3877:30): [True: 3, False: 60]
  ------------------
 3878|     52|        ERROR_MSG("error parsing msgSecurityModel");
  ------------------
  |  |  190|     52|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3879|     52|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  678|     52|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3880|     52|        DEBUGINDENTLESS();
  ------------------
  |  |   77|     52|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  146|     52|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 52]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  176|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (77:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3881|     52|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  244|     52|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3882|     52|    }
 3883|     60|    sptr = find_sec_mod(msg_sec_model);
 3884|     60|    if (!sptr) {
  ------------------
  |  Branch (3884:9): [True: 60, False: 0]
  ------------------
 3885|     60|        snmp_log(LOG_WARNING, "unknown security model: %ld\n",
 3886|     60|                 msg_sec_model);
 3887|     60|        snmp_increment_statistic(STAT_SNMPUNKNOWNSECURITYMODELS);
  ------------------
  |  |  652|     60|#define   STAT_SNMPUNKNOWNSECURITYMODELS     0
  ------------------
 3888|     60|        DEBUGINDENTLESS();
  ------------------
  |  |   77|     60|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  146|     60|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 60]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  176|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (77:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3889|     60|        return SNMPERR_UNKNOWN_SEC_MODEL;
  ------------------
  |  |  245|     60|#define SNMPERR_UNKNOWN_SEC_MODEL 	(-30)
  ------------------
 3890|     60|    }
 3891|      0|    pdu->securityModel = msg_sec_model;
 3892|       |
 3893|      0|    if (msg_flags & SNMP_MSG_FLAG_PRIV_BIT &&
  ------------------
  |  |  304|      0|#define SNMP_MSG_FLAG_PRIV_BIT          0x02
  ------------------
  |  Branch (3893:9): [True: 0, False: 0]
  ------------------
 3894|      0|        !(msg_flags & SNMP_MSG_FLAG_AUTH_BIT)) {
  ------------------
  |  |  303|      0|#define SNMP_MSG_FLAG_AUTH_BIT          0x01
  ------------------
  |  Branch (3894:9): [True: 0, False: 0]
  ------------------
 3895|      0|        ERROR_MSG("invalid message, illegal msgFlags");
  ------------------
  |  |  190|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3896|      0|        snmp_increment_statistic(STAT_SNMPINVALIDMSGS);
  ------------------
  |  |  653|      0|#define   STAT_SNMPINVALIDMSGS               1
  ------------------
 3897|      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]
  |  |  ------------------
  ------------------
 3898|      0|        return SNMPERR_INVALID_MSG;
  ------------------
  |  |  246|      0|#define SNMPERR_INVALID_MSG             (-31)
  ------------------
 3899|      0|    }
 3900|      0|    pdu->securityLevel = ((msg_flags & SNMP_MSG_FLAG_AUTH_BIT)
  ------------------
  |  |  303|      0|#define SNMP_MSG_FLAG_AUTH_BIT          0x01
  ------------------
  |  Branch (3900:27): [True: 0, False: 0]
  ------------------
 3901|      0|                          ? ((msg_flags & SNMP_MSG_FLAG_PRIV_BIT)
  ------------------
  |  |  304|      0|#define SNMP_MSG_FLAG_PRIV_BIT          0x02
  ------------------
  |  Branch (3901:30): [True: 0, False: 0]
  ------------------
 3902|      0|                             ? SNMP_SEC_LEVEL_AUTHPRIV
  ------------------
  |  |  301|      0|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
 3903|      0|                             : SNMP_SEC_LEVEL_AUTHNOPRIV)
  ------------------
  |  |  300|      0|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
 3904|      0|                          : SNMP_SEC_LEVEL_NOAUTH);
  ------------------
  |  |  299|      0|#define SNMP_SEC_LEVEL_NOAUTH		1
  ------------------
 3905|       |    /*
 3906|       |     * end of msgGlobalData 
 3907|       |     */
 3908|       |
 3909|       |    /*
 3910|       |     * securtityParameters OCTET STRING begins after msgGlobalData 
 3911|       |     */
 3912|      0|    sec_params = data;
 3913|      0|    pdu->contextEngineID = calloc(1, SNMP_MAX_ENG_SIZE);
  ------------------
  |  |  144|      0|#define SNMP_MAX_ENG_SIZE          32
  ------------------
 3914|      0|    pdu->contextEngineIDLen = SNMP_MAX_ENG_SIZE;
  ------------------
  |  |  144|      0|#define SNMP_MAX_ENG_SIZE          32
  ------------------
 3915|       |
 3916|       |    /*
 3917|       |     * Note: there is no length limit on the msgAuthoritativeEngineID field,
 3918|       |     * although we would EXPECT it to be limited to 32 (the SnmpEngineID TC
 3919|       |     * limit).  We'll use double that here to be on the safe side.  
 3920|       |     */
 3921|       |
 3922|      0|    pdu->securityEngineID = calloc(1, SNMP_MAX_ENG_SIZE * 2);
  ------------------
  |  |  144|      0|#define SNMP_MAX_ENG_SIZE          32
  ------------------
 3923|      0|    pdu->securityEngineIDLen = SNMP_MAX_ENG_SIZE * 2;
  ------------------
  |  |  144|      0|#define SNMP_MAX_ENG_SIZE          32
  ------------------
 3924|      0|    pdu->securityName = calloc(1, SNMP_MAX_SEC_NAME_SIZE);
  ------------------
  |  |  145|      0|#define SNMP_MAX_SEC_NAME_SIZE     256
  ------------------
 3925|      0|    pdu->securityNameLen = SNMP_MAX_SEC_NAME_SIZE;
  ------------------
  |  |  145|      0|#define SNMP_MAX_SEC_NAME_SIZE     256
  ------------------
 3926|       |
 3927|      0|    if ((pdu->securityName == NULL) ||
  ------------------
  |  Branch (3927:9): [True: 0, False: 0]
  ------------------
 3928|      0|        (pdu->securityEngineID == NULL) ||
  ------------------
  |  Branch (3928:9): [True: 0, False: 0]
  ------------------
 3929|      0|        (pdu->contextEngineID == NULL)) {
  ------------------
  |  Branch (3929:9): [True: 0, False: 0]
  ------------------
 3930|      0|        return SNMPERR_MALLOC;
  ------------------
  |  |  277|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 3931|      0|    }
 3932|       |
 3933|      0|    if (pdu_buf_len < msg_len
  ------------------
  |  Branch (3933:9): [True: 0, False: 0]
  ------------------
 3934|      0|        && pdu->securityLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|      0|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (3934:12): [True: 0, False: 0]
  ------------------
 3935|       |        /*
 3936|       |         * space needed is larger than we have in the default buffer 
 3937|       |         */
 3938|      0|        mallocbuf = calloc(1, msg_len);
 3939|      0|        pdu_buf_len = msg_len;
 3940|      0|        cp = mallocbuf;
 3941|      0|    } else {
 3942|      0|        memset(pdu_buf, 0, pdu_buf_len);
 3943|      0|        cp = pdu_buf;
 3944|      0|    }
 3945|       |
 3946|      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]
  |  |  ------------------
  ------------------
 3947|      0|    if (sptr->decode) {
  ------------------
  |  Branch (3947:9): [True: 0, False: 0]
  ------------------
 3948|      0|        struct snmp_secmod_incoming_params parms;
 3949|      0|        parms.msgProcModel = pdu->msgParseModel;
 3950|      0|        parms.maxMsgSize = pdu->msgMaxSize;
 3951|      0|        parms.secParams = sec_params;
 3952|      0|        parms.secModel = msg_sec_model;
 3953|      0|        parms.secLevel = pdu->securityLevel;
 3954|      0|        parms.wholeMsg = msg_data;
 3955|      0|        parms.wholeMsgLen = msg_len;
 3956|      0|        parms.secEngineID = pdu->securityEngineID;
 3957|      0|        parms.secEngineIDLen = &pdu->securityEngineIDLen;
 3958|      0|        parms.secName = pdu->securityName;
 3959|      0|        parms.secNameLen = &pdu->securityNameLen;
 3960|      0|        parms.scopedPdu = &cp;
 3961|      0|        parms.scopedPduLen = &pdu_buf_len;
 3962|      0|        parms.maxSizeResponse = &max_size_response;
 3963|      0|        parms.secStateRef = &pdu->securityStateRef;
 3964|      0|        parms.sess = sess;
 3965|      0|        parms.pdu = pdu;
 3966|      0|        parms.msg_flags = msg_flags;
 3967|      0|        ret_val = (*sptr->decode) (&parms);
 3968|      0|    } else {
 3969|      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]
  |  |  ------------------
  ------------------
 3970|      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]
  |  |  ------------------
  ------------------
 3971|      0|        snmp_log(LOG_WARNING, "security service %ld can't decode packets\n",
 3972|      0|                 msg_sec_model);
 3973|      0|        return (-1);
 3974|      0|    }
 3975|       |
 3976|      0|    if (ret_val != SNMPERR_SUCCESS) {
  ------------------
  |  |  215|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (3976:9): [True: 0, False: 0]
  ------------------
 3977|      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]
  |  |  ------------------
  ------------------
 3978|       |        /*
 3979|       |         * Parse as much as possible -- though I don't see the point? [jbpn].  
 3980|       |         */
 3981|      0|        if (cp) {
  ------------------
  |  Branch (3981:13): [True: 0, False: 0]
  ------------------
 3982|      0|            cp = snmpv3_scopedPDU_parse(pdu, cp, &pdu_buf_len);
 3983|      0|        }
 3984|      0|        if (cp) {
  ------------------
  |  Branch (3984:13): [True: 0, False: 0]
  ------------------
 3985|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3986|      0|            snmp_pdu_parse(pdu, cp, &pdu_buf_len);
 3987|      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]
  |  |  ------------------
  ------------------
 3988|      0|        } else {
 3989|      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]
  |  |  ------------------
  ------------------
 3990|      0|        }
 3991|       |
 3992|      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]
  |  |  ------------------
  ------------------
 3993|      0|        return ret_val;
 3994|      0|    }
 3995|       |
 3996|       |    /*
 3997|       |     * parse plaintext ScopedPDU sequence 
 3998|       |     */
 3999|      0|    *length = pdu_buf_len;
 4000|      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]
  |  |  ------------------
  ------------------
 4001|      0|    data = snmpv3_scopedPDU_parse(pdu, cp, length);
 4002|      0|    if (data == NULL) {
  ------------------
  |  Branch (4002:9): [True: 0, False: 0]
  ------------------
 4003|      0|        snmp_log(LOG_WARNING, "security service %ld error parsing ScopedPDU\n",
 4004|      0|                 msg_sec_model);
 4005|      0|        ERROR_MSG("error parsing PDU");
  ------------------
  |  |  190|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4006|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  678|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4007|      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]
  |  |  ------------------
  ------------------
 4008|      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]
  |  |  ------------------
  ------------------
 4009|      0|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  244|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 4010|      0|    }
 4011|       |
 4012|       |    /*
 4013|       |     * parse the PDU.  
 4014|       |     */
 4015|      0|    if (after_header != NULL) {
  ------------------
  |  Branch (4015:9): [True: 0, False: 0]
  ------------------
 4016|      0|        *after_header = data;
 4017|      0|        tmp_buf_len = *length;
 4018|      0|    }
 4019|       |
 4020|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4021|      0|    ret = snmp_pdu_parse(pdu, data, length);
 4022|      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]
  |  |  ------------------
  ------------------
 4023|       |
 4024|      0|    if (after_header != NULL) {
  ------------------
  |  Branch (4024:9): [True: 0, False: 0]
  ------------------
 4025|      0|        *length = tmp_buf_len;
 4026|      0|    }
 4027|       |
 4028|      0|    if (ret != SNMPERR_SUCCESS) {
  ------------------
  |  |  215|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (4028:9): [True: 0, False: 0]
  ------------------
 4029|      0|        snmp_log(LOG_WARNING, "security service %ld error parsing ScopedPDU\n",
 4030|      0|                 msg_sec_model);
 4031|      0|        ERROR_MSG("error parsing PDU");
  ------------------
  |  |  190|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4032|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  678|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4033|      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]
  |  |  ------------------
  ------------------
 4034|      0|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  244|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 4035|      0|    }
 4036|       |
 4037|      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]
  |  |  ------------------
  ------------------
 4038|      0|    return SNMPERR_SUCCESS;
  ------------------
  |  |  215|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 4039|      0|}                               /* end snmpv3_parse() */
snmp_parse:
 4564|  2.73k|{
 4565|  2.73k|    int             rc;
 4566|       |
 4567|  2.73k|    rc = _snmp_parse(slp, pss, pdu, data, length);
 4568|  2.73k|    if (rc) {
  ------------------
  |  Branch (4568:9): [True: 2.55k, False: 175]
  ------------------
 4569|  2.55k|        if (!pss->s_snmp_errno) {
  ------------------
  |  Branch (4569:13): [True: 2.46k, False: 98]
  ------------------
 4570|  2.46k|            pss->s_snmp_errno = SNMPERR_BAD_PARSE;
  ------------------
  |  |  228|  2.46k|#define SNMPERR_BAD_PARSE		(-13)
  ------------------
 4571|  2.46k|        }
 4572|  2.55k|        SET_SNMP_ERROR(pss->s_snmp_errno);
  ------------------
  |  |   56|  2.55k|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 4573|  2.55k|    }
 4574|       |
 4575|  2.73k|    return rc;
 4576|  2.73k|}
snmp_pdu_parse:
 4580|  1.38k|{
 4581|  1.38k|    u_char          type;
 4582|  1.38k|    u_char          msg_type;
 4583|  1.38k|    u_char         *var_val;
 4584|  1.38k|    size_t          len;
 4585|  1.38k|    size_t          four;
 4586|  1.38k|    netsnmp_variable_list *vp = NULL, *vplast = NULL;
 4587|  1.38k|    oid             objid[MAX_OID_LEN];
 4588|  1.38k|    u_char         *p;
 4589|       |
 4590|       |    /*
 4591|       |     * Get the PDU type 
 4592|       |     */
 4593|  1.38k|    data = asn_parse_header(data, length, &msg_type);
 4594|  1.38k|    if (data == NULL)
  ------------------
  |  Branch (4594:9): [True: 14, False: 1.37k]
  ------------------
 4595|     14|        return -1;
 4596|  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]
  |  |  ------------------
  ------------------
 4597|  1.37k|    pdu->command = msg_type;
 4598|  1.37k|    pdu->flags &= (~UCD_MSG_FLAG_RESPONSE_PDU);
  ------------------
  |  |  311|  1.37k|#define UCD_MSG_FLAG_RESPONSE_PDU            0x100
  ------------------
 4599|       |
 4600|       |    /*
 4601|       |     * get the fields in the PDU preceding the variable-bindings sequence
 4602|       |     */
 4603|  1.37k|    switch (pdu->command) {
 4604|  1.06k|    case SNMP_MSG_TRAP:
  ------------------
  |  |  135|  1.06k|#define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   92|  1.06k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   96|  1.06k|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4604:5): [True: 1.06k, False: 311]
  ------------------
 4605|       |        /*
 4606|       |         * enterprise 
 4607|       |         */
 4608|  1.06k|        pdu->enterprise_length = MAX_OID_LEN;
  ------------------
  |  |  103|  1.06k|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
 4609|  1.06k|        data = asn_parse_objid(data, length, &type, objid,
 4610|  1.06k|                               &pdu->enterprise_length);
 4611|  1.06k|        if (data == NULL)
  ------------------
  |  Branch (4611:13): [True: 207, False: 854]
  ------------------
 4612|    207|            return -1;
 4613|    854|        pdu->enterprise = netsnmp_memdup(objid,
 4614|    854|                                         pdu->enterprise_length * sizeof(oid));
 4615|    854|        if (pdu->enterprise == NULL) {
  ------------------
  |  Branch (4615:13): [True: 0, False: 854]
  ------------------
 4616|      0|            return -1;
 4617|      0|        }
 4618|       |
 4619|       |        /*
 4620|       |         * agent-addr 
 4621|       |         */
 4622|    854|        four = 4;
 4623|    854|        data = asn_parse_string(data, length, &type,
 4624|    854|                                (u_char *) pdu->agent_addr, &four);
 4625|    854|        if (data == NULL)
  ------------------
  |  Branch (4625:13): [True: 104, False: 750]
  ------------------
 4626|    104|            return -1;
 4627|       |
 4628|       |        /*
 4629|       |         * generic trap 
 4630|       |         */
 4631|    750|        data = asn_parse_int(data, length, &type, (long *) &pdu->trap_type,
 4632|    750|                             sizeof(pdu->trap_type));
 4633|    750|        if (data == NULL)
  ------------------
  |  Branch (4633:13): [True: 6, False: 744]
  ------------------
 4634|      6|            return -1;
 4635|       |        /*
 4636|       |         * specific trap 
 4637|       |         */
 4638|    744|        data =
 4639|    744|            asn_parse_int(data, length, &type,
 4640|    744|                          (long *) &pdu->specific_type,
 4641|    744|                          sizeof(pdu->specific_type));
 4642|    744|        if (data == NULL)
  ------------------
  |  Branch (4642:13): [True: 1, False: 743]
  ------------------
 4643|      1|            return -1;
 4644|       |
 4645|       |        /*
 4646|       |         * timestamp  
 4647|       |         */
 4648|    743|        data = asn_parse_unsigned_int(data, length, &type, &pdu->time,
 4649|    743|                                      sizeof(pdu->time));
 4650|    743|        if (data == NULL)
  ------------------
  |  Branch (4650:13): [True: 172, False: 571]
  ------------------
 4651|    172|            return -1;
 4652|       |
 4653|    571|        break;
 4654|       |
 4655|    571|    case SNMP_MSG_RESPONSE:
  ------------------
  |  |  127|     46|#define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   92|     46|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   96|     46|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4655:5): [True: 46, False: 1.32k]
  ------------------
 4656|    127|    case SNMP_MSG_REPORT:
  ------------------
  |  |  147|    127|#define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   92|    127|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   96|    127|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4656:5): [True: 81, False: 1.29k]
  ------------------
 4657|    127|        pdu->flags |= UCD_MSG_FLAG_RESPONSE_PDU;
  ------------------
  |  |  311|    127|#define UCD_MSG_FLAG_RESPONSE_PDU            0x100
  ------------------
 4658|    127|        NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2381|    127|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 4659|       |
 4660|    145|    case SNMP_MSG_TRAP2:
  ------------------
  |  |  142|    145|#define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   92|    145|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   96|    145|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4660:5): [True: 18, False: 1.35k]
  ------------------
 4661|    162|    case SNMP_MSG_INFORM:
  ------------------
  |  |  141|    162|#define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   92|    162|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   96|    162|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4661:5): [True: 17, False: 1.35k]
  ------------------
 4662|    162|#ifndef NETSNMP_NOTIFY_ONLY
 4663|    189|    case SNMP_MSG_GET:
  ------------------
  |  |  125|    189|#define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  ------------------
  |  |  |  |   92|    189|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  ------------------
  |  |  |  |   96|    189|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4663:5): [True: 27, False: 1.34k]
  ------------------
 4664|    238|    case SNMP_MSG_GETNEXT:
  ------------------
  |  |  126|    238|#define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   92|    238|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   96|    238|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4664:5): [True: 49, False: 1.32k]
  ------------------
 4665|    276|    case SNMP_MSG_GETBULK:
  ------------------
  |  |  140|    276|#define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  ------------------
  |  |  |  |   92|    276|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  ------------------
  |  |  |  |   96|    276|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4665:5): [True: 38, False: 1.33k]
  ------------------
 4666|    276|#endif /* ! NETSNMP_NOTIFY_ONLY */
 4667|    276|#ifndef NETSNMP_NO_WRITE_SUPPORT
 4668|    304|    case SNMP_MSG_SET:
  ------------------
  |  |  129|    304|#define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  ------------------
  |  |  |  |   92|    304|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  ------------------
  |  |  |  |   96|    304|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4668:5): [True: 28, False: 1.34k]
  ------------------
 4669|    304|#endif /* !NETSNMP_NO_WRITE_SUPPORT */
 4670|       |        /*
 4671|       |         * PDU is not an SNMPv1 TRAP 
 4672|       |         */
 4673|       |
 4674|       |        /*
 4675|       |         * request id 
 4676|       |         */
 4677|    304|        DEBUGDUMPHEADER("recv", "request_id");
  ------------------
  |  |   81|    304|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|    304|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 304]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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]
  |  |  ------------------
  ------------------
 4678|    304|        data = asn_parse_int(data, length, &type, &pdu->reqid,
 4679|    304|                             sizeof(pdu->reqid));
 4680|    304|        DEBUGINDENTLESS();
  ------------------
  |  |   77|    304|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  146|    304|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 304]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  176|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (77:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4681|    304|        if (data == NULL) {
  ------------------
  |  Branch (4681:13): [True: 8, False: 296]
  ------------------
 4682|      8|            return -1;
 4683|      8|        }
 4684|       |
 4685|       |        /*
 4686|       |         * error status (getbulk non-repeaters) 
 4687|       |         */
 4688|    296|        DEBUGDUMPHEADER("recv", "error status");
  ------------------
  |  |   81|    296|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|    296|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 296]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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]
  |  |  ------------------
  ------------------
 4689|    296|        data = asn_parse_int(data, length, &type, &pdu->errstat,
 4690|    296|                             sizeof(pdu->errstat));
 4691|    296|        DEBUGINDENTLESS();
  ------------------
  |  |   77|    296|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  146|    296|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 296]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  176|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (77:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4692|    296|        if (data == NULL) {
  ------------------
  |  Branch (4692:13): [True: 1, False: 295]
  ------------------
 4693|      1|            return -1;
 4694|      1|        }
 4695|       |
 4696|       |        /*
 4697|       |         * error index (getbulk max-repetitions) 
 4698|       |         */
 4699|    295|        DEBUGDUMPHEADER("recv", "error index");
  ------------------
  |  |   81|    295|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|    295|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 295]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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]
  |  |  ------------------
  ------------------
 4700|    295|        data = asn_parse_int(data, length, &type, &pdu->errindex,
 4701|    295|                             sizeof(pdu->errindex));
 4702|    295|        DEBUGINDENTLESS();
  ------------------
  |  |   77|    295|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  146|    295|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 295]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  176|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (77:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4703|    295|        if (data == NULL) {
  ------------------
  |  Branch (4703:13): [True: 1, False: 294]
  ------------------
 4704|      1|            return -1;
 4705|      1|        }
 4706|    294|	break;
 4707|       |
 4708|    294|    default:
  ------------------
  |  Branch (4708:5): [True: 7, False: 1.36k]
  ------------------
 4709|      7|        snmp_log(LOG_ERR, "Bad PDU type received: 0x%.2x\n", pdu->command);
 4710|      7|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  678|      7|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4711|      7|        return -1;
 4712|  1.37k|    }
 4713|       |
 4714|       |    /*
 4715|       |     * get header for variable-bindings sequence 
 4716|       |     */
 4717|    865|    DEBUGDUMPSECTION("recv", "VarBindList");
  ------------------
  |  |   83|    865|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|    865|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 865]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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]
  |  |  ------------------
  ------------------
 4718|    865|    data = asn_parse_sequence(data, length, &type,
 4719|    865|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   84|    865|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   96|    865|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 4720|    865|                              "varbinds");
 4721|    865|    if (data == NULL)
  ------------------
  |  Branch (4721:9): [True: 117, False: 748]
  ------------------
 4722|    117|        goto fail;
 4723|       |
 4724|       |    /*
 4725|       |     * get each varBind sequence 
 4726|       |     */
 4727|  16.4k|    while ((int) *length > 0) {
  ------------------
  |  Branch (4727:12): [True: 16.2k, False: 175]
  ------------------
 4728|  16.2k|        vp = SNMP_MALLOC_TYPEDEF(netsnmp_variable_list);
  ------------------
  |  |   73|  16.2k|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
 4729|  16.2k|        if (NULL == vp)
  ------------------
  |  Branch (4729:13): [True: 0, False: 16.2k]
  ------------------
 4730|      0|            goto fail;
 4731|       |
 4732|  16.2k|        vp->name_length = MAX_OID_LEN;
  ------------------
  |  |  103|  16.2k|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
 4733|  16.2k|        DEBUGDUMPSECTION("recv", "VarBind");
  ------------------
  |  |   83|  16.2k|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|  16.2k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 16.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]
  |  |  ------------------
  ------------------
 4734|  16.2k|        data = snmp_parse_var_op(data, objid, &vp->name_length, &vp->type,
 4735|  16.2k|                                 &vp->val_len, &var_val, length);
 4736|  16.2k|        if (data == NULL)
  ------------------
  |  Branch (4736:13): [True: 381, False: 15.9k]
  ------------------
 4737|    381|            goto fail;
 4738|  15.9k|        if (snmp_set_var_objid(vp, objid, vp->name_length))
  ------------------
  |  Branch (4738:13): [True: 0, False: 15.9k]
  ------------------
 4739|      0|            goto fail;
 4740|       |
 4741|  15.9k|        len = SNMP_MAX_PACKET_LEN;
  ------------------
  |  |   49|  15.9k|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
 4742|  15.9k|        DEBUGDUMPHEADER("recv", "Value");
  ------------------
  |  |   81|  15.9k|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|  15.9k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 15.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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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 ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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 &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  215|      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]
  |  |  ------------------
  ------------------
 4743|  15.9k|        switch ((short) vp->type) {
 4744|  1.09k|        case ASN_INTEGER:
  ------------------
  |  |   75|  1.09k|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (4744:9): [True: 1.09k, False: 14.8k]
  ------------------
 4745|  1.09k|            vp->val.integer = (long *) vp->buf;
 4746|  1.09k|            vp->val_len = sizeof(long);
 4747|  1.09k|            p = asn_parse_int(var_val, &len, &vp->type,
 4748|  1.09k|                          (long *) vp->val.integer,
 4749|  1.09k|                          sizeof(*vp->val.integer));
 4750|  1.09k|            if (!p)
  ------------------
  |  Branch (4750:17): [True: 3, False: 1.08k]
  ------------------
 4751|      3|                goto fail;
 4752|  1.08k|            break;
 4753|  1.08k|        case ASN_COUNTER:
  ------------------
  |  |   89|    663|#define ASN_COUNTER	(ASN_APPLICATION | 1)
  |  |  ------------------
  |  |  |  |   91|    663|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4753:9): [True: 663, False: 15.2k]
  ------------------
 4754|  1.15k|        case ASN_GAUGE:
  ------------------
  |  |   90|  1.15k|#define ASN_GAUGE	(ASN_APPLICATION | 2)
  |  |  ------------------
  |  |  |  |   91|  1.15k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4754:9): [True: 487, False: 15.4k]
  ------------------
 4755|  1.97k|        case ASN_TIMETICKS:
  ------------------
  |  |   92|  1.97k|#define ASN_TIMETICKS   (ASN_APPLICATION | 3)
  |  |  ------------------
  |  |  |  |   91|  1.97k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4755:9): [True: 821, False: 15.0k]
  ------------------
 4756|  2.48k|        case ASN_UINTEGER:
  ------------------
  |  |  100|  2.48k|#define ASN_UINTEGER    (ASN_APPLICATION | 7)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|  2.48k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4756:9): [True: 517, False: 15.3k]
  ------------------
 4757|  2.48k|            vp->val.integer = (long *) vp->buf;
 4758|  2.48k|            vp->val_len = sizeof(u_long);
 4759|  2.48k|            p = asn_parse_unsigned_int(var_val, &len, &vp->type,
 4760|  2.48k|                                   (u_long *) vp->val.integer,
 4761|  2.48k|                                   vp->val_len);
 4762|  2.48k|            if (!p)
  ------------------
  |  Branch (4762:17): [True: 15, False: 2.47k]
  ------------------
 4763|     15|                goto fail;
 4764|  2.47k|            break;
 4765|  2.47k|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 4766|  2.47k|        case ASN_OPAQUE_COUNTER64:
  ------------------
  |  |  156|    517|#define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  136|    517|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  146|    517|#define ASN_APP_COUNTER64 (ASN_APPLICATION | 6)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    517|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4766:9): [True: 517, False: 15.3k]
  ------------------
 4767|  1.26k|        case ASN_OPAQUE_U64:
  ------------------
  |  |  192|  1.26k|#define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  136|  1.26k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  150|  1.26k|#define ASN_APP_U64 (ASN_APPLICATION | 11)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.26k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4767:9): [True: 752, False: 15.1k]
  ------------------
 4768|  1.26k|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 4769|  2.22k|        case ASN_COUNTER64:
  ------------------
  |  |   99|  2.22k|#define ASN_COUNTER64   (ASN_APPLICATION | 6)
  |  |  ------------------
  |  |  |  |   91|  2.22k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4769:9): [True: 954, False: 14.9k]
  ------------------
 4770|  2.22k|            vp->val.counter64 = (struct counter64 *) vp->buf;
 4771|  2.22k|            vp->val_len = sizeof(struct counter64);
 4772|  2.22k|            p = asn_parse_unsigned_int64(var_val, &len, &vp->type,
 4773|  2.22k|                                     (struct counter64 *) vp->val.
 4774|  2.22k|                                     counter64, vp->val_len);
 4775|  2.22k|            if (!p)
  ------------------
  |  Branch (4775:17): [True: 31, False: 2.19k]
  ------------------
 4776|     31|                goto fail;
 4777|  2.19k|            break;
 4778|  2.19k|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 4779|  2.19k|        case ASN_OPAQUE_FLOAT:
  ------------------
  |  |  165|  1.10k|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|  1.10k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|  1.10k|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.10k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4779:9): [True: 1.10k, False: 14.8k]
  ------------------
 4780|  1.10k|            vp->val.floatVal = (float *) vp->buf;
 4781|  1.10k|            vp->val_len = sizeof(float);
 4782|  1.10k|            p = asn_parse_float(var_val, &len, &vp->type,
 4783|  1.10k|                            vp->val.floatVal, vp->val_len);
 4784|  1.10k|            if (!p)
  ------------------
  |  Branch (4784:17): [True: 30, False: 1.07k]
  ------------------
 4785|     30|                goto fail;
 4786|  1.07k|            break;
 4787|  1.07k|        case ASN_OPAQUE_DOUBLE:
  ------------------
  |  |  174|    679|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|    679|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|    679|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|    679|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4787:9): [True: 679, False: 15.2k]
  ------------------
 4788|    679|            vp->val.doubleVal = (double *) vp->buf;
 4789|    679|            vp->val_len = sizeof(double);
 4790|    679|            p = asn_parse_double(var_val, &len, &vp->type,
 4791|    679|                             vp->val.doubleVal, vp->val_len);
 4792|    679|            if (!p)
  ------------------
  |  Branch (4792:17): [True: 44, False: 635]
  ------------------
 4793|     44|                goto fail;
 4794|    635|            break;
 4795|  1.33k|        case ASN_OPAQUE_I64:
  ------------------
  |  |  183|  1.33k|#define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  136|  1.33k|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  149|  1.33k|#define ASN_APP_I64 (ASN_APPLICATION | 10)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|  1.33k|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4795:9): [True: 1.33k, False: 14.5k]
  ------------------
 4796|  1.33k|            vp->val.counter64 = (struct counter64 *) vp->buf;
 4797|  1.33k|            vp->val_len = sizeof(struct counter64);
 4798|  1.33k|            p = asn_parse_signed_int64(var_val, &len, &vp->type,
 4799|  1.33k|                                   (struct counter64 *) vp->val.counter64,
 4800|  1.33k|                                   sizeof(*vp->val.counter64));
 4801|       |
 4802|  1.33k|            if (!p)
  ------------------
  |  Branch (4802:17): [True: 33, False: 1.29k]
  ------------------
 4803|     33|                goto fail;
 4804|  1.29k|            break;
 4805|  1.29k|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 4806|  1.29k|        case ASN_IPADDRESS:
  ------------------
  |  |   88|    381|#define ASN_IPADDRESS   (ASN_APPLICATION | 0)
  |  |  ------------------
  |  |  |  |   91|    381|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4806:9): [True: 381, False: 15.5k]
  ------------------
 4807|    381|            if (vp->val_len != 4)
  ------------------
  |  Branch (4807:17): [True: 12, False: 369]
  ------------------
 4808|     12|                goto fail;
 4809|    381|            NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2381|    369|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 4810|  1.06k|        case ASN_OCTET_STR:
  ------------------
  |  |   78|  1.06k|#define ASN_OCTET_STR	    0x04U
  ------------------
  |  Branch (4810:9): [True: 699, False: 15.2k]
  ------------------
 4811|  2.32k|        case ASN_OPAQUE:
  ------------------
  |  |   93|  2.32k|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|  2.32k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4811:9): [True: 1.25k, False: 14.6k]
  ------------------
 4812|  2.92k|        case ASN_NSAP:
  ------------------
  |  |   98|  2.92k|#define ASN_NSAP	(ASN_APPLICATION | 5)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|  2.92k|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4812:9): [True: 596, False: 15.3k]
  ------------------
 4813|  2.92k|            if (vp->val_len < sizeof(vp->buf)) {
  ------------------
  |  Branch (4813:17): [True: 2.70k, False: 212]
  ------------------
 4814|  2.70k|                vp->val.string = (u_char *) vp->buf;
 4815|  2.70k|            } else {
 4816|    212|                vp->val.string = (u_char *) malloc(vp->val_len);
 4817|    212|            }
 4818|  2.92k|            if (vp->val.string == NULL) {
  ------------------
  |  Branch (4818:17): [True: 0, False: 2.92k]
  ------------------
 4819|      0|                goto fail;
 4820|      0|            }
 4821|  2.92k|            p = asn_parse_string(var_val, &len, &vp->type, vp->val.string,
 4822|  2.92k|                             &vp->val_len);
 4823|  2.92k|            if (!p)
  ------------------
  |  Branch (4823:17): [True: 0, False: 2.92k]
  ------------------
 4824|      0|                goto fail;
 4825|  2.92k|            break;
 4826|  2.92k|        case ASN_OBJECT_ID:
  ------------------
  |  |   81|  1.00k|#define ASN_OBJECT_ID	    0x06U
  ------------------
  |  Branch (4826:9): [True: 1.00k, False: 14.9k]
  ------------------
 4827|  1.00k|            vp->val_len = MAX_OID_LEN;
  ------------------
  |  |  103|  1.00k|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
 4828|  1.00k|            p = asn_parse_objid(var_val, &len, &vp->type, objid, &vp->val_len);
 4829|  1.00k|            if (!p)
  ------------------
  |  Branch (4829:17): [True: 2, False: 1.00k]
  ------------------
 4830|      2|                goto fail;
 4831|  1.00k|            vp->val_len *= sizeof(oid);
 4832|  1.00k|            vp->val.objid = netsnmp_memdup(objid, vp->val_len);
 4833|  1.00k|            if (vp->val.objid == NULL)
  ------------------
  |  Branch (4833:17): [True: 0, False: 1.00k]
  ------------------
 4834|      0|                goto fail;
 4835|  1.00k|            break;
 4836|  1.00k|        case SNMP_NOSUCHOBJECT:
  ------------------
  |  |  201|    309|#define SNMP_NOSUCHOBJECT    (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) /* 80=128 */
  |  |  ------------------
  |  |  |  |   92|    309|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_NOSUCHOBJECT    (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) /* 80=128 */
  |  |  ------------------
  |  |  |  |   95|    309|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (4836:9): [True: 309, False: 15.5k]
  ------------------
 4837|    984|        case SNMP_NOSUCHINSTANCE:
  ------------------
  |  |  202|    984|#define SNMP_NOSUCHINSTANCE  (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* 81=129 */
  |  |  ------------------
  |  |  |  |   92|    984|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_NOSUCHINSTANCE  (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* 81=129 */
  |  |  ------------------
  |  |  |  |   95|    984|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (4837:9): [True: 675, False: 15.2k]
  ------------------
 4838|  1.83k|        case SNMP_ENDOFMIBVIEW:
  ------------------
  |  |  203|  1.83k|#define SNMP_ENDOFMIBVIEW    (ASN_CONTEXT | ASN_PRIMITIVE | 0x2) /* 82=130 */
  |  |  ------------------
  |  |  |  |   92|  1.83k|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_ENDOFMIBVIEW    (ASN_CONTEXT | ASN_PRIMITIVE | 0x2) /* 82=130 */
  |  |  ------------------
  |  |  |  |   95|  1.83k|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (4838:9): [True: 849, False: 15.0k]
  ------------------
 4839|  2.23k|        case ASN_NULL:
  ------------------
  |  |   79|  2.23k|#define ASN_NULL	    0x05U
  ------------------
  |  Branch (4839:9): [True: 404, False: 15.5k]
  ------------------
 4840|  2.23k|            break;
 4841|    801|        case ASN_BIT_STR:
  ------------------
  |  |   77|    801|#define ASN_BIT_STR	    0x03U
  ------------------
  |  Branch (4841:9): [True: 801, False: 15.1k]
  ------------------
 4842|    801|            vp->val.bitstring = (u_char *) malloc(vp->val_len);
 4843|    801|            if (vp->val.bitstring == NULL) {
  ------------------
  |  Branch (4843:17): [True: 0, False: 801]
  ------------------
 4844|      0|                goto fail;
 4845|      0|            }
 4846|    801|            p = asn_parse_bitstring(var_val, &len, &vp->type,
 4847|    801|                                vp->val.bitstring, &vp->val_len);
 4848|    801|            if (!p)
  ------------------
  |  Branch (4848:17): [True: 7, False: 794]
  ------------------
 4849|      7|                goto fail;
 4850|    794|            break;
 4851|    794|        default:
  ------------------
  |  Branch (4851:9): [True: 15, False: 15.8k]
  ------------------
 4852|     15|            snmp_log(LOG_ERR, "bad type returned (%x)\n", vp->type);
 4853|     15|            goto fail;
 4854|      0|            break;
 4855|  15.9k|        }
 4856|  15.7k|        DEBUGINDENTADD(-4);
  ------------------
  |  |   75|  15.7k|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|  15.7k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 15.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]
  |  |  ------------------
  ------------------
 4857|       |
 4858|  15.7k|        if (NULL == vplast) {
  ------------------
  |  Branch (4858:13): [True: 605, False: 15.1k]
  ------------------
 4859|    605|            pdu->variables = vp;
 4860|  15.1k|        } else {
 4861|  15.1k|            vplast->next_variable = vp;
 4862|  15.1k|        }
 4863|  15.7k|        vplast = vp;
 4864|  15.7k|        vp = NULL;
 4865|  15.7k|    }
 4866|    175|    return 0;
 4867|       |
 4868|    690|  fail:
 4869|    690|    {
 4870|    690|        const char *errstr = snmp_api_errstring(SNMPERR_SUCCESS);
  ------------------
  |  |  215|    690|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 4871|    690|        DEBUGMSGTL(("recv", "error while parsing VarBindList:%s\n", errstr));
  ------------------
  |  |   68|    690|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|    690|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 690]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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]
  |  |  ------------------
  ------------------
 4872|    690|    }
 4873|       |    /** if we were parsing a var, remove it from the pdu and free it */
 4874|    690|    if (vp)
  ------------------
  |  Branch (4874:9): [True: 573, False: 117]
  ------------------
 4875|    573|        snmp_free_var(vp);
 4876|       |
 4877|    690|    return -1;
 4878|    748|}
snmp_free_var_internals:
 5473|  16.2k|{
 5474|  16.2k|    if (!var)
  ------------------
  |  Branch (5474:9): [True: 0, False: 16.2k]
  ------------------
 5475|      0|        return;
 5476|       |
 5477|  16.2k|    if (var->name != var->name_loc)
  ------------------
  |  Branch (5477:9): [True: 381, False: 15.9k]
  ------------------
 5478|    381|        SNMP_FREE(var->name);
  ------------------
  |  |   62|    381|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 381]
  |  |  |  Branch (62:66): [Folded - Ignored]
  |  |  ------------------
  ------------------
 5479|  16.2k|    if (var->val.string != var->buf)
  ------------------
  |  Branch (5479:9): [True: 4.66k, False: 11.6k]
  ------------------
 5480|  4.66k|        SNMP_FREE(var->val.string);
  ------------------
  |  |   62|  4.66k|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 2.01k, False: 2.64k]
  |  |  |  Branch (62:66): [Folded - Ignored]
  |  |  ------------------
  ------------------
 5481|  16.2k|    if (var->data) {
  ------------------
  |  Branch (5481:9): [True: 0, False: 16.2k]
  ------------------
 5482|      0|        if (var->dataFreeHook) {
  ------------------
  |  Branch (5482:13): [True: 0, False: 0]
  ------------------
 5483|      0|            var->dataFreeHook(var->data);
 5484|      0|            var->data = NULL;
 5485|      0|        } else {
 5486|      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]
  |  |  ------------------
  ------------------
 5487|      0|        }
 5488|      0|    }
 5489|  16.2k|}
snmp_free_var:
 5493|  16.2k|{
 5494|  16.2k|    snmp_free_var_internals(var);
 5495|  16.2k|    free(var);
 5496|  16.2k|}
snmp_free_varbind:
 5500|  5.46k|{
 5501|  5.46k|    netsnmp_variable_list *ptr;
 5502|  21.1k|    while (var) {
  ------------------
  |  Branch (5502:12): [True: 15.7k, False: 5.46k]
  ------------------
 5503|  15.7k|        ptr = var->next_variable;
 5504|  15.7k|        snmp_free_var(var);
 5505|  15.7k|        var = ptr;
 5506|  15.7k|    }
 5507|  5.46k|}
snmp_free_pdu:
 5514|  5.46k|{
 5515|  5.46k|    struct snmp_secmod_def *sptr;
 5516|       |
 5517|  5.46k|    if (!pdu)
  ------------------
  |  Branch (5517:9): [True: 0, False: 5.46k]
  ------------------
 5518|      0|        return;
 5519|       |
 5520|  5.46k|    free_securityStateRef(pdu);
 5521|       |
 5522|  5.46k|    sptr = find_sec_mod(pdu->securityModel);
 5523|  5.46k|    if (sptr && sptr->pdu_free)
  ------------------
  |  Branch (5523:9): [True: 0, False: 5.46k]
  |  Branch (5523:17): [True: 0, False: 0]
  ------------------
 5524|      0|        (*sptr->pdu_free)(pdu);
 5525|       |
 5526|  5.46k|    snmp_free_varbind(pdu->variables);
 5527|  5.46k|    free(pdu->enterprise);
 5528|  5.46k|    free(pdu->community);
 5529|  5.46k|    free(pdu->contextEngineID);
 5530|  5.46k|    free(pdu->securityEngineID);
 5531|  5.46k|    free(pdu->contextName);
 5532|  5.46k|    free(pdu->securityName);
 5533|  5.46k|    free(pdu->transport_data);
 5534|  5.46k|    free(pdu);
 5535|  5.46k|}
snmp_increment_statistic:
 7925|  3.95k|{
 7926|  3.95k|    if (which >= 0 && which < NETSNMP_STAT_MAX_STATS) {
  ------------------
  |  |  751|  3.95k|#define  NETSNMP_STAT_MAX_STATS              (STAT_TLSTM_STATS_END+1)
  |  |  ------------------
  |  |  |  |  747|  3.95k|#define  STAT_TLSTM_STATS_END          STAT_TLSTM_SNMPTLSTMSESSIONINVALIDCACHES
  |  |  |  |  ------------------
  |  |  |  |  |  |  744|  3.95k|#define  STAT_TLSTM_SNMPTLSTMSESSIONINVALIDCACHES              56
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (7926:9): [True: 3.95k, False: 0]
  |  Branch (7926:23): [True: 3.95k, False: 0]
  ------------------
 7927|  3.95k|        statistics[which]++;
 7928|  3.95k|        return statistics[which];
 7929|  3.95k|    }
 7930|      0|    return 0;
 7931|  3.95k|}
snmp_api.c:free_securityStateRef:
 4043|  5.46k|{
 4044|  5.46k|    struct snmp_secmod_def *sptr;
 4045|       |
 4046|  5.46k|    if (!pdu->securityStateRef)
  ------------------
  |  Branch (4046:9): [True: 5.46k, False: 0]
  ------------------
 4047|  5.46k|        return;
 4048|       |
 4049|      0|    sptr = find_sec_mod(pdu->securityModel);
 4050|      0|    if (sptr) {
  ------------------
  |  Branch (4050:9): [True: 0, False: 0]
  ------------------
 4051|      0|        if (sptr->pdu_free_state_ref) {
  ------------------
  |  Branch (4051:13): [True: 0, False: 0]
  ------------------
 4052|      0|            (*sptr->pdu_free_state_ref) (pdu->securityStateRef);
 4053|      0|        } else {
 4054|      0|            snmp_log(LOG_ERR,
 4055|      0|                     "Security Model %d can't free state references\n",
 4056|      0|                     pdu->securityModel);
 4057|      0|	}
 4058|      0|    } else {
 4059|      0|	snmp_log(LOG_ERR,
 4060|      0|		 "Can't find security model to free ptr: %d\n",
 4061|      0|		 pdu->securityModel);
 4062|      0|    }
 4063|      0|    pdu->securityStateRef = NULL;
 4064|      0|}
snmp_api.c:_snmp_parse:
 4269|  2.73k|{
 4270|  2.73k|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 4271|  2.73k|    u_char          community[COMMUNITY_MAX_LEN];
 4272|  2.73k|    size_t          community_length = COMMUNITY_MAX_LEN;
  ------------------
  |  |   41|  2.73k|#define COMMUNITY_MAX_LEN	256
  ------------------
 4273|  2.73k|#endif
 4274|  2.73k|    int             result = -1;
 4275|       |
 4276|  2.73k|    static const oid snmpEngineIDoid[]   = { 1,3,6,1,6,3,10,2,1,1,0};
 4277|  2.73k|    static size_t   snmpEngineIDoid_len = 11;
 4278|       |
 4279|  2.73k|    static char     ourEngineID[SNMP_SEC_PARAM_BUF_SIZE];
 4280|  2.73k|    static size_t   ourEngineID_len = sizeof(ourEngineID);
 4281|       |
 4282|  2.73k|    netsnmp_pdu    *pdu2 = NULL;
 4283|       |
 4284|  2.73k|    session->s_snmp_errno = 0;
 4285|  2.73k|    session->s_errno = 0;
 4286|       |
 4287|       |    /*
 4288|       |     * Ensure all incoming PDUs have a unique means of identification 
 4289|       |     * (This is not restricted to AgentX handling,
 4290|       |     * though that is where the need becomes visible)   
 4291|       |     */
 4292|  2.73k|    pdu->transid = snmp_get_next_transid();
 4293|       |
 4294|  2.73k|    if (session->version != SNMP_DEFAULT_VERSION) {
  ------------------
  |  |  123|  2.73k|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  |  Branch (4294:9): [True: 2.73k, False: 0]
  ------------------
 4295|  2.73k|        pdu->version = session->version;
 4296|  2.73k|    } else {
 4297|      0|        pdu->version = snmp_parse_version(data, length);
 4298|      0|    }
 4299|       |
 4300|  2.73k|    switch (pdu->version) {
 4301|      0|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 4302|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 4303|  2.73k|    case SNMP_VERSION_1:
  ------------------
  |  |  107|  2.73k|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (4303:5): [True: 2.73k, False: 0]
  ------------------
 4304|  2.73k|#endif
 4305|  2.73k|#ifndef NETSNMP_DISABLE_SNMPV2C
 4306|  2.73k|    case SNMP_VERSION_2c:
  ------------------
  |  |  110|  2.73k|#define SNMP_VERSION_2c    1
  ------------------
  |  Branch (4306:5): [True: 0, False: 2.73k]
  ------------------
 4307|  2.73k|#endif
 4308|  2.73k|        NETSNMP_RUNTIME_PROTOCOL_CHECK_V1V2(pdu->version,unsupported_version);
  ------------------
  |  |  219|  2.73k|#define NETSNMP_RUNTIME_PROTOCOL_CHECK_V1V2(pc_ver, pc_target) do {    \
  |  |  220|  2.73k|        if (NETSNMP_RUNTIME_PROTOCOL_SKIP_V1(pc_ver) ||                \
  |  |  ------------------
  |  |  |  |  204|  5.46k|    ((pc_ver) == SNMP_VERSION_1 &&                                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |  107|  5.46k|#define SNMP_VERSION_1	   0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (204:6): [True: 2.73k, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  205|  5.46k|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|  2.73k|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (205:6): [True: 0, False: 2.73k]
  |  |  |  |  ------------------
  |  |  |  |  206|  2.73k|                            NETSNMP_DS_LIB_DISABLE_V1))
  |  |  |  |  ------------------
  |  |  |  |  |  |  103|  2.73k|#define NETSNMP_DS_LIB_DISABLE_V1          43 /* disable SNMPv1 */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  221|  2.73k|            NETSNMP_RUNTIME_PROTOCOL_SKIP_V2(pc_ver)) {                \
  |  |  ------------------
  |  |  |  |  214|  2.73k|    ((pc_ver) == SNMP_VERSION_2c &&                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|  5.46k|#define SNMP_VERSION_2c    1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (214:6): [True: 0, False: 2.73k]
  |  |  |  |  ------------------
  |  |  |  |  215|  2.73k|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (215:6): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  216|      0|                            NETSNMP_DS_LIB_DISABLE_V2c))
  |  |  |  |  ------------------
  |  |  |  |  |  |  104|      0|#define NETSNMP_DS_LIB_DISABLE_V2c         44 /* disable SNMPv2c */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  222|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  223|      0|            goto pc_target;                                            \
  |  |  224|      0|        }                                                              \
  |  |  225|  2.73k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (225:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4309|  2.73k|        DEBUGMSGTL(("snmp_api", "Parsing SNMPv%ld message...\n",
  ------------------
  |  |   68|  2.73k|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|  2.73k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 2.73k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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]
  |  |  ------------------
  ------------------
 4310|  2.73k|                    (1 + pdu->version)));
 4311|       |
 4312|       |        /*
 4313|       |         * authenticates message and returns length if valid 
 4314|       |         */
 4315|  2.73k|#ifndef NETSNMP_DISABLE_SNMPV1
 4316|  2.73k|        if (pdu->version == SNMP_VERSION_1) {
  ------------------
  |  |  107|  2.73k|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (4316:13): [True: 2.73k, False: 0]
  ------------------
 4317|  2.73k|            DEBUGDUMPSECTION("recv", "SNMPv1 message\n");
  ------------------
  |  |   83|  2.73k|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|  2.73k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 2.73k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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]
  |  |  ------------------
  ------------------
 4318|  2.73k|        } else {
 4319|      0|#endif
 4320|      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]
  |  |  ------------------
  ------------------
 4321|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 4322|      0|        }
 4323|  2.73k|#endif
 4324|  2.73k|        data = snmp_comstr_parse(data, &length,
 4325|  2.73k|                                 community, &community_length,
 4326|  2.73k|                                 &pdu->version);
 4327|  2.73k|        if (data == NULL)
  ------------------
  |  Branch (4327:13): [True: 1.24k, False: 1.48k]
  ------------------
 4328|  1.24k|            return -1;
 4329|       |
 4330|  1.48k|        if (pdu->version != session->version &&
  ------------------
  |  Branch (4330:13): [True: 98, False: 1.38k]
  ------------------
 4331|  1.48k|            session->version != SNMP_DEFAULT_VERSION) {
  ------------------
  |  |  123|     98|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  |  Branch (4331:13): [True: 98, False: 0]
  ------------------
 4332|     98|            session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  229|     98|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 4333|     98|            return -1;
 4334|     98|        }
 4335|       |
 4336|       |        /*
 4337|       |         * maybe get the community string. 
 4338|       |         */
 4339|  1.38k|        pdu->securityLevel = SNMP_SEC_LEVEL_NOAUTH;
  ------------------
  |  |  299|  1.38k|#define SNMP_SEC_LEVEL_NOAUTH		1
  ------------------
 4340|  1.38k|        pdu->securityModel = 
 4341|  1.38k|#ifndef NETSNMP_DISABLE_SNMPV1
 4342|  1.38k|            (pdu->version == SNMP_VERSION_1) ? SNMP_SEC_MODEL_SNMPv1 : 
  ------------------
  |  |  107|  1.38k|#define SNMP_VERSION_1	   0
  ------------------
                          (pdu->version == SNMP_VERSION_1) ? SNMP_SEC_MODEL_SNMPv1 : 
  ------------------
  |  |  293|  1.38k|#define SNMP_SEC_MODEL_SNMPv1		1
  ------------------
  |  Branch (4342:13): [True: 1.38k, False: 0]
  ------------------
 4343|  1.38k|#endif
 4344|  1.38k|                                               SNMP_SEC_MODEL_SNMPv2c;
  ------------------
  |  |  294|  1.38k|#define SNMP_SEC_MODEL_SNMPv2c		2
  ------------------
 4345|  1.38k|        SNMP_FREE(pdu->community);
  ------------------
  |  |   62|  1.38k|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 1.38k]
  |  |  |  Branch (62:66): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4346|  1.38k|        pdu->community_len = 0;
 4347|  1.38k|        pdu->community = (u_char *) 0;
 4348|  1.38k|        if (community_length) {
  ------------------
  |  Branch (4348:13): [True: 39, False: 1.34k]
  ------------------
 4349|     39|            pdu->community_len = community_length;
 4350|     39|            pdu->community = netsnmp_memdup(community, community_length);
 4351|     39|            if (pdu->community == NULL) {
  ------------------
  |  Branch (4351:17): [True: 0, False: 39]
  ------------------
 4352|      0|                session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  277|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 4353|      0|                return -1;
 4354|      0|            }
 4355|     39|        }
 4356|  1.38k|        if (session->authenticator) {
  ------------------
  |  Branch (4356:13): [True: 0, False: 1.38k]
  ------------------
 4357|      0|            data = session->authenticator(data, &length,
 4358|      0|                                          community, community_length);
 4359|      0|            if (data == NULL) {
  ------------------
  |  Branch (4359:17): [True: 0, False: 0]
  ------------------
 4360|      0|                session->s_snmp_errno = SNMPERR_AUTHENTICATION_FAILURE;
  ------------------
  |  |  250|      0|#define SNMPERR_AUTHENTICATION_FAILURE 	(-35)
  ------------------
 4361|      0|                return -1;
 4362|      0|            }
 4363|      0|        }
 4364|       |
 4365|  1.38k|        DEBUGDUMPSECTION("recv", "PDU");
  ------------------
  |  |   83|  1.38k|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|  1.38k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 1.38k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	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]
  |  |  ------------------
  ------------------
 4366|  1.38k|        result = snmp_pdu_parse(pdu, data, &length);
 4367|  1.38k|        if (result < 0) {
  ------------------
  |  Branch (4367:13): [True: 1.21k, False: 175]
  ------------------
 4368|       |            /*
 4369|       |             * This indicates a parse error.  
 4370|       |             */
 4371|  1.21k|            snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  678|  1.21k|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4372|  1.21k|        }
 4373|  1.38k|        DEBUGINDENTADD(-6);
  ------------------
  |  |   75|  1.38k|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|  1.38k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 1.38k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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]
  |  |  ------------------
  ------------------
 4374|  1.38k|        break;
 4375|      0|#endif /* support for community based SNMP */
 4376|       |
 4377|      0|    case SNMP_VERSION_3:
  ------------------
  |  |  113|      0|#define SNMP_VERSION_3     3
  ------------------
  |  Branch (4377:5): [True: 0, False: 2.73k]
  ------------------
 4378|      0|        NETSNMP_RUNTIME_PROTOCOL_CHECK_V3(SNMP_VERSION_3,unsupported_version);
  ------------------
  |  |  232|      0|#define NETSNMP_RUNTIME_PROTOCOL_CHECK_V3(pc_ver, pc_target) do {      \
  |  |  233|      0|        if (NETSNMP_RUNTIME_PROTOCOL_SKIP_V3(pc_ver)) {                \
  |  |  ------------------
  |  |  |  |  228|      0|    ((pc_ver == SNMP_VERSION_3) &&                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  113|      0|#define SNMP_VERSION_3     3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (228:6): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  |  229|      0|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (229:6): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  230|      0|                            NETSNMP_DS_LIB_DISABLE_V3))
  |  |  |  |  ------------------
  |  |  |  |  |  |  105|      0|#define NETSNMP_DS_LIB_DISABLE_V3          45 /* disable SNMPv3 */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  234|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  235|      0|            goto pc_target;                                            \
  |  |  236|      0|        }                                                              \
  |  |  237|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (237:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 4379|      0|        result = snmpv3_parse(pdu, data, &length, NULL, session);
 4380|      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]
  |  |  ------------------
  ------------------
 4381|      0|                    "Parsed SNMPv3 message (secName:%s, secLevel:%s): %s\n",
 4382|      0|                    pdu->securityName, secLevelName[pdu->securityLevel],
 4383|      0|                    snmp_api_errstring(result)));
 4384|       |
 4385|      0|        if (result == SNMPERR_USM_UNKNOWNSECURITYNAME) {
  ------------------
  |  |  258|      0|#define SNMPERR_USM_UNKNOWNSECURITYNAME		(-43)
  ------------------
  |  Branch (4385:13): [True: 0, False: 0]
  ------------------
 4386|      0|            snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
  ------------------
  |  |   19|      0|#define SNMP_CALLBACK_APPLICATION 1
  ------------------
 4387|      0|                                SNMPD_CALLBACK_AUTH_FAILURE, pdu);
  ------------------
  |  |   21|      0|#define SNMPD_CALLBACK_AUTH_FAILURE             17
  ------------------
 4388|      0|        }
 4389|       |        
 4390|      0|        if (result) {
  ------------------
  |  Branch (4390:13): [True: 0, False: 0]
  ------------------
 4391|      0|            struct snmp_secmod_def *secmod =
 4392|      0|                find_sec_mod(pdu->securityModel);
 4393|      0|            if (!slp) {
  ------------------
  |  Branch (4393:17): [True: 0, False: 0]
  ------------------
 4394|      0|                session->s_snmp_errno = result;
 4395|      0|            } else {
 4396|       |                /*
 4397|       |                 * Call the security model to special handle any errors
 4398|       |                 */
 4399|       |
 4400|      0|                if (secmod && secmod->handle_report) {
  ------------------
  |  Branch (4400:21): [True: 0, False: 0]
  |  Branch (4400:31): [True: 0, False: 0]
  ------------------
 4401|      0|                    (*secmod->handle_report)(slp, slp->transport, session,
 4402|      0|                                             result, pdu);
 4403|      0|                }
 4404|      0|            }
 4405|      0|            free_securityStateRef(pdu);
 4406|      0|        }
 4407|       |
 4408|       |        /* Implement RFC5343 here for two reasons:
 4409|       |           1) From a security perspective it handles this otherwise
 4410|       |              always approved request earlier.  It bypasses the need
 4411|       |              for authorization to the snmpEngineID scalar, which is
 4412|       |              what is what RFC3415 appendix A species as ok.  Note
 4413|       |              that we haven't bypassed authentication since if there
 4414|       |              was an authentication eror it would have been handled
 4415|       |              above in the if(result) part at the lastet.
 4416|       |           2) From an application point of view if we let this request
 4417|       |              get all the way to the application, it'd require that
 4418|       |              all application types supporting discovery also fire up
 4419|       |              a minimal agent in order to handle just this request
 4420|       |              which seems like overkill.  Though there is no other
 4421|       |              application types that currently need discovery (NRs
 4422|       |              accept notifications from contextEngineIDs that derive
 4423|       |              from the NO not the NR).  Also a lame excuse for doing
 4424|       |              it here.
 4425|       |           3) Less important technically, but the net-snmp agent
 4426|       |              doesn't currently handle registrations of different
 4427|       |              engineIDs either and it would have been a lot more work
 4428|       |              to implement there since we'd need to support that
 4429|       |              first. :-/ Supporting multiple context engineIDs should
 4430|       |              be done anyway, so it's not a valid excuse here.
 4431|       |           4) There is a lot less to do if we trump the agent at this
 4432|       |              point; IE, the agent does a lot more unnecessary
 4433|       |              processing when the only thing that should ever be in
 4434|       |              this context by definition is the single scalar.
 4435|       |        */
 4436|       |
 4437|       |        /* special RFC5343 engineID discovery engineID check */
 4438|      0|        if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (4438:13): [True: 0, False: 0]
  ------------------
 4439|      0|                                    NETSNMP_DS_LIB_NO_DISCOVERY) &&
  ------------------
  |  |   98|      0|#define NETSNMP_DS_LIB_NO_DISCOVERY        38 /* don't support RFC5343 contextEngineID discovery */
  ------------------
 4440|      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 (4440:13): [True: 0, False: 0]
  ------------------
 4441|      0|            NULL                    != pdu->contextEngineID &&
  ------------------
  |  Branch (4441:13): [True: 0, False: 0]
  ------------------
 4442|      0|            pdu->contextEngineIDLen == 5 &&
  ------------------
  |  Branch (4442:13): [True: 0, False: 0]
  ------------------
 4443|      0|            pdu->contextEngineID[0] == 0x80 &&
  ------------------
  |  Branch (4443:13): [True: 0, False: 0]
  ------------------
 4444|      0|            pdu->contextEngineID[1] == 0x00 &&
  ------------------
  |  Branch (4444:13): [True: 0, False: 0]
  ------------------
 4445|      0|            pdu->contextEngineID[2] == 0x00 &&
  ------------------
  |  Branch (4445:13): [True: 0, False: 0]
  ------------------
 4446|      0|            pdu->contextEngineID[3] == 0x00 &&
  ------------------
  |  Branch (4446:13): [True: 0, False: 0]
  ------------------
 4447|      0|            pdu->contextEngineID[4] == 0x06) {
  ------------------
  |  Branch (4447:13): [True: 0, False: 0]
  ------------------
 4448|       |
 4449|       |            /* define a result so it doesn't get past us at this point
 4450|       |               and gets dropped by future parts of the stack */
 4451|      0|            result = SNMPERR_JUST_A_CONTEXT_PROBE;
  ------------------
  |  |  281|      0|#define SNMPERR_JUST_A_CONTEXT_PROBE    (-66)
  ------------------
 4452|       |
 4453|      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]
  |  |  ------------------
  ------------------
 4454|       |            /* ensure exactly one variable */
 4455|      0|            if (NULL != pdu->variables &&
  ------------------
  |  Branch (4455:17): [True: 0, False: 0]
  ------------------
 4456|      0|                NULL == pdu->variables->next_variable &&
  ------------------
  |  Branch (4456:17): [True: 0, False: 0]
  ------------------
 4457|       |
 4458|       |                /* if it's a GET, match it exactly */
 4459|      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 (4459:19): [True: 0, False: 0]
  ------------------
 4460|      0|                  snmp_oid_compare(snmpEngineIDoid,
  ------------------
  |  Branch (4460:19): [True: 0, False: 0]
  ------------------
 4461|      0|                                   snmpEngineIDoid_len,
 4462|      0|                                   pdu->variables->name,
 4463|      0|                                   pdu->variables->name_length) == 0)
 4464|       |                 /* if it's a GETNEXT ensure it's less than the engineID oid */
 4465|      0|                 ||
 4466|      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 (4466:19): [True: 0, False: 0]
  ------------------
 4467|      0|                  snmp_oid_compare(snmpEngineIDoid,
  ------------------
  |  Branch (4467:19): [True: 0, False: 0]
  ------------------
 4468|      0|                                   snmpEngineIDoid_len,
 4469|      0|                                   pdu->variables->name,
 4470|      0|                                   pdu->variables->name_length) > 0)
 4471|      0|                    )) {
 4472|       |
 4473|      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]
  |  |  ------------------
  ------------------
 4474|      0|                            "  One correct variable found\n"));
 4475|       |
 4476|       |                /* Note: we're explictly not handling a GETBULK.  Deal. */
 4477|       |
 4478|       |                /* set up the response */
 4479|      0|                pdu2 = snmp_clone_pdu(pdu);
 4480|       |
 4481|       |                /* free the current varbind */
 4482|      0|                snmp_free_varbind(pdu2->variables);
 4483|       |
 4484|       |                /* set the variables */
 4485|      0|                pdu2->variables = NULL;
 4486|      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
  |  |  ------------------
  ------------------
 4487|      0|                pdu2->errstat = 0;
 4488|      0|                pdu2->errindex = 0;
 4489|       |
 4490|      0|                ourEngineID_len =
 4491|      0|                    snmpv3_get_engineID((u_char*)ourEngineID, ourEngineID_len);
 4492|      0|                if (0 != ourEngineID_len) {
  ------------------
  |  Branch (4492:21): [True: 0, False: 0]
  ------------------
 4493|       |
 4494|      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]
  |  |  ------------------
  ------------------
 4495|      0|                                "  responding with our engineID\n"));
 4496|       |
 4497|      0|                    snmp_pdu_add_variable(pdu2,
 4498|      0|                                          snmpEngineIDoid, snmpEngineIDoid_len,
 4499|      0|                                          ASN_OCTET_STR,
  ------------------
  |  |   78|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
 4500|      0|                                          ourEngineID, ourEngineID_len);
 4501|       |                    
 4502|       |                    /* send the response */
 4503|      0|                    if (0 == snmp_sess_send(slp, pdu2)) {
  ------------------
  |  Branch (4503:25): [True: 0, False: 0]
  ------------------
 4504|       |
 4505|      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]
  |  |  ------------------
  ------------------
 4506|      0|                                    "  sent it off!\n"));
 4507|       |
 4508|      0|                        snmp_free_pdu(pdu2);
 4509|       |                        
 4510|      0|                        snmp_log(LOG_ERR, "sending a response to the context engineID probe failed\n");
 4511|      0|                    }
 4512|      0|                } else {
 4513|      0|                    snmp_log(LOG_ERR, "failed to get our own engineID!\n");
 4514|      0|                }
 4515|      0|            } else {
 4516|      0|                snmp_log(LOG_WARNING,
 4517|      0|                         "received an odd context engineID probe\n");
 4518|      0|            }
 4519|      0|        }
 4520|       |
 4521|      0|        break;
 4522|      0|    case SNMPERR_BAD_VERSION:
  ------------------
  |  |  229|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
  |  Branch (4522:5): [True: 0, False: 2.73k]
  ------------------
 4523|      0|        ERROR_MSG("error parsing snmp message version");
  ------------------
  |  |  190|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4524|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  678|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4525|      0|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  229|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 4526|      0|        break;
 4527|       |
 4528|      0|        unsupported_version:  /* goto label */
 4529|      0|    case SNMP_VERSION_sec:
  ------------------
  |  |  118|      0|#define SNMP_VERSION_sec   128  /* not (will never be) supported by this code */
  ------------------
  |  Branch (4529:5): [True: 0, False: 2.73k]
  ------------------
 4530|      0|    case SNMP_VERSION_2u:
  ------------------
  |  |  112|      0|#define SNMP_VERSION_2u    2    /* not (will never be) supported by this code */
  ------------------
  |  Branch (4530:5): [True: 0, False: 2.73k]
  ------------------
 4531|      0|    case SNMP_VERSION_2star:
  ------------------
  |  |  120|      0|#define SNMP_VERSION_2star 130  /* not (will never be) supported by this code */
  ------------------
  |  Branch (4531:5): [True: 0, False: 2.73k]
  ------------------
 4532|      0|    case SNMP_VERSION_2p:
  ------------------
  |  |  119|      0|#define SNMP_VERSION_2p	   129  /* no longer supported by this code (> 4.0) */
  ------------------
  |  Branch (4532:5): [True: 0, False: 2.73k]
  ------------------
 4533|      0|    default:
  ------------------
  |  Branch (4533:5): [True: 0, False: 2.73k]
  ------------------
 4534|      0|        ERROR_MSG("unsupported snmp message version");
  ------------------
  |  |  190|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4535|      0|        snmp_increment_statistic(STAT_SNMPINBADVERSIONS);
  ------------------
  |  |  675|      0|#define  STAT_SNMPINBADVERSIONS              11
  ------------------
 4536|       |
 4537|       |        /*
 4538|       |         * need better way to determine OS independent
 4539|       |         * INT32_MAX value, for now hardcode
 4540|       |         */
 4541|      0|        if (pdu->version < 0 || pdu->version > 2147483647) {
  ------------------
  |  Branch (4541:13): [True: 0, False: 0]
  |  Branch (4541:33): [True: 0, False: 0]
  ------------------
 4542|      0|            snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  678|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4543|      0|        }
 4544|      0|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  229|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 4545|      0|        break;
 4546|  2.73k|    }
 4547|       |
 4548|  1.38k|    return result;
 4549|  2.73k|}

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

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

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

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|        sptr->list = list;
  400|      2|        sliststorage = sptr;
  401|      2|    }
  402|      2|    return ret;
  403|      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|    202|{
 1094|    202|    static int      newline = 1;	 /* MTCRITICAL_RESOURCE */
 1095|    202|    const char     *newline_ptr;
 1096|    202|    char            sbuf[40];
 1097|       |
 1098|    202|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|    202|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1098:9): [True: 0, False: 202]
  ------------------
 1099|    202|                               NETSNMP_DS_LIB_LOG_TIMESTAMP) && newline) {
  ------------------
  |  |   64|    202|#define NETSNMP_DS_LIB_LOG_TIMESTAMP       5
  ------------------
  |  Branch (1099:65): [True: 0, False: 0]
  ------------------
 1100|      0|        sprintf_stamp(NULL, sbuf);
 1101|    202|    } else {
 1102|    202|        strcpy(sbuf, "");
 1103|    202|    }
 1104|       |    /*
 1105|       |     * Remember whether or not the current line ends with a newline for the
 1106|       |     * next call of log_handler_stdouterr().
 1107|       |     */
 1108|    202|    newline_ptr = strrchr(str, '\n');
 1109|    202|    newline = newline_ptr && newline_ptr[1] == 0;
  ------------------
  |  Branch (1109:15): [True: 202, False: 0]
  |  Branch (1109:30): [True: 202, False: 0]
  ------------------
 1110|       |
 1111|    202|    if (logh->imagic)
  ------------------
  |  Branch (1111:9): [True: 0, False: 202]
  ------------------
 1112|      0|       printf(         "%s%s", sbuf, str);
 1113|    202|    else
 1114|    202|       fprintf(stderr, "%s%s", sbuf, str);
 1115|       |
 1116|    202|    return 1;
 1117|    202|}
snmp_log_string:
 1284|    202|{
 1285|    202|#ifndef NETSNMP_FEATURE_REMOVE_LOGGING_STDIO
 1286|    202|    static int stderr_enabled = 0;
 1287|    202|    static netsnmp_log_handler lh = { 1, 0, 0, 0, "stderr",
 1288|    202|                                      log_handler_stdouterr, 0, NULL,  NULL,
 1289|    202|                                      NULL };
 1290|    202|#endif /* NETSNMP_FEATURE_REMOVE_LOGGING_STDIO */
 1291|    202|    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|    202|    if (0 == logh_enabled) {
  ------------------
  |  Branch (1297:9): [True: 202, False: 0]
  ------------------
 1298|    202|#ifndef NETSNMP_FEATURE_REMOVE_LOGGING_STDIO
 1299|    202|        if (!stderr_enabled) {
  ------------------
  |  Branch (1299:13): [True: 1, False: 201]
  ------------------
 1300|      1|            ++stderr_enabled;
 1301|      1|            netsnmp_set_line_buffering(stderr);
 1302|      1|        }
 1303|    202|        log_handler_stdouterr( &lh, priority, str );
 1304|    202|#endif /* NETSNMP_FEATURE_REMOVE_LOGGING_STDIO */
 1305|       |
 1306|    202|        return;
 1307|    202|    }
 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|    202|{
 1372|    202|    char           *buffer = NULL;
 1373|    202|    int             length;
 1374|       |
 1375|    202|    length = vasprintf(&buffer, format, ap);
 1376|    202|    if (length < 0) {
  ------------------
  |  Branch (1376:9): [True: 0, False: 202]
  ------------------
 1377|      0|        snmp_log_string(LOG_ERR, "Could not format log-string\n");
 1378|      0|        return -1;
 1379|      0|    }
 1380|       |
 1381|    202|    snmp_log_string(priority, buffer);
 1382|    202|    free(buffer);
 1383|    202|    return 0;
 1384|    202|}
snmp_log:
 1395|    202|{
 1396|    202|    va_list         ap;
 1397|    202|    int             ret;
 1398|    202|    va_start(ap, format);
 1399|    202|    ret = snmp_vlog(priority, format, ap);
 1400|    202|    va_end(ap);
 1401|    202|    return (ret);
 1402|    202|}

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;
  ------------------
  |  |  216|      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;
  ------------------
  |  |  277|      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;
  ------------------
  |  |  216|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  113|      0|    }
  114|      2|    return SNMPERR_SUCCESS;
  ------------------
  |  |  215|      2|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  115|      2|}
find_sec_mod:
  160|  5.52k|{
  161|  5.52k|    struct snmp_secmod_list *sptr;
  162|       |
  163|  11.0k|    for (sptr = registered_services; sptr; sptr = sptr->next) {
  ------------------
  |  Branch (163:38): [True: 5.52k, False: 5.52k]
  ------------------
  164|  5.52k|        if (sptr->securityModel == secmod) {
  ------------------
  |  Branch (164:13): [True: 0, False: 5.52k]
  ------------------
  165|      0|            return sptr->secDef;
  166|      0|        }
  167|  5.52k|    }
  168|       |    /*
  169|       |     * not registered 
  170|       |     */
  171|  5.52k|    return NULL;
  172|  5.52k|}

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

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

