snmp_input:
 1088|      1|{
 1089|      1|    oid stdTrapOidRoot[] = { 1, 3, 6, 1, 6, 3, 1, 1, 5 };
 1090|      1|    oid snmpTrapOid[]    = { 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0 };
 1091|      1|    oid trapOid[MAX_OID_LEN+2] = {0};
 1092|      1|    int trapOidLen;
 1093|      1|    netsnmp_variable_list *vars;
 1094|      1|    netsnmp_trapd_handler *traph;
 1095|      1|    netsnmp_transport *transport = (netsnmp_transport *) magic;
 1096|      1|    int ret, idx;
 1097|       |
 1098|      1|    switch (op) {
 1099|      1|    case NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE:
  ------------------
  |  |  352|      1|#define NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE	1
  ------------------
  |  Branch (1099:5): [True: 1, False: 0]
  ------------------
 1100|       |        /*
 1101|       |         * Drops packets with reception problems
 1102|       |         */
 1103|      1|        if (session->s_snmp_errno) {
  ------------------
  |  Branch (1103:13): [True: 1, False: 0]
  ------------------
 1104|       |            /* drop problem packets */
 1105|      1|            return 1;
 1106|      1|        }
 1107|       |
 1108|       |        /*
 1109|       |	 * Determine the OID that identifies the trap being handled
 1110|       |	 */
 1111|      0|        DEBUGMSGTL(("snmptrapd", "input: %x\n", pdu->command));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1112|      0|        switch (pdu->command) {
 1113|      0|        case SNMP_MSG_TRAP:
  ------------------
  |  |  135|      0|#define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (1113:9): [True: 0, False: 0]
  ------------------
 1114|       |            /*
 1115|       |	     * Convert v1 traps into a v2-style trap OID
 1116|       |	     *    (following RFC 2576)
 1117|       |	     */
 1118|      0|            if (pdu->trap_type == SNMP_TRAP_ENTERPRISESPECIFIC) {
  ------------------
  |  |  257|      0|#define SNMP_TRAP_ENTERPRISESPECIFIC	(6)
  ------------------
  |  Branch (1118:17): [True: 0, False: 0]
  ------------------
 1119|      0|                trapOidLen = pdu->enterprise_length;
 1120|       |                /*
 1121|       |                 * Drop packets that would trigger an out-of-bounds trapOid[]
 1122|       |                 * access.
 1123|       |                 */
 1124|      0|                if (trapOidLen < 1 || trapOidLen > OID_LENGTH(trapOid) - 2)
  ------------------
  |  |   64|      0|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|      0|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
  |  Branch (1124:21): [True: 0, False: 0]
  |  Branch (1124:39): [True: 0, False: 0]
  ------------------
 1125|      0|                    return 1;
 1126|      0|                memcpy(trapOid, pdu->enterprise, sizeof(oid) * trapOidLen);
 1127|      0|                if (trapOid[trapOidLen - 1] != 0) {
  ------------------
  |  Branch (1127:21): [True: 0, False: 0]
  ------------------
 1128|      0|                    trapOid[trapOidLen++] = 0;
 1129|      0|                }
 1130|      0|                trapOid[trapOidLen++] = pdu->specific_type;
 1131|      0|            } else {
 1132|      0|                memcpy(trapOid, stdTrapOidRoot, sizeof(stdTrapOidRoot));
 1133|      0|                trapOidLen = OID_LENGTH(stdTrapOidRoot);  /* 9 */
  ------------------
  |  |   64|      0|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|      0|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
 1134|       |                /* Drop packets with an invalid trap type. */
 1135|      0|                if (pdu->trap_type == LONG_MAX)
  ------------------
  |  Branch (1135:21): [True: 0, False: 0]
  ------------------
 1136|      0|                    return 1;
 1137|      0|                trapOid[trapOidLen++] = pdu->trap_type+1;
 1138|      0|            }
 1139|      0|            break;
 1140|       |
 1141|      0|        case SNMP_MSG_TRAP2:
  ------------------
  |  |  142|      0|#define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (1141:9): [True: 0, False: 0]
  ------------------
 1142|      0|        case SNMP_MSG_INFORM:
  ------------------
  |  |  141|      0|#define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (1142:9): [True: 0, False: 0]
  ------------------
 1143|       |            /*
 1144|       |	     * v2c/v3 notifications *should* have snmpTrapOID as the
 1145|       |	     *    second varbind, so we can go straight there.
 1146|       |	     *    But check, just to make sure
 1147|       |	     */
 1148|      0|            vars = pdu->variables;
 1149|      0|            if (vars)
  ------------------
  |  Branch (1149:17): [True: 0, False: 0]
  ------------------
 1150|      0|                vars = vars->next_variable;
 1151|      0|            if (!vars || snmp_oid_compare(vars->name, vars->name_length,
  ------------------
  |  Branch (1151:17): [True: 0, False: 0]
  |  Branch (1151:26): [True: 0, False: 0]
  ------------------
 1152|      0|                                          snmpTrapOid, OID_LENGTH(snmpTrapOid))) {
  ------------------
  |  |   64|      0|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|      0|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
 1153|       |	        /*
 1154|       |		 * Didn't find it!
 1155|       |		 * Let's look through the full list....
 1156|       |		 */
 1157|      0|		for ( vars = pdu->variables; vars; vars=vars->next_variable) {
  ------------------
  |  Branch (1157:32): [True: 0, False: 0]
  ------------------
 1158|      0|                    if (vars->type != ASN_OBJECT_ID)
  ------------------
  |  |   81|      0|#define ASN_OBJECT_ID	    0x06U
  ------------------
  |  Branch (1158:25): [True: 0, False: 0]
  ------------------
 1159|      0|                        continue;
 1160|      0|                    if (!snmp_oid_compare(vars->name, vars->name_length,
  ------------------
  |  Branch (1160:25): [True: 0, False: 0]
  ------------------
 1161|      0|                                          snmpTrapOid, OID_LENGTH(snmpTrapOid)))
  ------------------
  |  |   64|      0|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|      0|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
 1162|      0|                        break;
 1163|      0|                }
 1164|      0|                if (!vars) {
  ------------------
  |  Branch (1164:21): [True: 0, False: 0]
  ------------------
 1165|       |	            /*
 1166|       |		     * Still can't find it!  Give up.
 1167|       |		     */
 1168|      0|		    snmp_log(LOG_ERR, "Cannot find TrapOID in TRAP2 PDU\n");
 1169|      0|		    return 1;		/* ??? */
 1170|      0|		}
 1171|      0|	    }
 1172|      0|            trapOidLen = SNMP_MIN(sizeof(trapOid), vars->val_len) / sizeof(oid);
  ------------------
  |  |  111|      0|#define SNMP_MIN(a,b) ((a) > (b) ? (b) : (a))
  |  |  ------------------
  |  |  |  Branch (111:24): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1173|      0|            memcpy(trapOid, vars->val.objid, trapOidLen * sizeof(oid));
 1174|      0|            break;
 1175|       |
 1176|      0|        default:
  ------------------
  |  Branch (1176:9): [True: 0, False: 0]
  ------------------
 1177|       |            /* SHOULDN'T HAPPEN! */
 1178|      0|            return 1;	/* ??? */
 1179|      0|	}
 1180|      0|        DEBUGMSGTL(( "snmptrapd", "Trap OID: "));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1181|      0|        DEBUGMSGOID(("snmptrapd", trapOid, trapOidLen));
  ------------------
  |  |   67|      0|#define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  165|      0|#define __DBGMSGOID(x)     debugmsg_oid x
  |  |  ------------------
  |  |  |  Branch (67:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1182|      0|        DEBUGMSG(( "snmptrapd", "\n"));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1183|       |
 1184|       |
 1185|       |        /*
 1186|       |	 *  OK - We've found the Trap OID used to identify this trap.
 1187|       |         *  Call each of the various lists of handlers:
 1188|       |         *     a) authentication-related handlers,
 1189|       |         *     b) other handlers to be applied to all traps
 1190|       |         *		(*before* trap-specific handlers)
 1191|       |         *     c) the handler(s) specific to this trap
 1192|       |t        *     d) any other global handlers
 1193|       |         *
 1194|       |	 *  In each case, a particular trap handler can abort further
 1195|       |         *     processing - either just for that particular list,
 1196|       |         *     or for the trap completely.
 1197|       |         *
 1198|       |	 *  This is particularly designed for authentication-related
 1199|       |	 *     handlers, but can also be used elsewhere.
 1200|       |         *
 1201|       |         *  OK - Enough waffling, let's get to work.....
 1202|       |	 */
 1203|       |
 1204|      0|        for( idx = 0; handlers[idx].descr; ++idx ) {
  ------------------
  |  Branch (1204:23): [True: 0, False: 0]
  ------------------
 1205|      0|            DEBUGMSGTL(("snmptrapd", "Running %s handlers\n",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1206|      0|                        handlers[idx].descr));
 1207|      0|            if (NULL == handlers[idx].handler) /* specific */
  ------------------
  |  Branch (1207:17): [True: 0, False: 0]
  ------------------
 1208|      0|                traph = netsnmp_get_traphandler(trapOid, trapOidLen);
 1209|      0|            else
 1210|      0|                traph = *handlers[idx].handler;
 1211|       |
 1212|      0|            for( ; traph; traph = traph->nexth) {
  ------------------
  |  Branch (1212:20): [True: 0, False: 0]
  ------------------
 1213|      0|                if (!netsnmp_trapd_check_auth(traph->authtypes))
  ------------------
  |  Branch (1213:21): [True: 0, False: 0]
  ------------------
 1214|      0|                    continue; /* we continue on and skip this one */
 1215|       |
 1216|      0|                ret = (*(traph->handler))(pdu, transport, traph);
 1217|      0|                if(NETSNMPTRAPD_HANDLER_FINISH == ret)
  ------------------
  |  |   55|      0|#define NETSNMPTRAPD_HANDLER_FINISH  4	/* No further processing */
  ------------------
  |  Branch (1217:20): [True: 0, False: 0]
  ------------------
 1218|      0|                    return 1;
 1219|      0|                if (ret == NETSNMPTRAPD_HANDLER_BREAK)
  ------------------
  |  |   54|      0|#define NETSNMPTRAPD_HANDLER_BREAK   3	/* Move to the next list */
  ------------------
  |  Branch (1219:21): [True: 0, False: 0]
  ------------------
 1220|      0|                    break; /* move on to next type */
 1221|      0|            } /* traph */
 1222|      0|        } /* handlers */
 1223|       |
 1224|       |
 1225|      0|	if (pdu->command == SNMP_MSG_INFORM) {
  ------------------
  |  |  141|      0|#define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (1225:6): [True: 0, False: 0]
  ------------------
 1226|      0|	    netsnmp_pdu *reply = snmp_clone_pdu(pdu);
 1227|      0|	    if (!reply) {
  ------------------
  |  Branch (1227:10): [True: 0, False: 0]
  ------------------
 1228|      0|		snmp_log(LOG_ERR, "couldn't clone PDU for INFORM response\n");
 1229|      0|	    } else {
 1230|      0|		reply->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
  |  |  ------------------
  ------------------
 1231|      0|		reply->errstat = 0;
 1232|      0|		reply->errindex = 0;
 1233|      0|		if (!snmp_send(session, reply)) {
  ------------------
  |  Branch (1233:7): [True: 0, False: 0]
  ------------------
 1234|      0|		    snmp_sess_perror("snmptrapd: Couldn't respond to inform pdu",
 1235|      0|                                    session);
 1236|      0|		    snmp_free_pdu(reply);
 1237|      0|		}
 1238|      0|	    }
 1239|      0|	}
 1240|       |
 1241|      0|        break;
 1242|       |
 1243|      0|    case NETSNMP_CALLBACK_OP_TIMED_OUT:
  ------------------
  |  |  353|      0|#define NETSNMP_CALLBACK_OP_TIMED_OUT		2
  ------------------
  |  Branch (1243:5): [True: 0, False: 1]
  ------------------
 1244|      0|        snmp_log(LOG_ERR, "Timeout: This shouldn't happen!\n");
 1245|      0|        break;
 1246|       |
 1247|      0|    case NETSNMP_CALLBACK_OP_SEND_FAILED:
  ------------------
  |  |  354|      0|#define NETSNMP_CALLBACK_OP_SEND_FAILED		3
  ------------------
  |  Branch (1247:5): [True: 0, False: 1]
  ------------------
 1248|      0|        snmp_log(LOG_ERR, "Send Failed: This shouldn't happen either!\n");
 1249|      0|        break;
 1250|       |
 1251|      0|    case NETSNMP_CALLBACK_OP_CONNECT:
  ------------------
  |  |  355|      0|#define NETSNMP_CALLBACK_OP_CONNECT		4
  ------------------
  |  Branch (1251:5): [True: 0, False: 1]
  ------------------
 1252|      0|    case NETSNMP_CALLBACK_OP_DISCONNECT:
  ------------------
  |  |  356|      0|#define NETSNMP_CALLBACK_OP_DISCONNECT		5
  ------------------
  |  Branch (1252:5): [True: 0, False: 1]
  ------------------
 1253|       |        /* Ignore silently */
 1254|      0|        break;
 1255|       |
 1256|      0|    default:
  ------------------
  |  Branch (1256:5): [True: 0, False: 1]
  ------------------
 1257|      0|        snmp_log(LOG_ERR, "Unknown operation (%d): This shouldn't happen!\n", op);
 1258|      0|        break;
 1259|      1|    }
 1260|      0|    return 0;
 1261|      1|}

asn_parse_nlength:
  327|    204|{
  328|    204|    int len_len;
  329|       |
  330|    204|    if (pkt_len < 1)
  ------------------
  |  Branch (330:9): [True: 0, False: 204]
  ------------------
  331|      0|        return NULL;               /* always too short */
  332|       |
  333|    204|    if (NULL == pkt || NULL == data_len)
  ------------------
  |  Branch (333:9): [True: 0, False: 204]
  |  Branch (333:24): [True: 0, False: 204]
  ------------------
  334|      0|        return NULL;
  335|       |
  336|    204|    *data_len = 0;
  337|       |
  338|    204|    if (*pkt & 0x80) {
  ------------------
  |  Branch (338:9): [True: 17, False: 187]
  ------------------
  339|       |        /*
  340|       |         * long length; first byte is length of length (after masking high bit)
  341|       |         */
  342|     17|        len_len = (int) ((*pkt & ~0x80) + 1);
  343|     17|        if (pkt_len < len_len)
  ------------------
  |  Branch (343:13): [True: 3, False: 14]
  ------------------
  344|      3|            return NULL;           /* still too short for length and data */
  345|       |
  346|       |        /* now we know we have enough data to parse length */
  347|     14|        if (NULL == asn_parse_length(pkt, data_len))
  ------------------
  |  Branch (347:13): [True: 4, False: 10]
  ------------------
  348|      4|            return NULL;           /* propagate error from asn_parse_length */
  349|    187|    } else {
  350|       |        /*
  351|       |         * short length; first byte is the length
  352|       |         */
  353|    187|        len_len = 1;
  354|    187|        *data_len = *pkt;
  355|    187|    }
  356|       |
  357|    197|    if ((*data_len + len_len) > pkt_len)
  ------------------
  |  Branch (357:9): [True: 19, False: 178]
  ------------------
  358|     19|        return NULL;
  359|       |
  360|    178|    return (pkt + len_len);
  361|    197|}
asn_parse_int:
  563|     79|{
  564|       |    /*
  565|       |     * ASN.1 integer ::= 0x02 asnlength byte {byte}*
  566|       |     */
  567|     79|    static const char *errpre = "parse int";
  568|     79|    register u_char *bufp = data;
  569|     79|    u_long          asn_length;
  570|     79|    int             i;
  571|     79|    union {
  572|     79|        long          l;
  573|     79|        unsigned char b[sizeof(long)];
  574|     79|    } value;
  575|       |
  576|     79|    if (NULL == data || NULL == datalength || NULL == type || NULL == intp) {
  ------------------
  |  Branch (576:9): [True: 0, False: 79]
  |  Branch (576:25): [True: 0, False: 79]
  |  Branch (576:47): [True: 0, False: 79]
  |  Branch (576:63): [True: 0, False: 79]
  ------------------
  577|      0|        ERROR_MSG("parse int: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  578|      0|        return NULL;
  579|      0|    }
  580|       |
  581|     79|    if (intsize != sizeof(long)) {
  ------------------
  |  Branch (581:9): [True: 0, False: 79]
  ------------------
  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|     79|    if (*datalength < 2) {
  ------------------
  |  Branch (587:9): [True: 1, False: 78]
  ------------------
  588|      1|        _asn_short_err(errpre, *datalength, 2);
  589|      1|        return NULL;
  590|      1|    }
  591|       |
  592|     78|    *type = *bufp++;
  593|     78|    if (*type != ASN_INTEGER) {
  ------------------
  |  |   75|     78|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (593:9): [True: 2, False: 76]
  ------------------
  594|      2|        _asn_type_err(errpre, *type);
  595|      2|        return NULL;
  596|      2|    }
  597|       |
  598|     76|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
  599|     76|    if (NULL == bufp) {
  ------------------
  |  Branch (599:9): [True: 2, False: 74]
  ------------------
  600|      2|        _asn_short_err(errpre, *datalength - 1, asn_length);
  601|      2|        return NULL;
  602|      2|    }
  603|       |
  604|     74|    if ((size_t) asn_length > intsize || (int) asn_length == 0) {
  ------------------
  |  Branch (604:9): [True: 0, False: 74]
  |  Branch (604:42): [True: 1, False: 73]
  ------------------
  605|      1|        _asn_length_err(errpre, (size_t) asn_length, intsize);
  606|      1|        return NULL;
  607|      1|    }
  608|       |
  609|     73|    *datalength -= (int) asn_length + (bufp - data);
  610|       |
  611|     73|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|     73|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     73|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 73]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  196|      0|        debugmsg("dumpx" token, "dumpx_%s:%*s", token, __DBGINDENT(), ""); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  |  |  197|      0|        __DBGMSGHEX(("dumpx_" token,buf,len)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  |  |  ------------------
  |  |  |  |  198|      0|        if (debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (198:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  199|      0|            debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (199:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  200|      0|            debugmsg("dumpx_" token,"\n"); \
  |  |  |  |  201|      0|        } else { \
  |  |  |  |  202|      0|            debugmsg("dumpx_" token,"  "); \
  |  |  |  |  203|      0|        } \
  |  |  |  |  204|      0|        debugmsg("dumpv" token, "dumpv_%s:%*s", token, __DBGINDENT(), "");
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:60): [Folded, False: 73]
  |  |  ------------------
  ------------------
  612|       |
  613|     73|    memset(&value.b, *bufp & 0x80 ? 0xff : 0, sizeof(value.b));
  ------------------
  |  Branch (613:22): [True: 10, False: 63]
  ------------------
  614|     73|    if (NETSNMP_BIGENDIAN) {
  ------------------
  |  | 2390|     73|#  define NETSNMP_BIGENDIAN 0
  |  |  ------------------
  |  |  |  Branch (2390:29): [Folded, False: 73]
  |  |  ------------------
  ------------------
  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|     73|    } else {
  618|    265|        for (i = asn_length - 1; asn_length--; i--)
  ------------------
  |  Branch (618:34): [True: 192, False: 73]
  ------------------
  619|    192|            value.b[i] = *bufp++;
  620|     73|    }
  621|       |
  622|     73|    CHECK_OVERFLOW_S(value.l, 1);
  ------------------
  |  |  214|     73|#define CHECK_OVERFLOW_S(x,y) do {                                      \
  |  |  215|     73|        if (x > INT32_MAX) {                                            \
  |  |  ------------------
  |  |  |  Branch (215:13): [True: 3, False: 70]
  |  |  ------------------
  |  |  216|      3|            DEBUGMSG(("asn","truncating signed value %ld to 32 bits (%d)\n",(long)(x),y)); \
  |  |  ------------------
  |  |  |  |   61|      3|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  217|      3|            x &= 0xffffffff;                                            \
  |  |  218|     70|        } else if (x < INT32_MIN) {                                     \
  |  |  ------------------
  |  |  |  Branch (218:20): [True: 3, False: 67]
  |  |  ------------------
  |  |  219|      3|            DEBUGMSG(("asn","truncating signed value %ld to 32 bits (%d)\n",(long)(x),y)); \
  |  |  ------------------
  |  |  |  |   61|      3|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  220|      3|            x = 0 - (x & 0xffffffff);                                   \
  |  |  221|      3|        }                                                               \
  |  |  222|     73|    } while(0)
  |  |  ------------------
  |  |  |  Branch (222:13): [Folded, False: 73]
  |  |  ------------------
  ------------------
  623|       |
  624|     73|    DEBUGMSG(("dumpv_recv", "  Integer:\t%ld (0x%.2lX)\n", value.l, value.l));
  ------------------
  |  |   61|     73|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     73|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 73]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 73]
  |  |  ------------------
  ------------------
  625|       |
  626|     73|    *intp = value.l;
  627|     73|    return bufp;
  628|     74|}
asn_parse_unsigned_int:
  656|      2|{
  657|       |    /*
  658|       |     * ASN.1 integer ::= 0x02 asnlength byte {byte}*
  659|       |     */
  660|      2|    static const char *errpre = "parse uint";
  661|      2|    register u_char *bufp = data;
  662|      2|    u_long          asn_length;
  663|      2|    register u_long value = 0;
  664|       |
  665|      2|    if (NULL == data || NULL == datalength || NULL == type || NULL == intp) {
  ------------------
  |  Branch (665:9): [True: 0, False: 2]
  |  Branch (665:25): [True: 0, False: 2]
  |  Branch (665:47): [True: 0, False: 2]
  |  Branch (665:63): [True: 0, False: 2]
  ------------------
  666|      0|        ERROR_MSG("parse uint: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  667|      0|        return NULL;
  668|      0|    }
  669|       |
  670|      2|    if (intsize != sizeof(long)) {
  ------------------
  |  Branch (670:9): [True: 0, False: 2]
  ------------------
  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|      2|    if (*datalength < 2) {
  ------------------
  |  Branch (676:9): [True: 0, False: 2]
  ------------------
  677|      0|        _asn_short_err(errpre, *datalength, 2);
  678|      0|        return NULL;
  679|      0|    }
  680|       |
  681|      2|    *type = *bufp++;
  682|      2|    if (*type != ASN_COUNTER && *type != ASN_GAUGE && *type != ASN_TIMETICKS
  ------------------
  |  |   89|      4|#define ASN_COUNTER	(ASN_APPLICATION | 1)
  |  |  ------------------
  |  |  |  |   91|      2|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if (*type != ASN_COUNTER && *type != ASN_GAUGE && *type != ASN_TIMETICKS
  ------------------
  |  |   90|      4|#define ASN_GAUGE	(ASN_APPLICATION | 2)
  |  |  ------------------
  |  |  |  |   91|      2|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if (*type != ASN_COUNTER && *type != ASN_GAUGE && *type != ASN_TIMETICKS
  ------------------
  |  |   92|      4|#define ASN_TIMETICKS   (ASN_APPLICATION | 3)
  |  |  ------------------
  |  |  |  |   91|      2|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (682:9): [True: 2, False: 0]
  |  Branch (682:33): [True: 2, False: 0]
  |  Branch (682:55): [True: 0, False: 2]
  ------------------
  683|      0|            && *type != ASN_UINTEGER) {
  ------------------
  |  |  100|      0|#define ASN_UINTEGER    (ASN_APPLICATION | 7)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (683:16): [True: 0, False: 0]
  ------------------
  684|      0|        _asn_type_err(errpre, *type);
  685|      0|        return NULL;
  686|      0|    }
  687|       |
  688|      2|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
  689|      2|    if (NULL == bufp) {
  ------------------
  |  Branch (689:9): [True: 2, False: 0]
  ------------------
  690|      2|        _asn_short_err(errpre, *datalength - 1, asn_length);
  691|      2|        return NULL;
  692|      2|    }
  693|       |
  694|      0|    if ((asn_length > (intsize + 1)) || ((int) asn_length == 0) ||
  ------------------
  |  Branch (694:9): [True: 0, False: 0]
  |  Branch (694:41): [True: 0, False: 0]
  ------------------
  695|      0|        ((asn_length == intsize + 1) && *bufp != 0x00)) {
  ------------------
  |  Branch (695:10): [True: 0, False: 0]
  |  Branch (695:41): [True: 0, False: 0]
  ------------------
  696|      0|        _asn_length_err(errpre, (size_t) asn_length, intsize);
  697|      0|        return NULL;
  698|      0|    }
  699|      0|    *datalength -= (int) asn_length + (bufp - data);
  700|       |
  701|      0|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|      0|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  196|      0|        debugmsg("dumpx" token, "dumpx_%s:%*s", token, __DBGINDENT(), ""); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  |  |  197|      0|        __DBGMSGHEX(("dumpx_" token,buf,len)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  |  |  ------------------
  |  |  |  |  198|      0|        if (debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (198:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  199|      0|            debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (199:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  200|      0|            debugmsg("dumpx_" token,"\n"); \
  |  |  |  |  201|      0|        } else { \
  |  |  |  |  202|      0|            debugmsg("dumpx_" token,"  "); \
  |  |  |  |  203|      0|        } \
  |  |  |  |  204|      0|        debugmsg("dumpv" token, "dumpv_%s:%*s", token, __DBGINDENT(), "");
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:60): [Folded, False: 0]
  |  |  ------------------
  ------------------
  702|       |
  703|      0|    while (asn_length--)
  ------------------
  |  Branch (703:12): [True: 0, False: 0]
  ------------------
  704|      0|        value = (value << 8) | *bufp++;
  705|       |
  706|      0|    CHECK_OVERFLOW_U(value,2);
  ------------------
  |  |  224|      0|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|      0|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  226|      0|            x &= 0xffffffff;                                            \
  |  |  227|      0|            DEBUGMSG(("asn","truncating unsigned value to 32 bits (%d)\n",y)); \
  |  |  ------------------
  |  |  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  228|      0|        }                                                               \
  |  |  229|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
  707|       |
  708|      0|    DEBUGMSG(("dumpv_recv", "  UInteger:\t%ld (0x%.2lX)\n", value, value));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
  709|       |
  710|      0|    *intp = value;
  711|      0|    return bufp;
  712|      0|}
asn_parse_string:
  916|     38|{
  917|     38|    static const char *errpre = "parse string";
  918|     38|    u_char         *bufp = data;
  919|     38|    u_long          asn_length;
  920|       |
  921|     38|    if (NULL == data || NULL == datalength || NULL == type || NULL == str ||
  ------------------
  |  Branch (921:9): [True: 0, False: 38]
  |  Branch (921:25): [True: 0, False: 38]
  |  Branch (921:47): [True: 0, False: 38]
  |  Branch (921:63): [True: 0, False: 38]
  ------------------
  922|     38|        NULL == strlength) {
  ------------------
  |  Branch (922:9): [True: 0, False: 38]
  ------------------
  923|      0|        ERROR_MSG("parse string: NULL pointer");
  ------------------
  |  |  188|      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|     38|    if (*datalength < 2) {
  ------------------
  |  Branch (928:9): [True: 0, False: 38]
  ------------------
  929|      0|        _asn_short_err(errpre, *datalength, 2);
  930|      0|        return NULL;
  931|      0|    }
  932|       |
  933|     38|    *type = *bufp++;
  934|     38|    if (*type != ASN_OCTET_STR && *type != ASN_IPADDRESS && *type != ASN_OPAQUE
  ------------------
  |  |   78|     76|#define ASN_OCTET_STR	    0x04U
  ------------------
                  if (*type != ASN_OCTET_STR && *type != ASN_IPADDRESS && *type != ASN_OPAQUE
  ------------------
  |  |   88|     46|#define ASN_IPADDRESS   (ASN_APPLICATION | 0)
  |  |  ------------------
  |  |  |  |   91|      8|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if (*type != ASN_OCTET_STR && *type != ASN_IPADDRESS && *type != ASN_OPAQUE
  ------------------
  |  |   93|     44|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|      6|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (934:9): [True: 8, False: 30]
  |  Branch (934:35): [True: 6, False: 2]
  |  Branch (934:61): [True: 2, False: 4]
  ------------------
  935|      2|            && *type != ASN_NSAP) {
  ------------------
  |  |   98|      2|#define ASN_NSAP	(ASN_APPLICATION | 5)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|      2|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (935:16): [True: 2, False: 0]
  ------------------
  936|      2|        _asn_type_err(errpre, *type);
  937|      2|        return NULL;
  938|      2|    }
  939|       |
  940|     36|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
  941|     36|    if (NULL == bufp) {
  ------------------
  |  Branch (941:9): [True: 3, False: 33]
  ------------------
  942|      3|        _asn_short_err(errpre, *datalength - 1, asn_length);
  943|      3|        return NULL;
  944|      3|    }
  945|       |
  946|     33|    if (asn_length > *strlength) {
  ------------------
  |  Branch (946:9): [True: 0, False: 33]
  ------------------
  947|      0|        _asn_length_err(errpre, (size_t) asn_length, *strlength);
  948|      0|        return NULL;
  949|      0|    }
  950|       |
  951|     33|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|     33|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     33|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 33]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  196|      0|        debugmsg("dumpx" token, "dumpx_%s:%*s", token, __DBGINDENT(), ""); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  |  |  197|      0|        __DBGMSGHEX(("dumpx_" token,buf,len)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  |  |  ------------------
  |  |  |  |  198|      0|        if (debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (198:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  199|      0|            debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (199:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  200|      0|            debugmsg("dumpx_" token,"\n"); \
  |  |  |  |  201|      0|        } else { \
  |  |  |  |  202|      0|            debugmsg("dumpx_" token,"  "); \
  |  |  |  |  203|      0|        } \
  |  |  |  |  204|      0|        debugmsg("dumpv" token, "dumpv_%s:%*s", token, __DBGINDENT(), "");
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:60): [Folded, False: 33]
  |  |  ------------------
  ------------------
  952|       |
  953|     33|    memmove(str, bufp, asn_length);
  954|     33|    if (*strlength > asn_length)
  ------------------
  |  Branch (954:9): [True: 33, False: 0]
  ------------------
  955|     33|        str[asn_length] = 0;
  956|     33|    *strlength = asn_length;
  957|     33|    *datalength -= asn_length + (bufp - data);
  958|       |
  959|     33|    DEBUGIF("dumpv_recv") {
  ------------------
  |  |  145|     33|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|     66|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 33]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (145: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));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
  966|      0|        } else {
  967|      0|            if (buf == NULL) {
  ------------------
  |  Branch (967:17): [True: 0, False: 0]
  ------------------
  968|      0|                DEBUGMSG(("dumpv_recv", "  String:\t[TRUNCATED]\n"));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
  969|      0|            } else {
  970|      0|                DEBUGMSG(("dumpv_recv", "  String:\t%s [TRUNCATED]\n",
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
  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|     33|    return bufp + asn_length;
  980|     33|}
asn_parse_header:
 1077|    112|{
 1078|    112|    register u_char *bufp;
 1079|    112|    u_long          asn_length = 0;
 1080|    112|    const char      *errpre = "parse header";
 1081|       |
 1082|    112|    if (!data || !datalength || !type) {
  ------------------
  |  Branch (1082:9): [True: 0, False: 112]
  |  Branch (1082:18): [True: 0, False: 112]
  |  Branch (1082:33): [True: 0, False: 112]
  ------------------
 1083|      0|        ERROR_MSG("parse header: NULL pointer");
  ------------------
  |  |  188|      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|    112|    if (*datalength < 2) {
  ------------------
  |  Branch (1088:9): [True: 22, False: 90]
  ------------------
 1089|     22|        _asn_short_err(errpre, *datalength, 2);
 1090|     22|        return NULL;
 1091|     22|    }
 1092|       |
 1093|     90|    bufp = data;
 1094|       |    /*
 1095|       |     * this only works on data types < 30, i.e. no extension octets 
 1096|       |     */
 1097|     90|    if (IS_EXTENSION_ID(*bufp)) {
  ------------------
  |  |  103|     90|#define IS_EXTENSION_ID(byte)	(((byte) & ASN_EXTENSION_ID) == ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|     90|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  |  |               #define IS_EXTENSION_ID(byte)	(((byte) & ASN_EXTENSION_ID) == ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|     90|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  |  |  |  Branch (103:31): [True: 2, False: 88]
  |  |  ------------------
  ------------------
 1098|      2|        ERROR_MSG("can't process ID >= 30");
  ------------------
  |  |  188|      2|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1099|      2|        return NULL;
 1100|      2|    }
 1101|     88|    *type = *bufp++;
 1102|       |
 1103|     88|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 1104|     88|    if (NULL == bufp) {
  ------------------
  |  Branch (1104:9): [True: 19, False: 69]
  ------------------
 1105|     19|        _asn_short_err(errpre, *datalength - 1, asn_length);
 1106|     19|        return NULL;
 1107|     19|    }
 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|     69|#endif
 1119|       |
 1120|     69|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 1121|       |
 1122|     69|    if ((asn_length > 2) && (*type == ASN_OPAQUE) && (*bufp == ASN_OPAQUE_TAG1)) {
  ------------------
  |  |   93|     66|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|     66|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
                  if ((asn_length > 2) && (*type == ASN_OPAQUE) && (*bufp == ASN_OPAQUE_TAG1)) {
  ------------------
  |  |  131|      2|#define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   92|      2|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_TAG1 (ASN_CONTEXT | ASN_EXTENSION_ID)
  |  |  ------------------
  |  |  |  |   99|      2|#define ASN_EXTENSION_ID    0x1FU
  |  |  ------------------
  ------------------
  |  Branch (1122:9): [True: 66, False: 3]
  |  Branch (1122:29): [True: 2, False: 64]
  |  Branch (1122:54): [True: 0, False: 2]
  ------------------
 1123|       |
 1124|       |        /*
 1125|       |         * check if 64-but counter 
 1126|       |         */
 1127|      0|        switch (*(bufp + 1)) {
 1128|      0|        case ASN_OPAQUE_COUNTER64:
  ------------------
  |  |  156|      0|#define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  146|      0|#define ASN_APP_COUNTER64 (ASN_APPLICATION | 6)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1128:9): [True: 0, False: 0]
  ------------------
 1129|      0|        case ASN_OPAQUE_U64:
  ------------------
  |  |  192|      0|#define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  150|      0|#define ASN_APP_U64 (ASN_APPLICATION | 11)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1129:9): [True: 0, False: 0]
  ------------------
 1130|      0|        case ASN_OPAQUE_FLOAT:
  ------------------
  |  |  165|      0|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|      0|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1130:9): [True: 0, False: 0]
  ------------------
 1131|      0|        case ASN_OPAQUE_DOUBLE:
  ------------------
  |  |  174|      0|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|      0|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1131:9): [True: 0, False: 0]
  ------------------
 1132|      0|        case ASN_OPAQUE_I64:
  ------------------
  |  |  183|      0|#define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  149|      0|#define ASN_APP_I64 (ASN_APPLICATION | 10)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1132:9): [True: 0, False: 0]
  ------------------
 1133|      0|            *type = *(bufp + 1);
 1134|      0|            break;
 1135|       |
 1136|      0|        default:
  ------------------
  |  Branch (1136:9): [True: 0, False: 0]
  ------------------
 1137|       |            /*
 1138|       |             * just an Opaque 
 1139|       |             */
 1140|      0|            *datalength = (int) asn_length;
 1141|      0|            return bufp;
 1142|      0|        }
 1143|       |        /*
 1144|       |         * value is encoded as special format 
 1145|       |         */
 1146|      0|        *datalength = (int) asn_length;
 1147|      0|        bufp = asn_parse_nlength(bufp+2, *datalength - 2, &asn_length);
 1148|      0|        if (NULL == bufp) {
  ------------------
  |  Branch (1148:13): [True: 0, False: 0]
  ------------------
 1149|      0|            _asn_short_err("parse opaque header", *datalength - 2, asn_length);
 1150|      0|            return NULL;
 1151|      0|        }
 1152|      0|    }
 1153|     69|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 1154|       |
 1155|     69|    *datalength = (int) asn_length;
 1156|       |
 1157|     69|    return bufp;
 1158|     69|}
asn_parse_sequence:
 1177|    106|{                               /* error message prefix */
 1178|    106|    data = asn_parse_header(data, datalength, type);
 1179|    106|    if (data && (*type != expected_type)) {
  ------------------
  |  Branch (1179:9): [True: 63, False: 43]
  |  Branch (1179:17): [True: 5, False: 58]
  ------------------
 1180|      5|        char            ebuf[128];
 1181|      5|        snprintf(ebuf, sizeof(ebuf),
 1182|      5|                 "%s header type %02X: s/b %02X", estr,
 1183|      5|                (u_char) * type, (u_char) expected_type);
 1184|      5|        ebuf[ sizeof(ebuf)-1 ] = 0;
 1185|      5|        ERROR_MSG(ebuf);
  ------------------
  |  |  188|      5|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1186|      5|        return NULL;
 1187|      5|    }
 1188|    101|    return data;
 1189|    106|}
asn_parse_length:
 1302|     14|{
 1303|     14|    static const char *errpre = "parse length";
 1304|     14|    char            ebuf[128];
 1305|     14|    register u_char lengthbyte;
 1306|       |
 1307|     14|    if (!data || !length) {
  ------------------
  |  Branch (1307:9): [True: 0, False: 14]
  |  Branch (1307:18): [True: 0, False: 14]
  ------------------
 1308|      0|        ERROR_MSG("parse length: NULL pointer");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1309|      0|        return NULL;
 1310|      0|    }
 1311|     14|    lengthbyte = *data;
 1312|       |
 1313|     14|    if (lengthbyte & ASN_LONG_LEN) {
  ------------------
  |  |   98|     14|#define ASN_LONG_LEN	    0x80U
  ------------------
  |  Branch (1313:9): [True: 14, False: 0]
  ------------------
 1314|     14|        lengthbyte &= ~ASN_LONG_LEN;    /* turn MSb off */
  ------------------
  |  |   98|     14|#define ASN_LONG_LEN	    0x80U
  ------------------
 1315|     14|        if (lengthbyte == 0) {
  ------------------
  |  Branch (1315:13): [True: 0, False: 14]
  ------------------
 1316|      0|            snprintf(ebuf, sizeof(ebuf),
 1317|      0|                     "%s: indefinite length not supported", errpre);
 1318|      0|            ebuf[ sizeof(ebuf)-1 ] = 0;
 1319|      0|            ERROR_MSG(ebuf);
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1320|      0|            return NULL;
 1321|      0|        }
 1322|     14|        if (lengthbyte > sizeof(long)) {
  ------------------
  |  Branch (1322:13): [True: 2, False: 12]
  ------------------
 1323|      2|            snprintf(ebuf, sizeof(ebuf),
 1324|      2|                    "%s: data length %d > %lu not supported", errpre,
 1325|      2|                    lengthbyte, (unsigned long)sizeof(long));
 1326|      2|            ebuf[ sizeof(ebuf)-1 ] = 0;
 1327|      2|            ERROR_MSG(ebuf);
  ------------------
  |  |  188|      2|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1328|      2|            return NULL;
 1329|      2|        }
 1330|     12|        data++;
 1331|     12|        *length = 0;            /* protect against short lengths */
 1332|     82|        while (lengthbyte--) {
  ------------------
  |  Branch (1332:16): [True: 70, False: 12]
  ------------------
 1333|     70|            *length <<= 8;
 1334|     70|            *length |= *data++;
 1335|     70|        }
 1336|     12|        if ((long) *length < 0) {
  ------------------
  |  Branch (1336:13): [True: 2, False: 10]
  ------------------
 1337|      2|            snprintf(ebuf, sizeof(ebuf),
 1338|      2|                     "%s: negative data length %ld\n", errpre,
 1339|      2|                     (long) *length);
 1340|      2|            ebuf[ sizeof(ebuf)-1 ] = 0;
 1341|      2|            ERROR_MSG(ebuf);
  ------------------
  |  |  188|      2|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1342|      2|            return NULL;
 1343|      2|        }
 1344|     10|        return data;
 1345|     12|    } else {                    /* short asnlength */
 1346|      0|        *length = (long) lengthbyte;
 1347|      0|        return data + 1;
 1348|      0|    }
 1349|     14|}
asn_parse_objid:
 1450|      2|{
 1451|      2|    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|      2|    register u_char *bufp = data;
 1459|      2|    register oid   *oidp = objid + 1;
 1460|      2|    register u_long subidentifier;
 1461|      2|    register long   length;
 1462|      2|    u_long          asn_length;
 1463|      2|    size_t          original_length = *objidlength;
 1464|       |
 1465|      2|    if (NULL == data || NULL == datalength || NULL == type || NULL == objid) {
  ------------------
  |  Branch (1465:9): [True: 0, False: 2]
  |  Branch (1465:25): [True: 0, False: 2]
  |  Branch (1465:47): [True: 0, False: 2]
  |  Branch (1465:63): [True: 0, False: 2]
  ------------------
 1466|      0|        ERROR_MSG("parse objid: NULL pointer");
  ------------------
  |  |  188|      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|      2|    if (*datalength < 2) {
  ------------------
  |  Branch (1471:9): [True: 0, False: 2]
  ------------------
 1472|      0|        _asn_short_err(errpre, *datalength, 2);
 1473|      0|        return NULL;
 1474|      0|    }
 1475|       |
 1476|      2|    *type = *bufp++;
 1477|      2|    if (*type != ASN_OBJECT_ID) {
  ------------------
  |  |   81|      2|#define ASN_OBJECT_ID	    0x06U
  ------------------
  |  Branch (1477:9): [True: 0, False: 2]
  ------------------
 1478|      0|        _asn_type_err(errpre, *type);
 1479|      0|        return NULL;
 1480|      0|    }
 1481|      2|    bufp = asn_parse_nlength(bufp, *datalength - 1, &asn_length);
 1482|      2|    if (NULL == bufp) {
  ------------------
  |  Branch (1482:9): [True: 0, False: 2]
  ------------------
 1483|      0|        _asn_short_err(errpre, *datalength - 1, asn_length);
 1484|      0|        return NULL;
 1485|      0|    }
 1486|       |
 1487|      2|    *datalength -= (int) asn_length + (bufp - data);
 1488|       |
 1489|      2|    DEBUGDUMPSETUP("recv", data, bufp - data + asn_length);
  ------------------
  |  |   83|      2|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      2|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  196|      0|        debugmsg("dumpx" token, "dumpx_%s:%*s", token, __DBGINDENT(), ""); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  |  |  197|      0|        __DBGMSGHEX(("dumpx_" token,buf,len)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  |  |  ------------------
  |  |  |  |  198|      0|        if (debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (198:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  199|      0|            debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (199:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  200|      0|            debugmsg("dumpx_" token,"\n"); \
  |  |  |  |  201|      0|        } else { \
  |  |  |  |  202|      0|            debugmsg("dumpx_" token,"  "); \
  |  |  |  |  203|      0|        } \
  |  |  |  |  204|      0|        debugmsg("dumpv" token, "dumpv_%s:%*s", token, __DBGINDENT(), "");
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:60): [Folded, False: 2]
  |  |  ------------------
  ------------------
 1490|       |
 1491|       |    /*
 1492|       |     * Handle invalid object identifier encodings of the form 06 00 robustly 
 1493|       |     */
 1494|      2|    if (asn_length == 0)
  ------------------
  |  Branch (1494:9): [True: 0, False: 2]
  ------------------
 1495|      0|        objid[0] = objid[1] = 0;
 1496|       |
 1497|      2|    length = asn_length;
 1498|      2|    (*objidlength)--;           /* account for expansion of first byte */
 1499|       |
 1500|     10|    while (length > 0 && (*objidlength)-- > 0) {
  ------------------
  |  Branch (1500:12): [True: 8, False: 2]
  |  Branch (1500:26): [True: 8, False: 0]
  ------------------
 1501|      8|        subidentifier = 0;
 1502|     14|        do {                    /* shift and add in low order 7 bits */
 1503|     14|            subidentifier =
 1504|     14|                (subidentifier << 7) + (*(u_char *) bufp & ~ASN_BIT8);
  ------------------
  |  |  100|     14|#define ASN_BIT8	    0x80U
  ------------------
 1505|     14|            length--;
 1506|     14|        } while ((*(u_char *) bufp++ & ASN_BIT8) && (length > 0));        /* last byte has high bit clear */
  ------------------
  |  |  100|     14|#define ASN_BIT8	    0x80U
  ------------------
  |  Branch (1506:18): [True: 6, False: 8]
  |  Branch (1506:53): [True: 6, False: 0]
  ------------------
 1507|       |
 1508|      8|	if (length == 0) {
  ------------------
  |  Branch (1508:6): [True: 2, False: 6]
  ------------------
 1509|      2|            u_char *last_byte = bufp - 1;
 1510|      2|            if (*last_byte & ASN_BIT8) {
  ------------------
  |  |  100|      2|#define ASN_BIT8	    0x80U
  ------------------
  |  Branch (1510:17): [True: 0, False: 2]
  ------------------
 1511|       |                /* last byte has high bit set -> wrong BER encoded OID */
 1512|      0|                ERROR_MSG("subidentifier syntax error");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1513|      0|                return NULL;
 1514|      0|            }
 1515|      2|        }
 1516|      8|        if (subidentifier > MAX_SUBID) {
  ------------------
  |  |   18|      8|#define MAX_SUBID   0xFFFFFFFFUL
  ------------------
  |  Branch (1516:13): [True: 0, False: 8]
  ------------------
 1517|      0|            ERROR_MSG("subidentifier too large");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1518|      0|            return NULL;
 1519|      0|        }
 1520|      8|        *oidp++ = (oid) subidentifier;
 1521|      8|    }
 1522|       |
 1523|      2|    if (length || oidp < objid + 1) {
  ------------------
  |  Branch (1523:9): [True: 0, False: 2]
  |  Branch (1523:19): [True: 0, False: 2]
  ------------------
 1524|      0|        ERROR_MSG("OID length exceeds buffer size");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 1525|      0|        *objidlength = original_length;
 1526|      0|        return NULL;
 1527|      0|    }
 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|      2|    subidentifier = oidp - objid >= 2 ? objid[1] : 0;
  ------------------
  |  Branch (1535:21): [True: 2, False: 0]
  ------------------
 1536|      2|    if (subidentifier == 0x2B) {
  ------------------
  |  Branch (1536:9): [True: 0, False: 2]
  ------------------
 1537|      0|        objid[0] = 1;
 1538|      0|        objid[1] = 3;
 1539|      2|    } else {
 1540|      2|        if (subidentifier < 40) {
  ------------------
  |  Branch (1540:13): [True: 2, False: 0]
  ------------------
 1541|      2|            objid[0] = 0;
 1542|      2|            objid[1] = subidentifier;
 1543|      2|        } else if (subidentifier < 80) {
  ------------------
  |  Branch (1543:20): [True: 0, False: 0]
  ------------------
 1544|      0|            objid[0] = 1;
 1545|      0|            objid[1] = subidentifier - 40;
 1546|      0|        } else {
 1547|      0|            objid[0] = 2;
 1548|      0|            objid[1] = subidentifier - 80;
 1549|      0|        }
 1550|      2|    }
 1551|       |
 1552|      2|    *objidlength = (int) (oidp - objid);
 1553|       |
 1554|      2|    DEBUGMSG(("dumpv_recv", "  ObjID: "));
  ------------------
  |  |   61|      2|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      2|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 2]
  |  |  ------------------
  ------------------
 1555|      2|    DEBUGMSGOID(("dumpv_recv", objid, *objidlength));
  ------------------
  |  |   67|      2|#define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      2|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  165|      0|#define __DBGMSGOID(x)     debugmsg_oid x
  |  |  ------------------
  |  |  |  Branch (67:71): [Folded, False: 2]
  |  |  ------------------
  ------------------
 1556|      2|    DEBUGMSG(("dumpv_recv", "\n"));
  ------------------
  |  |   61|      2|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      2|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 2]
  |  |  ------------------
  ------------------
 1557|      2|    return bufp;
 1558|      2|}
asn_realloc_rbuild_length:
 2865|    104|{
 2866|    104|    static const char *errpre = "build length";
 2867|    104|    char            ebuf[128];
 2868|    104|    int             tmp_int;
 2869|    104|    size_t          start_offset = *offset;
 2870|       |
 2871|    104|    if (length <= 0x7f) {
  ------------------
  |  Branch (2871:9): [True: 104, False: 0]
  ------------------
 2872|    104|        if (((*pkt_len - *offset) < 1)
  ------------------
  |  Branch (2872:13): [True: 0, False: 104]
  ------------------
 2873|      0|            && !(r && asn_realloc(pkt, pkt_len))) {
  ------------------
  |  Branch (2873:18): [True: 0, False: 0]
  |  Branch (2873:23): [True: 0, False: 0]
  ------------------
 2874|      0|            snprintf(ebuf, sizeof(ebuf),
 2875|      0|                    "%s: bad length < 1 :%ld, %lu", errpre,
 2876|      0|                    (long)(*pkt_len - *offset), (unsigned long)length);
 2877|      0|            ebuf[ sizeof(ebuf)-1 ] = 0;
 2878|      0|            ERROR_MSG(ebuf);
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 2879|      0|            return 0;
 2880|      0|        }
 2881|    104|        *(*pkt + *pkt_len - (++*offset)) = length;
 2882|    104|    } else {
 2883|      0|        while (length > 0xff) {
  ------------------
  |  Branch (2883:16): [True: 0, False: 0]
  ------------------
 2884|      0|            if (((*pkt_len - *offset) < 1)
  ------------------
  |  Branch (2884:17): [True: 0, False: 0]
  ------------------
 2885|      0|                && !(r && asn_realloc(pkt, pkt_len))) {
  ------------------
  |  Branch (2885:22): [True: 0, False: 0]
  |  Branch (2885:27): [True: 0, False: 0]
  ------------------
 2886|      0|                snprintf(ebuf, sizeof(ebuf),
 2887|      0|                        "%s: bad length < 1 :%ld, %lu", errpre,
 2888|      0|                        (long)(*pkt_len - *offset), (unsigned long)length);
 2889|      0|                ebuf[ sizeof(ebuf)-1 ] = 0;
 2890|      0|                ERROR_MSG(ebuf);
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 2891|      0|                return 0;
 2892|      0|            }
 2893|      0|            *(*pkt + *pkt_len - (++*offset)) = length & 0xff;
 2894|      0|            length >>= 8;
 2895|      0|        }
 2896|       |
 2897|      0|        while ((*pkt_len - *offset) < 2) {
  ------------------
  |  Branch (2897:16): [True: 0, False: 0]
  ------------------
 2898|      0|            if (!(r && asn_realloc(pkt, pkt_len))) {
  ------------------
  |  Branch (2898:19): [True: 0, False: 0]
  |  Branch (2898:24): [True: 0, False: 0]
  ------------------
 2899|      0|                snprintf(ebuf, sizeof(ebuf),
 2900|      0|                        "%s: bad length < 1 :%ld, %lu", errpre,
 2901|      0|                        (long)(*pkt_len - *offset), (unsigned long)length);
 2902|      0|                ebuf[ sizeof(ebuf)-1 ] = 0;
 2903|      0|                ERROR_MSG(ebuf);
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 2904|      0|                return 0;
 2905|      0|            }
 2906|      0|        }
 2907|       |
 2908|      0|        *(*pkt + *pkt_len - (++*offset)) = length & 0xff;
 2909|      0|        tmp_int = *offset - start_offset;
 2910|      0|        *(*pkt + *pkt_len - (++*offset)) = tmp_int | 0x80;
 2911|      0|    }
 2912|       |
 2913|    104|    return 1;
 2914|    104|}
asn_realloc_rbuild_header:
 2937|    104|{
 2938|    104|    char            ebuf[128];
 2939|       |
 2940|    104|    if (asn_realloc_rbuild_length(pkt, pkt_len, offset, r, length)) {
  ------------------
  |  Branch (2940:9): [True: 104, False: 0]
  ------------------
 2941|    104|        if (((*pkt_len - *offset) < 1)
  ------------------
  |  Branch (2941:13): [True: 0, False: 104]
  ------------------
 2942|      0|            && !(r && asn_realloc(pkt, pkt_len))) {
  ------------------
  |  Branch (2942:18): [True: 0, False: 0]
  |  Branch (2942:23): [True: 0, False: 0]
  ------------------
 2943|      0|            snprintf(ebuf, sizeof(ebuf),
 2944|      0|                    "bad header length < 1 :%ld, %lu",
 2945|      0|                    (long)(*pkt_len - *offset), (unsigned long)length);
 2946|      0|            ebuf[ sizeof(ebuf)-1 ] = 0;
 2947|      0|            ERROR_MSG(ebuf);
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 2948|      0|            return 0;
 2949|      0|        }
 2950|    104|        *(*pkt + *pkt_len - (++*offset)) = type;
 2951|    104|        return 1;
 2952|    104|    }
 2953|      0|    return 0;
 2954|    104|}
asn_realloc_rbuild_int:
 2977|     36|{
 2978|     36|    static const char *errpre = "build int";
 2979|     36|    register long   integer = *intp;
 2980|     36|    int             testvalue;
 2981|     36|    size_t          start_offset = *offset;
 2982|       |
 2983|     36|    if (intsize != sizeof(long)) {
  ------------------
  |  Branch (2983:9): [True: 0, False: 36]
  ------------------
 2984|      0|        _asn_size_err(errpre, intsize, sizeof(long));
 2985|      0|        return 0;
 2986|      0|    }
 2987|       |
 2988|     36|    CHECK_OVERFLOW_S(integer,10);
  ------------------
  |  |  214|     36|#define CHECK_OVERFLOW_S(x,y) do {                                      \
  |  |  215|     36|        if (x > INT32_MAX) {                                            \
  |  |  ------------------
  |  |  |  Branch (215:13): [True: 0, False: 36]
  |  |  ------------------
  |  |  216|      0|            DEBUGMSG(("asn","truncating signed value %ld to 32 bits (%d)\n",(long)(x),y)); \
  |  |  ------------------
  |  |  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  217|      0|            x &= 0xffffffff;                                            \
  |  |  218|     36|        } else if (x < INT32_MIN) {                                     \
  |  |  ------------------
  |  |  |  Branch (218:20): [True: 0, False: 36]
  |  |  ------------------
  |  |  219|      0|            DEBUGMSG(("asn","truncating signed value %ld to 32 bits (%d)\n",(long)(x),y)); \
  |  |  ------------------
  |  |  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  220|      0|            x = 0 - (x & 0xffffffff);                                   \
  |  |  221|      0|        }                                                               \
  |  |  222|     36|    } while(0)
  |  |  ------------------
  |  |  |  Branch (222:13): [Folded, False: 36]
  |  |  ------------------
  ------------------
 2989|     36|    testvalue = (integer < 0) ? -1 : 0;
  ------------------
  |  Branch (2989:17): [True: 1, False: 35]
  ------------------
 2990|       |
 2991|     36|    if (((*pkt_len - *offset) < 1) && !(r && asn_realloc(pkt, pkt_len))) {
  ------------------
  |  Branch (2991:9): [True: 0, False: 36]
  |  Branch (2991:41): [True: 0, False: 0]
  |  Branch (2991:46): [True: 0, False: 0]
  ------------------
 2992|      0|        return 0;
 2993|      0|    }
 2994|     36|    *(*pkt + *pkt_len - (++*offset)) = (u_char) integer;
 2995|     36|    integer >>= 8;
 2996|       |
 2997|     55|    while (integer != testvalue) {
  ------------------
  |  Branch (2997:12): [True: 19, False: 36]
  ------------------
 2998|     19|        if (((*pkt_len - *offset) < 1)
  ------------------
  |  Branch (2998:13): [True: 0, False: 19]
  ------------------
 2999|      0|            && !(r && asn_realloc(pkt, pkt_len))) {
  ------------------
  |  Branch (2999:18): [True: 0, False: 0]
  |  Branch (2999:23): [True: 0, False: 0]
  ------------------
 3000|      0|            return 0;
 3001|      0|        }
 3002|     19|        *(*pkt + *pkt_len - (++*offset)) = (u_char) integer;
 3003|     19|        integer >>= 8;
 3004|     19|    }
 3005|       |
 3006|     36|    if ((*(*pkt + *pkt_len - *offset) & 0x80) != (testvalue & 0x80)) {
  ------------------
  |  Branch (3006:9): [True: 4, False: 32]
  ------------------
 3007|       |        /*
 3008|       |         * Make sure left most bit is representational of the rest of the bits
 3009|       |         * that aren't encoded.  
 3010|       |         */
 3011|      4|        if (((*pkt_len - *offset) < 1)
  ------------------
  |  Branch (3011:13): [True: 0, False: 4]
  ------------------
 3012|      0|            && !(r && asn_realloc(pkt, pkt_len))) {
  ------------------
  |  Branch (3012:18): [True: 0, False: 0]
  |  Branch (3012:23): [True: 0, False: 0]
  ------------------
 3013|      0|            return 0;
 3014|      0|        }
 3015|      4|        *(*pkt + *pkt_len - (++*offset)) = testvalue & 0xff;
 3016|      4|    }
 3017|       |
 3018|     36|    if (asn_realloc_rbuild_header(pkt, pkt_len, offset, r, type,
  ------------------
  |  Branch (3018:9): [True: 36, False: 0]
  ------------------
 3019|     36|                                  (*offset - start_offset))) {
 3020|     36|        if (_asn_realloc_build_header_check(errpre, pkt, pkt_len,
  ------------------
  |  Branch (3020:13): [True: 0, False: 36]
  ------------------
 3021|     36|                                            (*offset - start_offset))) {
 3022|      0|            return 0;
 3023|     36|        } else {
 3024|     36|            DEBUGDUMPSETUP("send", (*pkt + *pkt_len - *offset),
  ------------------
  |  |   83|     36|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     36|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 36]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  196|      0|        debugmsg("dumpx" token, "dumpx_%s:%*s", token, __DBGINDENT(), ""); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  |  |  197|      0|        __DBGMSGHEX(("dumpx_" token,buf,len)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  |  |  ------------------
  |  |  |  |  198|      0|        if (debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (198:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  199|      0|            debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (199:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  200|      0|            debugmsg("dumpx_" token,"\n"); \
  |  |  |  |  201|      0|        } else { \
  |  |  |  |  202|      0|            debugmsg("dumpx_" token,"  "); \
  |  |  |  |  203|      0|        } \
  |  |  |  |  204|      0|        debugmsg("dumpv" token, "dumpv_%s:%*s", token, __DBGINDENT(), "");
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:60): [Folded, False: 36]
  |  |  ------------------
  ------------------
 3025|     36|                           (*offset - start_offset));
 3026|     36|            DEBUGMSG(("dumpv_send", "  Integer:\t%ld (0x%.2lX)\n", *intp,
  ------------------
  |  |   61|     36|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     36|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 36]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 36]
  |  |  ------------------
  ------------------
 3027|     36|                      *intp));
 3028|     36|            return 1;
 3029|     36|        }
 3030|     36|    }
 3031|       |
 3032|      0|    return 0;
 3033|     36|}
asn_realloc_rbuild_string:
 3058|     28|{
 3059|     28|    static const char *errpre = "build string";
 3060|     28|    size_t          start_offset = *offset;
 3061|       |
 3062|     28|    while ((*pkt_len - *offset) < strlength) {
  ------------------
  |  Branch (3062:12): [True: 0, False: 28]
  ------------------
 3063|      0|        if (!(r && asn_realloc(pkt, pkt_len))) {
  ------------------
  |  Branch (3063:15): [True: 0, False: 0]
  |  Branch (3063:20): [True: 0, False: 0]
  ------------------
 3064|      0|            return 0;
 3065|      0|        }
 3066|      0|    }
 3067|       |
 3068|     28|    *offset += strlength;
 3069|     28|    if (str)
  ------------------
  |  Branch (3069:9): [True: 28, False: 0]
  ------------------
 3070|     28|        memcpy(*pkt + *pkt_len - *offset, str, strlength);
 3071|       |
 3072|     28|    if (asn_realloc_rbuild_header
  ------------------
  |  Branch (3072:9): [True: 28, False: 0]
  ------------------
 3073|     28|        (pkt, pkt_len, offset, r, type, strlength)) {
 3074|     28|        if (_asn_realloc_build_header_check
  ------------------
  |  Branch (3074:13): [True: 0, False: 28]
  ------------------
 3075|     28|            (errpre, pkt, pkt_len, strlength)) {
 3076|      0|            return 0;
 3077|     28|        } else {
 3078|     28|            DEBUGDUMPSETUP("send", (*pkt + *pkt_len - *offset),
  ------------------
  |  |   83|     28|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     28|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 28]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  196|      0|        debugmsg("dumpx" token, "dumpx_%s:%*s", token, __DBGINDENT(), ""); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  |  |  197|      0|        __DBGMSGHEX(("dumpx_" token,buf,len)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  |  |  ------------------
  |  |  |  |  198|      0|        if (debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (198:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  199|      0|            debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (199:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  200|      0|            debugmsg("dumpx_" token,"\n"); \
  |  |  |  |  201|      0|        } else { \
  |  |  |  |  202|      0|            debugmsg("dumpx_" token,"  "); \
  |  |  |  |  203|      0|        } \
  |  |  |  |  204|      0|        debugmsg("dumpv" token, "dumpv_%s:%*s", token, __DBGINDENT(), "");
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:60): [Folded, False: 28]
  |  |  ------------------
  ------------------
 3079|     28|                           *offset - start_offset);
 3080|     28|            DEBUGIF("dumpv_send") {
  ------------------
  |  |  145|     28|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|     56|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 28]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (145:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3081|      0|                if (strlength == 0) {
  ------------------
  |  Branch (3081:21): [True: 0, False: 0]
  ------------------
 3082|      0|                    DEBUGMSG(("dumpv_send", "  String: [NULL]\n"));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3083|      0|                } else {
 3084|      0|                    u_char         *buf = (u_char *) malloc(2 * strlength);
 3085|      0|                    size_t          l =
 3086|      0|                        (buf != NULL) ? (2 * strlength) : 0, ol = 0;
  ------------------
  |  Branch (3086:25): [True: 0, False: 0]
  ------------------
 3087|       |
 3088|      0|                    if (sprint_realloc_asciistring
  ------------------
  |  Branch (3088:25): [True: 0, False: 0]
  ------------------
 3089|      0|                        (&buf, &l, &ol, 1, str, strlength)) {
 3090|      0|                        DEBUGMSG(("dumpv_send", "  String:\t%s\n", buf));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3091|      0|                    } else {
 3092|      0|                        if (buf == NULL) {
  ------------------
  |  Branch (3092:29): [True: 0, False: 0]
  ------------------
 3093|      0|                            DEBUGMSG(("dumpv_send",
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3094|      0|                                      "  String:\t[TRUNCATED]\n"));
 3095|      0|                        } else {
 3096|      0|                            DEBUGMSG(("dumpv_send",
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3097|      0|                                      "  String:\t%s [TRUNCATED]\n", buf));
 3098|      0|                        }
 3099|      0|                    }
 3100|      0|                    if (buf != NULL) {
  ------------------
  |  Branch (3100:25): [True: 0, False: 0]
  ------------------
 3101|      0|                        free(buf);
 3102|      0|                    }
 3103|      0|                }
 3104|      0|            }
 3105|     28|        }
 3106|     28|        return 1;
 3107|     28|    }
 3108|       |
 3109|      0|    return 0;
 3110|     28|}
asn_realloc_rbuild_unsigned_int:
 3133|      4|{
 3134|      4|    static const char *errpre = "build uint";
 3135|      4|    register u_long integer = *intp;
 3136|      4|    size_t          start_offset = *offset;
 3137|       |
 3138|      4|    if (intsize != sizeof(unsigned long)) {
  ------------------
  |  Branch (3138:9): [True: 0, False: 4]
  ------------------
 3139|      0|        _asn_size_err(errpre, intsize, sizeof(unsigned long));
 3140|      0|        return 0;
 3141|      0|    }
 3142|       |
 3143|      4|    CHECK_OVERFLOW_U(integer,11);
  ------------------
  |  |  224|      4|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|      4|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 0, False: 4]
  |  |  ------------------
  |  |  226|      0|            x &= 0xffffffff;                                            \
  |  |  227|      0|            DEBUGMSG(("asn","truncating unsigned value to 32 bits (%d)\n",y)); \
  |  |  ------------------
  |  |  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  228|      0|        }                                                               \
  |  |  229|      4|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 4]
  |  |  ------------------
  ------------------
 3144|       |
 3145|      4|    if (((*pkt_len - *offset) < 1) && !(r && asn_realloc(pkt, pkt_len))) {
  ------------------
  |  Branch (3145:9): [True: 0, False: 4]
  |  Branch (3145:41): [True: 0, False: 0]
  |  Branch (3145:46): [True: 0, False: 0]
  ------------------
 3146|      0|        return 0;
 3147|      0|    }
 3148|      4|    *(*pkt + *pkt_len - (++*offset)) = (u_char) integer;
 3149|      4|    integer >>= 8;
 3150|       |
 3151|      4|    while (integer != 0) {
  ------------------
  |  Branch (3151:12): [True: 0, False: 4]
  ------------------
 3152|      0|        if (((*pkt_len - *offset) < 1)
  ------------------
  |  Branch (3152:13): [True: 0, False: 0]
  ------------------
 3153|      0|            && !(r && asn_realloc(pkt, pkt_len))) {
  ------------------
  |  Branch (3153:18): [True: 0, False: 0]
  |  Branch (3153:23): [True: 0, False: 0]
  ------------------
 3154|      0|            return 0;
 3155|      0|        }
 3156|      0|        *(*pkt + *pkt_len - (++*offset)) = (u_char) integer;
 3157|      0|        integer >>= 8;
 3158|      0|    }
 3159|       |
 3160|      4|    if ((*(*pkt + *pkt_len - *offset) & 0x80) != (0 & 0x80)) {
  ------------------
  |  Branch (3160:9): [True: 0, False: 4]
  ------------------
 3161|       |        /*
 3162|       |         * Make sure left most bit is representational of the rest of the bits
 3163|       |         * that aren't encoded.  
 3164|       |         */
 3165|      0|        if (((*pkt_len - *offset) < 1)
  ------------------
  |  Branch (3165:13): [True: 0, False: 0]
  ------------------
 3166|      0|            && !(r && asn_realloc(pkt, pkt_len))) {
  ------------------
  |  Branch (3166:18): [True: 0, False: 0]
  |  Branch (3166:23): [True: 0, False: 0]
  ------------------
 3167|      0|            return 0;
 3168|      0|        }
 3169|      0|        *(*pkt + *pkt_len - (++*offset)) = 0;
 3170|      0|    }
 3171|       |
 3172|      4|    if (asn_realloc_rbuild_header(pkt, pkt_len, offset, r, type,
  ------------------
  |  Branch (3172:9): [True: 4, False: 0]
  ------------------
 3173|      4|                                  (*offset - start_offset))) {
 3174|      4|        if (_asn_realloc_build_header_check(errpre, pkt, pkt_len,
  ------------------
  |  Branch (3174:13): [True: 0, False: 4]
  ------------------
 3175|      4|                                            (*offset - start_offset))) {
 3176|      0|            return 0;
 3177|      4|        } else {
 3178|      4|            DEBUGDUMPSETUP("send", (*pkt + *pkt_len - *offset),
  ------------------
  |  |   83|      4|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  196|      0|        debugmsg("dumpx" token, "dumpx_%s:%*s", token, __DBGINDENT(), ""); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  |  |  197|      0|        __DBGMSGHEX(("dumpx_" token,buf,len)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  |  |  ------------------
  |  |  |  |  198|      0|        if (debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (198:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  199|      0|            debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (199:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  200|      0|            debugmsg("dumpx_" token,"\n"); \
  |  |  |  |  201|      0|        } else { \
  |  |  |  |  202|      0|            debugmsg("dumpx_" token,"  "); \
  |  |  |  |  203|      0|        } \
  |  |  |  |  204|      0|        debugmsg("dumpv" token, "dumpv_%s:%*s", token, __DBGINDENT(), "");
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:60): [Folded, False: 4]
  |  |  ------------------
  ------------------
 3179|      4|                           (*offset - start_offset));
 3180|      4|            DEBUGMSG(("dumpv_send", "  UInteger:\t%lu (0x%.2lX)\n", *intp,
  ------------------
  |  |   61|      4|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 4]
  |  |  ------------------
  ------------------
 3181|      4|                      *intp));
 3182|      4|            return 1;
 3183|      4|        }
 3184|      4|    }
 3185|       |
 3186|      0|    return 0;
 3187|      4|}
asn_realloc_rbuild_sequence:
 3210|     28|{
 3211|     28|    return asn_realloc_rbuild_header(pkt, pkt_len, offset, r, type,
 3212|     28|                                     length);
 3213|     28|}
asn_realloc_rbuild_objid:
 3284|      4|{
 3285|       |    /*
 3286|       |     * ASN.1 objid ::= 0x06 asnlength subidentifier {subidentifier}*
 3287|       |     * subidentifier ::= {leadingbyte}* lastbyte
 3288|       |     * leadingbyte ::= 1 7bitvalue
 3289|       |     * lastbyte ::= 0 7bitvalue
 3290|       |     */
 3291|      4|    register size_t i;
 3292|      4|    register oid    tmpint;
 3293|      4|    size_t          start_offset = *offset;
 3294|      4|    const char     *errpre = "build objid";
 3295|       |
 3296|       |    /*
 3297|       |     * Check if there are at least 2 sub-identifiers.  
 3298|       |     */
 3299|      4|    if (objidlength == 0) {
  ------------------
  |  Branch (3299:9): [True: 0, False: 4]
  ------------------
 3300|       |        /*
 3301|       |         * There are not, so make the OID have two sub-identifiers with value
 3302|       |         * zero. Encode both sub-identifiers as a single byte.
 3303|       |         */
 3304|      0|        if (!store_byte(pkt, pkt_len, offset, r, 0))
  ------------------
  |  Branch (3304:13): [True: 0, False: 0]
  ------------------
 3305|      0|            return 0;
 3306|      4|    } else if (objid[0] > 2) {
  ------------------
  |  Branch (3306:16): [True: 0, False: 4]
  ------------------
 3307|      0|        ERROR_MSG("build objid: bad first subidentifier");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3308|      0|        return 0;
 3309|      4|    } else if (objidlength == 1) {
  ------------------
  |  Branch (3309:16): [True: 0, False: 4]
  ------------------
 3310|       |        /*
 3311|       |         * Encode the first value.  
 3312|       |         */
 3313|      0|        if (!store_byte(pkt, pkt_len, offset, r, 40 * objid[0]))
  ------------------
  |  Branch (3313:13): [True: 0, False: 0]
  ------------------
 3314|      0|            return 0;
 3315|      4|    } else {
 3316|     40|        for (i = objidlength - 1; i >= 2; i--) {
  ------------------
  |  Branch (3316:35): [True: 36, False: 4]
  ------------------
 3317|     36|            tmpint = objid[i];
 3318|     36|            CHECK_OVERFLOW_U(tmpint, 12);
  ------------------
  |  |  224|     36|#define CHECK_OVERFLOW_U(x,y) do {                                      \
  |  |  225|     36|        if (x > UINT32_MAX) {                                           \
  |  |  ------------------
  |  |  |  Branch (225:13): [True: 0, False: 36]
  |  |  ------------------
  |  |  226|      0|            x &= 0xffffffff;                                            \
  |  |  227|      0|            DEBUGMSG(("asn","truncating unsigned value to 32 bits (%d)\n",y)); \
  |  |  ------------------
  |  |  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  228|      0|        }                                                               \
  |  |  229|     36|    } while(0)
  |  |  ------------------
  |  |  |  Branch (229:13): [Folded, False: 36]
  |  |  ------------------
  ------------------
 3319|     36|            if (!store_uint32(pkt, pkt_len, offset, r, tmpint))
  ------------------
  |  Branch (3319:17): [True: 0, False: 36]
  ------------------
 3320|      0|                return 0;
 3321|     36|        }
 3322|       |
 3323|       |        /*
 3324|       |         * Combine the first two values.  
 3325|       |         */
 3326|      4|        if ((objid[1] >= 40 && objid[0] < 2) ||
  ------------------
  |  Branch (3326:14): [True: 0, False: 4]
  |  Branch (3326:32): [True: 0, False: 0]
  ------------------
 3327|      4|            objid[1] > UINT32_MAX - objid[0] * 40) {
  ------------------
  |  Branch (3327:13): [True: 0, False: 4]
  ------------------
 3328|      0|            return 0;
 3329|      0|        }
 3330|      4|        if (!store_uint32(pkt, pkt_len, offset, r, objid[0] * 40 + objid[1]))
  ------------------
  |  Branch (3330:13): [True: 0, False: 4]
  ------------------
 3331|      0|            return 0;
 3332|      4|    }
 3333|       |
 3334|      4|    tmpint = *offset - start_offset;
 3335|      4|    if (asn_realloc_rbuild_header(pkt, pkt_len, offset, r, type, tmpint)) {
  ------------------
  |  Branch (3335:9): [True: 4, False: 0]
  ------------------
 3336|      4|        if (_asn_realloc_build_header_check(errpre, pkt, pkt_len, tmpint)) {
  ------------------
  |  Branch (3336:13): [True: 0, False: 4]
  ------------------
 3337|      0|            return 0;
 3338|      4|        } else {
 3339|      4|            DEBUGDUMPSETUP("send", (*pkt + *pkt_len - *offset), tmpint);
  ------------------
  |  |   83|      4|	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSETUP(token,buf,len);} }while(0)
  |  |  ------------------
  |  |  |  |  196|      0|        debugmsg("dumpx" token, "dumpx_%s:%*s", token, __DBGINDENT(), ""); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  |  |  197|      0|        __DBGMSGHEX(("dumpx_" token,buf,len)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  |  |  ------------------
  |  |  |  |  198|      0|        if (debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS || \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (198:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  199|      0|            debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (199:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  200|      0|            debugmsg("dumpx_" token,"\n"); \
  |  |  |  |  201|      0|        } else { \
  |  |  |  |  202|      0|            debugmsg("dumpx_" token,"  "); \
  |  |  |  |  203|      0|        } \
  |  |  |  |  204|      0|        debugmsg("dumpv" token, "dumpv_%s:%*s", token, __DBGINDENT(), "");
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|#define __DBGINDENT()      debug_indent_get()
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (83:60): [Folded, False: 4]
  |  |  ------------------
  ------------------
 3340|      4|            DEBUGMSG(("dumpv_send", "  ObjID: "));
  ------------------
  |  |   61|      4|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 4]
  |  |  ------------------
  ------------------
 3341|      4|            DEBUGMSGOID(("dumpv_send", objid, objidlength));
  ------------------
  |  |   67|      4|#define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  165|      0|#define __DBGMSGOID(x)     debugmsg_oid x
  |  |  ------------------
  |  |  |  Branch (67:71): [Folded, False: 4]
  |  |  ------------------
  ------------------
 3342|      4|            DEBUGMSG(("dumpv_send", "\n"));
  ------------------
  |  |   61|      4|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 4]
  |  |  ------------------
  ------------------
 3343|      4|            return 1;
 3344|      4|        }
 3345|      4|    }
 3346|       |
 3347|      0|    return 0;
 3348|      4|}
asn1.c:_asn_short_err:
  301|     49|{
  302|     49|    char            ebuf[128];
  303|       |
  304|     49|    snprintf(ebuf, sizeof(ebuf), "%s length %lu too short: need %lu", str,
  305|     49|	    (unsigned long)wrongsize, (unsigned long)rightsize);
  306|     49|    ERROR_MSG(ebuf);
  ------------------
  |  |  188|     49|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  307|     49|}
asn1.c:_asn_type_err:
  262|      4|{
  263|      4|    char            ebuf[128];
  264|       |
  265|      4|    snprintf(ebuf, sizeof(ebuf), "%s type %d", str, wrongtype);
  266|      4|    ebuf[ sizeof(ebuf)-1 ] = 0;
  267|      4|    ERROR_MSG(ebuf);
  ------------------
  |  |  188|      4|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  268|      4|}
asn1.c:_asn_length_err:
  281|      1|{
  282|      1|    char            ebuf[128];
  283|       |
  284|      1|    snprintf(ebuf, sizeof(ebuf),
  285|      1|            "%s length %lu too large: exceeds %lu", str,
  286|      1|	    (unsigned long)wrongsize, (unsigned long)rightsize);
  287|      1|    ebuf[ sizeof(ebuf)-1 ] = 0;
  288|      1|    ERROR_MSG(ebuf);
  ------------------
  |  |  188|      1|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  289|      1|}
asn1.c:_asn_realloc_build_header_check:
  457|     72|{
  458|     72|    char            ebuf[128];
  459|       |
  460|     72|    if (pkt == NULL || *pkt == NULL) {
  ------------------
  |  Branch (460:9): [True: 0, False: 72]
  |  Branch (460:24): [True: 0, False: 72]
  ------------------
  461|       |        /*
  462|       |         * Error message is set.  
  463|       |         */
  464|      0|        return 1;
  465|      0|    }
  466|       |
  467|     72|    if (*pkt_len < typedlen) {
  ------------------
  |  Branch (467:9): [True: 0, False: 72]
  ------------------
  468|      0|        snprintf(ebuf, sizeof(ebuf),
  469|      0|                "%s: bad header, length too short: %lu < %lu", str,
  470|      0|                (unsigned long)*pkt_len, (unsigned long)typedlen);
  471|      0|        ebuf[ sizeof(ebuf)-1 ] = 0;
  472|      0|        ERROR_MSG(ebuf);
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  473|      0|        return 1;
  474|      0|    }
  475|     72|    return 0;
  476|     72|}
asn1.c:store_byte:
 3228|     40|{
 3229|     40|    netsnmp_assert(*offset <= *pkt_len);
  ------------------
  |  |   47|     40|#      define netsnmp_assert(x)  do { \
  |  |   48|     40|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 40, False: 0]
  |  |  ------------------
  |  |   49|     40|                 ; \
  |  |   50|     40|              else \
  |  |   51|     40|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|     40|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 40]
  |  |  ------------------
  ------------------
 3230|     40|    if (*offset >= *pkt_len && (!r || !asn_realloc(pkt, pkt_len)))
  ------------------
  |  Branch (3230:9): [True: 0, False: 40]
  |  Branch (3230:33): [True: 0, False: 0]
  |  Branch (3230:39): [True: 0, False: 0]
  ------------------
 3231|      0|        return 0;
 3232|     40|    netsnmp_assert(*offset < *pkt_len);
  ------------------
  |  |   47|     40|#      define netsnmp_assert(x)  do { \
  |  |   48|     40|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 40, False: 0]
  |  |  ------------------
  |  |   49|     40|                 ; \
  |  |   50|     40|              else \
  |  |   51|     40|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|     40|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 40]
  |  |  ------------------
  ------------------
 3233|     40|    *(*pkt + *pkt_len - (++*offset)) = byte;
 3234|     40|    return 1;
 3235|     40|}
asn1.c:store_uint32:
 3250|     40|{
 3251|     40|    if (!store_byte(pkt, pkt_len, offset, r, subid & 0x7f))
  ------------------
  |  Branch (3251:9): [True: 0, False: 40]
  ------------------
 3252|      0|        return 0;
 3253|       |
 3254|     40|    for (subid >>= 7; subid; subid >>= 7)
  ------------------
  |  Branch (3254:23): [True: 0, False: 40]
  ------------------
 3255|      0|        if (!store_byte(pkt, pkt_len, offset, r, subid | 0x80))
  ------------------
  |  Branch (3255:13): [True: 0, False: 0]
  ------------------
 3256|      0|            return 0;
 3257|       |
 3258|     40|    return 1;
 3259|     40|}

init_callbacks:
  180|     70|{
  181|       |    /*
  182|       |     * (poses a problem if you put init_callbacks() inside of
  183|       |     * init_snmp() and then want the app to register a callback before
  184|       |     * init_snmp() is called in the first place.  -- Wes 
  185|       |     */
  186|     70|    if (0 == _callback_need_init)
  ------------------
  |  Branch (186:9): [True: 69, False: 1]
  ------------------
  187|     69|        return;
  188|       |    
  189|      1|    _callback_need_init = 0;
  190|       |    
  191|      1|    memset(thecallbacks, 0, sizeof(thecallbacks)); 
  192|      1|#ifdef LOCK_PER_CALLBACK_SUBID
  193|      1|    memset(_locks, 0, sizeof(_locks));
  194|       |#else
  195|       |    _lock = 0;
  196|       |#endif
  197|       |    
  198|      1|    DEBUGMSGTL(("callback", "initialized\n"));
  ------------------
  |  |   66|      1|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 1]
  |  |  ------------------
  ------------------
  199|      1|}
snmp_register_callback:
  240|    759|{
  241|    759|    return netsnmp_register_callback( major, minor, new_callback, arg,
  242|    759|                                      NETSNMP_CALLBACK_DEFAULT_PRIORITY);
  ------------------
  |  |   40|    759|#define NETSNMP_CALLBACK_DEFAULT_PRIORITY       0
  ------------------
  243|    759|}
netsnmp_register_callback:
  262|    759|{
  263|    759|    struct snmp_gen_callback *newscp = NULL, *scp = NULL;
  264|       |
  265|    759|    if (major >= MAX_CALLBACK_IDS || minor >= MAX_CALLBACK_SUBIDS) {
  ------------------
  |  |   12|  1.51k|#define MAX_CALLBACK_IDS    2
  ------------------
                  if (major >= MAX_CALLBACK_IDS || minor >= MAX_CALLBACK_SUBIDS) {
  ------------------
  |  |   13|    759|#define MAX_CALLBACK_SUBIDS 18
  ------------------
  |  Branch (265:9): [True: 0, False: 759]
  |  Branch (265:38): [True: 0, False: 759]
  ------------------
  266|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  267|      0|    }
  268|       |
  269|    759|    if (_callback_need_init)
  ------------------
  |  Branch (269:9): [True: 1, False: 758]
  ------------------
  270|      1|        init_callbacks();
  271|       |
  272|    759|    _callback_lock(major,minor, "netsnmp_register_callback", 1);
  273|       |    
  274|    759|    if ((newscp = SNMP_MALLOC_STRUCT(snmp_gen_callback)) == NULL) {
  ------------------
  |  |   69|    759|#define SNMP_MALLOC_STRUCT(s)   (struct s *) calloc(1, sizeof(struct s))
  ------------------
  |  Branch (274:9): [True: 0, False: 759]
  ------------------
  275|      0|        _callback_unlock(major,minor);
  276|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  277|    759|    } else {
  278|    759|        struct snmp_gen_callback **prevNext = &(thecallbacks[major][minor]);
  279|       |
  280|    759|        newscp->priority = priority;
  281|    759|        newscp->sc_client_arg = arg;
  282|    759|        newscp->sc_callback = new_callback;
  283|    759|        newscp->next = NULL;
  284|       |
  285|  1.38k|        for (scp = thecallbacks[major][minor]; scp != NULL;
  ------------------
  |  Branch (285:48): [True: 621, False: 759]
  ------------------
  286|    759|             scp = scp->next) {
  287|    621|            if (newscp->priority < scp->priority) {
  ------------------
  |  Branch (287:17): [True: 0, False: 621]
  ------------------
  288|      0|                newscp->next = scp;
  289|      0|                break;
  290|      0|            }
  291|    621|            prevNext = &(scp->next);
  292|    621|        }
  293|       |
  294|    759|        *prevNext = newscp;
  295|       |
  296|    759|        DEBUGMSGTL(("callback", "registered (%d,%d) at %p with priority %d\n",
  ------------------
  |  |   66|    759|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    759|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 759]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 759]
  |  |  ------------------
  ------------------
  297|    759|                    major, minor, newscp, priority));
  298|    759|        _callback_unlock(major,minor);
  299|    759|        return SNMPERR_SUCCESS;
  ------------------
  |  |  217|    759|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  300|    759|    }
  301|    759|}
snmp_call_callbacks:
  322|    484|{
  323|    484|    struct snmp_gen_callback *scp;
  324|    484|    unsigned int    count = 0;
  325|       |    
  326|    484|    if (major >= MAX_CALLBACK_IDS || minor >= MAX_CALLBACK_SUBIDS) {
  ------------------
  |  |   12|    968|#define MAX_CALLBACK_IDS    2
  ------------------
                  if (major >= MAX_CALLBACK_IDS || minor >= MAX_CALLBACK_SUBIDS) {
  ------------------
  |  |   13|    484|#define MAX_CALLBACK_SUBIDS 18
  ------------------
  |  Branch (326:9): [True: 0, False: 484]
  |  Branch (326:38): [True: 0, False: 484]
  ------------------
  327|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  328|      0|    }
  329|       |    
  330|    484|    if (_callback_need_init)
  ------------------
  |  Branch (330:9): [True: 0, False: 484]
  ------------------
  331|      0|        init_callbacks();
  332|       |
  333|    484|#ifdef LOCK_PER_CALLBACK_SUBID
  334|    484|    _callback_lock(major,minor,"snmp_call_callbacks", 1);
  335|       |#else
  336|       |    /*
  337|       |     * Notes:
  338|       |     * - this gets hit the first time a trap is sent after a new trap
  339|       |     *   destination has been added (session init cb during send trap cb)
  340|       |     */
  341|       |    _callback_lock(major,minor, NULL, 0);
  342|       |#endif
  343|       |
  344|    484|    DEBUGMSGTL(("callback", "START calling callbacks for maj=%d min=%d\n",
  ------------------
  |  |   66|    484|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    484|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 484]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 484]
  |  |  ------------------
  ------------------
  345|    484|                major, minor));
  346|       |
  347|       |    /*
  348|       |     * for each registered callback of type major and minor 
  349|       |     */
  350|  1.24k|    for (scp = thecallbacks[major][minor]; scp != NULL; scp = scp->next) {
  ------------------
  |  Branch (350:44): [True: 759, False: 484]
  ------------------
  351|       |
  352|       |        /*
  353|       |         * skip unregistered callbacks
  354|       |         */
  355|    759|        if(NULL == scp->sc_callback)
  ------------------
  |  Branch (355:12): [True: 0, False: 759]
  ------------------
  356|      0|            continue;
  357|       |
  358|    759|        DEBUGMSGTL(("callback", "calling a callback for maj=%d min=%d\n",
  ------------------
  |  |   66|    759|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    759|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 759]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 759]
  |  |  ------------------
  ------------------
  359|    759|                    major, minor));
  360|       |
  361|       |        /*
  362|       |         * call them 
  363|       |         */
  364|    759|        (*(scp->sc_callback)) (major, minor, caller_arg,
  365|    759|                               scp->sc_client_arg);
  366|    759|        count++;
  367|    759|    }
  368|       |
  369|    484|    DEBUGMSGTL(("callback",
  ------------------
  |  |   66|    484|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    484|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 484]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 484]
  |  |  ------------------
  ------------------
  370|    484|                "END calling callbacks for maj=%d min=%d (%d called)\n",
  371|    484|                major, minor, count));
  372|       |
  373|    484|    _callback_unlock(major,minor);
  374|    484|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|    484|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  375|    484|}
netsnmp_callback_clear_client_arg:
  503|    138|{
  504|    138|    struct snmp_gen_callback *scp = NULL;
  505|    138|    int rc = 0;
  506|       |
  507|       |    /*
  508|       |     * don't init i and j before loop, since the caller specified
  509|       |     * the starting point explicitly. But *after* the i loop has
  510|       |     * finished executing once, init j to 0 for the next pass
  511|       |     * through the subids.
  512|       |     */
  513|    414|    for (; i < MAX_CALLBACK_IDS; i++,j=0) {
  ------------------
  |  |   12|    414|#define MAX_CALLBACK_IDS    2
  ------------------
  |  Branch (513:12): [True: 276, False: 138]
  ------------------
  514|  5.17k|        for (; j < MAX_CALLBACK_SUBIDS; j++) {
  ------------------
  |  |   13|  5.17k|#define MAX_CALLBACK_SUBIDS 18
  ------------------
  |  Branch (514:16): [True: 4.89k, False: 276]
  ------------------
  515|  4.89k|            scp = thecallbacks[i][j]; 
  516|  6.14k|            while (scp != NULL) {
  ------------------
  |  Branch (516:20): [True: 1.24k, False: 4.89k]
  ------------------
  517|  1.24k|                if ((NULL != scp->sc_callback) &&
  ------------------
  |  Branch (517:21): [True: 1.24k, False: 0]
  ------------------
  518|  1.24k|                    (scp->sc_client_arg != NULL) &&
  ------------------
  |  Branch (518:21): [True: 69, False: 1.17k]
  ------------------
  519|     69|                    (scp->sc_client_arg == ptr)) {
  ------------------
  |  Branch (519:21): [True: 0, False: 69]
  ------------------
  520|      0|                    DEBUGMSGTL(("9:callback", "  clearing %p at [%d,%d]\n", ptr, i, j));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  521|      0|                    scp->sc_client_arg = NULL;
  522|      0|                    ++rc;
  523|      0|                }
  524|  1.24k|                scp = scp->next;
  525|  1.24k|            }
  526|  4.89k|        }
  527|    276|    }
  528|       |
  529|    138|    if (0 != rc) {
  ------------------
  |  Branch (529:9): [True: 0, False: 138]
  ------------------
  530|      0|        DEBUGMSGTL(("callback", "removed %d client args\n", rc));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  531|      0|    }
  532|       |
  533|    138|    return rc;
  534|    138|}
clear_callback:
  538|     69|{
  539|     69|    unsigned int i = 0, j = 0;
  540|     69|    struct snmp_gen_callback *scp = NULL;
  541|       |
  542|     69|    if (_callback_need_init)
  ------------------
  |  Branch (542:9): [True: 0, False: 69]
  ------------------
  543|      0|        init_callbacks();
  544|       |
  545|     69|    DEBUGMSGTL(("callback", "clear callback\n"));
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
  546|    207|    for (i = 0; i < MAX_CALLBACK_IDS; i++) {
  ------------------
  |  |   12|    207|#define MAX_CALLBACK_IDS    2
  ------------------
  |  Branch (546:17): [True: 138, False: 69]
  ------------------
  547|  2.62k|        for (j = 0; j < MAX_CALLBACK_SUBIDS; j++) {
  ------------------
  |  |   13|  2.62k|#define MAX_CALLBACK_SUBIDS 18
  ------------------
  |  Branch (547:21): [True: 2.48k, False: 138]
  ------------------
  548|  2.48k|            _callback_lock(i,j, "clear_callback", 1);
  549|  2.48k|            scp = thecallbacks[i][j];
  550|  3.24k|            while (scp != NULL) {
  ------------------
  |  Branch (550:20): [True: 759, False: 2.48k]
  ------------------
  551|    759|                thecallbacks[i][j] = scp->next;
  552|       |                /*
  553|       |                 * if there is a client arg, check for duplicates
  554|       |                 * and then free it.
  555|       |                 */
  556|    759|                if ((NULL != scp->sc_callback) &&
  ------------------
  |  Branch (556:21): [True: 759, False: 0]
  ------------------
  557|    759|                    (scp->sc_client_arg != NULL)) {
  ------------------
  |  Branch (557:21): [True: 69, False: 690]
  ------------------
  558|     69|                    void *tmp_arg;
  559|       |                    /*
  560|       |                     * save the client arg, then set it to null so that it
  561|       |                     * won't look like a duplicate, then check for duplicates
  562|       |                     * starting at the current i,j (earlier dups should have
  563|       |                     * already been found) and free the pointer.
  564|       |                     */
  565|     69|                    tmp_arg = scp->sc_client_arg;
  566|     69|                    scp->sc_client_arg = NULL;
  567|     69|                    DEBUGMSGTL(("9:callback", "  freeing %p at [%d,%d]\n", tmp_arg, i, j));
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
  568|     69|                    (void)netsnmp_callback_clear_client_arg(tmp_arg, i, j);
  569|     69|                    free(tmp_arg);
  570|     69|                }
  571|       |                SNMP_FREE(scp);
  ------------------
  |  |   62|    759|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 759, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 759]
  |  |  ------------------
  ------------------
  572|    759|                scp = thecallbacks[i][j];
  573|    759|            }
  574|  2.48k|            _callback_unlock(i,j);
  575|  2.48k|        }
  576|    138|    }
  577|     69|}
callback.c:_callback_lock:
  119|  3.72k|{
  120|  3.72k|    int lock_holded=0;
  121|  3.72k|    NETSNMP_SELECT_TIMEVAL lock_time;
  ------------------
  |  | 1749|  3.72k|#define NETSNMP_SELECT_TIMEVAL struct timeval
  ------------------
  122|       |
  123|       |#ifdef NETSNMP_PARANOID_LEVEL_HIGH
  124|       |    if (major >= MAX_CALLBACK_IDS || minor >= MAX_CALLBACK_SUBIDS) {
  125|       |        netsnmp_assert("bad callback id");
  126|       |        return 1;
  127|       |    }
  128|       |#endif
  129|       |    
  130|  3.72k|#ifdef CALLBACK_NAME_LOGGING
  131|  3.72k|    DEBUGMSGTL(("9:callback:lock", "locked (%s,%s)\n",
  ------------------
  |  |   66|  3.72k|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  3.72k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3.72k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 3.72k]
  |  |  ------------------
  ------------------
  132|  3.72k|                types[major], (SNMP_CALLBACK_LIBRARY == major) ?
  133|  3.72k|                SNMP_STRORNULL(lib[minor]) : "null"));
  134|  3.72k|#endif
  135|  3.72k|    while (CALLBACK_LOCK_COUNT(major,minor) >= 1 && ++lock_holded < 100) {
  ------------------
  |  |  109|  3.72k|#define CALLBACK_LOCK_COUNT(maj,min) _locks[maj][min]
  ------------------
  |  Branch (135:12): [True: 0, False: 3.72k]
  |  Branch (135:53): [True: 0, False: 0]
  ------------------
  136|      0|	lock_time.tv_sec = 0;
  137|      0|	lock_time.tv_usec = 1000;
  138|      0|	select(0, NULL, NULL, NULL, &lock_time);
  139|      0|    }
  140|       |
  141|  3.72k|    if(lock_holded >= 100) {
  ------------------
  |  Branch (141:8): [True: 0, False: 3.72k]
  ------------------
  142|      0|        if (NULL != warn)
  ------------------
  |  Branch (142:13): [True: 0, False: 0]
  ------------------
  143|      0|            snmp_log(LOG_WARNING,
  144|      0|                     "lock in _callback_lock sleeps more than 100 milliseconds in %s\n", warn);
  145|      0|        if (do_assert)
  ------------------
  |  Branch (145:13): [True: 0, False: 0]
  ------------------
  146|      0|            netsnmp_assert(lock_holded < 100);
  ------------------
  |  |   47|      0|#      define netsnmp_assert(x)  do { \
  |  |   48|      0|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 0, False: 0]
  |  |  ------------------
  |  |   49|      0|                 ; \
  |  |   50|      0|              else \
  |  |   51|      0|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
  147|       |        
  148|      0|        return 1;
  149|      0|    }
  150|       |
  151|  3.72k|    CALLBACK_LOCK(major,minor);
  ------------------
  |  |  107|  3.72k|#define CALLBACK_LOCK(maj,min) ++_locks[maj][min]
  ------------------
  152|  3.72k|    return 0;
  153|  3.72k|}
callback.c:_callback_unlock:
  157|  3.72k|{
  158|       |#ifdef NETSNMP_PARANOID_LEVEL_HIGH
  159|       |    if (major >= MAX_CALLBACK_IDS || minor >= MAX_CALLBACK_SUBIDS) {
  160|       |        netsnmp_assert("bad callback id");
  161|       |        return;
  162|       |    }
  163|       |#endif
  164|       |    
  165|  3.72k|    CALLBACK_UNLOCK(major,minor);
  ------------------
  |  |  108|  3.72k|#define CALLBACK_UNLOCK(maj,min) --_locks[maj][min]
  ------------------
  166|       |
  167|  3.72k|#ifdef CALLBACK_NAME_LOGGING
  168|  3.72k|    DEBUGMSGTL(("9:callback:lock", "unlocked (%s,%s)\n",
  ------------------
  |  |   66|  3.72k|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  3.72k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3.72k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 3.72k]
  |  |  ------------------
  ------------------
  169|  3.72k|                types[major], (SNMP_CALLBACK_LIBRARY == major) ?
  170|  3.72k|                SNMP_STRORNULL(lib[minor]) : "null"));
  171|  3.72k|#endif
  172|  3.72k|}

_netsnmp_release_trustcerts:
  175|    207|{
  176|    207|    if (NULL != _trusted_certs) {
  ------------------
  |  Branch (176:9): [True: 69, False: 138]
  ------------------
  177|     69|        CONTAINER_FREE_ALL(_trusted_certs, NULL);
  178|     69|        CONTAINER_FREE(_trusted_certs);
  179|       |        _trusted_certs = NULL;
  180|     69|    }
  181|    207|}
_setup_trusted_certs:
  185|     69|{
  186|     69|    _trusted_certs = netsnmp_container_find("trusted_certs:fifo");
  187|     69|    if (NULL == _trusted_certs) {
  ------------------
  |  Branch (187:9): [True: 0, False: 69]
  ------------------
  188|      0|        snmp_log(LOG_ERR, "could not create container for trusted certs\n");
  189|      0|        netsnmp_certs_shutdown();
  190|      0|        return;
  191|      0|    }
  192|     69|    _trusted_certs->container_name = strdup("trusted certificates");
  193|     69|    _trusted_certs->compare = netsnmp_str_compare;
  194|     69|}
netsnmp_certs_init:
  209|     69|{
  210|     69|    const char *trustCert_help = TRUSTCERT_CONFIG_TOKEN
  ------------------
  |  |  140|     69|#define TRUSTCERT_CONFIG_TOKEN "trustCert"
  ------------------
  211|     69|        " FINGERPRINT|FILENAME";
  212|       |
  213|     69|    register_config_handler("snmp", TRUSTCERT_CONFIG_TOKEN,
  ------------------
  |  |  140|     69|#define TRUSTCERT_CONFIG_TOKEN "trustCert"
  ------------------
  214|     69|                            _parse_trustcert, _netsnmp_release_trustcerts,
  215|     69|                            trustCert_help);
  216|     69|    _setup_containers();
  217|       |
  218|       |    /** add certificate type mapping */
  219|     69|    se_add_pair_to_slist("cert_types", strdup("pem"), NS_CERT_TYPE_PEM);
  220|     69|    se_add_pair_to_slist("cert_types", strdup("crt"), NS_CERT_TYPE_DER);
  221|     69|    se_add_pair_to_slist("cert_types", strdup("cer"), NS_CERT_TYPE_DER);
  222|     69|    se_add_pair_to_slist("cert_types", strdup("cert"), NS_CERT_TYPE_DER);
  223|     69|    se_add_pair_to_slist("cert_types", strdup("der"), NS_CERT_TYPE_DER);
  224|     69|    se_add_pair_to_slist("cert_types", strdup("key"), NS_CERT_TYPE_KEY);
  225|     69|    se_add_pair_to_slist("cert_types", strdup("private"), NS_CERT_TYPE_KEY);
  226|       |
  227|       |    /** hash algs */
  228|     69|    se_add_pair_to_slist("cert_hash_alg", strdup("sha1"), NS_HASH_SHA1);
  ------------------
  |  |   82|     69|#define NS_HASH_SHA1        2
  ------------------
  229|     69|    se_add_pair_to_slist("cert_hash_alg", strdup("md5"), NS_HASH_MD5);
  ------------------
  |  |   81|     69|#define NS_HASH_MD5         1
  ------------------
  230|     69|    se_add_pair_to_slist("cert_hash_alg", strdup("sha224"), NS_HASH_SHA224);
  ------------------
  |  |   83|     69|#define NS_HASH_SHA224      3
  ------------------
  231|     69|    se_add_pair_to_slist("cert_hash_alg", strdup("sha256"), NS_HASH_SHA256);
  ------------------
  |  |   84|     69|#define NS_HASH_SHA256      4
  ------------------
  232|     69|    se_add_pair_to_slist("cert_hash_alg", strdup("sha384"), NS_HASH_SHA384);
  ------------------
  |  |   85|     69|#define NS_HASH_SHA384      5
  ------------------
  233|     69|    se_add_pair_to_slist("cert_hash_alg", strdup("sha512"), NS_HASH_SHA512);
  ------------------
  |  |   86|     69|#define NS_HASH_SHA512      6
  ------------------
  234|       |
  235|       |    /** map types */
  236|     69|    se_add_pair_to_slist("cert_map_type", strdup("cn"),
  237|     69|                         TSNM_tlstmCertCommonName);
  ------------------
  |  |  126|     69|#define TSNM_tlstmCertCommonName                6
  ------------------
  238|     69|    se_add_pair_to_slist("cert_map_type", strdup("ip"),
  239|     69|                         TSNM_tlstmCertSANIpAddress);
  ------------------
  |  |  124|     69|#define TSNM_tlstmCertSANIpAddress              4
  ------------------
  240|     69|    se_add_pair_to_slist("cert_map_type", strdup("rfc822"),
  241|     69|                         TSNM_tlstmCertSANRFC822Name);
  ------------------
  |  |  122|     69|#define TSNM_tlstmCertSANRFC822Name             2
  ------------------
  242|     69|    se_add_pair_to_slist("cert_map_type", strdup("dns"),
  243|     69|                         TSNM_tlstmCertSANDNSName);
  ------------------
  |  |  123|     69|#define TSNM_tlstmCertSANDNSName                3
  ------------------
  244|     69|    se_add_pair_to_slist("cert_map_type", strdup("any"), TSNM_tlstmCertSANAny);
  ------------------
  |  |  125|     69|#define TSNM_tlstmCertSANAny                    5
  ------------------
  245|     69|    se_add_pair_to_slist("cert_map_type", strdup("sn"),
  246|     69|                         TSNM_tlstmCertSpecified);
  ------------------
  |  |  121|     69|#define TSNM_tlstmCertSpecified                 1
  ------------------
  247|       |
  248|     69|}
netsnmp_certs_shutdown:
  252|     69|{
  253|     69|    netsnmp_container ***c, **containers[] = {
  254|     69|        &_tlstmParams, &_tlstmAddr, &_maps, &_certs, &_keys, NULL
  255|     69|    };
  256|       |
  257|     69|    DEBUGMSGT(("cert:util:shutdown","shutdown\n"));
  ------------------
  |  |   62|     69|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 69]
  |  |  ------------------
  ------------------
  258|       |
  259|    414|    for (c = containers; *c; c++) {
  ------------------
  |  Branch (259:26): [True: 345, False: 69]
  ------------------
  260|    345|        if (!**c)
  ------------------
  |  Branch (260:13): [True: 207, False: 138]
  ------------------
  261|    207|            continue;
  262|    138|        CONTAINER_FREE_ALL(**c, NULL);
  263|    138|        CONTAINER_FREE(**c);
  264|       |        **c = NULL;
  265|    138|    }
  266|     69|    _netsnmp_release_trustcerts();
  267|     69|}
netsnmp_certs_load:
  271|      1|{
  272|      1|    netsnmp_iterator  *itr;
  273|      1|    netsnmp_key        *key;
  274|      1|    netsnmp_cert       *cert;
  275|       |
  276|      1|    DEBUGMSGT(("cert:util:init","init\n"));
  ------------------
  |  |   62|      1|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 1]
  |  |  ------------------
  ------------------
  277|       |
  278|      1|    if (NULL == _certs) {
  ------------------
  |  Branch (278:9): [True: 0, False: 1]
  ------------------
  279|      0|        snmp_log(LOG_ERR, "cant load certs without container\n");
  280|      0|        return;
  281|      0|    }
  282|       |
  283|      1|    if (CONTAINER_SIZE(_certs) != 0) {
  ------------------
  |  |  403|      1|#define CONTAINER_SIZE(x)           (x)->get_size(x)
  ------------------
  |  Branch (283:9): [True: 0, False: 1]
  ------------------
  284|      0|        DEBUGMSGT(("cert:util:init", "ignoring duplicate init\n"));
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
  285|      0|        return;
  286|      0|    }
  287|       |
  288|      1|    netsnmp_init_openssl();
  289|       |
  290|       |    /** scan config dirs for certs */
  291|      1|    _cert_indexes_load();
  292|       |
  293|       |    /** match up keys w/certs */
  294|      1|    itr = CONTAINER_ITERATOR(_keys);
  ------------------
  |  |  404|      1|#define CONTAINER_ITERATOR(x)       (x)->get_iterator(x)
  ------------------
  295|      1|    if (NULL == itr) {
  ------------------
  |  Branch (295:9): [True: 0, False: 1]
  ------------------
  296|      0|        snmp_log(LOG_ERR, "could not get iterator for keys\n");
  297|      0|        netsnmp_certs_shutdown();
  298|      0|        return;
  299|      0|    }
  300|      1|    key = ITERATOR_FIRST(itr);
  ------------------
  |  |  546|      1|#define ITERATOR_FIRST(x)  x->first(x)
  ------------------
  301|      1|    for( ; key; key = ITERATOR_NEXT(itr))
  ------------------
  |  |  547|      0|#define ITERATOR_NEXT(x)   x->next(x)
  ------------------
  |  Branch (301:12): [True: 0, False: 1]
  ------------------
  302|      0|        _find_partner(NULL, key);
  303|      1|    ITERATOR_RELEASE(itr);
  ------------------
  |  |  550|      1|#define ITERATOR_RELEASE(x) do { x->release(x); x = NULL; } while(0)
  |  |  ------------------
  |  |  |  Branch (550:67): [Folded, False: 1]
  |  |  ------------------
  ------------------
  304|       |
  305|      1|    DEBUGIF("cert:dump") {
  ------------------
  |  |  145|      1|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|      2|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (145:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  306|      0|        itr = CONTAINER_ITERATOR(_certs);
  ------------------
  |  |  404|      0|#define CONTAINER_ITERATOR(x)       (x)->get_iterator(x)
  ------------------
  307|      0|        if (NULL == itr) {
  ------------------
  |  Branch (307:13): [True: 0, False: 0]
  ------------------
  308|      0|            snmp_log(LOG_ERR, "could not get iterator for certs\n");
  309|      0|            netsnmp_certs_shutdown();
  310|      0|            return;
  311|      0|        }
  312|      0|        cert = ITERATOR_FIRST(itr);
  ------------------
  |  |  546|      0|#define ITERATOR_FIRST(x)  x->first(x)
  ------------------
  313|      0|        for( ; cert; cert = ITERATOR_NEXT(itr)) {
  ------------------
  |  |  547|      0|#define ITERATOR_NEXT(x)   x->next(x)
  ------------------
  |  Branch (313:16): [True: 0, False: 0]
  ------------------
  314|      0|            netsnmp_cert_load_x509(cert);
  315|      0|        }
  316|      0|        ITERATOR_RELEASE(itr);
  ------------------
  |  |  550|      0|#define ITERATOR_RELEASE(x) do { x->release(x); x = NULL; } while(0)
  |  |  ------------------
  |  |  |  Branch (550:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
  317|      0|        DEBUGMSGT(("cert:dump",
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
  318|      0|                   "-------------------- Certificates -----------------\n"));
  319|      0|        netsnmp_cert_dump_all();
  320|      0|        DEBUGMSGT(("cert:dump",
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
  321|      0|                   "------------------------ End ----------------------\n"));
  322|      0|    }
  323|      1|}
cert_util.c:_setup_containers:
  353|     69|{
  354|     69|    netsnmp_container *additional_keys;
  355|       |
  356|     69|    int rc;
  357|       |
  358|     69|    _certs = _get_cert_container("netsnmp certificates");
  359|     69|    if (NULL == _certs)
  ------------------
  |  Branch (359:9): [True: 0, False: 69]
  ------------------
  360|      0|        return;
  361|       |
  362|       |    /** additional keys: common name */
  363|     69|    additional_keys = netsnmp_container_find("certs_cn:binary_array");
  364|     69|    if (NULL == additional_keys) {
  ------------------
  |  Branch (364:9): [True: 0, False: 69]
  ------------------
  365|      0|        snmp_log(LOG_ERR, "could not create CN container for certificates\n");
  366|      0|        netsnmp_certs_shutdown();
  367|      0|        return;
  368|      0|    }
  369|     69|    additional_keys->container_name = strdup("certs_cn");
  370|     69|    additional_keys->free_item = NULL;
  371|     69|    additional_keys->compare = _cert_cn_compare;
  372|     69|    CONTAINER_SET_OPTIONS(additional_keys, CONTAINER_KEY_ALLOW_DUPLICATES, rc);
  ------------------
  |  |  375|     69|#define CONTAINER_SET_OPTIONS(x,o,rc)  do {                             \
  |  |  376|     69|        if (NULL==(x)->options)                                         \
  |  |  ------------------
  |  |  |  Branch (376:13): [True: 0, False: 69]
  |  |  ------------------
  |  |  377|     69|            rc = -1;                                                    \
  |  |  378|     69|        else {                                                          \
  |  |  379|     69|            rc = (x)->options(x, 1, o);                                 \
  |  |  380|     69|            if (rc != -1 )                                              \
  |  |  ------------------
  |  |  |  Branch (380:17): [True: 69, False: 0]
  |  |  ------------------
  |  |  381|     69|                (x)->flags |= o;                                        \
  |  |  382|     69|        }                                                               \
  |  |  383|     69|    } while(0)
  |  |  ------------------
  |  |  |  Branch (383:13): [Folded, False: 69]
  |  |  ------------------
  ------------------
  373|     69|    netsnmp_container_add_index(_certs, additional_keys);
  374|       |
  375|       |    /** additional keys: subject name */
  376|     69|    additional_keys = netsnmp_container_find("certs_sn:binary_array");
  377|     69|    if (NULL == additional_keys) {
  ------------------
  |  Branch (377:9): [True: 0, False: 69]
  ------------------
  378|      0|        snmp_log(LOG_ERR, "could not create SN container for certificates\n");
  379|      0|        netsnmp_certs_shutdown();
  380|      0|        return;
  381|      0|    }
  382|     69|    additional_keys->container_name = strdup("certs_sn");
  383|     69|    additional_keys->free_item = NULL;
  384|     69|    additional_keys->compare = _cert_sn_compare;
  385|     69|    additional_keys->ncompare = _cert_sn_ncompare;
  386|     69|    CONTAINER_SET_OPTIONS(additional_keys, CONTAINER_KEY_ALLOW_DUPLICATES, rc);
  ------------------
  |  |  375|     69|#define CONTAINER_SET_OPTIONS(x,o,rc)  do {                             \
  |  |  376|     69|        if (NULL==(x)->options)                                         \
  |  |  ------------------
  |  |  |  Branch (376:13): [True: 0, False: 69]
  |  |  ------------------
  |  |  377|     69|            rc = -1;                                                    \
  |  |  378|     69|        else {                                                          \
  |  |  379|     69|            rc = (x)->options(x, 1, o);                                 \
  |  |  380|     69|            if (rc != -1 )                                              \
  |  |  ------------------
  |  |  |  Branch (380:17): [True: 69, False: 0]
  |  |  ------------------
  |  |  381|     69|                (x)->flags |= o;                                        \
  |  |  382|     69|        }                                                               \
  |  |  383|     69|    } while(0)
  |  |  ------------------
  |  |  |  Branch (383:13): [Folded, False: 69]
  |  |  ------------------
  ------------------
  387|     69|    netsnmp_container_add_index(_certs, additional_keys);
  388|       |
  389|       |    /** additional keys: file name */
  390|     69|    additional_keys = netsnmp_container_find("certs_fn:binary_array");
  391|     69|    if (NULL == additional_keys) {
  ------------------
  |  Branch (391:9): [True: 0, False: 69]
  ------------------
  392|      0|        snmp_log(LOG_ERR, "could not create FN container for certificates\n");
  393|      0|        netsnmp_certs_shutdown();
  394|      0|        return;
  395|      0|    }
  396|     69|    additional_keys->container_name = strdup("certs_fn");
  397|     69|    additional_keys->free_item = NULL;
  398|     69|    additional_keys->compare = _cert_fn_compare;
  399|     69|    additional_keys->ncompare = _cert_fn_ncompare;
  400|     69|    CONTAINER_SET_OPTIONS(additional_keys, CONTAINER_KEY_ALLOW_DUPLICATES, rc);
  ------------------
  |  |  375|     69|#define CONTAINER_SET_OPTIONS(x,o,rc)  do {                             \
  |  |  376|     69|        if (NULL==(x)->options)                                         \
  |  |  ------------------
  |  |  |  Branch (376:13): [True: 0, False: 69]
  |  |  ------------------
  |  |  377|     69|            rc = -1;                                                    \
  |  |  378|     69|        else {                                                          \
  |  |  379|     69|            rc = (x)->options(x, 1, o);                                 \
  |  |  380|     69|            if (rc != -1 )                                              \
  |  |  ------------------
  |  |  |  Branch (380:17): [True: 69, False: 0]
  |  |  ------------------
  |  |  381|     69|                (x)->flags |= o;                                        \
  |  |  382|     69|        }                                                               \
  |  |  383|     69|    } while(0)
  |  |  ------------------
  |  |  |  Branch (383:13): [Folded, False: 69]
  |  |  ------------------
  ------------------
  401|     69|    netsnmp_container_add_index(_certs, additional_keys);
  402|       |
  403|     69|    _keys = netsnmp_container_find("cert_keys:binary_array");
  404|     69|    if (NULL == _keys) {
  ------------------
  |  Branch (404:9): [True: 0, False: 69]
  ------------------
  405|      0|        snmp_log(LOG_ERR, "could not create container for certificate keys\n");
  406|      0|        netsnmp_certs_shutdown();
  407|      0|        return;
  408|      0|    }
  409|     69|    _keys->container_name = strdup("netsnmp certificate keys");
  410|     69|    _keys->free_item = _key_free;
  411|     69|    _keys->compare = _cert_fn_compare;
  412|       |
  413|     69|    _setup_trusted_certs();
  414|     69|}
cert_util.c:_get_cert_container:
  332|     69|{
  333|     69|    netsnmp_container *c;
  334|       |
  335|     69|    int rc;
  336|       |
  337|     69|    c = netsnmp_container_find("certs:binary_array");
  338|     69|    if (NULL == c) {
  ------------------
  |  Branch (338:9): [True: 0, False: 69]
  ------------------
  339|      0|        snmp_log(LOG_ERR, "could not create container for %s\n", use);
  340|      0|        return NULL;
  341|      0|    }
  342|     69|    c->container_name = strdup(use);
  343|     69|    c->free_item = _cert_free;
  344|     69|    c->compare = _cert_compare;
  345|       |
  346|     69|    CONTAINER_SET_OPTIONS(c, CONTAINER_KEY_ALLOW_DUPLICATES, rc);
  ------------------
  |  |  375|     69|#define CONTAINER_SET_OPTIONS(x,o,rc)  do {                             \
  |  |  376|     69|        if (NULL==(x)->options)                                         \
  |  |  ------------------
  |  |  |  Branch (376:13): [True: 0, False: 69]
  |  |  ------------------
  |  |  377|     69|            rc = -1;                                                    \
  |  |  378|     69|        else {                                                          \
  |  |  379|     69|            rc = (x)->options(x, 1, o);                                 \
  |  |  380|     69|            if (rc != -1 )                                              \
  |  |  ------------------
  |  |  |  Branch (380:17): [True: 69, False: 0]
  |  |  ------------------
  |  |  381|     69|                (x)->flags |= o;                                        \
  |  |  382|     69|        }                                                               \
  |  |  383|     69|    } while(0)
  |  |  ------------------
  |  |  |  Branch (383:13): [Folded, False: 69]
  |  |  ------------------
  ------------------
  347|       |
  348|     69|    return c;
  349|     69|}
cert_util.c:_cert_indexes_load:
 1725|      1|{
 1726|      1|    const char     *confpath;
 1727|      1|    char           *confpath_copy, *dir, *st = NULL;
 1728|      1|    char            certdir[SNMP_MAXPATH];
 1729|      1|    const char     *subdirs[] = { NULL, "ca-certs", "certs", "private", NULL };
 1730|      1|    int             i = 0;
 1731|       |
 1732|       |    /*
 1733|       |     * load indexes from persistent dir
 1734|       |     */
 1735|      1|    _certindexes_load();
 1736|       |
 1737|       |    /*
 1738|       |     * duplicate path building from read_config_files_of_type() in
 1739|       |     * read_config.c. That is, use SNMPCONFPATH environment variable if
 1740|       |     * it is defined, otherwise use configuration directory.
 1741|       |     */
 1742|      1|    confpath = netsnmp_getenv("SNMPCONFPATH");
 1743|      1|    if (NULL == confpath)
  ------------------
  |  Branch (1743:9): [True: 1, False: 0]
  ------------------
 1744|      1|        confpath = get_configuration_directory();
 1745|       |
 1746|      1|    subdirs[0] = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1747|      1|                                       NETSNMP_DS_LIB_CERT_EXTRA_SUBDIR);
  ------------------
  |  |  177|      1|#define NETSNMP_DS_LIB_CERT_EXTRA_SUBDIR 26
  ------------------
 1748|      1|    confpath_copy = strdup(confpath);
 1749|      1|    if (!confpath_copy)
  ------------------
  |  Branch (1749:9): [True: 0, False: 1]
  ------------------
 1750|      0|        return;
 1751|      1|    for ( dir = strtok_r(confpath_copy, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|      1|#define ENV_SEPARATOR ":"
  ------------------
 1752|      5|          dir; dir = strtok_r(NULL, ENV_SEPARATOR, &st)) {
  ------------------
  |  |   67|      4|#define ENV_SEPARATOR ":"
  ------------------
  |  Branch (1752:11): [True: 4, False: 1]
  ------------------
 1753|       |
 1754|      4|        i = (NULL == subdirs[0]) ? 1 : 0;
  ------------------
  |  Branch (1754:13): [True: 4, False: 0]
  ------------------
 1755|     16|        for ( ; subdirs[i] ; ++i ) {
  ------------------
  |  Branch (1755:17): [True: 12, False: 4]
  ------------------
 1756|       |            /** check tls subdir */
 1757|     12|            snprintf(certdir, sizeof(certdir), "%s/tls/%s", dir, subdirs[i]);
 1758|     12|            _add_certdir(certdir);
 1759|     12|        } /* for subdirs */
 1760|      4|    } /* for conf path dirs */
 1761|       |    SNMP_FREE(confpath_copy);
  ------------------
  |  |   62|      1|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 1, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 1]
  |  |  ------------------
  ------------------
 1762|      1|}
cert_util.c:_certindexes_load:
  779|      1|{
  780|      1|    DIR *dir;
  781|      1|    struct dirent *file;
  782|      1|    FILE *fp;
  783|      1|    char filename[SNMP_MAXPATH], line[300];
  784|      1|    int  i;
  785|      1|    char *cp, *pos;
  786|       |
  787|       |    /*
  788|       |     * Open the CERT index directory, or create it (empty)
  789|       |     */
  790|      1|    snprintf( filename, sizeof(filename), "%s/cert_indexes",
  791|      1|              get_persistent_directory());
  792|      1|    filename[sizeof(filename)-1] = 0;
  793|      1|    dir = opendir( filename );
  794|      1|    if ( dir == NULL ) {
  ------------------
  |  Branch (794:10): [True: 1, False: 0]
  ------------------
  795|      1|        DEBUGMSGT(("cert:index:load",
  ------------------
  |  |   62|      1|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 1]
  |  |  ------------------
  ------------------
  796|      1|                   "creating new cert_indexes directory\n"));
  797|      1|        mkdirhier( filename, NETSNMP_AGENT_DIRECTORY_MODE, 0);
  ------------------
  |  | 2002|      1|#define NETSNMP_AGENT_DIRECTORY_MODE 0700
  ------------------
  798|      1|        return;
  799|      1|    }
  800|       |
  801|       |    /*
  802|       |     * Create a list of which directory each file refers to
  803|       |     */
  804|      0|    while ((file = readdir( dir ))) {
  ------------------
  |  Branch (804:12): [True: 0, False: 0]
  ------------------
  805|      0|        if ( !isdigit(0xFF & file->d_name[0]))
  ------------------
  |  Branch (805:14): [True: 0, False: 0]
  ------------------
  806|      0|            continue;
  807|      0|        i = atoi( file->d_name );
  808|       |
  809|      0|        snprintf( filename, sizeof(filename), "%s/cert_indexes/%d",
  810|      0|              get_persistent_directory(), i );
  811|      0|        filename[sizeof(filename)-1] = 0;
  812|      0|        fp = fopen( filename, "r" );
  813|      0|        if ( !fp ) {
  ------------------
  |  Branch (813:14): [True: 0, False: 0]
  ------------------
  814|      0|            DEBUGMSGT(("cert:index:load", "error opening index (%d)\n", i));
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
  815|      0|            continue;
  816|      0|        }
  817|      0|        cp = fgets( line, sizeof(line), fp );
  818|      0|        if ( cp ) {
  ------------------
  |  Branch (818:14): [True: 0, False: 0]
  ------------------
  819|      0|            line[strlen(line)-1] = 0;
  820|      0|            pos = strrchr(line, ' ');
  821|      0|            if (pos)
  ------------------
  |  Branch (821:17): [True: 0, False: 0]
  ------------------
  822|      0|                *pos = '\0';
  823|      0|            DEBUGMSGT(("9:cert:index:load","adding (%d) %s\n", i, line));
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
  824|      0|            (void)_certindex_add( line+4, i );  /* Skip 'DIR ' */
  825|      0|        } else {
  826|      0|            DEBUGMSGT(("cert:index:load", "Empty index (%d)\n", i));
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
  827|      0|        }
  828|      0|        fclose( fp );
  829|      0|    }
  830|      0|    closedir( dir );
  831|      0|}
cert_util.c:_add_certdir:
 1634|     12|{
 1635|     12|    FILE           *index;
 1636|     12|    char           *file;
 1637|     12|    int             count = 0;
 1638|     12|    netsnmp_container *cert_container;
 1639|     12|    netsnmp_iterator  *it;
 1640|     12|    struct stat     statbuf;
 1641|       |
 1642|     12|    netsnmp_assert(NULL != dirname);
  ------------------
  |  |   47|     12|#      define netsnmp_assert(x)  do { \
  |  |   48|     12|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 12, False: 0]
  |  |  ------------------
  |  |   49|     12|                 ; \
  |  |   50|     12|              else \
  |  |   51|     12|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|     12|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 12]
  |  |  ------------------
  ------------------
 1643|       |
 1644|     12|    DEBUGMSGT(("9:cert:dir:add", " config dir: %s\n", dirname ));
  ------------------
  |  |   62|     12|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     12|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 12]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 12]
  |  |  ------------------
  ------------------
 1645|       |
 1646|     12|    if (stat(dirname, &statbuf) != 0) {
  ------------------
  |  Branch (1646:9): [True: 12, False: 0]
  ------------------
 1647|     12|        DEBUGMSGT(("9:cert:dir:add", " dir not present: %s\n",
  ------------------
  |  |   62|     12|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     12|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 12]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 12]
  |  |  ------------------
  ------------------
 1648|     12|                   dirname ));
 1649|     12|        return -1;
 1650|     12|    }
 1651|      0|#ifdef S_ISDIR
 1652|      0|    if (!S_ISDIR(statbuf.st_mode)) {
  ------------------
  |  Branch (1652:9): [True: 0, False: 0]
  ------------------
 1653|      0|        DEBUGMSGT(("9:cert:dir:add", " not a dir: %s\n", dirname ));
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1654|      0|        return -1;
 1655|      0|    }
 1656|      0|#endif
 1657|       |
 1658|      0|    DEBUGMSGT(("cert:index:dir", "Scanning directory %s\n", dirname));
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1659|       |
 1660|       |    /*
 1661|       |     * look for existing index
 1662|       |     */
 1663|      0|    count = _cert_read_index(dirname, &statbuf);
 1664|      0|    if (count >= 0)
  ------------------
  |  Branch (1664:9): [True: 0, False: 0]
  ------------------
 1665|      0|        return count;
 1666|       |
 1667|      0|    index = _certindex_new( dirname );
 1668|      0|    if (NULL == index) {
  ------------------
  |  Branch (1668:9): [True: 0, False: 0]
  ------------------
 1669|      0|        DEBUGMSGT(("9:cert:index:dir",
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1670|      0|                    "error opening index for cert directory\n"));
 1671|      0|        DEBUGMSGTL(("cert:index", "could not open certificate index file\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1672|      0|    }
 1673|       |
 1674|       |    /*
 1675|       |     * index was missing, out of date or bad. rescan directory.
 1676|       |     */
 1677|      0|    cert_container =
 1678|      0|        netsnmp_directory_container_read_some(NULL, dirname,
 1679|      0|                                              _cert_cert_filter, NULL,
 1680|      0|                                              NETSNMP_DIR_RELATIVE_PATH |
  ------------------
  |  |   48|      0|#define NETSNMP_DIR_RELATIVE_PATH                     0x0002
  ------------------
 1681|      0|                                              NETSNMP_DIR_EMPTY_OK |
  ------------------
  |  |   51|      0|#define NETSNMP_DIR_EMPTY_OK                          0x0008
  ------------------
 1682|      0|                                              NETSNMP_DIR_ALLOW_DUPLICATES);
  ------------------
  |  |   57|      0|#define NETSNMP_DIR_ALLOW_DUPLICATES                  0x0040
  ------------------
 1683|      0|    if (NULL == cert_container) {
  ------------------
  |  Branch (1683:9): [True: 0, False: 0]
  ------------------
 1684|      0|        DEBUGMSGT(("cert:index:dir",
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1685|      0|                    "error creating container for cert files\n"));
 1686|      0|        goto err_index;
 1687|      0|    }
 1688|       |
 1689|       |    /*
 1690|       |     * iterate through the found files and add them to index
 1691|       |     */
 1692|      0|    it = CONTAINER_ITERATOR(cert_container);
  ------------------
  |  |  404|      0|#define CONTAINER_ITERATOR(x)       (x)->get_iterator(x)
  ------------------
 1693|      0|    if (NULL == it) {
  ------------------
  |  Branch (1693:9): [True: 0, False: 0]
  ------------------
 1694|      0|        DEBUGMSGT(("cert:index:dir",
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1695|      0|                    "error creating iterator for cert files\n"));
 1696|      0|        goto err_container;
 1697|      0|    }
 1698|       |
 1699|      0|    for (file = ITERATOR_FIRST(it); file; file = ITERATOR_NEXT(it)) {
  ------------------
  |  |  546|      0|#define ITERATOR_FIRST(x)  x->first(x)
  ------------------
                  for (file = ITERATOR_FIRST(it); file; file = ITERATOR_NEXT(it)) {
  ------------------
  |  |  547|      0|#define ITERATOR_NEXT(x)   x->next(x)
  ------------------
  |  Branch (1699:37): [True: 0, False: 0]
  ------------------
 1700|      0|        DEBUGMSGT(("cert:index:dir", "adding %s to index\n", file));
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1701|      0|        if ( 0 == _add_certfile( dirname, file, index ))
  ------------------
  |  Branch (1701:14): [True: 0, False: 0]
  ------------------
 1702|      0|            count++;
 1703|      0|        else
 1704|      0|            DEBUGMSGT(("cert:index:dir", "error adding %s to index\n",
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1705|      0|                        file));
 1706|      0|    }
 1707|       |
 1708|       |    /*
 1709|       |     * clean up and return
 1710|       |     */
 1711|      0|    ITERATOR_RELEASE(it);
  ------------------
  |  |  550|      0|#define ITERATOR_RELEASE(x) do { x->release(x); x = NULL; } while(0)
  |  |  ------------------
  |  |  |  Branch (550:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1712|       |
 1713|      0|  err_container:
 1714|      0|    netsnmp_directory_container_free(cert_container);
 1715|       |
 1716|      0|  err_index:
 1717|      0|    if (index)
  ------------------
  |  Branch (1717:9): [True: 0, False: 0]
  ------------------
 1718|      0|        fclose(index);
 1719|       |
 1720|      0|    return count;
 1721|      0|}

netsnmp_container_init_list:
   82|     69|{
   83|     69|    if (NULL != containers)
  ------------------
  |  Branch (83:9): [True: 0, False: 69]
  ------------------
   84|      0|        return;
   85|       |
   86|       |    /*
   87|       |     * create a binary array container to hold container
   88|       |     * factories
   89|       |     */
   90|     69|    containers = netsnmp_container_get_binary_array();
   91|     69|    containers->compare = netsnmp_compare_cstring;
   92|     69|    containers->container_name = strdup("container list");
   93|       |
   94|       |    /*
   95|       |     * register containers
   96|       |     */
   97|     69|    netsnmp_container_binary_array_init();
   98|     69|#ifndef NETSNMP_FEATURE_REMOVE_CONTAINER_LINKED_LIST
   99|     69|    netsnmp_container_ssll_init();
  100|     69|#endif /* NETSNMP_FEATURE_REMOVE_CONTAINER_LINKED_LIST */
  101|     69|#ifndef NETSNMP_FEATURE_REMOVE_CONTAINER_NULL
  102|     69|    netsnmp_container_null_init();
  103|     69|#endif /* NETSNMP_FEATURE_REMOVE_CONTAINER_NULL */
  104|       |
  105|       |    /*
  106|       |     * default aliases for some containers
  107|       |     */
  108|     69|    netsnmp_container_register("table_container",
  109|     69|                               netsnmp_container_get_factory("binary_array"));
  110|       |
  111|     69|#ifndef NETSNMP_FEATURE_REMOVE_CONTAINER_LINKED_LIST
  112|     69|    netsnmp_container_register("linked_list",
  113|     69|                               netsnmp_container_get_factory("sorted_singly_linked_list"));
  114|     69|    netsnmp_container_register("ssll_container",
  115|     69|                               netsnmp_container_get_factory("sorted_singly_linked_list"));
  116|     69|#endif /* NETSNMP_FEATURE_REMOVE_CONTAINER_LINKED_LIST */
  117|       |
  118|     69|    netsnmp_container_register_with_compare
  119|     69|        ("cstring", netsnmp_container_get_factory("binary_array"),
  120|     69|         netsnmp_compare_direct_cstring);
  121|       |
  122|     69|    netsnmp_container_register_with_compare
  123|     69|        ("string", netsnmp_container_get_factory("binary_array"),
  124|     69|         netsnmp_compare_cstring);
  125|     69|    netsnmp_container_register_with_compare
  126|     69|        ("string_binary_array", netsnmp_container_get_factory("binary_array"),
  127|     69|         netsnmp_compare_cstring);
  128|       |
  129|     69|}
netsnmp_container_free_list:
  133|     69|{
  134|     69|    DEBUGMSGTL(("container", "netsnmp_container_free_list() called\n"));
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
  135|     69|    if (containers == NULL)
  ------------------
  |  Branch (135:9): [True: 0, False: 69]
  ------------------
  136|      0|	return;
  137|       |
  138|       |    /*
  139|       |     * free memory used by each factory entry
  140|       |     */
  141|     69|    CONTAINER_FOR_EACH(containers, _factory_free, NULL);
  ------------------
  |  |  406|     69|#define CONTAINER_FOR_EACH(x,f,c)   (x)->for_each(x,f,c)
  ------------------
  142|       |
  143|       |    /*
  144|       |     * free factory container
  145|       |     */
  146|     69|    CONTAINER_FREE(containers);
  147|       |    containers = NULL;
  148|     69|}
netsnmp_container_register_with_compare:
  153|    828|{
  154|    828|    container_type *ct, tmp;
  155|       |
  156|    828|    if (NULL==containers)
  ------------------
  |  Branch (156:9): [True: 0, False: 828]
  ------------------
  157|      0|        return -1;
  158|       |
  159|    828|    tmp.name = name;
  160|    828|    ct = (container_type *)CONTAINER_FIND(containers, &tmp);
  ------------------
  |  |  394|    828|#define CONTAINER_FIND(x,k)         (x)->find(x,k)
  ------------------
  161|    828|    if (NULL!=ct) {
  ------------------
  |  Branch (161:9): [True: 0, False: 828]
  ------------------
  162|      0|        DEBUGMSGT(("container_registry",
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
  163|      0|                   "replacing previous container factory\n"));
  164|      0|        ct->factory = f;
  165|      0|    }
  166|    828|    else {
  167|    828|        ct = SNMP_MALLOC_TYPEDEF(container_type);
  ------------------
  |  |   73|    828|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
  168|    828|        if (NULL == ct)
  ------------------
  |  Branch (168:13): [True: 0, False: 828]
  ------------------
  169|      0|            return -1;
  170|    828|        ct->name = strdup(name);
  171|    828|        ct->factory = f;
  172|    828|        ct->compare = c;
  173|    828|        CONTAINER_INSERT(containers, ct);
  174|    828|    }
  175|    828|    DEBUGMSGT(("container_registry", "registered container factory %s (%s)\n",
  ------------------
  |  |   62|    828|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    828|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 828]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 828]
  |  |  ------------------
  ------------------
  176|    828|               ct->name, f->product));
  177|       |
  178|    828|    return 0;
  179|    828|}
netsnmp_container_register:
  183|    621|{
  184|       |    return netsnmp_container_register_with_compare(name, f, NULL);
  185|    621|}
netsnmp_container_get_factory:
  191|    414|{
  192|    414|    container_type ct, *found;
  193|       |    
  194|    414|    if (NULL==containers)
  ------------------
  |  Branch (194:9): [True: 0, False: 414]
  ------------------
  195|      0|        return NULL;
  196|       |
  197|    414|    ct.name = type;
  198|    414|    found = (container_type *)CONTAINER_FIND(containers, &ct);
  ------------------
  |  |  394|    414|#define CONTAINER_FIND(x,k)         (x)->find(x,k)
  ------------------
  199|       |
  200|    414|    return found ? found->factory : NULL;
  ------------------
  |  Branch (200:12): [True: 414, False: 0]
  ------------------
  201|    414|}
netsnmp_container_find:
  300|    414|{
  301|    414|    container_type *ct = netsnmp_container_find_ct(type);
  302|    414|    netsnmp_container *c = ct ? (netsnmp_container *)(ct->factory->produce()) : NULL;
  ------------------
  |  Branch (302:28): [True: 414, False: 0]
  ------------------
  303|       |
  304|       |    /*
  305|       |     * provide default compare and ncompare
  306|       |     */
  307|    414|    if (c) {
  ------------------
  |  Branch (307:9): [True: 414, False: 0]
  ------------------
  308|    414|        if (ct->compare)
  ------------------
  |  Branch (308:13): [True: 0, False: 414]
  ------------------
  309|      0|            c->compare = ct->compare;
  310|    414|        else if (NULL == c->compare)
  ------------------
  |  Branch (310:18): [True: 414, False: 0]
  ------------------
  311|    414|            c->compare = netsnmp_compare_netsnmp_index;
  312|       |
  313|    414|        if (NULL == c->ncompare)
  ------------------
  |  Branch (313:13): [True: 414, False: 0]
  ------------------
  314|    414|            c->ncompare = netsnmp_ncompare_netsnmp_index;
  315|    414|    }
  316|       |
  317|    414|    return c;
  318|    414|}
netsnmp_container_add_index:
  325|    207|{
  326|    207|    netsnmp_container *curr = primary;
  327|       |
  328|    207|    if((NULL == new_index) || (NULL == primary)) {
  ------------------
  |  Branch (328:8): [True: 0, False: 207]
  |  Branch (328:31): [True: 0, False: 207]
  ------------------
  329|      0|        snmp_log(LOG_ERR, "add index called with null pointer\n");
  330|      0|        return;
  331|      0|    }
  332|       |
  333|    414|    while(curr->next)
  ------------------
  |  Branch (333:11): [True: 207, False: 207]
  ------------------
  334|    207|        curr = curr->next;
  335|       |
  336|    207|    curr->next = new_index;
  337|    207|    new_index->prev = curr;
  338|    207|}
CONTAINER_INSERT_HELPER:
  341|  1.65k|{
  342|  1.65k|    while(x && x->insert_filter && x->insert_filter(x,k) == 1)
  ------------------
  |  Branch (342:11): [True: 828, False: 828]
  |  Branch (342:16): [True: 0, False: 828]
  |  Branch (342:36): [True: 0, False: 0]
  ------------------
  343|      0|        x = x->next;
  344|  1.65k|    if(x) {
  ------------------
  |  Branch (344:8): [True: 828, False: 828]
  ------------------
  345|    828|        int rc = x->insert(x,k);
  346|    828|        if(rc)
  ------------------
  |  Branch (346:12): [True: 0, False: 828]
  ------------------
  347|      0|            snmp_log(LOG_DEBUG,"error on subcontainer '%s' insert (%d)\n",
  348|      0|                     x->container_name ? x->container_name : "", rc);
  ------------------
  |  Branch (348:22): [True: 0, False: 0]
  ------------------
  349|    828|        else {
  350|    828|            rc = CONTAINER_INSERT_HELPER(x->next, k);
  351|    828|            if(rc)
  ------------------
  |  Branch (351:16): [True: 0, False: 828]
  ------------------
  352|      0|                x->remove(x,k);
  353|    828|        }
  354|    828|        return rc;
  355|    828|    }
  356|    828|    return 0;
  357|  1.65k|}
CONTAINER_INSERT:
  360|    828|{
  361|       |    /** start at first container */
  362|    828|    while(x->prev)
  ------------------
  |  Branch (362:11): [True: 0, False: 828]
  ------------------
  363|      0|        x = x->prev;
  364|    828|    return CONTAINER_INSERT_HELPER(x, k);
  365|    828|}
CONTAINER_FREE:
  469|    276|{
  470|    276|    int  rc2, rc = 0;
  471|       |
  472|    276|    if (!x)
  ------------------
  |  Branch (472:9): [True: 0, False: 276]
  ------------------
  473|      0|        return rc;
  474|       |
  475|       |    /** start at last container */
  476|    483|    while(x->next)
  ------------------
  |  Branch (476:11): [True: 207, False: 276]
  ------------------
  477|    207|        x = x->next;
  478|    759|    while(x) {
  ------------------
  |  Branch (478:11): [True: 483, False: 276]
  ------------------
  479|    483|        netsnmp_container *tmp;
  480|    483|        char *name;
  481|    483|        tmp = x->prev;
  482|    483|        name = x->container_name;
  483|    483|        x->container_name = NULL;
  484|    483|        rc2 = x->cfree(x);
  485|    483|        if (rc2) {
  ------------------
  |  Branch (485:13): [True: 0, False: 483]
  ------------------
  486|      0|            snmp_log(LOG_ERR,"error on subcontainer '%s' cfree (%d)\n",
  487|      0|                     name ? name : "", rc2);
  ------------------
  |  Branch (487:22): [True: 0, False: 0]
  ------------------
  488|      0|            rc = rc2;
  489|      0|        }
  490|       |        SNMP_FREE(name);
  ------------------
  |  |   62|    483|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 483, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 483]
  |  |  ------------------
  ------------------
  491|    483|        x = tmp;
  492|    483|    }
  493|    276|    return rc;
  494|    276|}
CONTAINER_CLEAR:
  503|    207|{
  504|       |    /** start at last container */
  505|    414|    while(x->next)
  ------------------
  |  Branch (505:11): [True: 207, False: 207]
  ------------------
  506|    207|        x = x->next;
  507|    414|    while(x->prev) {
  ------------------
  |  Branch (507:11): [True: 207, False: 207]
  ------------------
  508|       |        x->clear(x, NULL, c);
  509|    207|        x = x->prev;
  510|    207|    }
  511|    207|    x->clear(x, f, c);
  512|    207|#ifdef HAVE_MALLOC_TRIM
  513|    207|    malloc_trim(0);
  514|    207|#endif
  515|    207|}
CONTAINER_FREE_ALL:
  524|    207|{
  525|    207|    CONTAINER_CLEAR(x, x->free_item, c);
  526|    207|}
netsnmp_init_container:
  563|    483|{
  564|    483|    if (c == NULL)
  ------------------
  |  Branch (564:9): [True: 0, False: 483]
  ------------------
  565|      0|        return;
  566|       |
  567|    483|    c->init = init;
  568|    483|    c->cfree = cfree;
  569|    483|    c->get_size = size;
  570|    483|    c->compare = cmp;
  571|    483|    c->insert = ins;
  572|    483|    c->remove = rem;
  573|    483|    c->find = fnd;
  574|    483|    c->free_item = netsnmp_container_simple_free;
  575|    483|}
netsnmp_compare_cstring:
  643|  10.2k|{
  644|  10.2k|    const container_type *lhs = lhs_arg;
  645|  10.2k|    const container_type *rhs = rhs_arg;
  646|       |
  647|  10.2k|    return strcmp(lhs->name, rhs->name);
  648|  10.2k|}
container.c:_factory_free:
   65|    828|{
   66|    828|    container_type *data = (container_type *)dat;
   67|    828|    if (data == NULL)
  ------------------
  |  Branch (67:9): [True: 0, False: 828]
  ------------------
   68|      0|	return;
   69|       |    
   70|    828|    if (data->name != NULL) {
  ------------------
  |  Branch (70:9): [True: 828, False: 0]
  ------------------
   71|    828|        DEBUGMSGTL(("container", "  _factory_free_list() called for %s\n",
  ------------------
  |  |   66|    828|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    828|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 828]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 828]
  |  |  ------------------
  ------------------
   72|    828|                    data->name));
   73|    828|	free(NETSNMP_REMOVE_CONST(void *, data->name)); /* SNMP_FREE wasted on object about to be freed */
  ------------------
  |  |   91|    828|    (__extension__ ({ const t tmp = (e); (t)(size_t)tmp; }))
  ------------------
   74|    828|    }
   75|    828|    free(data); /* SNMP_FREE wasted on param */
   76|    828|}
container.c:netsnmp_container_get_ct:
  234|    828|{
  235|    828|    container_type ct;
  236|       |
  237|    828|    if (NULL == containers)
  ------------------
  |  Branch (237:9): [True: 0, False: 828]
  ------------------
  238|      0|        return NULL;
  239|       |    
  240|    828|    ct.name = type;
  241|    828|    return (container_type *)CONTAINER_FIND(containers, &ct);
  ------------------
  |  |  394|    828|#define CONTAINER_FIND(x,k)         (x)->find(x,k)
  ------------------
  242|    828|}
container.c:netsnmp_container_find_ct:
  246|    414|{
  247|    414|    container_type    *ct = NULL;
  248|    414|    char              *list, *entry;
  249|    414|    char              *st = NULL;
  250|       |
  251|    414|    if (NULL==type_list)
  ------------------
  |  Branch (251:9): [True: 0, False: 414]
  ------------------
  252|      0|        return NULL;
  253|       |
  254|    414|    list = strdup(type_list);
  255|    414|    if (!list)
  ------------------
  |  Branch (255:9): [True: 0, False: 414]
  ------------------
  256|      0|        return NULL;
  257|    414|    entry = strtok_r(list, ":", &st);
  258|    828|    while (entry) {
  ------------------
  |  Branch (258:12): [True: 828, False: 0]
  ------------------
  259|    828|        ct = netsnmp_container_get_ct(entry);
  260|    828|        if (NULL != ct)
  ------------------
  |  Branch (260:13): [True: 414, False: 414]
  ------------------
  261|    414|            break;
  262|    414|        entry = strtok_r(NULL, ":", &st);
  263|    414|    }
  264|       |
  265|    414|    free(list);
  266|    414|    return ct;
  267|    414|}

netsnmp_binary_array_release:
  204|    414|{
  205|    414|    binary_array_table *t = (binary_array_table*)c->container_data;
  206|    414|    SNMP_FREE(t->data);
  ------------------
  |  |   62|    414|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 69, False: 345]
  |  |  |  Branch (62:66): [Folded, False: 414]
  |  |  ------------------
  ------------------
  207|    414|    SNMP_FREE(t);
  ------------------
  |  |   62|    414|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 414, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 414]
  |  |  ------------------
  ------------------
  208|    414|    SNMP_FREE(c->container_name);
  ------------------
  |  |   62|    414|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 414]
  |  |  |  Branch (62:66): [Folded, False: 414]
  |  |  ------------------
  ------------------
  209|       |    SNMP_FREE(c);
  ------------------
  |  |   62|    414|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 414, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 414]
  |  |  ------------------
  ------------------
  210|    414|}
netsnmp_binary_array_options_set:
  220|    276|{
  221|    276|#define BA_FLAGS (CONTAINER_KEY_ALLOW_DUPLICATES|CONTAINER_KEY_UNSORTED)
  222|       |
  223|    276|    if (set) {
  ------------------
  |  Branch (223:9): [True: 276, False: 0]
  ------------------
  224|    276|        if ((flags & BA_FLAGS) == flags) {
  ------------------
  |  |  221|    276|#define BA_FLAGS (CONTAINER_KEY_ALLOW_DUPLICATES|CONTAINER_KEY_UNSORTED)
  |  |  ------------------
  |  |  |  |  370|    276|#define CONTAINER_KEY_ALLOW_DUPLICATES             0x00000001
  |  |  ------------------
  |  |               #define BA_FLAGS (CONTAINER_KEY_ALLOW_DUPLICATES|CONTAINER_KEY_UNSORTED)
  |  |  ------------------
  |  |  |  |  371|    276|#define CONTAINER_KEY_UNSORTED                     0x00000002
  |  |  ------------------
  ------------------
  |  Branch (224:13): [True: 276, False: 0]
  ------------------
  225|       |            /** if turning off unsorted, do sort */
  226|    276|            int sort = ((c->flags & CONTAINER_KEY_UNSORTED) &&
  ------------------
  |  |  371|    276|#define CONTAINER_KEY_UNSORTED                     0x00000002
  ------------------
  |  Branch (226:25): [True: 0, False: 276]
  ------------------
  227|      0|                        ! (flags & CONTAINER_KEY_UNSORTED));
  ------------------
  |  |  371|      0|#define CONTAINER_KEY_UNSORTED                     0x00000002
  ------------------
  |  Branch (227:25): [True: 0, False: 0]
  ------------------
  228|    276|            c->flags = flags;
  229|    276|            if (sort) {
  ------------------
  |  Branch (229:17): [True: 0, False: 276]
  ------------------
  230|      0|                binary_array_table *t = (binary_array_table*)c->container_data;
  231|      0|                t->dirty = 1; /* force sort */
  232|      0|                Sort_Array(c);
  233|      0|            }
  234|    276|            return flags;
  235|    276|        } else {
  236|      0|            return -1; /* unsupported flag */
  237|      0|        }
  238|    276|    } else {
  239|      0|        return ((c->flags & flags) == flags);
  240|      0|    }
  241|    276|}
netsnmp_container_get_binary_array:
  804|    414|{
  805|       |    /*
  806|       |     * allocate memory
  807|       |     */
  808|    414|    netsnmp_container *c = SNMP_MALLOC_TYPEDEF(netsnmp_container);
  ------------------
  |  |   73|    414|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
  809|    414|    if (NULL==c) {
  ------------------
  |  Branch (809:9): [True: 0, False: 414]
  ------------------
  810|      0|        snmp_log(LOG_ERR, "couldn't allocate memory\n");
  811|      0|        return NULL;
  812|      0|    }
  813|       |
  814|    414|    c->container_data = netsnmp_binary_array_initialize();
  815|    414|    if (NULL == c->container_data) {
  ------------------
  |  Branch (815:9): [True: 0, False: 414]
  ------------------
  816|      0|        free(c);
  817|      0|        snmp_log(LOG_ERR, "couldn't allocate memory for container_data\n");
  818|      0|        return NULL;
  819|      0|    }
  820|       |
  821|       |    /*
  822|       |     * NOTE: CHANGES HERE MUST BE DUPLICATED IN duplicate AS WELL!!
  823|       |     */
  824|    414|    netsnmp_init_container(c, NULL, _ba_free, _ba_size, NULL, _ba_insert,
  825|    414|                           _ba_remove, _ba_find);
  826|    414|    c->find_next = _ba_find_next;
  827|    414|    c->get_subset = _ba_get_subset;
  828|    414|    c->get_iterator = _ba_iterator_get;
  829|    414|    c->for_each = _ba_for_each;
  830|    414|    c->clear = _ba_clear;
  831|    414|    c->options = _ba_options;
  832|    414|    c->duplicate = _ba_duplicate;
  833|    414|    c->get_at = netsnmp_binary_array_get_at;
  834|    414|    c->remove_at = netsnmp_binary_array_remove_at;
  835|    414|    c->insert_before = _ba_insert_before;
  836|       |
  837|    414|    return c;
  838|    414|}
netsnmp_container_get_binary_array_factory:
  842|     69|{
  843|     69|    static netsnmp_factory f = { "binary_array",
  844|     69|                                 netsnmp_container_get_binary_array };
  845|       |    
  846|     69|    return &f;
  847|     69|}
netsnmp_container_binary_array_init:
  851|     69|{
  852|     69|    netsnmp_container_register("binary_array",
  853|     69|                               netsnmp_container_get_binary_array_factory());
  854|     69|}
container_binary_array.c:_ba_is_sorted:
  324|    828|{
  325|       |    /*
  326|       |     * The code below has been commented out because it negatively affects
  327|       |     * performance.
  328|       |     */
  329|       |#if 0
  330|       |    const binary_array_table *t = c->container_data;
  331|       |    int i;
  332|       |
  333|       |    for (i = 0; i + 1 < t->count; ++i)
  334|       |        if (c->compare(t->data[i], t->data[i + 1]) > 0)
  335|       |            return 0;
  336|       |#endif
  337|       |
  338|    828|    return 1;
  339|    828|}
container_binary_array.c:binary_search:
  113|  2.76k|{
  114|  2.76k|    binary_array_table *t = (binary_array_table*)c->container_data;
  115|  2.76k|    size_t             len = t->count;
  116|  2.76k|    size_t             half;
  117|  2.76k|    size_t             first = 0;
  118|  2.76k|    size_t             middle = 0; /* init not needed; keeps compiler happy */
  119|  2.76k|    int                result = 0; /* init not needed; keeps compiler happy */
  120|       |
  121|  2.76k|    if (!len) {
  ------------------
  |  Branch (121:9): [True: 0, False: 2.76k]
  ------------------
  122|      0|        if (NULL != next)
  ------------------
  |  Branch (122:13): [True: 0, False: 0]
  ------------------
  123|      0|            *next = 0;
  124|      0|        return -1;
  125|      0|    }
  126|       |
  127|  2.76k|    if (c->flags & CONTAINER_KEY_UNSORTED) {
  ------------------
  |  |  371|  2.76k|#define CONTAINER_KEY_UNSORTED                     0x00000002
  ------------------
  |  Branch (127:9): [True: 0, False: 2.76k]
  ------------------
  128|      0|        if (!exact) {
  ------------------
  |  Branch (128:13): [True: 0, False: 0]
  ------------------
  129|      0|            snmp_log(LOG_ERR, "non-exact search on unsorted container %s?!?\n",
  130|      0|                     c->container_name);
  131|      0|            return -1;
  132|      0|        }
  133|      0|        return linear_search(val, c);
  134|      0|    }
  135|       |
  136|  2.76k|    if (t->dirty)
  ------------------
  |  Branch (136:9): [True: 0, False: 2.76k]
  ------------------
  137|      0|        Sort_Array(c);
  138|       |
  139|  10.8k|    while (len > 0) {
  ------------------
  |  Branch (139:12): [True: 8.90k, False: 1.93k]
  ------------------
  140|  8.90k|        half = len >> 1;
  141|  8.90k|        middle = first + half;
  142|  8.90k|        if ((result = c->compare(t->data[middle], val)) < 0) {
  ------------------
  |  Branch (142:13): [True: 2.96k, False: 5.93k]
  ------------------
  143|  2.96k|            first = middle + 1;
  144|  2.96k|            len = len - half - 1;
  145|  5.93k|        } else if (result == 0) {
  ------------------
  |  Branch (145:20): [True: 828, False: 5.10k]
  ------------------
  146|    828|            first = middle;
  147|    828|            break;
  148|  5.10k|        } else {
  149|  5.10k|            len = half;
  150|  5.10k|        }
  151|  8.90k|    }
  152|       |
  153|  2.76k|    if (first >= t->count) {
  ------------------
  |  Branch (153:9): [True: 276, False: 2.48k]
  ------------------
  154|    276|        if (exact && NULL != next)
  ------------------
  |  Branch (154:13): [True: 276, False: 0]
  |  Branch (154:22): [True: 138, False: 138]
  ------------------
  155|    138|            *next = t->count;
  156|    276|        return -1;
  157|    276|    }
  158|       |
  159|  2.48k|    if (first != middle) {
  ------------------
  |  Branch (159:9): [True: 1.38k, False: 1.10k]
  ------------------
  160|       |        /* last compare wasn't against first, so get actual result */
  161|  1.38k|        result = c->compare(t->data[first], val);
  162|  1.38k|    }
  163|       |
  164|  2.48k|    if(result == 0) {
  ------------------
  |  Branch (164:8): [True: 828, False: 1.65k]
  ------------------
  165|    828|        if (exact && NULL != next)
  ------------------
  |  Branch (165:13): [True: 828, False: 0]
  |  Branch (165:22): [True: 0, False: 828]
  ------------------
  166|      0|            *next = first+1;
  167|    828|        else if (!exact && ++first == t->count) {
  ------------------
  |  Branch (167:18): [True: 0, False: 828]
  |  Branch (167:28): [True: 0, False: 0]
  ------------------
  168|      0|            if (NULL != next)
  ------------------
  |  Branch (168:17): [True: 0, False: 0]
  ------------------
  169|      0|                *next = first;
  170|      0|            first = -1;
  171|      0|        }
  172|  1.65k|    } else if(exact) {
  ------------------
  |  Branch (172:15): [True: 1.65k, False: 0]
  ------------------
  173|  1.65k|        if (NULL != next) {
  ------------------
  |  Branch (173:13): [True: 621, False: 1.03k]
  ------------------
  174|    621|            if (result > 0)
  ------------------
  |  Branch (174:17): [True: 621, False: 0]
  ------------------
  175|    621|                *next = first;
  176|      0|            else
  177|      0|                *next = t->count;
  178|    621|        }
  179|  1.65k|        first = -1;
  180|  1.65k|    }
  181|       |
  182|  2.48k|    return first;
  183|  2.76k|}
container_binary_array.c:netsnmp_binary_array_initialize:
  187|    414|{
  188|    414|    binary_array_table *t;
  189|       |
  190|    414|    t = SNMP_MALLOC_TYPEDEF(binary_array_table);
  ------------------
  |  |   73|    414|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
  191|    414|    if (t == NULL)
  ------------------
  |  Branch (191:9): [True: 0, False: 414]
  ------------------
  192|      0|        return NULL;
  193|       |
  194|    414|    t->max_size = 0;
  195|    414|    t->count = 0;
  196|    414|    t->dirty = 0;
  197|    414|    t->data = NULL;
  198|       |
  199|    414|    return t;
  200|    414|}
container_binary_array.c:_ba_free:
  700|    414|{
  701|    414|    netsnmp_binary_array_release(container);
  702|    414|    return 0;
  703|    414|}
container_binary_array.c:_ba_size:
  707|      1|{
  708|      1|    return netsnmp_binary_array_count(container);
  709|      1|}
container_binary_array.c:netsnmp_binary_array_count:
  245|      1|{
  246|      1|    binary_array_table *t = (binary_array_table*)c->container_data;
  247|       |    /*
  248|       |     * return count
  249|       |     */
  250|      1|    return t ? t->count : 0;
  ------------------
  |  Branch (250:12): [True: 1, False: 0]
  ------------------
  251|      1|}
container_binary_array.c:_ba_insert:
  681|    828|{
  682|    828|    return netsnmp_binary_array_insert(container, data);
  683|    828|}
container_binary_array.c:netsnmp_binary_array_insert:
  520|    828|{
  521|    828|    binary_array_table *t = (binary_array_table*)c->container_data;
  522|    828|    const int duplicates_allowed = c->flags & CONTAINER_KEY_ALLOW_DUPLICATES;
  ------------------
  |  |  370|    828|#define CONTAINER_KEY_ALLOW_DUPLICATES             0x00000001
  ------------------
  523|    828|    const int sorted = !(c->flags & CONTAINER_KEY_UNSORTED);
  ------------------
  |  |  371|    828|#define CONTAINER_KEY_UNSORTED                     0x00000002
  ------------------
  524|    828|    int             i = -2;
  525|    828|    size_t          next, pos;
  526|    828|    void           *entry = NETSNMP_REMOVE_CONST(void *, const_entry);
  ------------------
  |  |   91|    828|    (__extension__ ({ const t tmp = (e); (t)(size_t)tmp; }))
  ------------------
  527|       |
  528|    828|    if (NULL == entry)
  ------------------
  |  Branch (528:9): [True: 0, False: 828]
  ------------------
  529|      0|        return -1;
  530|       |
  531|       |    /*
  532|       |     * check key if we have at least 1 item and duplicates aren't allowed
  533|       |     */
  534|    828|    if (!duplicates_allowed && t->count) {
  ------------------
  |  Branch (534:9): [True: 828, False: 0]
  |  Branch (534:32): [True: 759, False: 69]
  ------------------
  535|    759|        i = binary_search(entry, c, 1, &next);
  536|    759|        if (i >= 0) {
  ------------------
  |  Branch (536:13): [True: 0, False: 759]
  ------------------
  537|      0|            DEBUGMSGTL(("container","not inserting duplicate key\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  538|      0|            return -1;
  539|      0|        }
  540|    759|    }
  541|       | 
  542|       |    /*
  543|       |     * if unsorted, just add at the end
  544|       |     */
  545|    828|    if (!sorted) {
  ------------------
  |  Branch (545:9): [True: 0, False: 828]
  ------------------
  546|      0|        pos = t->count;
  547|    828|    } else {
  548|       |        /** if we haven't searched for key yet, do it now */
  549|    828|        if (-2 == i) {
  ------------------
  |  Branch (549:13): [True: 69, False: 759]
  ------------------
  550|     69|            if (0 == t->count) {
  ------------------
  |  Branch (550:17): [True: 69, False: 0]
  ------------------
  551|     69|                next = 0;
  552|     69|                i = -1;
  553|     69|            } else {
  554|      0|                i = binary_search(entry, c, 1, &next);
  555|      0|            }
  556|     69|        }
  557|       |
  558|    828|        pos = next;
  559|       |        /* if key found, advance past any duplicates */
  560|    828|        if (duplicates_allowed && i >= 0)
  ------------------
  |  Branch (560:13): [True: 0, False: 828]
  |  Branch (560:35): [True: 0, False: 0]
  ------------------
  561|      0|            while (pos < t->count && c->compare(t->data[pos], entry) == 0)
  ------------------
  |  Branch (561:20): [True: 0, False: 0]
  |  Branch (561:38): [True: 0, False: 0]
  ------------------
  562|      0|                ++pos;
  563|    828|    }
  564|       |
  565|    828|    return netsnmp_binary_array_insert_before(c, pos, entry, !sorted);
  566|    828|}
container_binary_array.c:netsnmp_binary_array_insert_before:
  475|    828|{
  476|    828|    binary_array_table *t = (binary_array_table*)c->container_data;
  477|       |
  478|    828|    if (NULL == entry)
  ------------------
  |  Branch (478:9): [True: 0, False: 828]
  ------------------
  479|      0|        return -1;
  480|       |
  481|    828|    if (index > t->count) {
  ------------------
  |  Branch (481:9): [True: 0, False: 828]
  ------------------
  482|      0|        DEBUGMSGTL(("container:insert:before", "index out of range\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  483|      0|        return -1;
  484|      0|    }
  485|       |
  486|       |     /*
  487|       |      * check if we need to resize the array
  488|       |      */
  489|    828|    _ba_resize_check(t);
  490|       |
  491|    828|    netsnmp_assert(t->count < t->max_size);
  ------------------
  |  |   47|    828|#      define netsnmp_assert(x)  do { \
  |  |   48|    828|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 828, False: 0]
  |  |  ------------------
  |  |   49|    828|                 ; \
  |  |   50|    828|              else \
  |  |   51|    828|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|    828|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 828]
  |  |  ------------------
  ------------------
  492|       |
  493|       |    /*
  494|       |     * shift array
  495|       |     */
  496|    828|    memmove(&t->data[index+1], &t->data[index],
  497|    828|            sizeof(void*) * (t->count - index));
  498|       |
  499|       |    /*
  500|       |     * Insert the new entry into the data array
  501|       |     */
  502|    828|    t->data[index] = NETSNMP_REMOVE_CONST(void *, entry);
  ------------------
  |  |   91|    828|    (__extension__ ({ const t tmp = (e); (t)(size_t)tmp; }))
  ------------------
  503|    828|    ++t->count;
  504|       |
  505|    828|    netsnmp_assert(index < t->count);
  ------------------
  |  |   47|    828|#      define netsnmp_assert(x)  do { \
  |  |   48|    828|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 828, False: 0]
  |  |  ------------------
  |  |   49|    828|                 ; \
  |  |   50|    828|              else \
  |  |   51|    828|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|    828|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 828]
  |  |  ------------------
  ------------------
  506|    828|    netsnmp_assert(t->count <= t->max_size);
  ------------------
  |  |   47|    828|#      define netsnmp_assert(x)  do { \
  |  |   48|    828|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 828, False: 0]
  |  |  ------------------
  |  |   49|    828|                 ; \
  |  |   50|    828|              else \
  |  |   51|    828|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|    828|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 828]
  |  |  ------------------
  ------------------
  507|       |
  508|    828|    if (dirty)
  ------------------
  |  Branch (508:9): [True: 0, False: 828]
  ------------------
  509|      0|        t->dirty = 1;
  510|       |
  511|    828|    netsnmp_assert(t->dirty || _ba_is_sorted(c));
  ------------------
  |  |   47|    828|#      define netsnmp_assert(x)  do { \
  |  |   48|  2.48k|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 0, False: 828]
  |  |  |  Branch (48:20): [True: 828, False: 0]
  |  |  ------------------
  |  |   49|    828|                 ; \
  |  |   50|    828|              else \
  |  |   51|    828|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|    828|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 828]
  |  |  ------------------
  ------------------
  512|       |
  513|    828|    ++c->sync;
  514|       |
  515|    828|    return 0;
  516|    828|}
container_binary_array.c:_ba_resize_check:
  446|    828|{
  447|    828|    size_t new_max;
  448|    828|    void ** new_data;
  449|    828|    if (t->max_size > t->count)
  ------------------
  |  Branch (449:9): [True: 690, False: 138]
  ------------------
  450|    690|        return 0; /* resize not needed */
  451|       |
  452|       |    /*
  453|       |     * Table is full, so extend it to double the size, or use 10 elements
  454|       |     * if it is empty.
  455|       |     */
  456|    138|    new_max = t->max_size > 0 ? 2 * t->max_size : 10;
  ------------------
  |  Branch (456:15): [True: 69, False: 69]
  ------------------
  457|    138|    new_data = (void**) realloc(t->data, new_max * sizeof(void*));
  458|    138|    if (new_data == NULL) {
  ------------------
  |  Branch (458:9): [True: 0, False: 138]
  ------------------
  459|      0|        snmp_log(LOG_ERR, "malloc failed in _ba_resize_check\n");
  460|      0|        return -1; /* error */
  461|      0|    }
  462|       |
  463|    138|    memset(new_data + t->max_size, 0x0,
  464|    138|           (new_max - t->max_size) * sizeof(void*));
  465|       |
  466|    138|    t->data = new_data;
  467|    138|    t->max_size = new_max;
  468|       |
  469|    138|    return 1; /* resized */
  470|    138|}
container_binary_array.c:_ba_find:
  669|  2.07k|{
  670|  2.07k|    return netsnmp_binary_array_get(container, data, 1);
  671|  2.07k|}
container_binary_array.c:netsnmp_binary_array_get:
  255|  2.07k|{
  256|  2.07k|    binary_array_table *t = (binary_array_table*)c->container_data;
  257|  2.07k|    int             index = 0;
  258|       |
  259|       |    /*
  260|       |     * if there is no data, return NULL;
  261|       |     */
  262|  2.07k|    if (!t->count)
  ------------------
  |  Branch (262:9): [True: 69, False: 2.00k]
  ------------------
  263|     69|        return NULL;
  264|       |
  265|       |    /*
  266|       |     * if the table is dirty, sort it.
  267|       |     */
  268|  2.00k|    if (t->dirty)
  ------------------
  |  Branch (268:9): [True: 0, False: 2.00k]
  ------------------
  269|      0|        Sort_Array(c);
  270|       |
  271|       |    /*
  272|       |     * if there is a key, search. Otherwise default is 0;
  273|       |     */
  274|  2.00k|    if (key) {
  ------------------
  |  Branch (274:9): [True: 2.00k, False: 0]
  ------------------
  275|  2.00k|        if ((index = binary_search(key, c, exact, NULL)) == -1)
  ------------------
  |  Branch (275:13): [True: 1.17k, False: 828]
  ------------------
  276|  1.17k|            return NULL;
  277|    828|        if (!exact &&
  ------------------
  |  Branch (277:13): [True: 0, False: 828]
  ------------------
  278|      0|            c->flags & CONTAINER_KEY_ALLOW_DUPLICATES) {
  ------------------
  |  |  370|      0|#define CONTAINER_KEY_ALLOW_DUPLICATES             0x00000001
  ------------------
  |  Branch (278:13): [True: 0, False: 0]
  ------------------
  279|      0|            int result;
  280|       |
  281|       |            /*
  282|       |             * If duplicates are allowed, we have to be extra
  283|       |             * sure that we didn't just increment to a duplicate,
  284|       |             * thus causing a getnext loop.
  285|       |             */
  286|      0|            result = c->compare(t->data[index], key);
  287|      0|            while (result == 0) {
  ------------------
  |  Branch (287:20): [True: 0, False: 0]
  ------------------
  288|      0|		DEBUGMSGTL(("container","skipping duplicate key in %s\n",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  289|      0|					    c->container_name));
  290|      0|                if (++index == t->count)
  ------------------
  |  Branch (290:21): [True: 0, False: 0]
  ------------------
  291|      0|                   return NULL;
  292|      0|                result = c->compare(t->data[index], key);
  293|      0|            }
  294|      0|        }
  295|    828|    }
  296|       |
  297|    828|    return t->data[index];
  298|  2.00k|}
container_binary_array.c:_ba_for_each:
  714|     69|{
  715|     69|    netsnmp_binary_array_for_each(container, f, context, 1);
  716|     69|}
container_binary_array.c:netsnmp_binary_array_for_each:
  414|     69|{
  415|     69|    binary_array_table *t = (binary_array_table*)c->container_data;
  416|     69|    size_t             i;
  417|       |
  418|     69|    if (sort && t->dirty)
  ------------------
  |  Branch (418:9): [True: 69, False: 0]
  |  Branch (418:17): [True: 0, False: 69]
  ------------------
  419|      0|        Sort_Array(c);
  420|       |
  421|    897|    for (i = 0; i < t->count; ++i)
  ------------------
  |  Branch (421:17): [True: 828, False: 69]
  ------------------
  422|    828|        (*fe) (t->data[i], context);
  423|     69|}
container_binary_array.c:_ba_clear:
  721|    345|{
  722|    345|    netsnmp_binary_array_clear(container, f, context);
  723|    345|}
container_binary_array.c:netsnmp_binary_array_clear:
  429|    345|{
  430|    345|    binary_array_table *t = (binary_array_table*)c->container_data;
  431|       |
  432|    345|    if( NULL != fe ) {
  ------------------
  |  Branch (432:9): [True: 138, False: 207]
  ------------------
  433|    138|        size_t             i;
  434|       |
  435|    138|        for (i = 0; i < t->count; ++i)
  ------------------
  |  Branch (435:21): [True: 0, False: 138]
  ------------------
  436|      0|            (*fe) (t->data[i], context);
  437|    138|    }
  438|       |
  439|    345|    t->count = 0;
  440|    345|    t->dirty = 0;
  441|    345|    ++c->sync;
  442|    345|}
container_binary_array.c:_ba_options:
  749|    276|{
  750|    276|    return netsnmp_binary_array_options_set(c, set, flags);
  751|    276|}
container_binary_array.c:_ba_iterator_get:
 1008|      1|{
 1009|      1|    binary_array_iterator* it;
 1010|       |
 1011|      1|    if(NULL == c)
  ------------------
  |  Branch (1011:8): [True: 0, False: 1]
  ------------------
 1012|      0|        return NULL;
 1013|       |
 1014|      1|    it = SNMP_MALLOC_TYPEDEF(binary_array_iterator);
  ------------------
  |  |   73|      1|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
 1015|      1|    if(NULL == it)
  ------------------
  |  Branch (1015:8): [True: 0, False: 1]
  ------------------
 1016|      0|        return NULL;
 1017|       |
 1018|      1|    it->base.container = c;
 1019|       |    
 1020|      1|    it->base.first = _ba_iterator_first;
 1021|      1|    it->base.next = _ba_iterator_next;
 1022|      1|    it->base.curr = _ba_iterator_curr;
 1023|      1|    it->base.last = _ba_iterator_last;
 1024|      1|    it->base.remove = _ba_iterator_remove;
 1025|      1|    it->base.reset = _ba_iterator_reset;
 1026|      1|    it->base.release = _ba_iterator_release;
 1027|       |
 1028|      1|    (void)_ba_iterator_reset(&it->base);
 1029|       |
 1030|      1|    return &it->base;
 1031|      1|}
container_binary_array.c:_ba_iterator_first:
  919|      1|{
  920|      1|    binary_array_iterator *it = (void *)nit;
  921|       |
  922|      1|    return _ba_iterator_position(it, 0);
  923|      1|}
container_binary_array.c:_ba_iterator_position:
  882|      1|{
  883|      1|    binary_array_table *t = _ba_it2cont(it);
  884|      1|    if (NULL == t)
  ------------------
  |  Branch (884:9): [True: 0, False: 1]
  ------------------
  885|      0|        return t; /* msg already logged */
  886|       |
  887|      1|    if(it->base.container->sync != it->base.sync) {
  ------------------
  |  Branch (887:8): [True: 0, False: 1]
  ------------------
  888|      0|        DEBUGMSGTL(("container:iterator", "out of sync\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  889|      0|        return NULL;
  890|      0|    }
  891|       |    
  892|      1|    if(0 == t->count) {
  ------------------
  |  Branch (892:8): [True: 1, False: 0]
  ------------------
  893|      1|        DEBUGMSGTL(("container:iterator", "empty\n"));
  ------------------
  |  |   66|      1|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 1]
  |  |  ------------------
  ------------------
  894|      1|        return NULL;
  895|      1|    }
  896|      0|    else if(pos >= t->count) {
  ------------------
  |  Branch (896:13): [True: 0, False: 0]
  ------------------
  897|      0|        DEBUGMSGTL(("container:iterator", "end of container\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  898|      0|        return NULL;
  899|      0|    }
  900|       |
  901|      0|    return t->data[ pos ];
  902|      1|}
container_binary_array.c:_ba_it2cont:
  863|      2|{
  864|      2|    if(NULL == it) {
  ------------------
  |  Branch (864:8): [True: 0, False: 2]
  ------------------
  865|      0|        netsnmp_assert(NULL != it);
  ------------------
  |  |   47|      0|#      define netsnmp_assert(x)  do { \
  |  |   48|      0|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 0, False: 0]
  |  |  ------------------
  |  |   49|      0|                 ; \
  |  |   50|      0|              else \
  |  |   51|      0|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
  866|      0|        return NULL;
  867|      0|    }
  868|      2|    if(NULL == it->base.container) {
  ------------------
  |  Branch (868:8): [True: 0, False: 2]
  ------------------
  869|      0|        netsnmp_assert(NULL != it->base.container);
  ------------------
  |  |   47|      0|#      define netsnmp_assert(x)  do { \
  |  |   48|      0|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 0, False: 0]
  |  |  ------------------
  |  |   49|      0|                 ; \
  |  |   50|      0|              else \
  |  |   51|      0|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
  870|      0|        return NULL;
  871|      0|    }
  872|      2|    if(NULL == it->base.container->container_data) {
  ------------------
  |  Branch (872:8): [True: 0, False: 2]
  ------------------
  873|      0|        netsnmp_assert(NULL != it->base.container->container_data);
  ------------------
  |  |   47|      0|#      define netsnmp_assert(x)  do { \
  |  |   48|      0|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 0, False: 0]
  |  |  ------------------
  |  |   49|      0|                 ; \
  |  |   50|      0|              else \
  |  |   51|      0|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
  874|      0|        return NULL;
  875|      0|    }
  876|       |
  877|      2|    return (binary_array_table*)(it->base.container->container_data);
  878|      2|}
container_binary_array.c:_ba_iterator_reset:
  976|      1|{
  977|      1|    binary_array_iterator *it = (void *)nit;
  978|      1|    binary_array_table* t = _ba_it2cont(it);
  979|      1|    if(NULL == t) {
  ------------------
  |  Branch (979:8): [True: 0, False: 1]
  ------------------
  980|      0|        netsnmp_assert(NULL != t);
  ------------------
  |  |   47|      0|#      define netsnmp_assert(x)  do { \
  |  |   48|      0|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 0, False: 0]
  |  |  ------------------
  |  |   49|      0|                 ; \
  |  |   50|      0|              else \
  |  |   51|      0|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
  981|      0|        return -1;
  982|      0|    }
  983|       |
  984|      1|    if (t->dirty)
  ------------------
  |  Branch (984:9): [True: 0, False: 1]
  ------------------
  985|      0|        Sort_Array(it->base.container);
  986|       |
  987|       |    /*
  988|       |     * save sync count, to make sure container doesn't change while
  989|       |     * iterator is in use.
  990|       |     */
  991|      1|    it->base.sync = it->base.container->sync;
  992|       |
  993|      1|    it->pos = 0;
  994|       |
  995|      1|    return 0;
  996|      1|}
container_binary_array.c:_ba_iterator_release:
 1000|      1|{
 1001|      1|    free(it);
 1002|       |
 1003|      1|    return 0;
 1004|      1|}

netsnmp_container_get_usll:
  386|     69|{
  387|       |    /*
  388|       |     * allocate memory
  389|       |     */
  390|     69|    sl_container *sl = (sl_container *)netsnmp_container_get_ssll();
  391|     69|    if (NULL==sl)
  ------------------
  |  Branch (391:9): [True: 0, False: 69]
  ------------------
  392|      0|        return NULL; /* msg already logged */
  393|       |
  394|     69|    sl->unsorted = 1;
  395|       |
  396|     69|    return (netsnmp_container*)sl;
  397|     69|}
netsnmp_container_get_singly_linked_list:
  401|     69|{
  402|     69|    sl_container *sl = (sl_container *)netsnmp_container_get_usll();
  403|     69|    if (NULL == sl)
  ------------------
  |  Branch (403:9): [True: 0, False: 69]
  ------------------
  404|      0|        return NULL; /* error already logged */
  405|       |
  406|     69|    sl->fifo = fifo;
  407|       |
  408|     69|    return (netsnmp_container *)sl;
  409|     69|}
netsnmp_container_get_fifo:
  413|     69|{
  414|     69|    return netsnmp_container_get_singly_linked_list(1);
  415|     69|}
netsnmp_container_ssll_init:
  419|     69|{
  420|     69|    static netsnmp_factory ssll = {
  421|     69|        "sorted_singly_linked_list",
  422|     69|        netsnmp_container_get_ssll
  423|     69|    };
  424|     69|    static netsnmp_factory usll = {
  425|     69|        "unsorted_singly_linked_list-lifo",
  426|     69|        netsnmp_container_get_usll
  427|     69|    };
  428|     69|    static netsnmp_factory fifo = {
  429|     69|        "unsorted_singly_linked_list-fifo",
  430|     69|        netsnmp_container_get_fifo
  431|     69|    };
  432|       |
  433|     69|    netsnmp_container_register("sorted_singly_linked_list", &ssll);
  434|     69|    netsnmp_container_register("unsorted_singly_linked_list", &usll);
  435|     69|    netsnmp_container_register("lifo", &usll);
  436|     69|    netsnmp_container_register("fifo", &fifo);
  437|     69|}
container_list_ssll.c:netsnmp_container_get_ssll:
  361|     69|{
  362|       |    /*
  363|       |     * allocate memory
  364|       |     */
  365|     69|    sl_container *sl = SNMP_MALLOC_TYPEDEF(sl_container);
  ------------------
  |  |   73|     69|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
  366|     69|    if (NULL==sl) {
  ------------------
  |  Branch (366:9): [True: 0, False: 69]
  ------------------
  367|      0|        snmp_log(LOG_ERR, "couldn't allocate memory\n");
  368|      0|        return NULL;
  369|      0|    }
  370|       |
  371|     69|    netsnmp_init_container((netsnmp_container *)sl, NULL, _ssll_free,
  372|     69|                           _ssll_size, NULL, _ssll_insert, _ssll_remove,
  373|     69|                           _ssll_find);
  374|     69|    sl->c.find_next = _ssll_find_next;
  375|     69|    sl->c.get_subset = NULL;
  376|     69|    sl->c.get_iterator =_ssll_iterator_get;
  377|     69|    sl->c.for_each = _ssll_for_each;
  378|     69|    sl->c.clear = _ssll_clear;
  379|     69|    sl->c.duplicate = _ssll_duplicate;
  380|       |
  381|     69|    return &sl->c;
  382|     69|}
container_list_ssll.c:_ssll_free:
  110|     69|{
  111|     69|    if(c) {
  ------------------
  |  Branch (111:8): [True: 69, False: 0]
  ------------------
  112|     69|        free(c);
  113|     69|    }
  114|     69|    return 0;
  115|     69|}
container_list_ssll.c:_ssll_clear:
  287|     69|{
  288|     69|    sl_container *sl = (sl_container*)c;
  289|     69|    sl_node  *curr, *next;
  290|       |    
  291|     69|    if(NULL == c)
  ------------------
  |  Branch (291:8): [True: 0, False: 69]
  ------------------
  292|      0|        return;
  293|       |    
  294|     69|    for(curr = sl->head; curr; curr = next) {
  ------------------
  |  Branch (294:26): [True: 0, False: 69]
  ------------------
  295|       |
  296|      0|        next = curr->next;
  297|       |
  298|      0|        if( NULL != f ) {
  ------------------
  |  Branch (298:13): [True: 0, False: 0]
  ------------------
  299|      0|            curr->next = NULL;
  300|      0|            (*f) ((void *)curr->data, context);
  301|      0|        }
  302|       |
  303|       |        /*
  304|       |         * free our node structure, but not the data
  305|       |         */
  306|      0|        free(curr);
  307|      0|    }
  308|       |    sl->head = NULL;
  309|     69|    sl->count = 0;
  310|     69|    ++c->sync;
  311|     69|}

netsnmp_container_get_null_factory:
  173|     69|{
  174|     69|    static netsnmp_factory f = { "null",
  175|     69|                                 netsnmp_container_get_null};
  176|       |    
  177|     69|    DEBUGMSGTL(("container:null:get_null_factory","in\n"));
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
  178|     69|    return &f;
  179|     69|}
netsnmp_container_null_init:
  183|     69|{
  184|     69|    netsnmp_container_register("null",
  185|     69|                               netsnmp_container_get_null_factory());
  186|     69|}

netsnmp_free_all_list_data:
   49|    207|{
   50|    207|    netsnmp_data_list *tmpptr;
   51|    207|    for (; head;) {
  ------------------
  |  Branch (51:12): [True: 0, False: 207]
  ------------------
   52|      0|        netsnmp_free_list_data(head);
   53|      0|        tmpptr = head;
   54|      0|        head = head->next;
   55|       |        SNMP_FREE(tmpptr);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
   56|      0|    }
   57|    207|}
shutdown_data_list:
  395|     69|{
  396|     69|    netsnmp_free_all_list_data(saveHead);
  397|     69|}

netsnmp_ds_set_boolean:
  201|    345|{
  202|    345|    if (storeid < 0 || storeid >= NETSNMP_DS_MAX_IDS || 
  ------------------
  |  |   38|    690|#define NETSNMP_DS_MAX_IDS 3
  ------------------
  |  Branch (202:9): [True: 0, False: 345]
  |  Branch (202:24): [True: 0, False: 345]
  ------------------
  203|    345|	which   < 0 || which   >= NETSNMP_DS_MAX_SUBIDS) {
  ------------------
  |  |   39|    345|#define NETSNMP_DS_MAX_SUBIDS 64        /* needs to be a multiple of 8 */
  ------------------
  |  Branch (203:2): [True: 0, False: 345]
  |  Branch (203:17): [True: 0, False: 345]
  ------------------
  204|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  205|      0|    }
  206|       |
  207|    345|    DEBUGMSGTL(("netsnmp_ds_set_boolean", "Setting %s:%d = %d/%s\n",
  ------------------
  |  |   66|    345|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    345|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 345]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 345]
  |  |  ------------------
  ------------------
  208|    345|                stores[storeid], which, value, ((value) ? "True" : "False")));
  209|       |
  210|    345|    if (value > 0) {
  ------------------
  |  Branch (210:9): [True: 345, False: 0]
  ------------------
  211|    345|        netsnmp_ds_booleans[storeid][which/8] |= (1 << (which % 8));
  212|    345|    } else {
  213|      0|        netsnmp_ds_booleans[storeid][which/8] &= (0xff7f >> (7 - (which % 8)));
  214|      0|    }
  215|       |
  216|    345|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|    345|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  217|    345|}
netsnmp_ds_get_boolean:
  242|  7.42k|{
  243|  7.42k|    if (storeid < 0 || storeid >= NETSNMP_DS_MAX_IDS || 
  ------------------
  |  |   38|  14.8k|#define NETSNMP_DS_MAX_IDS 3
  ------------------
  |  Branch (243:9): [True: 0, False: 7.42k]
  |  Branch (243:24): [True: 0, False: 7.42k]
  ------------------
  244|  7.42k|	which   < 0 || which   >= NETSNMP_DS_MAX_SUBIDS) {
  ------------------
  |  |   39|  7.42k|#define NETSNMP_DS_MAX_SUBIDS 64        /* needs to be a multiple of 8 */
  ------------------
  |  Branch (244:2): [True: 0, False: 7.42k]
  |  Branch (244:17): [True: 0, False: 7.42k]
  ------------------
  245|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  246|      0|    }
  247|       |
  248|  7.42k|    return (netsnmp_ds_booleans[storeid][which/8] & (1 << (which % 8))) ? 1:0;
  ------------------
  |  Branch (248:12): [True: 3.79k, False: 3.62k]
  ------------------
  249|  7.42k|}
netsnmp_ds_set_int:
  253|    138|{
  254|    138|    if (storeid < 0 || storeid >= NETSNMP_DS_MAX_IDS || 
  ------------------
  |  |   38|    276|#define NETSNMP_DS_MAX_IDS 3
  ------------------
  |  Branch (254:9): [True: 0, False: 138]
  |  Branch (254:24): [True: 0, False: 138]
  ------------------
  255|    138|	which   < 0 || which   >= NETSNMP_DS_MAX_SUBIDS) {
  ------------------
  |  |   39|    138|#define NETSNMP_DS_MAX_SUBIDS 64        /* needs to be a multiple of 8 */
  ------------------
  |  Branch (255:2): [True: 0, False: 138]
  |  Branch (255:17): [True: 0, False: 138]
  ------------------
  256|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  257|      0|    }
  258|       |
  259|    138|    DEBUGMSGTL(("netsnmp_ds_set_int", "Setting %s:%d = %d\n",
  ------------------
  |  |   66|    138|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    138|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 138]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 138]
  |  |  ------------------
  ------------------
  260|    138|                stores[storeid], which, value));
  261|       |
  262|    138|    netsnmp_ds_integers[storeid][which] = value;
  263|    138|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|    138|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  264|    138|}
netsnmp_ds_get_int:
  268|    624|{
  269|    624|    if (storeid < 0 || storeid >= NETSNMP_DS_MAX_IDS || 
  ------------------
  |  |   38|  1.24k|#define NETSNMP_DS_MAX_IDS 3
  ------------------
  |  Branch (269:9): [True: 0, False: 624]
  |  Branch (269:24): [True: 0, False: 624]
  ------------------
  270|    624|	which   < 0 || which   >= NETSNMP_DS_MAX_SUBIDS) {
  ------------------
  |  |   39|    624|#define NETSNMP_DS_MAX_SUBIDS 64        /* needs to be a multiple of 8 */
  ------------------
  |  Branch (270:2): [True: 0, False: 624]
  |  Branch (270:17): [True: 0, False: 624]
  ------------------
  271|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  272|      0|    }
  273|       |
  274|    624|    return netsnmp_ds_integers[storeid][which];
  275|    624|}
netsnmp_ds_set_string:
  279|    277|{
  280|    277|    if (storeid < 0 || storeid >= NETSNMP_DS_MAX_IDS || 
  ------------------
  |  |   38|    554|#define NETSNMP_DS_MAX_IDS 3
  ------------------
  |  Branch (280:9): [True: 0, False: 277]
  |  Branch (280:24): [True: 0, False: 277]
  ------------------
  281|    277|	which   < 0 || which   >= NETSNMP_DS_MAX_SUBIDS) {
  ------------------
  |  |   39|    277|#define NETSNMP_DS_MAX_SUBIDS 64        /* needs to be a multiple of 8 */
  ------------------
  |  Branch (281:2): [True: 0, False: 277]
  |  Branch (281:17): [True: 0, False: 277]
  ------------------
  282|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  283|      0|    }
  284|       |
  285|    277|    DEBUGMSGTL(("netsnmp_ds_set_string", "Setting %s:%d = \"%s\"\n",
  ------------------
  |  |   66|    277|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    277|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 277]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 277]
  |  |  ------------------
  ------------------
  286|    277|                stores[storeid], which, (value ? value : "(null)")));
  287|       |
  288|       |    /*
  289|       |     * is some silly person is calling us with our own pointer?
  290|       |     */
  291|    277|    if (netsnmp_ds_strings[storeid][which] == value)
  ------------------
  |  Branch (291:9): [True: 69, False: 208]
  ------------------
  292|     69|        return SNMPERR_SUCCESS;
  ------------------
  |  |  217|     69|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  293|       |
  294|    208|    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   79|    208|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded, False: 208]
  |  |  ------------------
  ------------------
  295|    208|    if (netsnmp_ds_strings[storeid][which] != NULL) {
  ------------------
  |  Branch (295:9): [True: 0, False: 208]
  ------------------
  296|      0|        free(netsnmp_ds_strings[storeid][which]);
  297|      0|	netsnmp_ds_strings[storeid][which] = NULL;
  298|      0|    }
  299|    208|    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   80|    208|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded, False: 208]
  |  |  ------------------
  ------------------
  300|       |
  301|    208|    if (value) {
  ------------------
  |  Branch (301:9): [True: 208, False: 0]
  ------------------
  302|    208|        netsnmp_ds_strings[storeid][which] = strdup(value);
  303|    208|    } else {
  304|      0|        netsnmp_ds_strings[storeid][which] = NULL;
  305|      0|    }
  306|       |
  307|    208|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|    208|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  308|    277|}
netsnmp_ds_get_string:
  312|  1.45k|{
  313|  1.45k|    if (storeid < 0 || storeid >= NETSNMP_DS_MAX_IDS || 
  ------------------
  |  |   38|  2.91k|#define NETSNMP_DS_MAX_IDS 3
  ------------------
  |  Branch (313:9): [True: 0, False: 1.45k]
  |  Branch (313:24): [True: 0, False: 1.45k]
  ------------------
  314|  1.45k|	which   < 0 || which   >= NETSNMP_DS_MAX_SUBIDS) {
  ------------------
  |  |   39|  1.45k|#define NETSNMP_DS_MAX_SUBIDS 64        /* needs to be a multiple of 8 */
  ------------------
  |  Branch (314:2): [True: 0, False: 1.45k]
  |  Branch (314:17): [True: 0, False: 1.45k]
  ------------------
  315|      0|        return NULL;
  316|      0|    }
  317|       |
  318|  1.45k|    return netsnmp_ds_strings[storeid][which];
  319|  1.45k|}
netsnmp_ds_register_config:
  447|  2.96k|{
  448|  2.96k|    netsnmp_ds_read_config *drsp;
  449|       |
  450|  2.96k|    if (storeid < 0 || storeid >= NETSNMP_DS_MAX_IDS    || 
  ------------------
  |  |   38|  5.93k|#define NETSNMP_DS_MAX_IDS 3
  ------------------
  |  Branch (450:9): [True: 0, False: 2.96k]
  |  Branch (450:24): [True: 0, False: 2.96k]
  ------------------
  451|  2.96k|	which   < 0 || which   >= NETSNMP_DS_MAX_SUBIDS || token == NULL) {
  ------------------
  |  |   39|  5.93k|#define NETSNMP_DS_MAX_SUBIDS 64        /* needs to be a multiple of 8 */
  ------------------
  |  Branch (451:2): [True: 0, False: 2.96k]
  |  Branch (451:17): [True: 0, False: 2.96k]
  |  Branch (451:53): [True: 0, False: 2.96k]
  ------------------
  452|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  453|      0|    }
  454|       |
  455|  2.96k|    if (netsnmp_ds_configs == NULL) {
  ------------------
  |  Branch (455:9): [True: 69, False: 2.89k]
  ------------------
  456|     69|        netsnmp_ds_configs = SNMP_MALLOC_TYPEDEF(netsnmp_ds_read_config);
  ------------------
  |  |   73|     69|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
  457|     69|        if (netsnmp_ds_configs == NULL)
  ------------------
  |  Branch (457:13): [True: 0, False: 69]
  ------------------
  458|      0|            return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  459|     69|        drsp = netsnmp_ds_configs;
  460|  2.89k|    } else {
  461|   116k|        for (drsp = netsnmp_ds_configs; drsp->next != NULL; drsp = drsp->next);
  ------------------
  |  Branch (461:41): [True: 113k, False: 2.89k]
  ------------------
  462|  2.89k|        drsp->next = SNMP_MALLOC_TYPEDEF(netsnmp_ds_read_config);
  ------------------
  |  |   73|  2.89k|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
  463|  2.89k|        if (drsp->next == NULL)
  ------------------
  |  Branch (463:13): [True: 0, False: 2.89k]
  ------------------
  464|      0|            return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  465|  2.89k|        drsp = drsp->next;
  466|  2.89k|    }
  467|       |
  468|  2.96k|    drsp->type    = type;
  469|  2.96k|    drsp->ftype   = strdup(ftype);
  470|  2.96k|    drsp->token   = strdup(token);
  471|  2.96k|    drsp->storeid = storeid;
  472|  2.96k|    drsp->which   = which;
  473|       |
  474|  2.96k|    switch (type) {
  ------------------
  |  Branch (474:13): [True: 2.96k, False: 0]
  ------------------
  475|    897|    case ASN_BOOLEAN:
  ------------------
  |  |   72|    897|#define ASN_BOOLEAN	    0x01U
  ------------------
  |  Branch (475:5): [True: 897, False: 2.07k]
  ------------------
  476|    897|        register_config_handler(ftype, token, netsnmp_ds_handle_config, NULL,
  477|    897|                                "(1|yes|true|0|no|false)");
  478|    897|        break;
  479|       |
  480|    552|    case ASN_INTEGER:
  ------------------
  |  |   75|    552|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (480:5): [True: 552, False: 2.41k]
  ------------------
  481|    552|        register_config_handler(ftype, token, netsnmp_ds_handle_config, NULL,
  482|    552|                                "integerValue");
  483|    552|        break;
  484|       |
  485|  1.51k|    case ASN_OCTET_STR:
  ------------------
  |  |   78|  1.51k|#define ASN_OCTET_STR	    0x04U
  ------------------
  |  Branch (485:5): [True: 1.51k, False: 1.44k]
  ------------------
  486|  1.51k|        register_config_handler(ftype, token, netsnmp_ds_handle_config, NULL,
  487|  1.51k|                                "string");
  488|  1.51k|        break;
  489|       |
  490|  2.96k|    }
  491|  2.96k|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|  2.96k|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  492|  2.96k|}
netsnmp_ds_register_premib:
  497|  1.58k|{
  498|  1.58k|    netsnmp_ds_read_config *drsp;
  499|       |
  500|  1.58k|    if (storeid < 0 || storeid >= NETSNMP_DS_MAX_IDS    || 
  ------------------
  |  |   38|  3.17k|#define NETSNMP_DS_MAX_IDS 3
  ------------------
  |  Branch (500:9): [True: 0, False: 1.58k]
  |  Branch (500:24): [True: 0, False: 1.58k]
  ------------------
  501|  1.58k|	which   < 0 || which   >= NETSNMP_DS_MAX_SUBIDS || token == NULL) {
  ------------------
  |  |   39|  3.17k|#define NETSNMP_DS_MAX_SUBIDS 64        /* needs to be a multiple of 8 */
  ------------------
  |  Branch (501:2): [True: 0, False: 1.58k]
  |  Branch (501:17): [True: 0, False: 1.58k]
  |  Branch (501:53): [True: 0, False: 1.58k]
  ------------------
  502|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  503|      0|    }
  504|       |
  505|  1.58k|    if (netsnmp_ds_configs == NULL) {
  ------------------
  |  Branch (505:9): [True: 0, False: 1.58k]
  ------------------
  506|      0|        netsnmp_ds_configs = SNMP_MALLOC_TYPEDEF(netsnmp_ds_read_config);
  ------------------
  |  |   73|      0|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
  507|      0|        if (netsnmp_ds_configs == NULL)
  ------------------
  |  Branch (507:13): [True: 0, False: 0]
  ------------------
  508|      0|            return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  509|      0|        drsp = netsnmp_ds_configs;
  510|  1.58k|    } else {
  511|  31.1k|        for (drsp = netsnmp_ds_configs; drsp->next != NULL; drsp = drsp->next);
  ------------------
  |  Branch (511:41): [True: 29.5k, False: 1.58k]
  ------------------
  512|  1.58k|        drsp->next = SNMP_MALLOC_TYPEDEF(netsnmp_ds_read_config);
  ------------------
  |  |   73|  1.58k|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
  513|  1.58k|        if (drsp->next == NULL)
  ------------------
  |  Branch (513:13): [True: 0, False: 1.58k]
  ------------------
  514|      0|            return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  515|  1.58k|        drsp = drsp->next;
  516|  1.58k|    }
  517|       |
  518|  1.58k|    drsp->type    = type;
  519|  1.58k|    drsp->ftype   = strdup(ftype);
  520|  1.58k|    drsp->token   = strdup(token);
  521|  1.58k|    drsp->storeid = storeid;
  522|  1.58k|    drsp->which   = which;
  523|       |
  524|  1.58k|    switch (type) {
  ------------------
  |  Branch (524:13): [True: 1.58k, False: 0]
  ------------------
  525|  1.17k|    case ASN_BOOLEAN:
  ------------------
  |  |   72|  1.17k|#define ASN_BOOLEAN	    0x01U
  ------------------
  |  Branch (525:5): [True: 1.17k, False: 414]
  ------------------
  526|  1.17k|        register_prenetsnmp_mib_handler(ftype, token, netsnmp_ds_handle_config,
  527|  1.17k|                                        NULL, "(1|yes|true|0|no|false)");
  528|  1.17k|        break;
  529|       |
  530|    276|    case ASN_INTEGER:
  ------------------
  |  |   75|    276|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (530:5): [True: 276, False: 1.31k]
  ------------------
  531|    276|        register_prenetsnmp_mib_handler(ftype, token, netsnmp_ds_handle_config,
  532|    276|                                        NULL, "integerValue");
  533|    276|        break;
  534|       |
  535|    138|    case ASN_OCTET_STR:
  ------------------
  |  |   78|    138|#define ASN_OCTET_STR	    0x04U
  ------------------
  |  Branch (535:5): [True: 138, False: 1.44k]
  ------------------
  536|    138|        register_prenetsnmp_mib_handler(ftype, token, netsnmp_ds_handle_config,
  537|    138|                                        NULL, "string");
  538|    138|        break;
  539|       |
  540|  1.58k|    }
  541|  1.58k|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|  1.58k|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  542|  1.58k|}
netsnmp_ds_shutdown:
  546|     69|{
  547|     69|    netsnmp_ds_read_config *drsp;
  548|     69|    int             i, j;
  549|       |
  550|     69|    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   79|     69|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded, False: 69]
  |  |  ------------------
  ------------------
  551|  4.62k|    for (drsp = netsnmp_ds_configs; drsp; drsp = netsnmp_ds_configs) {
  ------------------
  |  Branch (551:37): [True: 4.55k, False: 69]
  ------------------
  552|  4.55k|        netsnmp_ds_configs = drsp->next;
  553|       |
  554|  4.55k|        if (drsp->ftype && drsp->token) {
  ------------------
  |  Branch (554:13): [True: 4.55k, False: 0]
  |  Branch (554:28): [True: 4.55k, False: 0]
  ------------------
  555|  4.55k|            unregister_config_handler(drsp->ftype, drsp->token);
  556|  4.55k|        }
  557|  4.55k|	if (drsp->ftype != NULL) {
  ------------------
  |  Branch (557:6): [True: 4.55k, False: 0]
  ------------------
  558|  4.55k|	    free(drsp->ftype);
  559|  4.55k|	}
  560|  4.55k|	if (drsp->token != NULL) {
  ------------------
  |  Branch (560:6): [True: 4.55k, False: 0]
  ------------------
  561|  4.55k|	    free(drsp->token);
  562|  4.55k|	}
  563|  4.55k|        free(drsp);
  564|  4.55k|    }
  565|       |
  566|    276|    for (i = 0; i < NETSNMP_DS_MAX_IDS; i++) {
  ------------------
  |  |   38|    276|#define NETSNMP_DS_MAX_IDS 3
  ------------------
  |  Branch (566:17): [True: 207, False: 69]
  ------------------
  567|  13.4k|        for (j = 0; j < NETSNMP_DS_MAX_SUBIDS; j++) {
  ------------------
  |  |   39|  13.4k|#define NETSNMP_DS_MAX_SUBIDS 64        /* needs to be a multiple of 8 */
  ------------------
  |  Branch (567:21): [True: 13.2k, False: 207]
  ------------------
  568|  13.2k|            if (netsnmp_ds_strings[i][j] != NULL) {
  ------------------
  |  Branch (568:17): [True: 208, False: 13.0k]
  ------------------
  569|    208|                free(netsnmp_ds_strings[i][j]);
  570|    208|                netsnmp_ds_strings[i][j] = NULL;
  571|    208|            }
  572|  13.2k|        }
  573|    207|    }
  574|     69|    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   80|     69|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded, False: 69]
  |  |  ------------------
  ------------------
  575|     69|}

netsnmp_large_fd_setfd:
  120|     68|{
  121|     68|    netsnmp_assert(fd >= 0);
  ------------------
  |  |   47|     68|#      define netsnmp_assert(x)  do { \
  |  |   48|     68|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 68, False: 0]
  |  |  ------------------
  |  |   49|     68|                 ; \
  |  |   50|     68|              else \
  |  |   51|     68|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|     68|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 68]
  |  |  ------------------
  ------------------
  122|       |
  123|     68|    while (fd >= (int)fdset->lfs_setsize)
  ------------------
  |  Branch (123:12): [True: 0, False: 68]
  ------------------
  124|      0|        netsnmp_large_fd_set_resize(fdset, 2 * (fdset->lfs_setsize + 1));
  125|       |
  126|     68|    LFD_SET(fd, fdset->lfs_setptr);
  127|     68|}
netsnmp_large_fd_clr:
  131|     68|{
  132|     68|    netsnmp_assert(fd >= 0);
  ------------------
  |  |   47|     68|#      define netsnmp_assert(x)  do { \
  |  |   48|     68|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 68, False: 0]
  |  |  ------------------
  |  |   49|     68|                 ; \
  |  |   50|     68|              else \
  |  |   51|     68|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|     68|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 68]
  |  |  ------------------
  ------------------
  133|       |
  134|     68|    if ((unsigned)fd < fdset->lfs_setsize)
  ------------------
  |  Branch (134:9): [True: 68, False: 0]
  ------------------
  135|     68|        LFD_CLR(fd, fdset->lfs_setptr);
  136|     68|}
netsnmp_large_fd_is_set:
  140|     68|{
  141|     68|    netsnmp_assert(fd >= 0);
  ------------------
  |  |   47|     68|#      define netsnmp_assert(x)  do { \
  |  |   48|     68|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 68, False: 0]
  |  |  ------------------
  |  |   49|     68|                 ; \
  |  |   50|     68|              else \
  |  |   51|     68|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|     68|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 68]
  |  |  ------------------
  ------------------
  142|       |
  143|     68|    return ((unsigned)fd < fdset->lfs_setsize &&
  ------------------
  |  Branch (143:13): [True: 68, False: 0]
  ------------------
  144|     68|            LFD_ISSET(fd, fdset->lfs_setptr));
  ------------------
  |  Branch (144:13): [True: 68, False: 0]
  ------------------
  145|     68|}
netsnmp_large_fd_set_init:
  151|    136|{
  152|    136|    fdset->lfs_setsize = 0;
  153|    136|    fdset->lfs_setptr  = NULL;
  154|       |#if !defined(cygwin) && defined(HAVE_WINSOCK_H)
  155|       |    fdset->lfs_set.fd_count = 0;
  156|       |#endif
  157|    136|    netsnmp_large_fd_set_resize(fdset, setsize);
  158|    136|}
netsnmp_large_fd_set_resize:
  192|    408|{
  193|    408|    int             fd_set_bytes;
  194|       |
  195|    408|    if (fdset->lfs_setsize == setsize)
  ------------------
  |  Branch (195:9): [True: 136, False: 272]
  ------------------
  196|    136|        goto success;
  197|       |
  198|    272|    if (setsize > FD_SETSIZE) {
  ------------------
  |  Branch (198:9): [True: 0, False: 272]
  ------------------
  199|      0|        fd_set_bytes = NETSNMP_FD_SET_BYTES(setsize);
  ------------------
  |  |   99|      0|    (sizeof(fd_set) + ((setsize) > FD_SETSIZE ?                          \
  |  |  ------------------
  |  |  |  Branch (99:24): [True: 0, False: 0]
  |  |  ------------------
  |  |  100|      0|                       NETSNMP_FD_SET_ELEM_COUNT((setsize) - FD_SETSIZE) \
  |  |  ------------------
  |  |  |  |   92|      0|    (setsize + NETSNMP_BITS_PER_FD_MASK - 1) / NETSNMP_BITS_PER_FD_MASK
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|      0|#define NETSNMP_BITS_PER_FD_MASK (8 * NETSNMP_FD_MASK_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   85|      0|#define NETSNMP_FD_MASK_SIZE sizeof(((fd_set*)0)->fds_bits[0])
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |                   (setsize + NETSNMP_BITS_PER_FD_MASK - 1) / NETSNMP_BITS_PER_FD_MASK
  |  |  |  |  ------------------
  |  |  |  |  |  |   88|      0|#define NETSNMP_BITS_PER_FD_MASK (8 * NETSNMP_FD_MASK_SIZE)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   85|      0|#define NETSNMP_FD_MASK_SIZE sizeof(((fd_set*)0)->fds_bits[0])
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  101|      0|                       * NETSNMP_FD_MASK_SIZE : 0))
  |  |  ------------------
  |  |  |  |   85|      0|#define NETSNMP_FD_MASK_SIZE sizeof(((fd_set*)0)->fds_bits[0])
  |  |  ------------------
  ------------------
  200|      0|        if (fdset->lfs_setsize > FD_SETSIZE) {
  ------------------
  |  Branch (200:13): [True: 0, False: 0]
  ------------------
  201|      0|            fdset->lfs_setptr = realloc(fdset->lfs_setptr, fd_set_bytes);
  202|      0|            if (!fdset->lfs_setptr)
  ------------------
  |  Branch (202:17): [True: 0, False: 0]
  ------------------
  203|      0|                goto out_of_mem;
  204|      0|        } else {
  205|      0|            fdset->lfs_setptr = malloc(fd_set_bytes);
  206|      0|            if (!fdset->lfs_setptr)
  ------------------
  |  Branch (206:17): [True: 0, False: 0]
  ------------------
  207|      0|                goto out_of_mem;
  208|      0|            *fdset->lfs_setptr = fdset->lfs_set;
  209|      0|        }
  210|    272|    } else {
  211|    272|        if (fdset->lfs_setsize > FD_SETSIZE) {
  ------------------
  |  Branch (211:13): [True: 0, False: 272]
  ------------------
  212|      0|            fdset->lfs_set = *fdset->lfs_setptr;
  213|      0|            free(fdset->lfs_setptr);
  214|      0|        }
  215|    272|        fdset->lfs_setptr = &fdset->lfs_set;
  216|    272|    }
  217|       |
  218|    272|#if defined(cygwin) || !defined(HAVE_WINSOCK_H)
  219|       |    /*
  220|       |     * Unix: when enlarging, clear the file descriptors defined in the
  221|       |     * resized *fdset but that were not defined in the original *fdset.
  222|       |     */
  223|    272|    if ( fdset->lfs_setsize == 0 && setsize == FD_SETSIZE ) {
  ------------------
  |  Branch (223:10): [True: 136, False: 136]
  |  Branch (223:37): [True: 136, False: 0]
  ------------------
  224|       |        /* In this case we can use the OS's FD_ZERO */
  225|    136|        FD_ZERO(fdset->lfs_setptr);
  ------------------
  |  Branch (225:9): [Folded, False: 136]
  ------------------
  226|    136|    } else {
  227|    136|        int             i;
  228|       |
  229|    136|        for (i = fdset->lfs_setsize; i < setsize; i++)
  ------------------
  |  Branch (229:38): [True: 0, False: 136]
  ------------------
  230|      0|            LFD_CLR(i, fdset->lfs_setptr);
  231|    136|    }
  232|    272|#endif
  233|       |
  234|    272|    fdset->lfs_setsize = setsize;
  235|       |#if !defined(cygwin) && defined(HAVE_WINSOCK_H)
  236|       |    if (setsize < fdset->lfs_setptr->fd_count)
  237|       |        fdset->lfs_setptr->fd_count = setsize;
  238|       |#endif
  239|    408|success:
  240|    408|    return 1;
  241|       |
  242|      0|out_of_mem:
  243|      0|    fdset->lfs_setsize = 0;
  244|       |#if !defined(cygwin) && defined(HAVE_WINSOCK_H)
  245|       |    fdset->lfs_setptr->fd_count = 0;
  246|       |#endif
  247|      0|    return 0;
  248|    272|}
netsnmp_large_fd_set_cleanup:
  252|    136|{
  253|    136|    netsnmp_large_fd_set_resize(fdset, 0);
  254|    136|    fdset->lfs_setsize = 0;
  255|       |    fdset->lfs_setptr  = NULL;
  256|    136|}
netsnmp_copy_fd_set_to_large_fd_set:
  261|    136|{
  262|       |    netsnmp_large_fd_set_resize(dst, FD_SETSIZE);
  263|    136|    *dst->lfs_setptr = *src;
  264|    136|}
netsnmp_copy_large_fd_set_to_fd_set:
  269|     68|{
  270|       |    /* Report failure if *src is larger than FD_SETSIZE. */
  271|     68|    if (src->lfs_setsize > FD_SETSIZE) {
  ------------------
  |  Branch (271:9): [True: 0, False: 68]
  ------------------
  272|      0|        FD_ZERO(dst);
  ------------------
  |  Branch (272:9): [Folded, False: 0]
  ------------------
  273|      0|        return -1;
  274|      0|    }
  275|       |
  276|     68|    *dst = *src->lfs_setptr;
  277|       |
  278|     68|#if !(!defined(cygwin) && defined(HAVE_WINSOCK_H))
  279|     68|    {
  280|     68|        int             i;
  281|       |
  282|       |        /* Unix: clear any file descriptors defined in *dst but not in *src. */
  283|     68|        for (i = src->lfs_setsize; i < FD_SETSIZE; ++i)
  ------------------
  |  Branch (283:36): [True: 0, False: 68]
  ------------------
  284|     68|            FD_CLR(i, dst);
  285|     68|    }
  286|     68|#endif
  287|       |
  288|     68|    return 0;
  289|     68|}
large_fd_set.c:LFD_SET:
   95|     68|{
   96|     68|    enum { nfdbits = 8 * sizeof(p->fds_bits[0]) };
   97|     68|    NETSNMP_FD_MASK_TYPE *fds_array = p->fds_bits;
  ------------------
  |  | 1693|     68|#define NETSNMP_FD_MASK_TYPE __fd_mask
  ------------------
   98|       |
   99|     68|    fds_array[n / nfdbits] |= (1ULL << (n % nfdbits));
  100|     68|}
large_fd_set.c:LFD_CLR:
  103|     68|{
  104|     68|    enum { nfdbits = 8 * sizeof(p->fds_bits[0]) };
  105|     68|    NETSNMP_FD_MASK_TYPE *fds_array = p->fds_bits;
  ------------------
  |  | 1693|     68|#define NETSNMP_FD_MASK_TYPE __fd_mask
  ------------------
  106|       |
  107|     68|    fds_array[n / nfdbits] &= ~(1ULL << (n % nfdbits));
  108|     68|}
large_fd_set.c:LFD_ISSET:
  111|     68|{
  112|     68|    enum { nfdbits = 8 * sizeof(p->fds_bits[0]) };
  113|     68|    const NETSNMP_FD_MASK_TYPE *fds_array = p->fds_bits;
  114|       |
  115|     68|    return (fds_array[n / nfdbits] & (1ULL << (n % nfdbits))) != 0;
  116|     68|}

get_enginetime:
   98|      6|{
   99|      6|    int             rval = SNMPERR_SUCCESS;
  ------------------
  |  |  217|      6|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  100|      6|    int             timediff = 0;
  101|      6|    Enginetime      e = NULL;
  102|       |
  103|       |
  104|       |
  105|       |    /*
  106|       |     * Sanity check.
  107|       |     */
  108|      6|    if (!engine_time || !engineboot) {
  ------------------
  |  Branch (108:9): [True: 0, False: 6]
  |  Branch (108:25): [True: 0, False: 6]
  ------------------
  109|      0|        QUITFUN(SNMPERR_GENERR, get_enginetime_quit);
  ------------------
  |  |  143|      0|	if ( (e) != SNMPERR_SUCCESS) {	\
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (143:7): [True: 0, Folded]
  |  |  ------------------
  |  |  144|      0|		rval = SNMPERR_GENERR;	\
  |  |  ------------------
  |  |  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  |  |  ------------------
  |  |  145|      0|		goto l ;		\
  |  |  146|      0|	}
  ------------------
  110|      0|    }
  111|       |
  112|       |
  113|       |    /*
  114|       |     * Compute estimated current engine_time tuple at engineID if
  115|       |     * a record is cached for it.
  116|       |     */
  117|      6|    *engine_time = *engineboot = 0;
  118|       |
  119|      6|    if (!engineID || (engineID_len <= 0)) {
  ------------------
  |  Branch (119:9): [True: 0, False: 6]
  |  Branch (119:22): [True: 0, False: 6]
  ------------------
  120|      0|        QUITFUN(SNMPERR_GENERR, get_enginetime_quit);
  ------------------
  |  |  143|      0|	if ( (e) != SNMPERR_SUCCESS) {	\
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (143:7): [True: 0, Folded]
  |  |  ------------------
  |  |  144|      0|		rval = SNMPERR_GENERR;	\
  |  |  ------------------
  |  |  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  |  |  ------------------
  |  |  145|      0|		goto l ;		\
  |  |  146|      0|	}
  ------------------
  121|      0|    }
  122|       |
  123|      6|    if (!(e = search_enginetime_list(engineID, engineID_len))) {
  ------------------
  |  Branch (123:9): [True: 2, False: 4]
  ------------------
  124|      2|        QUITFUN(SNMPERR_GENERR, get_enginetime_quit);
  ------------------
  |  |  143|      2|	if ( (e) != SNMPERR_SUCCESS) {	\
  |  |  ------------------
  |  |  |  |  217|      2|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (143:7): [True: 2, Folded]
  |  |  ------------------
  |  |  144|      2|		rval = SNMPERR_GENERR;	\
  |  |  ------------------
  |  |  |  |  218|      2|#define SNMPERR_GENERR			(-1)
  |  |  ------------------
  |  |  145|      2|		goto l ;		\
  |  |  146|      2|	}
  ------------------
  125|      0|    }
  126|      4|#ifdef LCD_TIME_SYNC_OPT
  127|      4|    if (!authenticated || e->authenticatedFlag) {
  ------------------
  |  Branch (127:9): [True: 4, False: 0]
  |  Branch (127:27): [True: 0, False: 0]
  ------------------
  128|      4|#endif
  129|      4|        *engine_time = e->engineTime;
  130|      4|        *engineboot = e->engineBoot;
  131|       |
  132|      4|       timediff = (int) (snmpv3_local_snmpEngineTime() - e->lastReceivedEngineTime);
  133|       |
  134|      4|#ifdef LCD_TIME_SYNC_OPT
  135|      4|    }
  136|      4|#endif
  137|       |
  138|      4|    if (timediff > (int) (ENGINETIME_MAX - *engine_time)) {
  ------------------
  |  |  182|      4|#define ENGINETIME_MAX	2147483647      /* ((2^31)-1) */
  ------------------
  |  Branch (138:9): [True: 0, False: 4]
  ------------------
  139|      0|        *engine_time = (timediff - (ENGINETIME_MAX - *engine_time));
  ------------------
  |  |  182|      0|#define ENGINETIME_MAX	2147483647      /* ((2^31)-1) */
  ------------------
  140|       |
  141|       |        /*
  142|       |         * FIX -- move this check up... should not change anything
  143|       |         * * if engineboot is already locked.  ???
  144|       |         */
  145|      0|        if (*engineboot < ENGINEBOOT_MAX) {
  ------------------
  |  |  183|      0|#define ENGINEBOOT_MAX	2147483647      /* ((2^31)-1) */
  ------------------
  |  Branch (145:13): [True: 0, False: 0]
  ------------------
  146|      0|            *engineboot += 1;
  147|      0|        }
  148|       |
  149|      4|    } else {
  150|      4|        *engine_time += timediff;
  151|      4|    }
  152|       |
  153|      4|    DEBUGMSGTL(("lcd_get_enginetime", "engineID "));
  ------------------
  |  |   66|      4|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 4]
  |  |  ------------------
  ------------------
  154|      4|    DEBUGMSGHEX(("lcd_get_enginetime", engineID, engineID_len));
  ------------------
  |  |   71|      4|#define DEBUGMSGHEX(x)     do {if (_DBG_IF_) {__DBGMSGHEX(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGHEX(x)     do {if (_DBG_IF_) {__DBGMSGHEX(x);} }while(0)
  |  |  ------------------
  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  ------------------
  |  |  |  Branch (71:71): [Folded, False: 4]
  |  |  ------------------
  ------------------
  155|      4|    DEBUGMSG(("lcd_get_enginetime", ": boots=%d, time=%d\n", *engineboot,
  ------------------
  |  |   61|      4|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 4]
  |  |  ------------------
  ------------------
  156|      4|              *engine_time));
  157|       |
  158|      6|  get_enginetime_quit:
  159|      6|    return rval;
  160|       |
  161|      4|}                               /* end get_enginetime() */
free_etimelist:
  295|     69|{
  296|     69|     int index = 0;
  297|     69|     Enginetime e = NULL;
  298|     69|     Enginetime nextE = NULL;
  299|       |
  300|  1.65k|     for( ; index < ETIMELIST_SIZE; ++index)
  ------------------
  |  |   21|  1.65k|#define ETIMELIST_SIZE	23
  ------------------
  |  Branch (300:13): [True: 1.58k, False: 69]
  ------------------
  301|  1.58k|     {
  302|  1.58k|           e = etimelist[index];
  303|       |
  304|  1.65k|           while(e != NULL)
  ------------------
  |  Branch (304:18): [True: 71, False: 1.58k]
  ------------------
  305|     71|           {
  306|     71|                 nextE = e->next;
  307|     71|                 SNMP_FREE(e->engineID);
  ------------------
  |  |   62|     71|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 71, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 71]
  |  |  ------------------
  ------------------
  308|     71|                 SNMP_FREE(e);
  ------------------
  |  |   62|     71|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 71, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 71]
  |  |  ------------------
  ------------------
  309|     71|                 e = nextE;
  310|     71|           }
  311|       |
  312|       |           etimelist[index] = NULL;
  313|  1.58k|     }
  314|     69|     return;
  315|     69|}
set_enginetime:
  344|     71|{
  345|     71|    int             rval = SNMPERR_SUCCESS, iindex;
  ------------------
  |  |  217|     71|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  346|     71|    Enginetime      e = NULL;
  347|       |
  348|       |
  349|       |
  350|       |    /*
  351|       |     * Sanity check.
  352|       |     */
  353|     71|    if (!engineID || (engineID_len <= 0)) {
  ------------------
  |  Branch (353:9): [True: 0, False: 71]
  |  Branch (353:22): [True: 0, False: 71]
  ------------------
  354|      0|        return rval;
  355|      0|    }
  356|       |
  357|       |
  358|       |    /*
  359|       |     * Store the given <engine_time, engineboot> tuple in the record
  360|       |     * for engineID.  Create a new record if necessary.
  361|       |     */
  362|     71|    if (!(e = search_enginetime_list(engineID, engineID_len))) {
  ------------------
  |  Branch (362:9): [True: 71, False: 0]
  ------------------
  363|     71|        if ((iindex = hash_engineID(engineID, engineID_len)) < 0) {
  ------------------
  |  Branch (363:13): [True: 0, False: 71]
  ------------------
  364|      0|            QUITFUN(SNMPERR_GENERR, set_enginetime_quit);
  ------------------
  |  |  143|      0|	if ( (e) != SNMPERR_SUCCESS) {	\
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (143:7): [True: 0, Folded]
  |  |  ------------------
  |  |  144|      0|		rval = SNMPERR_GENERR;	\
  |  |  ------------------
  |  |  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  |  |  ------------------
  |  |  145|      0|		goto l ;		\
  |  |  146|      0|	}
  ------------------
  365|      0|        }
  366|       |
  367|     71|        e = calloc(1, sizeof(*e));
  368|       |
  369|     71|        e->next = etimelist[iindex];
  370|     71|        etimelist[iindex] = e;
  371|       |
  372|     71|        e->engineID = calloc(1, engineID_len);
  373|     71|        memcpy(e->engineID, engineID, engineID_len);
  374|       |
  375|     71|        e->engineID_len = engineID_len;
  376|     71|    }
  377|     71|#ifdef LCD_TIME_SYNC_OPT
  378|     71|    if (authenticated || !e->authenticatedFlag) {
  ------------------
  |  Branch (378:9): [True: 69, False: 2]
  |  Branch (378:26): [True: 2, False: 0]
  ------------------
  379|     71|        e->authenticatedFlag = authenticated;
  380|       |#else
  381|       |    if (authenticated) {
  382|       |#endif
  383|     71|        e->engineTime = engine_time;
  384|     71|        e->engineBoot = engineboot;
  385|     71|        e->lastReceivedEngineTime = snmpv3_local_snmpEngineTime();
  386|     71|    }
  387|       |
  388|     71|    e = NULL;                   /* Indicates a successful update. */
  389|       |
  390|     71|    DEBUGMSGTL(("lcd_set_enginetime", "engineID "));
  ------------------
  |  |   66|     71|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     71|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 71]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 71]
  |  |  ------------------
  ------------------
  391|     71|    DEBUGMSGHEX(("lcd_set_enginetime", engineID, engineID_len));
  ------------------
  |  |   71|     71|#define DEBUGMSGHEX(x)     do {if (_DBG_IF_) {__DBGMSGHEX(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     71|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 71]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGHEX(x)     do {if (_DBG_IF_) {__DBGMSGHEX(x);} }while(0)
  |  |  ------------------
  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  ------------------
  |  |  |  Branch (71:71): [Folded, False: 71]
  |  |  ------------------
  ------------------
  392|     71|    DEBUGMSG(("lcd_set_enginetime", ": boots=%d, time=%d\n", engineboot,
  ------------------
  |  |   61|     71|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     71|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 71]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 71]
  |  |  ------------------
  ------------------
  393|     71|              engine_time));
  394|       |
  395|     71|  set_enginetime_quit:
  396|     71|    SNMP_FREE(e);
  ------------------
  |  |   62|     71|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 71]
  |  |  |  Branch (62:66): [Folded, False: 71]
  |  |  ------------------
  ------------------
  397|       |
  398|     71|    return rval;
  399|       |
  400|     71|}                               /* end set_enginetime() */
search_enginetime_list:
  423|     77|{
  424|     77|    int             rval = SNMPERR_SUCCESS;
  ------------------
  |  |  217|     77|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  425|     77|    Enginetime      e = NULL;
  426|       |
  427|       |
  428|       |    /*
  429|       |     * Sanity check.
  430|       |     */
  431|     77|    if (!engineID || (engineID_len <= 0)) {
  ------------------
  |  Branch (431:9): [True: 0, False: 77]
  |  Branch (431:22): [True: 0, False: 77]
  ------------------
  432|      0|        QUITFUN(SNMPERR_GENERR, search_enginetime_list_quit);
  ------------------
  |  |  143|      0|	if ( (e) != SNMPERR_SUCCESS) {	\
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (143:7): [True: 0, Folded]
  |  |  ------------------
  |  |  144|      0|		rval = SNMPERR_GENERR;	\
  |  |  ------------------
  |  |  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  |  |  ------------------
  |  |  145|      0|		goto l ;		\
  |  |  146|      0|	}
  ------------------
  433|      0|    }
  434|       |
  435|       |
  436|       |    /*
  437|       |     * Find the entry for engineID if there be one.
  438|       |     */
  439|     77|    rval = hash_engineID(engineID, engineID_len);
  440|     77|    if (rval < 0) {
  ------------------
  |  Branch (440:9): [True: 0, False: 77]
  ------------------
  441|      0|        QUITFUN(SNMPERR_GENERR, search_enginetime_list_quit);
  ------------------
  |  |  143|      0|	if ( (e) != SNMPERR_SUCCESS) {	\
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (143:7): [True: 0, Folded]
  |  |  ------------------
  |  |  144|      0|		rval = SNMPERR_GENERR;	\
  |  |  ------------------
  |  |  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  |  |  ------------------
  |  |  145|      0|		goto l ;		\
  |  |  146|      0|	}
  ------------------
  442|      0|    }
  443|     77|    e = etimelist[rval];
  444|       |
  445|     77|    for ( /*EMPTY*/; e; e = e->next) {
  ------------------
  |  Branch (445:22): [True: 4, False: 73]
  ------------------
  446|      4|        if ((engineID_len == e->engineID_len)
  ------------------
  |  Branch (446:13): [True: 4, False: 0]
  ------------------
  447|      4|            && !memcmp(e->engineID, engineID, engineID_len)) {
  ------------------
  |  Branch (447:16): [True: 4, False: 0]
  ------------------
  448|      4|            break;
  449|      4|        }
  450|      4|    }
  451|       |
  452|       |
  453|     77|  search_enginetime_list_quit:
  454|     77|    return e;
  455|       |
  456|     77|}                               /* end search_enginetime_list() */
hash_engineID:
  481|    148|{
  482|    148|    int             rval = SNMPERR_GENERR;
  ------------------
  |  |  218|    148|#define SNMPERR_GENERR			(-1)
  ------------------
  483|    148|    size_t          buf_len = SNMP_MAXBUF;
  ------------------
  |  |   43|    148|#define SNMP_MAXBUF		(1024 * 4)
  ------------------
  484|    148|    u_int           additive = 0;
  485|    148|    u_char         *bufp, buf[SNMP_MAXBUF];
  486|    148|    void           *context = NULL;
  487|       |
  488|       |
  489|       |
  490|       |    /*
  491|       |     * Sanity check.
  492|       |     */
  493|    148|    if (!engineID || (engineID_len <= 0)) {
  ------------------
  |  Branch (493:9): [True: 0, False: 148]
  |  Branch (493:22): [True: 0, False: 148]
  ------------------
  494|      0|        QUITFUN(SNMPERR_GENERR, hash_engineID_quit);
  ------------------
  |  |  143|      0|	if ( (e) != SNMPERR_SUCCESS) {	\
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (143:7): [True: 0, Folded]
  |  |  ------------------
  |  |  144|      0|		rval = SNMPERR_GENERR;	\
  |  |  ------------------
  |  |  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  |  |  ------------------
  |  |  145|      0|		goto l ;		\
  |  |  146|      0|	}
  ------------------
  495|      0|    }
  496|       |
  497|       |
  498|       |    /*
  499|       |     * Hash engineID into a list index.
  500|       |     */
  501|    148|#ifndef NETSNMP_DISABLE_MD5
  502|    148|    rval = sc_hash(usmHMACMD5AuthProtocol,
  503|    148|                   OID_LENGTH(usmHMACMD5AuthProtocol),
  ------------------
  |  |   64|    148|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|    148|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
  504|    148|                   engineID, engineID_len, buf, &buf_len);
  505|    148|    if (rval == SNMPERR_SC_NOT_CONFIGURED) {
  ------------------
  |  |  256|    148|#define SNMPERR_SC_NOT_CONFIGURED	(-39)
  ------------------
  |  Branch (505:9): [True: 0, False: 148]
  ------------------
  506|       |        /* fall back to sha1 */
  507|      0|        rval = sc_hash(usmHMACSHA1AuthProtocol,
  508|      0|                   OID_LENGTH(usmHMACSHA1AuthProtocol),
  ------------------
  |  |   64|      0|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|      0|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
  509|      0|                   engineID, engineID_len, buf, &buf_len);
  510|      0|    }
  511|       |#else
  512|       |    rval = sc_hash(usmHMACSHA1AuthProtocol,
  513|       |                   OID_LENGTH(usmHMACSHA1AuthProtocol),
  514|       |                   engineID, engineID_len, buf, &buf_len);
  515|       |#endif
  516|    148|    QUITFUN(rval, hash_engineID_quit);
  ------------------
  |  |  143|    148|	if ( (e) != SNMPERR_SUCCESS) {	\
  |  |  ------------------
  |  |  |  |  217|    148|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (143:7): [True: 0, False: 148]
  |  |  ------------------
  |  |  144|      0|		rval = SNMPERR_GENERR;	\
  |  |  ------------------
  |  |  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  |  |  ------------------
  |  |  145|      0|		goto l ;		\
  |  |  146|      0|	}
  ------------------
  517|       |
  518|    740|    for (bufp = buf; (bufp - buf) < (int) buf_len; bufp += 4) {
  ------------------
  |  Branch (518:22): [True: 592, False: 148]
  ------------------
  519|    592|        additive += (u_int) * bufp;
  520|    592|    }
  521|       |
  522|    148|  hash_engineID_quit:
  523|    148|    SNMP_FREE(context);
  ------------------
  |  |   62|    148|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 148]
  |  |  |  Branch (62:66): [Folded, False: 148]
  |  |  ------------------
  ------------------
  524|    148|    memset(buf, 0, SNMP_MAXBUF);
  ------------------
  |  |   43|    148|#define SNMP_MAXBUF		(1024 * 4)
  ------------------
  525|       |
  526|    148|    return (rval < 0) ? rval : (int)(additive % ETIMELIST_SIZE);
  ------------------
  |  |   21|    148|#define ETIMELIST_SIZE	23
  ------------------
  |  Branch (526:12): [True: 0, False: 148]
  ------------------
  527|       |
  528|    148|}                               /* end hash_engineID() */

register_mib_handlers:
 2452|     69|{
 2453|     69|#ifndef NETSNMP_DISABLE_MIB_LOADING
 2454|     69|    register_prenetsnmp_mib_handler("snmp", "mibdirs",
 2455|     69|                                    handle_mibdirs_conf, NULL,
 2456|     69|                                    "[mib-dirs|+mib-dirs|-mib-dirs]");
 2457|     69|    register_prenetsnmp_mib_handler("snmp", "mibs",
 2458|     69|                                    handle_mibs_conf, NULL,
 2459|     69|                                    "[mib-tokens|+mib-tokens|-mib-tokens]");
 2460|     69|    register_config_handler("snmp", "mibfile",
 2461|     69|                            handle_mibfile_conf, NULL, "mibfile-to-read");
 2462|       |    /*
 2463|       |     * register the snmp.conf configuration handlers for default
 2464|       |     * parsing behaviour 
 2465|       |     */
 2466|       |
 2467|     69|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "showMibErrors",
  ------------------
  |  |   72|     69|#define ASN_BOOLEAN	    0x01U
  ------------------
 2468|     69|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_ERRORS);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_ERRORS);
  ------------------
  |  |   59|     69|#define NETSNMP_DS_LIB_MIB_ERRORS          0
  ------------------
 2469|     69|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "commentToEOL",     /* Describes actual behaviour */
  ------------------
  |  |   72|     69|#define ASN_BOOLEAN	    0x01U
  ------------------
 2470|     69|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_COMMENT_TERM);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_COMMENT_TERM);
  ------------------
  |  |   61|     69|#define NETSNMP_DS_LIB_MIB_COMMENT_TERM    2
  ------------------
 2471|     69|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "strictCommentTerm",    /* Backward compatibility */
  ------------------
  |  |   72|     69|#define ASN_BOOLEAN	    0x01U
  ------------------
 2472|     69|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_COMMENT_TERM);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_COMMENT_TERM);
  ------------------
  |  |   61|     69|#define NETSNMP_DS_LIB_MIB_COMMENT_TERM    2
  ------------------
 2473|     69|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "mibAllowUnderline",
  ------------------
  |  |   72|     69|#define ASN_BOOLEAN	    0x01U
  ------------------
 2474|     69|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_PARSE_LABEL);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_PARSE_LABEL);
  ------------------
  |  |   62|     69|#define NETSNMP_DS_LIB_MIB_PARSE_LABEL     3
  ------------------
 2475|     69|    netsnmp_ds_register_premib(ASN_INTEGER, "snmp", "mibWarningLevel",
  ------------------
  |  |   75|     69|#define ASN_INTEGER	    0x02U
  ------------------
 2476|     69|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_WARNINGS);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_WARNINGS);
  ------------------
  |  |  114|     69|#define NETSNMP_DS_LIB_MIB_WARNINGS         0
  ------------------
 2477|     69|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "mibReplaceWithLatest",
  ------------------
  |  |   72|     69|#define ASN_BOOLEAN	    0x01U
  ------------------
 2478|     69|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_REPLACE);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIB_REPLACE);
  ------------------
  |  |   67|     69|#define NETSNMP_DS_LIB_MIB_REPLACE         7    /* replace objects from latest module */
  ------------------
 2479|     69|#endif
 2480|       |
 2481|     69|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "printNumericEnums",
  ------------------
  |  |   72|     69|#define ASN_BOOLEAN	    0x01U
  ------------------
 2482|     69|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_NUMERIC_ENUM);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_NUMERIC_ENUM);
  ------------------
  |  |   68|     69|#define NETSNMP_DS_LIB_PRINT_NUMERIC_ENUM  8    /* print only numeric enum values */
  ------------------
 2483|     69|    register_prenetsnmp_mib_handler("snmp", "printNumericOids",
 2484|     69|                       handle_print_numeric, NULL, "(1|yes|true|0|no|false)");
 2485|     69|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "escapeQuotes",
  ------------------
  |  |   72|     69|#define ASN_BOOLEAN	    0x01U
  ------------------
 2486|     69|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_ESCAPE_QUOTES);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_ESCAPE_QUOTES);
  ------------------
  |  |   79|     69|#define NETSNMP_DS_LIB_ESCAPE_QUOTES       19   /* shell escape quote marks in oids */
  ------------------
 2487|     69|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "dontBreakdownOids",
  ------------------
  |  |   72|     69|#define ASN_BOOLEAN	    0x01U
  ------------------
 2488|     69|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_BREAKDOWN_OIDS);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_BREAKDOWN_OIDS);
  ------------------
  |  |   70|     69|#define NETSNMP_DS_LIB_DONT_BREAKDOWN_OIDS 10   /* dont print oid indexes specially */
  ------------------
 2489|     69|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "quickPrinting",
  ------------------
  |  |   72|     69|#define ASN_BOOLEAN	    0x01U
  ------------------
 2490|     69|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT);
  ------------------
  |  |   73|     69|#define NETSNMP_DS_LIB_QUICK_PRINT         13   /* print very brief output for parsing */
  ------------------
 2491|     69|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "numericTimeticks",
  ------------------
  |  |   72|     69|#define ASN_BOOLEAN	    0x01U
  ------------------
 2492|     69|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NUMERIC_TIMETICKS);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NUMERIC_TIMETICKS);
  ------------------
  |  |   78|     69|#define NETSNMP_DS_LIB_NUMERIC_TIMETICKS   18   /* print timeticks as a number */
  ------------------
 2493|     69|    netsnmp_ds_register_premib(ASN_INTEGER, "snmp", "oidOutputFormat",
  ------------------
  |  |   75|     69|#define ASN_INTEGER	    0x02U
  ------------------
 2494|     69|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT);
  ------------------
  |  |  118|     69|#define NETSNMP_DS_LIB_OID_OUTPUT_FORMAT    4
  ------------------
 2495|     69|    netsnmp_ds_register_premib(ASN_INTEGER, "snmp", "suffixPrinting",
  ------------------
  |  |   75|     69|#define ASN_INTEGER	    0x02U
  ------------------
 2496|     69|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OID_OUTPUT_FORMAT);
  ------------------
  |  |  118|     69|#define NETSNMP_DS_LIB_OID_OUTPUT_FORMAT    4
  ------------------
 2497|     69|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "extendedIndex",
  ------------------
  |  |   72|     69|#define ASN_BOOLEAN	    0x01U
  ------------------
 2498|     69|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_EXTENDED_INDEX);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_EXTENDED_INDEX);
  ------------------
  |  |   82|     69|#define NETSNMP_DS_LIB_EXTENDED_INDEX	   22   /* print extended index format [x1][x2] */
  ------------------
 2499|     69|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "printHexText",
  ------------------
  |  |   72|     69|#define ASN_BOOLEAN	    0x01U
  ------------------
 2500|     69|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_HEX_TEXT);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_HEX_TEXT);
  ------------------
  |  |   83|     69|#define NETSNMP_DS_LIB_PRINT_HEX_TEXT      23   /* print ASCII text along with hex strings */
  ------------------
 2501|     69|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "printValueOnly",
  ------------------
  |  |   72|     69|#define ASN_BOOLEAN	    0x01U
  ------------------
 2502|     69|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_BARE_VALUE);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_BARE_VALUE);
  ------------------
  |  |   81|     69|#define NETSNMP_DS_LIB_PRINT_BARE_VALUE	   21   /* just print value (not OID = value) */
  ------------------
 2503|     69|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "dontPrintUnits",
  ------------------
  |  |   72|     69|#define ASN_BOOLEAN	    0x01U
  ------------------
 2504|     69|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_PRINT_UNITS);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_PRINT_UNITS);
  ------------------
  |  |   89|     69|#define NETSNMP_DS_LIB_DONT_PRINT_UNITS    29 /* don't print UNITS suffix */
  ------------------
 2505|     69|    netsnmp_ds_register_premib(ASN_INTEGER, "snmp", "hexOutputLength",
  ------------------
  |  |   75|     69|#define ASN_INTEGER	    0x02U
  ------------------
 2506|     69|                       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_HEX_OUTPUT_LENGTH);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                     NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_HEX_OUTPUT_LENGTH);
  ------------------
  |  |  121|     69|#define NETSNMP_DS_LIB_HEX_OUTPUT_LENGTH    6
  ------------------
 2507|     69|}
netsnmp_set_mib_directory:
 2522|     69|{
 2523|     69|    const char *newdir;
 2524|     69|    char *olddir, *tmpdir = NULL;
 2525|       |
 2526|     69|    DEBUGTRACE;
  ------------------
  |  |   63|     69|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  ------------------
  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  ------------------
  |  |  |  Branch (63:67): [Folded, False: 69]
  |  |  ------------------
  ------------------
 2527|     69|    if (NULL == dir) {
  ------------------
  |  Branch (2527:9): [True: 0, False: 69]
  ------------------
 2528|      0|        return;
 2529|      0|    }
 2530|       |    
 2531|     69|    olddir = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 2532|     69|				   NETSNMP_DS_LIB_MIBDIRS);
  ------------------
  |  |  162|     69|#define NETSNMP_DS_LIB_MIBDIRS           11
  ------------------
 2533|     69|    if (olddir) {
  ------------------
  |  Branch (2533:9): [True: 69, False: 0]
  ------------------
 2534|     69|        if ((*dir == '+') || (*dir == '-')) {
  ------------------
  |  Branch (2534:13): [True: 0, False: 69]
  |  Branch (2534:30): [True: 0, False: 69]
  ------------------
 2535|       |            /** New dir starts with '+', thus we add it. */
 2536|      0|            tmpdir = (char *)malloc(strlen(dir) + strlen(olddir) + 2);
 2537|      0|            if (!tmpdir) {
  ------------------
  |  Branch (2537:17): [True: 0, False: 0]
  ------------------
 2538|      0|                DEBUGMSGTL(("read_config:initmib", "set mibdir malloc failed"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2539|      0|                return;
 2540|      0|            }
 2541|      0|            if (*dir++ == '+')
  ------------------
  |  Branch (2541:17): [True: 0, False: 0]
  ------------------
 2542|      0|                sprintf(tmpdir, "%s%c%s", olddir, ENV_SEPARATOR_CHAR, dir);
  ------------------
  |  |   70|      0|#define ENV_SEPARATOR_CHAR ':'
  ------------------
 2543|      0|            else
 2544|      0|                sprintf(tmpdir, "%s%c%s", dir, ENV_SEPARATOR_CHAR, olddir);
  ------------------
  |  |   70|      0|#define ENV_SEPARATOR_CHAR ':'
  ------------------
 2545|      0|            newdir = tmpdir;
 2546|     69|        } else {
 2547|     69|            newdir = dir;
 2548|     69|        }
 2549|     69|    } else {
 2550|       |        /** If dir starts with '+' skip '+' it. */
 2551|      0|        newdir = ((*dir == '+') ? ++dir : dir);
  ------------------
  |  Branch (2551:19): [True: 0, False: 0]
  ------------------
 2552|      0|    }
 2553|     69|    netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS,
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS,
  ------------------
  |  |  162|     69|#define NETSNMP_DS_LIB_MIBDIRS           11
  ------------------
 2554|     69|                          newdir);
 2555|       |
 2556|       |    /** set_string calls strdup, so if we allocated memory, free it */
 2557|     69|    if (tmpdir == newdir) {
  ------------------
  |  Branch (2557:9): [True: 0, False: 69]
  ------------------
 2558|       |        SNMP_FREE(tmpdir);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2559|      0|    }
 2560|     69|}
netsnmp_get_mib_directory:
 2577|    139|{
 2578|    139|    char *dir;
 2579|       |
 2580|    139|    DEBUGTRACE;
  ------------------
  |  |   63|    139|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    139|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 139]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  ------------------
  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  ------------------
  |  |  |  Branch (63:67): [Folded, False: 139]
  |  |  ------------------
  ------------------
 2581|    139|    dir = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS);
  ------------------
  |  |   48|    139|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  dir = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS);
  ------------------
  |  |  162|    139|#define NETSNMP_DS_LIB_MIBDIRS           11
  ------------------
 2582|    139|    if (dir == NULL) {
  ------------------
  |  Branch (2582:9): [True: 0, False: 139]
  ------------------
 2583|      0|        DEBUGMSGTL(("get_mib_directory", "no mib directories set\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2584|       |
 2585|       |        /** Check if the environment variable is set */
 2586|      0|        dir = netsnmp_getenv("MIBDIRS");
 2587|      0|        if (dir == NULL) {
  ------------------
  |  Branch (2587:13): [True: 0, False: 0]
  ------------------
 2588|      0|            DEBUGMSGTL(("get_mib_directory", "no mib directories set by environment\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2589|       |            /** Not set use hard coded path */
 2590|      0|            if (confmibdir == NULL) {
  ------------------
  |  Branch (2590:17): [True: 0, False: 0]
  ------------------
 2591|      0|                DEBUGMSGTL(("get_mib_directory", "no mib directories set by config\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2592|      0|                netsnmp_set_mib_directory(NETSNMP_DEFAULT_MIBDIRS);
  ------------------
  |  | 1641|      0|#define NETSNMP_DEFAULT_MIBDIRS "$HOME/.snmp/mibs:/usr/local/net-snmp-master/share/snmp/mibs"
  ------------------
 2593|      0|            }
 2594|      0|            else if ((*confmibdir == '+') || (*confmibdir == '-')) {
  ------------------
  |  Branch (2594:22): [True: 0, False: 0]
  |  Branch (2594:46): [True: 0, False: 0]
  ------------------
 2595|      0|                DEBUGMSGTL(("get_mib_directory", "mib directories set by config (but added)\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2596|      0|                netsnmp_set_mib_directory(NETSNMP_DEFAULT_MIBDIRS);
  ------------------
  |  | 1641|      0|#define NETSNMP_DEFAULT_MIBDIRS "$HOME/.snmp/mibs:/usr/local/net-snmp-master/share/snmp/mibs"
  ------------------
 2597|      0|                netsnmp_set_mib_directory(confmibdir);
 2598|      0|            }
 2599|      0|            else {
 2600|      0|                DEBUGMSGTL(("get_mib_directory", "mib directories set by config\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2601|      0|                netsnmp_set_mib_directory(confmibdir);
 2602|      0|            }
 2603|      0|        } else if ((*dir == '+') || (*dir == '-')) {
  ------------------
  |  Branch (2603:20): [True: 0, False: 0]
  |  Branch (2603:37): [True: 0, False: 0]
  ------------------
 2604|      0|            DEBUGMSGTL(("get_mib_directory", "mib directories set by environment (but added)\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2605|      0|            netsnmp_set_mib_directory(NETSNMP_DEFAULT_MIBDIRS);
  ------------------
  |  | 1641|      0|#define NETSNMP_DEFAULT_MIBDIRS "$HOME/.snmp/mibs:/usr/local/net-snmp-master/share/snmp/mibs"
  ------------------
 2606|      0|            netsnmp_set_mib_directory(dir);
 2607|      0|        } else {
 2608|      0|            DEBUGMSGTL(("get_mib_directory", "mib directories set by environment\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2609|      0|            netsnmp_set_mib_directory(dir);
 2610|      0|        }
 2611|      0|        dir = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS);
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                      dir = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS);
  ------------------
  |  |  162|      0|#define NETSNMP_DS_LIB_MIBDIRS           11
  ------------------
 2612|      0|    }
 2613|    139|    DEBUGMSGTL(("get_mib_directory", "mib directories set '%s'\n", dir));
  ------------------
  |  |   66|    139|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    139|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 139]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 139]
  |  |  ------------------
  ------------------
 2614|    139|    return(dir);
 2615|    139|}
netsnmp_fixup_mib_directory:
 2624|     69|{
 2625|     69|    const char *homepath = netsnmp_gethomedir();
 2626|     69|    char *mibpath = netsnmp_get_mib_directory();
 2627|     69|    char *oldmibpath = NULL;
 2628|     69|    char *ptr_home;
 2629|     69|    char *new_mibpath;
 2630|       |
 2631|     69|    DEBUGTRACE;
  ------------------
  |  |   63|     69|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  ------------------
  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  ------------------
  |  |  |  Branch (63:67): [Folded, False: 69]
  |  |  ------------------
  ------------------
 2632|     69|    if (homepath && mibpath) {
  ------------------
  |  Branch (2632:9): [True: 69, False: 0]
  |  Branch (2632:21): [True: 69, False: 0]
  ------------------
 2633|     69|        DEBUGMSGTL(("fixup_mib_directory", "mib directories '%s'\n", mibpath));
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
 2634|     69|        while ((ptr_home = strstr(mibpath, "$HOME"))) {
  ------------------
  |  Branch (2634:16): [True: 0, False: 69]
  ------------------
 2635|      0|            new_mibpath = (char *)malloc(strlen(mibpath) - strlen("$HOME") +
 2636|      0|					 strlen(homepath)+1);
 2637|      0|            if (new_mibpath) {
  ------------------
  |  Branch (2637:17): [True: 0, False: 0]
  ------------------
 2638|      0|                *ptr_home = 0; /* null out the spot where we stop copying */
 2639|      0|                sprintf(new_mibpath, "%s%s%s", mibpath, homepath,
 2640|      0|			ptr_home + strlen("$HOME"));
 2641|       |                /** swap in the new value and repeat */
 2642|      0|                mibpath = new_mibpath;
 2643|      0|		if (oldmibpath != NULL) {
  ------------------
  |  Branch (2643:7): [True: 0, False: 0]
  ------------------
 2644|      0|		    SNMP_FREE(oldmibpath);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2645|      0|		}
 2646|      0|		oldmibpath = new_mibpath;
 2647|      0|            } else {
 2648|      0|                break;
 2649|      0|            }
 2650|      0|        }
 2651|       |
 2652|     69|        netsnmp_set_mib_directory(mibpath);
 2653|       |	
 2654|       |	/*  The above copies the mibpath for us, so...  */
 2655|       |
 2656|     69|	if (oldmibpath != NULL) {
  ------------------
  |  Branch (2656:6): [True: 0, False: 69]
  ------------------
 2657|      0|	    SNMP_FREE(oldmibpath);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2658|      0|	}
 2659|       |
 2660|     69|    }
 2661|       |
 2662|     69|}
netsnmp_init_mib:
 2671|     69|{
 2672|     69|    const char     *prefix;
 2673|     69|    char           *env_var, *entry;
 2674|     69|    PrefixListPtr   pp = &mib_prefixes[0];
 2675|     69|    char           *st = NULL;
 2676|       |
 2677|     69|    if (Mib)
  ------------------
  |  Branch (2677:9): [True: 0, False: 69]
  ------------------
 2678|      0|        return;
 2679|     69|    netsnmp_init_mib_internals();
 2680|       |
 2681|       |    /*
 2682|       |     * Initialise the MIB directory/ies 
 2683|       |     */
 2684|     69|    netsnmp_fixup_mib_directory();
 2685|     69|    env_var = strdup(netsnmp_get_mib_directory());
 2686|     69|    if (!env_var)
  ------------------
  |  Branch (2686:9): [True: 0, False: 69]
  ------------------
 2687|      0|        return;
 2688|       |
 2689|     69|    DEBUGMSGTL(("init_mib",
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
 2690|     69|                "Seen MIBDIRS: Looking in '%s' for mib dirs ...\n",
 2691|     69|                env_var));
 2692|       |
 2693|     69|    entry = strtok_r(env_var, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|     69|#define ENV_SEPARATOR ":"
  ------------------
 2694|    138|    while (entry) {
  ------------------
  |  Branch (2694:12): [True: 69, False: 69]
  ------------------
 2695|     69|        add_mibdir(entry);
 2696|     69|        entry = strtok_r(NULL, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|     69|#define ENV_SEPARATOR ":"
  ------------------
 2697|     69|    }
 2698|     69|    SNMP_FREE(env_var);
  ------------------
  |  |   62|     69|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 69, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 69]
  |  |  ------------------
  ------------------
 2699|       |
 2700|     69|    env_var = netsnmp_getenv("MIBFILES");
 2701|     69|    if (env_var != NULL) {
  ------------------
  |  Branch (2701:9): [True: 0, False: 69]
  ------------------
 2702|      0|        if (*env_var == '+')
  ------------------
  |  Branch (2702:13): [True: 0, False: 0]
  ------------------
 2703|      0|            entry = strtok_r(env_var+1, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|      0|#define ENV_SEPARATOR ":"
  ------------------
 2704|      0|        else
 2705|      0|            entry = strtok_r(env_var, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|      0|#define ENV_SEPARATOR ":"
  ------------------
 2706|      0|        while (entry) {
  ------------------
  |  Branch (2706:16): [True: 0, False: 0]
  ------------------
 2707|      0|            add_mibfile(entry, NULL);
 2708|      0|            entry = strtok_r(NULL, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|      0|#define ENV_SEPARATOR ":"
  ------------------
 2709|      0|        }
 2710|      0|    }
 2711|       |
 2712|     69|    netsnmp_init_mib_internals();
 2713|       |
 2714|       |    /*
 2715|       |     * Read in any modules or mibs requested 
 2716|       |     */
 2717|       |
 2718|     69|    env_var = netsnmp_getenv("MIBS");
 2719|     69|    if (env_var == NULL) {
  ------------------
  |  Branch (2719:9): [True: 69, False: 0]
  ------------------
 2720|     69|        if (confmibs != NULL)
  ------------------
  |  Branch (2720:13): [True: 0, False: 69]
  ------------------
 2721|      0|            env_var = strdup(confmibs);
 2722|     69|        else
 2723|     69|            env_var = strdup(NETSNMP_DEFAULT_MIBS);
  ------------------
  |  | 1982|     69|#define NETSNMP_DEFAULT_MIBS ":NET-SNMP-EXTEND-MIB:SNMPv2-MIB:IF-MIB:IP-MIB:TCP-MIB:UDP-MIB:HOST-RESOURCES-MIB:NOTIFICATION-LOG-MIB:DISMAN-EVENT-MIB:DISMAN-SCHEDULE-MIB:NET-SNMP-PERIODIC-NOTIFY-MIB:DISMAN-NSLOOKUP-MIB:DISMAN-PING-MIB:DISMAN-TRACEROUTE-MIB:EtherLike-MIB:NET-SNMP-EXAMPLES-MIB:HOST-RESOURCES-TYPES:IP-FORWARD-MIB:MTA-MIB:NETWORK-SERVICES-MIB:UCD-IPFWACC-MIB:RMON-MIB:SCTP-MIB:SNMP-USM-DH-OBJECTS-MIB:SNMP-TLS-TM-MIB:SNMP-TSM-MIB:TUNNEL-MIB:IPV6-FLOW-LABEL-MIB:UCD-DISKIO-MIB:UCD-SNMP-MIB:UCD-DEMO-MIB:SNMP-TARGET-MIB:NET-SNMP-AGENT-MIB:SNMP-NOTIFICATION-MIB:NET-SNMP-PASS-MIB:SNMP-FRAMEWORK-MIB:SNMP-MPD-MIB:SNMP-USER-BASED-SM-MIB:SNMP-VIEW-BASED-ACM-MIB:SNMP-COMMUNITY-MIB:IPV6-ICMP-MIB:IPV6-MIB:IPV6-TCP-MIB:IPV6-UDP-MIB:UCD-DLMOD-MIB:SNMPv2-TM:NET-SNMP-VACM-MIB"
  ------------------
 2724|     69|    } else {
 2725|      0|        env_var = strdup(env_var);
 2726|      0|    }
 2727|     69|    if (env_var && ((*env_var == '+') || (*env_var == '-'))) {
  ------------------
  |  Branch (2727:9): [True: 69, False: 0]
  |  Branch (2727:21): [True: 0, False: 69]
  |  Branch (2727:42): [True: 0, False: 69]
  ------------------
 2728|      0|        int res;
 2729|       |
 2730|      0|        if (*env_var == '+')
  ------------------
  |  Branch (2730:13): [True: 0, False: 0]
  ------------------
 2731|      0|            res = asprintf(&entry, "%s%c%s", NETSNMP_DEFAULT_MIBS,
  ------------------
  |  | 1982|      0|#define NETSNMP_DEFAULT_MIBS ":NET-SNMP-EXTEND-MIB:SNMPv2-MIB:IF-MIB:IP-MIB:TCP-MIB:UDP-MIB:HOST-RESOURCES-MIB:NOTIFICATION-LOG-MIB:DISMAN-EVENT-MIB:DISMAN-SCHEDULE-MIB:NET-SNMP-PERIODIC-NOTIFY-MIB:DISMAN-NSLOOKUP-MIB:DISMAN-PING-MIB:DISMAN-TRACEROUTE-MIB:EtherLike-MIB:NET-SNMP-EXAMPLES-MIB:HOST-RESOURCES-TYPES:IP-FORWARD-MIB:MTA-MIB:NETWORK-SERVICES-MIB:UCD-IPFWACC-MIB:RMON-MIB:SCTP-MIB:SNMP-USM-DH-OBJECTS-MIB:SNMP-TLS-TM-MIB:SNMP-TSM-MIB:TUNNEL-MIB:IPV6-FLOW-LABEL-MIB:UCD-DISKIO-MIB:UCD-SNMP-MIB:UCD-DEMO-MIB:SNMP-TARGET-MIB:NET-SNMP-AGENT-MIB:SNMP-NOTIFICATION-MIB:NET-SNMP-PASS-MIB:SNMP-FRAMEWORK-MIB:SNMP-MPD-MIB:SNMP-USER-BASED-SM-MIB:SNMP-VIEW-BASED-ACM-MIB:SNMP-COMMUNITY-MIB:IPV6-ICMP-MIB:IPV6-MIB:IPV6-TCP-MIB:IPV6-UDP-MIB:UCD-DLMOD-MIB:SNMPv2-TM:NET-SNMP-VACM-MIB"
  ------------------
 2732|      0|                           ENV_SEPARATOR_CHAR, env_var + 1);
  ------------------
  |  |   70|      0|#define ENV_SEPARATOR_CHAR ':'
  ------------------
 2733|      0|        else
 2734|      0|            res = asprintf(&entry, "%s%c%s", env_var + 1, ENV_SEPARATOR_CHAR,
  ------------------
  |  |   70|      0|#define ENV_SEPARATOR_CHAR ':'
  ------------------
 2735|      0|                           NETSNMP_DEFAULT_MIBS);
  ------------------
  |  | 1982|      0|#define NETSNMP_DEFAULT_MIBS ":NET-SNMP-EXTEND-MIB:SNMPv2-MIB:IF-MIB:IP-MIB:TCP-MIB:UDP-MIB:HOST-RESOURCES-MIB:NOTIFICATION-LOG-MIB:DISMAN-EVENT-MIB:DISMAN-SCHEDULE-MIB:NET-SNMP-PERIODIC-NOTIFY-MIB:DISMAN-NSLOOKUP-MIB:DISMAN-PING-MIB:DISMAN-TRACEROUTE-MIB:EtherLike-MIB:NET-SNMP-EXAMPLES-MIB:HOST-RESOURCES-TYPES:IP-FORWARD-MIB:MTA-MIB:NETWORK-SERVICES-MIB:UCD-IPFWACC-MIB:RMON-MIB:SCTP-MIB:SNMP-USM-DH-OBJECTS-MIB:SNMP-TLS-TM-MIB:SNMP-TSM-MIB:TUNNEL-MIB:IPV6-FLOW-LABEL-MIB:UCD-DISKIO-MIB:UCD-SNMP-MIB:UCD-DEMO-MIB:SNMP-TARGET-MIB:NET-SNMP-AGENT-MIB:SNMP-NOTIFICATION-MIB:NET-SNMP-PASS-MIB:SNMP-FRAMEWORK-MIB:SNMP-MPD-MIB:SNMP-USER-BASED-SM-MIB:SNMP-VIEW-BASED-ACM-MIB:SNMP-COMMUNITY-MIB:IPV6-ICMP-MIB:IPV6-MIB:IPV6-TCP-MIB:IPV6-UDP-MIB:UCD-DLMOD-MIB:SNMPv2-TM:NET-SNMP-VACM-MIB"
  ------------------
 2736|      0|        SNMP_FREE(env_var);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2737|      0|        if (res < 0) {
  ------------------
  |  Branch (2737:13): [True: 0, False: 0]
  ------------------
 2738|      0|            DEBUGMSGTL(("init_mib", "env mibs malloc failed"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2739|      0|            return;
 2740|      0|        }
 2741|      0|        env_var = entry;
 2742|      0|    }
 2743|       |
 2744|     69|    if (env_var != NULL) {
  ------------------
  |  Branch (2744:9): [True: 69, False: 0]
  ------------------
 2745|     69|        DEBUGMSGTL(("init_mib",
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
 2746|     69|                    "Seen MIBS: Looking in '%s' for mib files ...\n",
 2747|     69|                    env_var));
 2748|     69|        entry = strtok_r(env_var, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|     69|#define ENV_SEPARATOR ":"
  ------------------
 2749|  3.31k|        while (entry) {
  ------------------
  |  Branch (2749:16): [True: 3.24k, False: 69]
  ------------------
 2750|  3.24k|            if (strcasecmp(entry, DEBUG_ALWAYS_TOKEN) == 0) {
  ------------------
  |  |  227|  3.24k|#define DEBUG_ALWAYS_TOKEN "all"
  ------------------
  |  Branch (2750:17): [True: 0, False: 3.24k]
  ------------------
 2751|      0|                read_all_mibs();
 2752|  3.24k|            } else if (strstr(entry, "/") != NULL) {
  ------------------
  |  Branch (2752:24): [True: 0, False: 3.24k]
  ------------------
 2753|      0|                read_mib(entry);
 2754|  3.24k|            } else {
 2755|  3.24k|                netsnmp_read_module(entry);
 2756|  3.24k|            }
 2757|  3.24k|            entry = strtok_r(NULL, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|  3.24k|#define ENV_SEPARATOR ":"
  ------------------
 2758|  3.24k|        }
 2759|     69|        adopt_orphans();
 2760|     69|        SNMP_FREE(env_var);
  ------------------
  |  |   62|     69|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 69, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 69]
  |  |  ------------------
  ------------------
 2761|     69|    }
 2762|       |
 2763|     69|    env_var = netsnmp_getenv("MIBFILES");
 2764|     69|    if (env_var != NULL) {
  ------------------
  |  Branch (2764:9): [True: 0, False: 69]
  ------------------
 2765|      0|        if ((*env_var == '+') || (*env_var == '-')) {
  ------------------
  |  Branch (2765:13): [True: 0, False: 0]
  |  Branch (2765:34): [True: 0, False: 0]
  ------------------
 2766|       |#ifdef NETSNMP_DEFAULT_MIBFILES
 2767|       |            entry =
 2768|       |                (char *) malloc(strlen(NETSNMP_DEFAULT_MIBFILES) +
 2769|       |                                strlen(env_var) + 2);
 2770|       |            if (!entry) {
 2771|       |                DEBUGMSGTL(("init_mib", "env mibfiles malloc failed"));
 2772|       |            } else {
 2773|       |                if (*env_var++ == '+')
 2774|       |                    sprintf(entry, "%s%c%s", NETSNMP_DEFAULT_MIBFILES, ENV_SEPARATOR_CHAR,
 2775|       |                            env_var );
 2776|       |                else
 2777|       |                    sprintf(entry, "%s%c%s", env_var, ENV_SEPARATOR_CHAR,
 2778|       |                            NETSNMP_DEFAULT_MIBFILES );
 2779|       |            }
 2780|       |            SNMP_FREE(env_var);
 2781|       |            env_var = entry;
 2782|       |#else
 2783|      0|            env_var = strdup(env_var + 1);
 2784|      0|#endif
 2785|      0|        } else {
 2786|      0|            env_var = strdup(env_var);
 2787|      0|        }
 2788|     69|    } else {
 2789|       |#ifdef NETSNMP_DEFAULT_MIBFILES
 2790|       |        env_var = strdup(NETSNMP_DEFAULT_MIBFILES);
 2791|       |#endif
 2792|     69|    }
 2793|       |
 2794|     69|    if (env_var != NULL) {
  ------------------
  |  Branch (2794:9): [True: 0, False: 69]
  ------------------
 2795|      0|        DEBUGMSGTL(("init_mib",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2796|      0|                    "Seen MIBFILES: Looking in '%s' for mib files ...\n",
 2797|      0|                    env_var));
 2798|      0|        entry = strtok_r(env_var, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|      0|#define ENV_SEPARATOR ":"
  ------------------
 2799|      0|        while (entry) {
  ------------------
  |  Branch (2799:16): [True: 0, False: 0]
  ------------------
 2800|      0|            read_mib(entry);
 2801|      0|            entry = strtok_r(NULL, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|      0|#define ENV_SEPARATOR ":"
  ------------------
 2802|      0|        }
 2803|      0|        SNMP_FREE(env_var);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2804|      0|    }
 2805|       |
 2806|     69|    prefix = netsnmp_getenv("PREFIX");
 2807|       |
 2808|     69|    if (!prefix)
  ------------------
  |  Branch (2808:9): [True: 69, False: 0]
  ------------------
 2809|     69|        prefix = Standard_Prefix;
 2810|       |
 2811|     69|    Prefix = (char *) malloc(strlen(prefix) + 2);
 2812|     69|    if (!Prefix)
  ------------------
  |  Branch (2812:9): [True: 0, False: 69]
  ------------------
 2813|      0|        DEBUGMSGTL(("init_mib", "Prefix malloc failed"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2814|     69|    else
 2815|     69|        strcpy(Prefix, prefix);
 2816|       |
 2817|     69|    DEBUGMSGTL(("init_mib",
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
 2818|     69|                "Seen PREFIX: Looking in '%s' for prefix ...\n", Prefix));
 2819|       |
 2820|       |    /*
 2821|       |     * remove trailing dot 
 2822|       |     */
 2823|     69|    if (Prefix) {
  ------------------
  |  Branch (2823:9): [True: 69, False: 0]
  ------------------
 2824|     69|        env_var = &Prefix[strlen(Prefix) - 1];
 2825|     69|        if (*env_var == '.')
  ------------------
  |  Branch (2825:13): [True: 0, False: 69]
  ------------------
 2826|      0|            *env_var = '\0';
 2827|     69|    }
 2828|       |
 2829|     69|    pp->str = Prefix;           /* fixup first mib_prefix entry */
 2830|       |    /*
 2831|       |     * now that the list of prefixes is built, save each string length. 
 2832|       |     */
 2833|    483|    while (pp->str) {
  ------------------
  |  Branch (2833:12): [True: 414, False: 69]
  ------------------
 2834|    414|        pp->len = strlen(pp->str);
 2835|    414|        pp++;
 2836|    414|    }
 2837|       |
 2838|     69|    Mib = tree_head;            /* Backwards compatibility */
 2839|     69|    tree_top = calloc(1, sizeof(struct tree));
 2840|       |    /*
 2841|       |     * XX error check ? 
 2842|       |     */
 2843|     69|    if (tree_top) {
  ------------------
  |  Branch (2843:9): [True: 69, False: 0]
  ------------------
 2844|     69|        tree_top->label = strdup("(top)");
 2845|     69|        tree_top->child_list = tree_head;
 2846|     69|    }
 2847|     69|}
shutdown_mib:
 2863|     69|{
 2864|     69|    unload_all_mibs();
 2865|     69|    if (tree_top) {
  ------------------
  |  Branch (2865:9): [True: 69, False: 0]
  ------------------
 2866|     69|        if (tree_top->label)
  ------------------
  |  Branch (2866:13): [True: 69, False: 0]
  ------------------
 2867|     69|            SNMP_FREE(tree_top->label);
  ------------------
  |  |   62|     69|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 69, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 69]
  |  |  ------------------
  ------------------
 2868|     69|        SNMP_FREE(tree_top);
  ------------------
  |  |   62|     69|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 69, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 69]
  |  |  ------------------
  ------------------
 2869|     69|    }
 2870|     69|    tree_head = NULL;
 2871|     69|    Mib = NULL;
 2872|     69|    if (Prefix != NULL && Prefix != &Standard_Prefix[0])
  ------------------
  |  Branch (2872:9): [True: 69, False: 0]
  |  Branch (2872:27): [True: 69, False: 0]
  ------------------
 2873|     69|        SNMP_FREE(Prefix);
  ------------------
  |  |   62|     69|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 69, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 69]
  |  |  ------------------
  ------------------
 2874|     69|    if (Prefix)
  ------------------
  |  Branch (2874:9): [True: 0, False: 69]
  ------------------
 2875|      0|        Prefix = NULL;
 2876|     69|    SNMP_FREE(confmibs);
  ------------------
  |  |   62|     69|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 69]
  |  |  |  Branch (62:66): [Folded, False: 69]
  |  |  ------------------
  ------------------
 2877|       |    SNMP_FREE(confmibdir);
  ------------------
  |  |   62|     69|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 69]
  |  |  |  Branch (62:66): [Folded, False: 69]
  |  |  ------------------
  ------------------
 2878|     69|}
set_function:
 2910|    207|{
 2911|    207|    subtree->printer = NULL;
 2912|    207|    switch (subtree->type) {
 2913|      0|    case TYPE_OBJID:
  ------------------
  |  |  155|      0|#define TYPE_OBJID          1
  ------------------
  |  Branch (2913:5): [True: 0, False: 207]
  ------------------
 2914|      0|        subtree->printomat = sprint_realloc_object_identifier;
 2915|      0|        break;
 2916|      0|    case TYPE_OCTETSTR:
  ------------------
  |  |  156|      0|#define TYPE_OCTETSTR       2
  ------------------
  |  Branch (2916:5): [True: 0, False: 207]
  ------------------
 2917|      0|        subtree->printomat = sprint_realloc_octet_string;
 2918|      0|        break;
 2919|      0|    case TYPE_INTEGER:
  ------------------
  |  |  157|      0|#define TYPE_INTEGER        3
  ------------------
  |  Branch (2919:5): [True: 0, False: 207]
  ------------------
 2920|      0|        subtree->printomat = sprint_realloc_integer;
 2921|      0|        break;
 2922|      0|    case TYPE_INTEGER32:
  ------------------
  |  |  170|      0|#define TYPE_INTEGER32      16
  ------------------
  |  Branch (2922:5): [True: 0, False: 207]
  ------------------
 2923|      0|        subtree->printomat = sprint_realloc_integer;
 2924|      0|        break;
 2925|      0|    case TYPE_NETADDR:
  ------------------
  |  |  158|      0|#define TYPE_NETADDR        4
  ------------------
  |  Branch (2925:5): [True: 0, False: 207]
  ------------------
 2926|      0|        subtree->printomat = sprint_realloc_networkaddress;
 2927|      0|        break;
 2928|      0|    case TYPE_IPADDR:
  ------------------
  |  |  159|      0|#define TYPE_IPADDR         5
  ------------------
  |  Branch (2928:5): [True: 0, False: 207]
  ------------------
 2929|      0|        subtree->printomat = sprint_realloc_ipaddress;
 2930|      0|        break;
 2931|      0|    case TYPE_COUNTER:
  ------------------
  |  |  160|      0|#define TYPE_COUNTER        6
  ------------------
  |  Branch (2931:5): [True: 0, False: 207]
  ------------------
 2932|      0|        subtree->printomat = sprint_realloc_counter;
 2933|      0|        break;
 2934|      0|    case TYPE_GAUGE:
  ------------------
  |  |  161|      0|#define TYPE_GAUGE          7
  ------------------
  |  Branch (2934:5): [True: 0, False: 207]
  ------------------
 2935|      0|        subtree->printomat = sprint_realloc_gauge;
 2936|      0|        break;
 2937|      0|    case TYPE_TIMETICKS:
  ------------------
  |  |  162|      0|#define TYPE_TIMETICKS      8
  ------------------
  |  Branch (2937:5): [True: 0, False: 207]
  ------------------
 2938|      0|        subtree->printomat = sprint_realloc_timeticks;
 2939|      0|        break;
 2940|      0|    case TYPE_OPAQUE:
  ------------------
  |  |  163|      0|#define TYPE_OPAQUE         9
  ------------------
  |  Branch (2940:5): [True: 0, False: 207]
  ------------------
 2941|      0|        subtree->printomat = sprint_realloc_opaque;
 2942|      0|        break;
 2943|      0|    case TYPE_NULL:
  ------------------
  |  |  164|      0|#define TYPE_NULL           10
  ------------------
  |  Branch (2943:5): [True: 0, False: 207]
  ------------------
 2944|      0|        subtree->printomat = sprint_realloc_null;
 2945|      0|        break;
 2946|      0|    case TYPE_BITSTRING:
  ------------------
  |  |  166|      0|#define TYPE_BITSTRING      12
  ------------------
  |  Branch (2946:5): [True: 0, False: 207]
  ------------------
 2947|      0|        subtree->printomat = sprint_realloc_bitstring;
 2948|      0|        break;
 2949|      0|    case TYPE_NSAPADDRESS:
  ------------------
  |  |  167|      0|#define TYPE_NSAPADDRESS    13
  ------------------
  |  Branch (2949:5): [True: 0, False: 207]
  ------------------
 2950|      0|        subtree->printomat = sprint_realloc_nsapaddress;
 2951|      0|        break;
 2952|      0|    case TYPE_COUNTER64:
  ------------------
  |  |  165|      0|#define TYPE_COUNTER64      11
  ------------------
  |  Branch (2952:5): [True: 0, False: 207]
  ------------------
 2953|      0|        subtree->printomat = sprint_realloc_counter64;
 2954|      0|        break;
 2955|      0|    case TYPE_UINTEGER:
  ------------------
  |  |  168|      0|#define TYPE_UINTEGER       14
  ------------------
  |  Branch (2955:5): [True: 0, False: 207]
  ------------------
 2956|      0|        subtree->printomat = sprint_realloc_uinteger;
 2957|      0|        break;
 2958|      0|    case TYPE_UNSIGNED32:
  ------------------
  |  |  169|      0|#define TYPE_UNSIGNED32     15
  ------------------
  |  Branch (2958:5): [True: 0, False: 207]
  ------------------
 2959|      0|        subtree->printomat = sprint_realloc_gauge;
 2960|      0|        break;
 2961|    207|    case TYPE_OTHER:
  ------------------
  |  |  154|    207|#define TYPE_OTHER          0
  ------------------
  |  Branch (2961:5): [True: 207, False: 0]
  ------------------
 2962|    207|    default:
  ------------------
  |  Branch (2962:5): [True: 0, False: 207]
  ------------------
 2963|    207|        subtree->printomat = sprint_realloc_by_type;
 2964|    207|        break;
 2965|    207|    }
 2966|    207|}

netsnmp_init_mib_internals:
  700|  3.45k|{
  701|  3.45k|    register struct tok *tp;
  702|  3.45k|    register int    b, i;
  703|  3.45k|    int             max_modc;
  704|       |
  705|  3.45k|    if (tree_head)
  ------------------
  |  Branch (705:9): [True: 3.38k, False: 69]
  ------------------
  706|  3.38k|        return;
  707|       |
  708|       |    /*
  709|       |     * Set up hash list of pre-defined tokens
  710|       |     */
  711|     69|    memset(buckets, 0, sizeof(buckets));
  712|  6.41k|    for (tp = tokens; tp->name; tp++) {
  ------------------
  |  Branch (712:23): [True: 6.34k, False: 69]
  ------------------
  713|  6.34k|        tp->hash = name_hash(tp->name);
  714|  6.34k|        b = BUCKET(tp->hash);
  ------------------
  |  |  527|  6.34k|#define BUCKET(x)       (x & (HASHSIZE-1))
  |  |  ------------------
  |  |  |  |  526|  6.34k|#define HASHSIZE        32
  |  |  ------------------
  ------------------
  715|  6.34k|        if (buckets[b])
  ------------------
  |  Branch (715:13): [True: 4.14k, False: 2.20k]
  ------------------
  716|  4.14k|            tp->next = buckets[b];      /* BUG ??? */
  717|  6.34k|        buckets[b] = tp;
  718|  6.34k|    }
  719|       |
  720|       |    /*
  721|       |     * Initialise other internal structures
  722|       |     */
  723|       |
  724|     69|    max_modc = sizeof(module_map) / sizeof(module_map[0]) - 1;
  725|  1.51k|    for (i = 0; i < max_modc; ++i)
  ------------------
  |  Branch (725:17): [True: 1.44k, False: 69]
  ------------------
  726|  1.44k|        module_map[i].next = &(module_map[i + 1]);
  727|     69|    module_map[max_modc].next = NULL;
  728|     69|    module_map_head = module_map;
  729|       |
  730|     69|    memset(nbuckets, 0, sizeof(nbuckets));
  731|     69|    memset(tbuckets, 0, sizeof(tbuckets));
  732|     69|    free(tclist);
  733|     69|    tc_alloc = TC_INCR;
  ------------------
  |  |  134|     69|#define TC_INCR 100
  ------------------
  734|     69|    tclist = calloc(tc_alloc, sizeof(struct tc));
  735|     69|    build_translation_table();
  736|     69|    init_tree_roots();          /* Set up initial roots */
  737|       |    /*
  738|       |     * Relies on 'add_mibdir' having set up the modules 
  739|       |     */
  740|     69|}
which_module:
 3801|    207|{
 3802|    207|    struct module  *mp;
 3803|       |
 3804|    207|    for (mp = module_head; mp; mp = mp->next)
  ------------------
  |  Branch (3804:28): [True: 0, False: 207]
  ------------------
 3805|      0|        if (!label_compare(mp->name, name))
  ------------------
  |  | 1236|      0|#define	label_compare	strcmp
  ------------------
  |  Branch (3805:13): [True: 0, False: 0]
  ------------------
 3806|      0|            return (mp->modid);
 3807|       |
 3808|    207|    DEBUGMSGTL(("parse-mibs", "Module %s not found\n", name));
  ------------------
  |  |   66|    207|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    207|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 207]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 207]
  |  |  ------------------
  ------------------
 3809|    207|    return (-1);
 3810|    207|}
adopt_orphans:
 3999|     69|{
 4000|     69|    struct node    *np = NULL, *onp;
 4001|     69|    struct tree    *tp;
 4002|     69|    int             i, adopted = 1;
 4003|       |
 4004|     69|    if (!orphan_nodes)
  ------------------
  |  Branch (4004:9): [True: 69, False: 0]
  ------------------
 4005|     69|        return;
 4006|      0|    init_node_hash(orphan_nodes);
 4007|      0|    orphan_nodes = NULL;
 4008|       |
 4009|      0|    while (adopted) {
  ------------------
  |  Branch (4009:12): [True: 0, False: 0]
  ------------------
 4010|      0|        adopted = 0;
 4011|      0|        for (i = 0; i < NHASHSIZE; i++)
  ------------------
  |  |  529|      0|#define NHASHSIZE    128
  ------------------
  |  Branch (4011:21): [True: 0, False: 0]
  ------------------
 4012|      0|            if (nbuckets[i]) {
  ------------------
  |  Branch (4012:17): [True: 0, False: 0]
  ------------------
 4013|      0|                for (np = nbuckets[i]; np != NULL; np = np->next) {
  ------------------
  |  Branch (4013:40): [True: 0, False: 0]
  ------------------
 4014|      0|                    tp = find_tree_node(np->parent, -1);
 4015|      0|		    if (tp) {
  ------------------
  |  Branch (4015:11): [True: 0, False: 0]
  ------------------
 4016|      0|			do_subtree(tp, &np);
 4017|      0|			adopted = 1;
 4018|       |                        /*
 4019|       |                         * if do_subtree adopted the entire bucket, stop
 4020|       |                         */
 4021|      0|                        if(NULL == nbuckets[i])
  ------------------
  |  Branch (4021:28): [True: 0, False: 0]
  ------------------
 4022|      0|                            break;
 4023|       |
 4024|       |                        /*
 4025|       |                         * do_subtree may modify nbuckets, and if np
 4026|       |                         * was adopted, np->next probably isn't an orphan
 4027|       |                         * anymore. if np is still in the bucket (do_subtree
 4028|       |                         * didn't adopt it) keep on plugging. otherwise
 4029|       |                         * start over, at the top of the bucket.
 4030|       |                         */
 4031|      0|                        for(onp = nbuckets[i]; onp; onp = onp->next)
  ------------------
  |  Branch (4031:48): [True: 0, False: 0]
  ------------------
 4032|      0|                            if(onp == np)
  ------------------
  |  Branch (4032:32): [True: 0, False: 0]
  ------------------
 4033|      0|                                break;
 4034|      0|                        if(NULL == onp) { /* not in the list */
  ------------------
  |  Branch (4034:28): [True: 0, False: 0]
  ------------------
 4035|      0|                            np = nbuckets[i]; /* start over */
 4036|      0|                        }
 4037|      0|		    }
 4038|      0|		}
 4039|      0|            }
 4040|      0|    }
 4041|       |
 4042|       |    /*
 4043|       |     * Report on outstanding orphans
 4044|       |     *    and link them back into the orphan list
 4045|       |     */
 4046|      0|    for (i = 0; i < NHASHSIZE; i++)
  ------------------
  |  |  529|      0|#define NHASHSIZE    128
  ------------------
  |  Branch (4046:17): [True: 0, False: 0]
  ------------------
 4047|      0|        if (nbuckets[i]) {
  ------------------
  |  Branch (4047:13): [True: 0, False: 0]
  ------------------
 4048|      0|            if (orphan_nodes)
  ------------------
  |  Branch (4048:17): [True: 0, False: 0]
  ------------------
 4049|      0|                onp = np->next = nbuckets[i];
 4050|      0|            else
 4051|      0|                onp = orphan_nodes = nbuckets[i];
 4052|      0|            nbuckets[i] = NULL;
 4053|      0|            while (onp) {
  ------------------
  |  Branch (4053:20): [True: 0, False: 0]
  ------------------
 4054|      0|                char            modbuf[256];
 4055|      0|                snmp_log(LOG_WARNING,
 4056|      0|                         "Cannot resolve OID in %s: %s ::= { %s %ld } at line %d in %s\n",
 4057|      0|                         module_name(onp->modid, modbuf),
 4058|      0|                         (onp->label ? onp->label : "<no label>"),
  ------------------
  |  Branch (4058:27): [True: 0, False: 0]
  ------------------
 4059|      0|                         (onp->parent ? onp->parent : "<no parent>"),
  ------------------
  |  Branch (4059:27): [True: 0, False: 0]
  ------------------
 4060|      0|                         onp->subid, onp->lineno, onp->filename);
 4061|      0|                np = onp;
 4062|      0|                onp = onp->next;
 4063|      0|            }
 4064|      0|        }
 4065|      0|}
netsnmp_read_module:
 4077|  3.24k|{
 4078|  3.24k|    int status = 0;
 4079|  3.24k|    status = read_module_internal(name);
 4080|       |
 4081|  3.24k|    if (status == MODULE_NOT_FOUND) {
  ------------------
  |  |  513|  3.24k|#define MODULE_NOT_FOUND	0
  ------------------
  |  Branch (4081:9): [True: 3.24k, False: 0]
  ------------------
 4082|  3.24k|        if (!read_module_replacements(name))
  ------------------
  |  Branch (4082:13): [True: 3.24k, False: 0]
  ------------------
 4083|  3.24k|            print_module_not_found(name);
 4084|  3.24k|    } else if (status == MODULE_SYNTAX_ERROR) {
  ------------------
  |  |  520|      0|#define MODULE_SYNTAX_ERROR     4
  ------------------
  |  Branch (4084:16): [True: 0, False: 0]
  ------------------
 4085|      0|        gMibError = 0;
 4086|      0|        gLoop = 1;
 4087|       |
 4088|      0|        strncat(gMibNames, " ", sizeof(gMibNames) - strlen(gMibNames) - 1);
 4089|      0|        strncat(gMibNames, name, sizeof(gMibNames) - strlen(gMibNames) - 1);
 4090|      0|    }
 4091|       |
 4092|  3.24k|    return tree_head;
 4093|  3.24k|}
unload_module_by_ID:
 4102|     69|{
 4103|     69|    struct tree    *tp, *next;
 4104|     69|    int             i;
 4105|       |
 4106|    276|    for (tp = tree_top; tp; tp = next) {
  ------------------
  |  Branch (4106:25): [True: 207, False: 69]
  ------------------
 4107|       |        /*
 4108|       |         * Essentially, this is equivalent to the code fragment:
 4109|       |         *      if (tp->modID == modID)
 4110|       |         *        tp->number_modules--;
 4111|       |         * but handles one tree node being part of several modules,
 4112|       |         * and possible multiple copies of the same module ID.
 4113|       |         */
 4114|    207|        int             nmod = tp->number_modules;
 4115|    207|        if (nmod > 0) {         /* in some module */
  ------------------
  |  Branch (4115:13): [True: 207, False: 0]
  ------------------
 4116|       |            /*
 4117|       |             * Remove all copies of this module ID
 4118|       |             */
 4119|    207|            int             cnt = 0, *pi1, *pi2 = tp->module_list;
 4120|    414|            for (i = 0, pi1 = pi2; i < nmod; i++, pi2++) {
  ------------------
  |  Branch (4120:36): [True: 207, False: 207]
  ------------------
 4121|    207|                if (*pi2 == modID)
  ------------------
  |  Branch (4121:21): [True: 207, False: 0]
  ------------------
 4122|    207|                    continue;
 4123|      0|                cnt++;
 4124|      0|                *pi1++ = *pi2;
 4125|      0|            }
 4126|    207|            if (nmod != cnt) {  /* in this module */
  ------------------
  |  Branch (4126:17): [True: 207, False: 0]
  ------------------
 4127|       |                /*
 4128|       |                 * if ( (nmod - cnt) > 1)
 4129|       |                 * printf("Dup modid %d,  %d times, '%s'\n", tp->modid, (nmod-cnt), tp->label); fflush(stdout); ?* XXDEBUG 
 4130|       |                 */
 4131|    207|                tp->number_modules = cnt;
 4132|    207|                switch (cnt) {
 4133|    207|                case 0:
  ------------------
  |  Branch (4133:17): [True: 207, False: 0]
  ------------------
 4134|    207|                    tp->module_list[0] = -1;    /* Mark unused, */
 4135|    207|		    NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2408|    207|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 4136|       |
 4137|    207|                case 1:        /* save the remaining module */
  ------------------
  |  Branch (4137:17): [True: 0, False: 207]
  ------------------
 4138|    207|                    if (&(tp->modid) != tp->module_list) {
  ------------------
  |  Branch (4138:25): [True: 0, False: 207]
  ------------------
 4139|      0|                        tp->modid = tp->module_list[0];
 4140|      0|                        free(tp->module_list);
 4141|      0|                        tp->module_list = &(tp->modid);
 4142|      0|                    }
 4143|    207|                    break;
 4144|       |
 4145|      0|                default:
  ------------------
  |  Branch (4145:17): [True: 0, False: 207]
  ------------------
 4146|      0|                    break;
 4147|    207|                }
 4148|    207|            }                   /* if tree node is in this module */
 4149|    207|        }
 4150|       |        /*
 4151|       |         * if tree node is in some module 
 4152|       |         */
 4153|    207|        next = tp->next_peer;
 4154|       |
 4155|       |
 4156|       |        /*
 4157|       |         *  OK - that's dealt with *this* node.
 4158|       |         *    Now let's look at the children.
 4159|       |         *    (Isn't recursion wonderful!)
 4160|       |         */
 4161|    207|        if (tp->child_list)
  ------------------
  |  Branch (4161:13): [True: 0, False: 207]
  ------------------
 4162|      0|            unload_module_by_ID(modID, tp->child_list);
 4163|       |
 4164|       |
 4165|    207|        if (tp->number_modules == 0) {
  ------------------
  |  Branch (4165:13): [True: 207, False: 0]
  ------------------
 4166|       |            /*
 4167|       |             * This node isn't needed any more (except perhaps
 4168|       |             * for the sake of the children) 
 4169|       |             */
 4170|    207|            if (tp->child_list == NULL) {
  ------------------
  |  Branch (4170:17): [True: 207, False: 0]
  ------------------
 4171|    207|                unlink_tree(tp);
 4172|    207|                free_tree(tp);
 4173|    207|            } else {
 4174|      0|                free_partial_tree(tp, TRUE);
  ------------------
  |  |  128|      0|#define TRUE  1
  ------------------
 4175|      0|            }
 4176|    207|        }
 4177|    207|    }
 4178|     69|}
unload_all_mibs:
 4215|     69|{
 4216|     69|    struct module  *mp;
 4217|     69|    struct module_compatability *mcp;
 4218|     69|    struct tc      *ptc;
 4219|     69|    unsigned int    i;
 4220|       |
 4221|     69|    for (mcp = module_map_head; mcp; mcp = module_map_head) {
  ------------------
  |  Branch (4221:33): [True: 69, False: 0]
  ------------------
 4222|     69|        if (mcp == module_map)
  ------------------
  |  Branch (4222:13): [True: 69, False: 0]
  ------------------
 4223|     69|            break;
 4224|      0|        module_map_head = mcp->next;
 4225|      0|        if (mcp->tag) free(NETSNMP_REMOVE_CONST(char *, mcp->tag));
  ------------------
  |  |   91|      0|    (__extension__ ({ const t tmp = (e); (t)(size_t)tmp; }))
  ------------------
  |  Branch (4225:13): [True: 0, False: 0]
  ------------------
 4226|      0|        free(NETSNMP_REMOVE_CONST(char *, mcp->old_module));
  ------------------
  |  |   91|      0|    (__extension__ ({ const t tmp = (e); (t)(size_t)tmp; }))
  ------------------
 4227|      0|        free(NETSNMP_REMOVE_CONST(char *, mcp->new_module));
  ------------------
  |  |   91|      0|    (__extension__ ({ const t tmp = (e); (t)(size_t)tmp; }))
  ------------------
 4228|      0|        free(mcp);
 4229|      0|    }
 4230|       |
 4231|     69|    for (mp = module_head; mp; mp = module_head) {
  ------------------
  |  Branch (4231:28): [True: 0, False: 69]
  ------------------
 4232|      0|        struct module_import *mi = mp->imports;
 4233|      0|        if (mi) {
  ------------------
  |  Branch (4233:13): [True: 0, False: 0]
  ------------------
 4234|      0|            for (i = 0; i < (unsigned int)mp->no_imports; ++i) {
  ------------------
  |  Branch (4234:25): [True: 0, False: 0]
  ------------------
 4235|      0|                SNMP_FREE((mi + i)->label);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4236|      0|            }
 4237|      0|            mp->no_imports = 0;
 4238|      0|            if (mi == root_imports)
  ------------------
  |  Branch (4238:17): [True: 0, False: 0]
  ------------------
 4239|      0|                memset(mi, 0, sizeof(*mi));
 4240|      0|            else
 4241|      0|                free(mi);
 4242|      0|        }
 4243|       |
 4244|      0|        unload_module_by_ID(mp->modid, tree_head);
 4245|      0|        module_head = mp->next;
 4246|      0|        free(mp->name);
 4247|      0|        free(mp->file);
 4248|      0|        free(mp);
 4249|      0|    }
 4250|     69|    unload_module_by_ID(-1, tree_head);
 4251|       |    /*
 4252|       |     * tree nodes are cleared 
 4253|       |     */
 4254|       |
 4255|  6.96k|    for (i = 0, ptc = tclist; i < tc_alloc; i++, ptc++) {
  ------------------
  |  Branch (4255:31): [True: 6.90k, False: 69]
  ------------------
 4256|  6.90k|        if (ptc->type == 0)
  ------------------
  |  Branch (4256:13): [True: 6.90k, False: 0]
  ------------------
 4257|  6.90k|            continue;
 4258|      0|        free_enums(&ptc->enums);
 4259|      0|        free_ranges(&ptc->ranges);
 4260|      0|        free(ptc->descriptor);
 4261|      0|        if (ptc->hint)
  ------------------
  |  Branch (4261:13): [True: 0, False: 0]
  ------------------
 4262|      0|            free(ptc->hint);
 4263|      0|        if (ptc->description)
  ------------------
  |  Branch (4263:13): [True: 0, False: 0]
  ------------------
 4264|      0|            free(ptc->description);
 4265|      0|    }
 4266|     69|    SNMP_FREE(tclist);
  ------------------
  |  |   62|     69|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 69, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 69]
  |  |  ------------------
  ------------------
 4267|     69|    tc_alloc = 0;
 4268|       |
 4269|     69|    memset(buckets, 0, sizeof(buckets));
 4270|     69|    memset(nbuckets, 0, sizeof(nbuckets));
 4271|     69|    memset(tbuckets, 0, sizeof(tbuckets));
 4272|       |
 4273|    276|    for (i = 0; i < sizeof(root_imports) / sizeof(root_imports[0]); i++) {
  ------------------
  |  Branch (4273:17): [True: 207, False: 69]
  ------------------
 4274|    207|        SNMP_FREE(root_imports[i].label);
  ------------------
  |  |   62|    207|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 207, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 207]
  |  |  ------------------
  ------------------
 4275|    207|    }
 4276|       |
 4277|     69|    max_module = 0;
 4278|     69|    current_module = 0;
 4279|     69|    module_map_head = NULL;
 4280|       |    SNMP_FREE(last_err_module);
  ------------------
  |  |   62|     69|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 69, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 69]
  |  |  ------------------
  ------------------
 4281|     69|}
add_mibdir:
 5064|     69|{
 5065|     69|    const char     *oldFile = File;
 5066|     69|    char          **filenames;
 5067|     69|    int             count = 0;
 5068|     69|    int             filename_count, i;
 5069|       |
 5070|     69|    DEBUGMSGTL(("parse-mibs", "Scanning directory %s\n", dirname));
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
 5071|       |
 5072|     69|    filename_count = scan_directory(&filenames, dirname);
 5073|       |
 5074|     69|    if (filename_count >= 0) {
  ------------------
  |  Branch (5074:9): [True: 0, False: 69]
  ------------------
 5075|      0|        for (i = 0; i < filename_count; i++) {
  ------------------
  |  Branch (5075:21): [True: 0, False: 0]
  ------------------
 5076|      0|            if (add_mibfile(filenames[i], strrchr(filenames[i], '/')) == 0)
  ------------------
  |  Branch (5076:17): [True: 0, False: 0]
  ------------------
 5077|      0|                count++;
 5078|      0|	    free(filenames[i]);
 5079|      0|        }
 5080|      0|        File = oldFile;
 5081|      0|        free(filenames);
 5082|      0|        return (count);
 5083|      0|    }
 5084|     69|    else
 5085|     69|        DEBUGMSGTL(("parse-mibs","cannot open MIB directory %s\n", dirname));
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
 5086|       |
 5087|     69|    return (-1);
 5088|     69|}
parse.c:name_hash:
  687|  6.76k|{
  688|  6.76k|    int             hash = 0;
  689|  6.76k|    const char     *cp;
  690|       |
  691|  6.76k|    if (!name)
  ------------------
  |  Branch (691:9): [True: 0, False: 6.76k]
  ------------------
  692|      0|        return 0;
  693|  70.9k|    for (cp = name; *cp; cp++)
  ------------------
  |  Branch (693:21): [True: 64.1k, False: 6.76k]
  ------------------
  694|  64.1k|        hash += tolower((unsigned char)(*cp));
  ------------------
  |  Branch (694:17): [True: 0, False: 0]
  |  Branch (694:17): [True: 0, False: 0]
  |  Branch (694:17): [Folded, False: 64.1k]
  ------------------
  695|  6.76k|    return (hash);
  696|  6.76k|}
parse.c:build_translation_table:
 1071|     69|{
 1072|     69|    int             count;
 1073|       |
 1074|  17.7k|    for (count = 0; count < 256; count++) {
  ------------------
  |  Branch (1074:21): [True: 17.6k, False: 69]
  ------------------
 1075|  17.6k|        switch (count) {
 1076|     69|        case OBJID:
  ------------------
  |  |  167|     69|#define OBJID       (4 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     69|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1076:9): [True: 69, False: 17.5k]
  ------------------
 1077|     69|            translation_table[count] = TYPE_OBJID;
  ------------------
  |  |  155|     69|#define TYPE_OBJID          1
  ------------------
 1078|     69|            break;
 1079|     69|        case OCTETSTR:
  ------------------
  |  |  168|     69|#define OCTETSTR    (5 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     69|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1079:9): [True: 69, False: 17.5k]
  ------------------
 1080|     69|            translation_table[count] = TYPE_OCTETSTR;
  ------------------
  |  |  156|     69|#define TYPE_OCTETSTR       2
  ------------------
 1081|     69|            break;
 1082|     69|        case INTEGER:
  ------------------
  |  |  169|     69|#define INTEGER     (6 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     69|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1082:9): [True: 69, False: 17.5k]
  ------------------
 1083|     69|            translation_table[count] = TYPE_INTEGER;
  ------------------
  |  |  157|     69|#define TYPE_INTEGER        3
  ------------------
 1084|     69|            break;
 1085|     69|        case NETADDR:
  ------------------
  |  |  170|     69|#define NETADDR     (7 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     69|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1085:9): [True: 69, False: 17.5k]
  ------------------
 1086|     69|            translation_table[count] = TYPE_NETADDR;
  ------------------
  |  |  158|     69|#define TYPE_NETADDR        4
  ------------------
 1087|     69|            break;
 1088|     69|        case IPADDR:
  ------------------
  |  |  171|     69|#define IPADDR      (8 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     69|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1088:9): [True: 69, False: 17.5k]
  ------------------
 1089|     69|            translation_table[count] = TYPE_IPADDR;
  ------------------
  |  |  159|     69|#define TYPE_IPADDR         5
  ------------------
 1090|     69|            break;
 1091|     69|        case COUNTER:
  ------------------
  |  |  172|     69|#define COUNTER     (9 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     69|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1091:9): [True: 69, False: 17.5k]
  ------------------
 1092|     69|            translation_table[count] = TYPE_COUNTER;
  ------------------
  |  |  160|     69|#define TYPE_COUNTER        6
  ------------------
 1093|     69|            break;
 1094|     69|        case GAUGE:
  ------------------
  |  |  173|     69|#define GAUGE       (10 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     69|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1094:9): [True: 69, False: 17.5k]
  ------------------
 1095|     69|            translation_table[count] = TYPE_GAUGE;
  ------------------
  |  |  161|     69|#define TYPE_GAUGE          7
  ------------------
 1096|     69|            break;
 1097|     69|        case TIMETICKS:
  ------------------
  |  |  174|     69|#define TIMETICKS   (11 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     69|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1097:9): [True: 69, False: 17.5k]
  ------------------
 1098|     69|            translation_table[count] = TYPE_TIMETICKS;
  ------------------
  |  |  162|     69|#define TYPE_TIMETICKS      8
  ------------------
 1099|     69|            break;
 1100|     69|        case KW_OPAQUE:
  ------------------
  |  |  175|     69|#define KW_OPAQUE   (12 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     69|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1100:9): [True: 69, False: 17.5k]
  ------------------
 1101|     69|            translation_table[count] = TYPE_OPAQUE;
  ------------------
  |  |  163|     69|#define TYPE_OPAQUE         9
  ------------------
 1102|     69|            break;
 1103|     69|        case NUL:
  ------------------
  |  |  176|     69|#define NUL         (13 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     69|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1103:9): [True: 69, False: 17.5k]
  ------------------
 1104|     69|            translation_table[count] = TYPE_NULL;
  ------------------
  |  |  164|     69|#define TYPE_NULL           10
  ------------------
 1105|     69|            break;
 1106|     69|        case COUNTER64:
  ------------------
  |  |  211|     69|#define COUNTER64   (43 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     69|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1106:9): [True: 69, False: 17.5k]
  ------------------
 1107|     69|            translation_table[count] = TYPE_COUNTER64;
  ------------------
  |  |  165|     69|#define TYPE_COUNTER64      11
  ------------------
 1108|     69|            break;
 1109|     69|        case BITSTRING:
  ------------------
  |  |  209|     69|#define BITSTRING   (41 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     69|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1109:9): [True: 69, False: 17.5k]
  ------------------
 1110|     69|            translation_table[count] = TYPE_BITSTRING;
  ------------------
  |  |  166|     69|#define TYPE_BITSTRING      12
  ------------------
 1111|     69|            break;
 1112|     69|        case NSAPADDRESS:
  ------------------
  |  |  210|     69|#define NSAPADDRESS (42 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     69|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1112:9): [True: 69, False: 17.5k]
  ------------------
 1113|     69|            translation_table[count] = TYPE_NSAPADDRESS;
  ------------------
  |  |  167|     69|#define TYPE_NSAPADDRESS    13
  ------------------
 1114|     69|            break;
 1115|     69|        case INTEGER32:
  ------------------
  |  |  274|     69|#define INTEGER32	(105 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     69|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1115:9): [True: 69, False: 17.5k]
  ------------------
 1116|     69|            translation_table[count] = TYPE_INTEGER32;
  ------------------
  |  |  170|     69|#define TYPE_INTEGER32      16
  ------------------
 1117|     69|            break;
 1118|     69|        case UINTEGER32:
  ------------------
  |  |  224|     69|#define UINTEGER32 (56 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     69|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1118:9): [True: 69, False: 17.5k]
  ------------------
 1119|     69|            translation_table[count] = TYPE_UINTEGER;
  ------------------
  |  |  168|     69|#define TYPE_UINTEGER       14
  ------------------
 1120|     69|            break;
 1121|     69|        case UNSIGNED32:
  ------------------
  |  |  273|     69|#define UNSIGNED32	(104 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|     69|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1121:9): [True: 69, False: 17.5k]
  ------------------
 1122|     69|            translation_table[count] = TYPE_UNSIGNED32;
  ------------------
  |  |  169|     69|#define TYPE_UNSIGNED32     15
  ------------------
 1123|     69|            break;
 1124|     69|        case TRAPTYPE:
  ------------------
  |  |  229|     69|#define TRAPTYPE    61
  ------------------
  |  Branch (1124:9): [True: 69, False: 17.5k]
  ------------------
 1125|     69|            translation_table[count] = TYPE_TRAPTYPE;
  ------------------
  |  |  174|     69|#define TYPE_TRAPTYPE	    20
  ------------------
 1126|     69|            break;
 1127|     69|        case NOTIFTYPE:
  ------------------
  |  |  213|     69|#define NOTIFTYPE   45
  ------------------
  |  Branch (1127:9): [True: 69, False: 17.5k]
  ------------------
 1128|     69|            translation_table[count] = TYPE_NOTIFTYPE;
  ------------------
  |  |  175|     69|#define TYPE_NOTIFTYPE      21
  ------------------
 1129|     69|            break;
 1130|     69|        case NOTIFGROUP:
  ------------------
  |  |  258|     69|#define NOTIFGROUP  88
  ------------------
  |  Branch (1130:9): [True: 69, False: 17.5k]
  ------------------
 1131|     69|            translation_table[count] = TYPE_NOTIFGROUP;
  ------------------
  |  |  177|     69|#define TYPE_NOTIFGROUP	    23
  ------------------
 1132|     69|            break;
 1133|     69|        case OBJGROUP:
  ------------------
  |  |  212|     69|#define OBJGROUP    44
  ------------------
  |  Branch (1133:9): [True: 69, False: 17.5k]
  ------------------
 1134|     69|            translation_table[count] = TYPE_OBJGROUP;
  ------------------
  |  |  176|     69|#define TYPE_OBJGROUP	    22
  ------------------
 1135|     69|            break;
 1136|     69|        case MODULEIDENTITY:
  ------------------
  |  |  220|     69|#define MODULEIDENTITY 52
  ------------------
  |  Branch (1136:9): [True: 69, False: 17.5k]
  ------------------
 1137|     69|            translation_table[count] = TYPE_MODID;
  ------------------
  |  |  178|     69|#define TYPE_MODID	    24
  ------------------
 1138|     69|            break;
 1139|     69|        case OBJIDENTITY:
  ------------------
  |  |  275|     69|#define OBJIDENTITY	106
  ------------------
  |  Branch (1139:9): [True: 69, False: 17.5k]
  ------------------
 1140|     69|            translation_table[count] = TYPE_OBJIDENTITY;
  ------------------
  |  |  181|     69|#define TYPE_OBJIDENTITY    27
  ------------------
 1141|     69|            break;
 1142|     69|        case AGENTCAP:
  ------------------
  |  |  243|     69|#define AGENTCAP    73
  ------------------
  |  Branch (1142:9): [True: 69, False: 17.5k]
  ------------------
 1143|     69|            translation_table[count] = TYPE_AGENTCAP;
  ------------------
  |  |  179|     69|#define TYPE_AGENTCAP       25
  ------------------
 1144|     69|            break;
 1145|     69|        case COMPLIANCE:
  ------------------
  |  |  215|     69|#define COMPLIANCE  47
  ------------------
  |  Branch (1145:9): [True: 69, False: 17.5k]
  ------------------
 1146|     69|            translation_table[count] = TYPE_MODCOMP;
  ------------------
  |  |  180|     69|#define TYPE_MODCOMP        26
  ------------------
 1147|     69|            break;
 1148|  16.0k|        default:
  ------------------
  |  Branch (1148:9): [True: 16.0k, False: 1.65k]
  ------------------
 1149|  16.0k|            translation_table[count] = TYPE_OTHER;
  ------------------
  |  |  154|  16.0k|#define TYPE_OTHER          0
  ------------------
 1150|  16.0k|            break;
 1151|  17.6k|        }
 1152|  17.6k|    }
 1153|     69|}
parse.c:init_tree_roots:
 1157|     69|{
 1158|     69|    struct tree    *tp, *lasttp;
 1159|     69|    int             base_modid;
 1160|     69|    int             hash;
 1161|       |
 1162|     69|    base_modid = which_module("SNMPv2-SMI");
 1163|     69|    if (base_modid == -1)
  ------------------
  |  Branch (1163:9): [True: 69, False: 0]
  ------------------
 1164|     69|        base_modid = which_module("RFC1155-SMI");
 1165|     69|    if (base_modid == -1)
  ------------------
  |  Branch (1165:9): [True: 69, False: 0]
  ------------------
 1166|     69|        base_modid = which_module("RFC1213-MIB");
 1167|       |
 1168|       |    /*
 1169|       |     * build root node 
 1170|       |     */
 1171|     69|    tp = calloc(1, sizeof(struct tree));
 1172|     69|    if (tp == NULL)
  ------------------
  |  Branch (1172:9): [True: 0, False: 69]
  ------------------
 1173|      0|        return;
 1174|     69|    tp->label = strdup("joint-iso-ccitt");
 1175|     69|    tp->modid = base_modid;
 1176|     69|    tp->number_modules = 1;
 1177|     69|    tp->module_list = &(tp->modid);
 1178|     69|    tp->subid = 2;
 1179|     69|    tp->tc_index = -1;
 1180|     69|    set_function(tp);           /* from mib.c */
 1181|     69|    hash = NBUCKET(name_hash(tp->label));
  ------------------
  |  |  530|     69|#define NBUCKET(x)   (x & (NHASHSIZE-1))
  |  |  ------------------
  |  |  |  |  529|     69|#define NHASHSIZE    128
  |  |  ------------------
  ------------------
 1182|     69|    tp->next = tbuckets[hash];
 1183|     69|    tbuckets[hash] = tp;
 1184|     69|    lasttp = tp;
 1185|     69|    root_imports[0].label = strdup(tp->label);
 1186|     69|    root_imports[0].modid = base_modid;
 1187|       |
 1188|       |    /*
 1189|       |     * build root node 
 1190|       |     */
 1191|     69|    tp = calloc(1, sizeof(struct tree));
 1192|     69|    if (tp == NULL)
  ------------------
  |  Branch (1192:9): [True: 0, False: 69]
  ------------------
 1193|      0|        return;
 1194|     69|    tp->next_peer = lasttp;
 1195|     69|    tp->label = strdup("ccitt");
 1196|     69|    tp->modid = base_modid;
 1197|     69|    tp->number_modules = 1;
 1198|     69|    tp->module_list = &(tp->modid);
 1199|     69|    tp->subid = 0;
 1200|     69|    tp->tc_index = -1;
 1201|     69|    set_function(tp);           /* from mib.c */
 1202|     69|    hash = NBUCKET(name_hash(tp->label));
  ------------------
  |  |  530|     69|#define NBUCKET(x)   (x & (NHASHSIZE-1))
  |  |  ------------------
  |  |  |  |  529|     69|#define NHASHSIZE    128
  |  |  ------------------
  ------------------
 1203|     69|    tp->next = tbuckets[hash];
 1204|     69|    tbuckets[hash] = tp;
 1205|     69|    lasttp = tp;
 1206|     69|    root_imports[1].label = strdup(tp->label);
 1207|     69|    root_imports[1].modid = base_modid;
 1208|       |
 1209|       |    /*
 1210|       |     * build root node 
 1211|       |     */
 1212|     69|    tp = calloc(1, sizeof(struct tree));
 1213|     69|    if (tp == NULL)
  ------------------
  |  Branch (1213:9): [True: 0, False: 69]
  ------------------
 1214|      0|        return;
 1215|     69|    tp->next_peer = lasttp;
 1216|     69|    tp->label = strdup("iso");
 1217|     69|    tp->modid = base_modid;
 1218|     69|    tp->number_modules = 1;
 1219|     69|    tp->module_list = &(tp->modid);
 1220|     69|    tp->subid = 1;
 1221|     69|    tp->tc_index = -1;
 1222|     69|    set_function(tp);           /* from mib.c */
 1223|     69|    hash = NBUCKET(name_hash(tp->label));
  ------------------
  |  |  530|     69|#define NBUCKET(x)   (x & (NHASHSIZE-1))
  |  |  ------------------
  |  |  |  |  529|     69|#define NHASHSIZE    128
  |  |  ------------------
  ------------------
 1224|     69|    tp->next = tbuckets[hash];
 1225|     69|    tbuckets[hash] = tp;
 1226|     69|    lasttp = tp;
 1227|     69|    root_imports[2].label = strdup(tp->label);
 1228|     69|    root_imports[2].modid = base_modid;
 1229|       |
 1230|     69|    tree_head = tp;
 1231|     69|}
parse.c:unlink_tbucket:
  830|    207|{
  831|    207|    int             hash = NBUCKET(name_hash(tp->label));
  ------------------
  |  |  530|    207|#define NBUCKET(x)   (x & (NHASHSIZE-1))
  |  |  ------------------
  |  |  |  |  529|    207|#define NHASHSIZE    128
  |  |  ------------------
  ------------------
  832|    207|    struct tree    *otp = NULL, *ntp = tbuckets[hash];
  833|       |
  834|    207|    while (ntp && ntp != tp) {
  ------------------
  |  Branch (834:12): [True: 207, False: 0]
  |  Branch (834:19): [True: 0, False: 207]
  ------------------
  835|      0|        otp = ntp;
  836|      0|        ntp = ntp->next;
  837|      0|    }
  838|    207|    if (!ntp)
  ------------------
  |  Branch (838:9): [True: 0, False: 207]
  ------------------
  839|      0|        snmp_log(LOG_EMERG, "Can't find %s in tbuckets\n", tp->label);
  840|    207|    else if (otp)
  ------------------
  |  Branch (840:14): [True: 0, False: 207]
  ------------------
  841|      0|        otp->next = ntp->next;
  842|    207|    else
  843|    207|        tbuckets[hash] = tp->next;
  844|    207|}
parse.c:free_indexes:
 5298|    207|{
 5299|    207|    if (spp && *spp) {
  ------------------
  |  Branch (5299:9): [True: 207, False: 0]
  |  Branch (5299:16): [True: 0, False: 207]
  ------------------
 5300|      0|        struct index_list *pp, *npp;
 5301|       |
 5302|      0|        pp = *spp;
 5303|      0|        *spp = NULL;
 5304|       |
 5305|      0|        while (pp) {
  ------------------
  |  Branch (5305:16): [True: 0, False: 0]
  ------------------
 5306|      0|            npp = pp->next;
 5307|      0|            if (pp->ilabel)
  ------------------
  |  Branch (5307:17): [True: 0, False: 0]
  ------------------
 5308|      0|                free(pp->ilabel);
 5309|      0|            free(pp);
 5310|      0|            pp = npp;
 5311|      0|        }
 5312|      0|    }
 5313|    207|}
parse.c:free_varbinds:
 5317|    207|{
 5318|    207|    if (spp && *spp) {
  ------------------
  |  Branch (5318:9): [True: 207, False: 0]
  |  Branch (5318:16): [True: 0, False: 207]
  ------------------
 5319|      0|        struct varbind_list *pp, *npp;
 5320|       |
 5321|      0|        pp = *spp;
 5322|      0|        *spp = NULL;
 5323|       |
 5324|      0|        while (pp) {
  ------------------
  |  Branch (5324:16): [True: 0, False: 0]
  ------------------
 5325|      0|            npp = pp->next;
 5326|      0|            if (pp->vblabel)
  ------------------
  |  Branch (5326:17): [True: 0, False: 0]
  ------------------
 5327|      0|                free(pp->vblabel);
 5328|      0|            free(pp);
 5329|      0|            pp = npp;
 5330|      0|        }
 5331|      0|    }
 5332|    207|}
parse.c:read_module_internal:
 3985|  3.24k|{
 3986|  3.24k|    struct module  *mp;
 3987|       |
 3988|  3.24k|    netsnmp_init_mib_internals();
 3989|       |
 3990|  3.24k|    for (mp = module_head; mp; mp = mp->next)
  ------------------
  |  Branch (3990:28): [True: 0, False: 3.24k]
  ------------------
 3991|      0|        if (!label_compare(mp->name, name))
  ------------------
  |  | 1236|      0|#define	label_compare	strcmp
  ------------------
  |  Branch (3991:13): [True: 0, False: 0]
  ------------------
 3992|      0|            return read_from_file(mp, name);
 3993|       |
 3994|  3.24k|    return MODULE_NOT_FOUND;
  ------------------
  |  |  513|  3.24k|#define MODULE_NOT_FOUND	0
  ------------------
 3995|  3.24k|}
parse.c:print_error:
  780|  3.24k|{
  781|  3.24k|    erroneousMibs++;
  782|  3.24k|    if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|  3.24k|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (782:9): [True: 0, False: 3.24k]
  ------------------
  783|  3.24k|                                NETSNMP_DS_LIB_MIB_ERRORS))
  ------------------
  |  |   59|  3.24k|#define NETSNMP_DS_LIB_MIB_ERRORS          0
  ------------------
  784|      0|	return;
  785|  3.24k|    DEBUGMSGTL(("parse-mibs", "\n"));
  ------------------
  |  |   66|  3.24k|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  3.24k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3.24k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 3.24k]
  |  |  ------------------
  ------------------
  786|  3.24k|    if (type == ENDOFFILE)
  ------------------
  |  |  163|  3.24k|#define ENDOFFILE   0
  ------------------
  |  Branch (786:9): [True: 0, False: 3.24k]
  ------------------
  787|      0|        snmp_log(LOG_ERR, "%s (EOF): At line %d in %s\n", str, mibLine,
  788|      0|                 File);
  789|  3.24k|    else if (token && *token)
  ------------------
  |  Branch (789:14): [True: 3.24k, False: 0]
  |  Branch (789:23): [True: 3.24k, False: 0]
  ------------------
  790|  3.24k|        snmp_log(LOG_ERR, "%s (%s): At line %d in %s\n", str, token,
  791|  3.24k|                 mibLine, File);
  792|      0|    else
  793|      0|        snmp_log(LOG_ERR, "%s: At line %d in %s\n", str, mibLine, File);
  794|  3.24k|}
parse.c:read_module_replacements:
 3865|  3.24k|{
 3866|  3.24k|    struct module_compatability *mcp;
 3867|       |
 3868|  74.5k|    for (mcp = module_map_head; mcp; mcp = mcp->next) {
  ------------------
  |  Branch (3868:33): [True: 71.3k, False: 3.24k]
  ------------------
 3869|  71.3k|        if (!label_compare(mcp->old_module, name)) {
  ------------------
  |  | 1236|  71.3k|#define	label_compare	strcmp
  ------------------
  |  Branch (3869:13): [True: 0, False: 71.3k]
  ------------------
 3870|      0|            if (netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (3870:17): [True: 0, False: 0]
  ------------------
 3871|      0|				   NETSNMP_DS_LIB_MIB_WARNINGS)) {
  ------------------
  |  |  114|      0|#define NETSNMP_DS_LIB_MIB_WARNINGS         0
  ------------------
 3872|      0|                snmp_log(LOG_WARNING,
 3873|      0|                         "Loading replacement module %s for %s (%s)\n",
 3874|      0|                         mcp->new_module, name, File);
 3875|      0|	    }
 3876|      0|            (void) netsnmp_read_module(mcp->new_module);
 3877|      0|            return 1;
 3878|      0|        }
 3879|  71.3k|    }
 3880|  3.24k|    return 0;
 3881|  3.24k|}
parse.c:print_module_not_found:
  798|  3.24k|{
  799|  3.24k|    if (first_err_module) {
  ------------------
  |  Branch (799:9): [True: 1, False: 3.24k]
  ------------------
  800|      1|        snmp_log(LOG_ERR, "MIB search path: %s\n",
  801|      1|                           netsnmp_get_mib_directory());
  802|      1|        first_err_module = 0;
  803|      1|    }
  804|  3.24k|    if (!last_err_module || strcmp(cp, last_err_module))
  ------------------
  |  Branch (804:9): [True: 69, False: 3.17k]
  |  Branch (804:29): [True: 3.17k, False: 0]
  ------------------
  805|  3.24k|        print_error("Cannot find module", cp, CONTINUE);
  ------------------
  |  |  162|  3.24k|#define CONTINUE    -1
  ------------------
  806|  3.24k|    if (last_err_module)
  ------------------
  |  Branch (806:9): [True: 3.17k, False: 69]
  ------------------
  807|  3.17k|        free(last_err_module);
  808|  3.24k|    last_err_module = strdup(cp);
  809|  3.24k|}
parse.c:unlink_tree:
  848|    207|{
  849|    207|    struct tree    *otp = NULL, *ntp = tp->parent;
  850|       |
  851|    207|    if (!ntp) {                 /* this tree has no parent */
  ------------------
  |  Branch (851:9): [True: 207, False: 0]
  ------------------
  852|    207|        DEBUGMSGTL(("unlink_tree", "Tree node %s has no parent\n",
  ------------------
  |  |   66|    207|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    207|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 207]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 207]
  |  |  ------------------
  ------------------
  853|    207|                    tp->label));
  854|    207|    } else {
  855|      0|        ntp = ntp->child_list;
  856|       |
  857|      0|        while (ntp && ntp != tp) {
  ------------------
  |  Branch (857:16): [True: 0, False: 0]
  |  Branch (857:23): [True: 0, False: 0]
  ------------------
  858|      0|            otp = ntp;
  859|      0|            ntp = ntp->next_peer;
  860|      0|        }
  861|      0|        if (!ntp)
  ------------------
  |  Branch (861:13): [True: 0, False: 0]
  ------------------
  862|      0|            snmp_log(LOG_EMERG, "Can't find %s in %s's children\n",
  863|      0|                     tp->label, tp->parent->label);
  864|      0|        else if (otp)
  ------------------
  |  Branch (864:18): [True: 0, False: 0]
  ------------------
  865|      0|            otp->next_peer = ntp->next_peer;
  866|      0|        else
  867|      0|            tp->parent->child_list = tp->next_peer;
  868|      0|    }
  869|       |
  870|    207|    if (tree_head == tp)
  ------------------
  |  Branch (870:9): [True: 207, False: 0]
  ------------------
  871|    207|        tree_head = tp->next_peer;
  872|    207|}
parse.c:free_tree:
  903|    207|{
  904|    207|    if (!Tree)
  ------------------
  |  Branch (904:9): [True: 0, False: 207]
  ------------------
  905|      0|        return;
  906|       |
  907|    207|    unlink_tbucket(Tree);
  908|    207|    free_partial_tree(Tree, FALSE);
  ------------------
  |  |  125|    207|#define FALSE 0
  ------------------
  909|    207|    if (Tree->module_list != &Tree->modid)
  ------------------
  |  Branch (909:9): [True: 0, False: 207]
  ------------------
  910|      0|        free(Tree->module_list);
  911|    207|    free(Tree);
  912|    207|}
parse.c:free_partial_tree:
  876|    207|{
  877|    207|    if (!tp)
  ------------------
  |  Branch (877:9): [True: 0, False: 207]
  ------------------
  878|      0|        return;
  879|       |
  880|       |    /*
  881|       |     * remove the data from this tree node 
  882|       |     */
  883|    207|    free_enums(&tp->enums);
  884|    207|    free_ranges(&tp->ranges);
  885|    207|    free_indexes(&tp->indexes);
  886|    207|    free_varbinds(&tp->varbinds);
  887|    207|    if (!keep_label)
  ------------------
  |  Branch (887:9): [True: 207, False: 0]
  ------------------
  888|    207|        SNMP_FREE(tp->label);
  ------------------
  |  |   62|    207|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 207, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 207]
  |  |  ------------------
  ------------------
  889|    207|    SNMP_FREE(tp->hint);
  ------------------
  |  |   62|    207|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 207]
  |  |  |  Branch (62:66): [Folded, False: 207]
  |  |  ------------------
  ------------------
  890|    207|    SNMP_FREE(tp->units);
  ------------------
  |  |   62|    207|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 207]
  |  |  |  Branch (62:66): [Folded, False: 207]
  |  |  ------------------
  ------------------
  891|    207|    SNMP_FREE(tp->description);
  ------------------
  |  |   62|    207|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 207]
  |  |  |  Branch (62:66): [Folded, False: 207]
  |  |  ------------------
  ------------------
  892|    207|    SNMP_FREE(tp->reference);
  ------------------
  |  |   62|    207|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 207]
  |  |  |  Branch (62:66): [Folded, False: 207]
  |  |  ------------------
  ------------------
  893|    207|    SNMP_FREE(tp->augments);
  ------------------
  |  |   62|    207|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 207]
  |  |  |  Branch (62:66): [Folded, False: 207]
  |  |  ------------------
  ------------------
  894|       |    SNMP_FREE(tp->defaultValue);
  ------------------
  |  |   62|    207|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 207]
  |  |  |  Branch (62:66): [Folded, False: 207]
  |  |  ------------------
  ------------------
  895|    207|}
parse.c:scan_directory:
 4994|     69|{
 4995|     69|    DIR            *dir, *dir2;
 4996|     69|    struct dirent  *file;
 4997|     69|    char          **filenames = NULL;
 4998|     69|    int             fname_len, i, filename_count = 0, array_size = 0;
 4999|     69|    char           *tmpstr;
 5000|       |
 5001|     69|    *result = NULL;
 5002|       |
 5003|     69|    dir = opendir(dirname);
 5004|     69|    if (!dir)
  ------------------
  |  Branch (5004:9): [True: 69, False: 0]
  ------------------
 5005|     69|        return -1;
 5006|       |
 5007|      0|    while ((file = readdir(dir))) {
  ------------------
  |  Branch (5007:12): [True: 0, False: 0]
  ------------------
 5008|       |        /*
 5009|       |         * Only parse file names that don't begin with a '.'
 5010|       |         * Also skip files ending in '~', or starting/ending
 5011|       |         * with '#' which are typically editor backup files.
 5012|       |         */
 5013|      0|        fname_len = strlen(file->d_name);
 5014|      0|        if (fname_len > 0 && file->d_name[0] != '.'
  ------------------
  |  Branch (5014:13): [True: 0, False: 0]
  |  Branch (5014:30): [True: 0, False: 0]
  ------------------
 5015|      0|            && file->d_name[0] != '#'
  ------------------
  |  Branch (5015:16): [True: 0, False: 0]
  ------------------
 5016|      0|            && file->d_name[fname_len-1] != '#'
  ------------------
  |  Branch (5016:16): [True: 0, False: 0]
  ------------------
 5017|      0|            && file->d_name[fname_len-1] != '~') {
  ------------------
  |  Branch (5017:16): [True: 0, False: 0]
  ------------------
 5018|      0|            if (asprintf(&tmpstr, "%s/%s", dirname, file->d_name) < 0)
  ------------------
  |  Branch (5018:17): [True: 0, False: 0]
  ------------------
 5019|      0|                continue;
 5020|      0|            dir2 = opendir(tmpstr);
 5021|      0|            if (dir2) {
  ------------------
  |  Branch (5021:17): [True: 0, False: 0]
  ------------------
 5022|       |                /* file is a directory, don't read it */
 5023|      0|                closedir(dir2);
 5024|      0|            } else {
 5025|      0|                if (filename_count >= array_size) {
  ------------------
  |  Branch (5025:21): [True: 0, False: 0]
  ------------------
 5026|      0|                    char **new_filenames;
 5027|       |
 5028|      0|                    array_size = (array_size + 16) * 2;
 5029|      0|                    new_filenames = realloc(filenames,
 5030|      0|                                        array_size * sizeof(filenames[0]));
 5031|      0|                    if (!new_filenames) {
  ------------------
  |  Branch (5031:25): [True: 0, False: 0]
  ------------------
 5032|      0|                        free(tmpstr);
 5033|      0|                        for (i = 0; i < filename_count; i++)
  ------------------
  |  Branch (5033:37): [True: 0, False: 0]
  ------------------
 5034|      0|                            free(filenames[i]);
 5035|      0|                        free(filenames);
 5036|      0|                        closedir(dir);
 5037|      0|                        return -1;
 5038|      0|                    }
 5039|      0|                    filenames = new_filenames;
 5040|      0|                }
 5041|      0|                filenames[filename_count++] = tmpstr;
 5042|      0|                tmpstr = NULL;
 5043|      0|            }
 5044|      0|            free(tmpstr);
 5045|      0|        }
 5046|      0|    }
 5047|      0|    closedir(dir);
 5048|       |
 5049|      0|    if (filenames)
  ------------------
  |  Branch (5049:9): [True: 0, False: 0]
  ------------------
 5050|      0|        qsort(filenames, filename_count, sizeof(filenames[0]), elemcmp);
 5051|      0|    *result = filenames;
 5052|       |
 5053|      0|    return filename_count;
 5054|      0|}
parse.c:free_ranges:
 5336|    207|{
 5337|    207|    if (spp && *spp) {
  ------------------
  |  Branch (5337:9): [True: 207, False: 0]
  |  Branch (5337:16): [True: 0, False: 207]
  ------------------
 5338|      0|        struct range_list *pp, *npp;
 5339|       |
 5340|      0|        pp = *spp;
 5341|      0|        *spp = NULL;
 5342|       |
 5343|      0|        while (pp) {
  ------------------
  |  Branch (5343:16): [True: 0, False: 0]
  ------------------
 5344|      0|            npp = pp->next;
 5345|      0|            free(pp);
 5346|      0|            pp = npp;
 5347|      0|        }
 5348|      0|    }
 5349|    207|}
parse.c:free_enums:
 5353|    207|{
 5354|    207|    if (spp && *spp) {
  ------------------
  |  Branch (5354:9): [True: 207, False: 0]
  |  Branch (5354:16): [True: 0, False: 207]
  ------------------
 5355|      0|        struct enum_list *pp, *npp;
 5356|       |
 5357|      0|        pp = *spp;
 5358|      0|        *spp = NULL;
 5359|       |
 5360|      0|        while (pp) {
  ------------------
  |  Branch (5360:16): [True: 0, False: 0]
  ------------------
 5361|      0|            npp = pp->next;
 5362|      0|            if (pp->label)
  ------------------
  |  Branch (5362:17): [True: 0, False: 0]
  ------------------
 5363|      0|                free(pp->label);
 5364|      0|            free(pp);
 5365|      0|            pp = npp;
 5366|      0|        }
 5367|      0|    }
 5368|    207|}

register_prenetsnmp_mib_handler:
  255|  2.41k|{
  256|  2.41k|    return internal_register_config_handler(type, token, parser, NULL, releaser,
  257|  2.41k|					    help, PREMIB_CONFIG);
  ------------------
  |  |   15|  2.41k|#define PREMIB_CONFIG 1
  ------------------
  258|  2.41k|}
register_config_handler:
  310|  4.34k|{
  311|  4.34k|    return internal_register_config_handler(type, token, parser, NULL, releaser,
  312|  4.34k|					    help, NORMAL_CONFIG);
  ------------------
  |  |   14|  4.34k|#define NORMAL_CONFIG 0
  ------------------
  313|  4.34k|}
register_const_config_handler:
  320|     69|{
  321|     69|    return internal_register_config_handler(type, token, NULL, parser, releaser,
  322|     69|					    help, NORMAL_CONFIG);
  ------------------
  |  |   14|     69|#define NORMAL_CONFIG 0
  ------------------
  323|     69|}
register_app_config_handler:
  329|    138|{
  330|       |    return register_config_handler(NULL, token, parser, releaser, help);
  331|    138|}
unregister_config_handler:
  355|  11.5k|{
  356|  11.5k|    struct config_files **ctmp = &config_files;
  357|  11.5k|    struct config_line  **ltmp;
  358|  11.5k|    const char           *type = type_param;
  359|       |
  360|  11.5k|    if (type == NULL || *type == '\0') {
  ------------------
  |  Branch (360:9): [True: 0, False: 11.5k]
  |  Branch (360:25): [True: 0, False: 11.5k]
  ------------------
  361|      0|        type = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  362|      0|				     NETSNMP_DS_LIB_APPTYPE);
  ------------------
  |  |  157|      0|#define NETSNMP_DS_LIB_APPTYPE           6
  ------------------
  363|      0|    }
  364|       |
  365|       |    /*
  366|       |     * Handle multiple types (recursively)
  367|       |     */
  368|  11.5k|    if (strchr(type, ':')) {
  ------------------
  |  Branch (368:9): [True: 0, False: 11.5k]
  ------------------
  369|      0|        char                buf[STRINGMAX];
  370|      0|        char               *cptr = buf;
  371|       |
  372|      0|        strlcpy(buf, type, STRINGMAX);
  ------------------
  |  |   12|      0|#define STRINGMAX 1024
  ------------------
  373|      0|        while (cptr) {
  ------------------
  |  Branch (373:16): [True: 0, False: 0]
  ------------------
  374|      0|            char* c = cptr;
  375|      0|            cptr = strchr(cptr, ':');
  376|      0|            if(cptr) {
  ------------------
  |  Branch (376:16): [True: 0, False: 0]
  ------------------
  377|      0|                *cptr = '\0';
  378|      0|                ++cptr;
  379|      0|            }
  380|      0|            unregister_config_handler(c, token);
  381|      0|        }
  382|      0|        return;
  383|      0|    }
  384|       |    
  385|       |    /*
  386|       |     * find type in current list 
  387|       |     */
  388|  11.5k|    while (*ctmp != NULL && strcmp((*ctmp)->fileHeader, type)) {
  ------------------
  |  Branch (388:12): [True: 6.96k, False: 4.55k]
  |  Branch (388:29): [True: 0, False: 6.96k]
  ------------------
  389|      0|        ctmp = &((*ctmp)->next);
  390|      0|    }
  391|       |
  392|  11.5k|    if (*ctmp == NULL) {
  ------------------
  |  Branch (392:9): [True: 4.55k, False: 6.96k]
  ------------------
  393|       |        /*
  394|       |         * Not found, return. 
  395|       |         */
  396|  4.55k|        return;
  397|  4.55k|    }
  398|       |
  399|  6.96k|    ltmp = &((*ctmp)->start);
  400|  6.96k|    if (*ltmp == NULL) {
  ------------------
  |  Branch (400:9): [True: 0, False: 6.96k]
  ------------------
  401|       |        /*
  402|       |         * Not found, return. 
  403|       |         */
  404|      0|        return;
  405|      0|    }
  406|  6.96k|    if (strcmp((*ltmp)->config_token, token) == 0) {
  ------------------
  |  Branch (406:9): [True: 6.96k, False: 0]
  ------------------
  407|       |        /*
  408|       |         * found it at the top of the list 
  409|       |         */
  410|  6.96k|        struct config_line *ltmp2 = (*ltmp)->next;
  411|  6.96k|        if ((*ltmp)->free_func)
  ------------------
  |  Branch (411:13): [True: 483, False: 6.48k]
  ------------------
  412|    483|            (*ltmp)->free_func();
  413|  6.96k|        SNMP_FREE((*ltmp)->config_token);
  ------------------
  |  |   62|  6.96k|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 6.96k, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 6.96k]
  |  |  ------------------
  ------------------
  414|  6.96k|        SNMP_FREE((*ltmp)->help);
  ------------------
  |  |   62|  6.96k|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 6.14k, False: 828]
  |  |  |  Branch (62:66): [Folded, False: 6.96k]
  |  |  ------------------
  ------------------
  415|  6.96k|        SNMP_FREE(*ltmp);
  ------------------
  |  |   62|  6.96k|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 6.96k, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 6.96k]
  |  |  ------------------
  ------------------
  416|  6.96k|        (*ctmp)->start = ltmp2;
  417|  6.96k|        return;
  418|  6.96k|    }
  419|      0|    while ((*ltmp)->next != NULL
  ------------------
  |  Branch (419:12): [True: 0, False: 0]
  ------------------
  420|      0|           && strcmp((*ltmp)->next->config_token, token)) {
  ------------------
  |  Branch (420:15): [True: 0, False: 0]
  ------------------
  421|      0|        ltmp = &((*ltmp)->next);
  422|      0|    }
  423|      0|    if ((*ltmp)->next != NULL) {
  ------------------
  |  Branch (423:9): [True: 0, False: 0]
  ------------------
  424|      0|        struct config_line *ltmp2 = (*ltmp)->next->next;
  425|      0|        if ((*ltmp)->next->free_func)
  ------------------
  |  Branch (425:13): [True: 0, False: 0]
  ------------------
  426|      0|            (*ltmp)->next->free_func();
  427|      0|        SNMP_FREE((*ltmp)->next->config_token);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
  428|      0|        SNMP_FREE((*ltmp)->next->help);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
  429|       |        SNMP_FREE((*ltmp)->next);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
  430|      0|        (*ltmp)->next = ltmp2;
  431|      0|    }
  432|      0|}
unregister_all_config_handlers:
  444|     69|{
  445|     69|    struct config_files *ctmp, *save;
  446|     69|    struct config_line *ltmp;
  447|       |
  448|       |    /*
  449|       |     * Keep using config_files until there are no more! 
  450|       |     */
  451|    207|    for (ctmp = config_files; ctmp;) {
  ------------------
  |  Branch (451:31): [True: 138, False: 69]
  ------------------
  452|  7.10k|        for (ltmp = ctmp->start; ltmp; ltmp = ctmp->start) {
  ------------------
  |  Branch (452:34): [True: 6.96k, False: 138]
  ------------------
  453|  6.96k|            unregister_config_handler(ctmp->fileHeader,
  454|  6.96k|                                      ltmp->config_token);
  455|  6.96k|        }
  456|    138|        SNMP_FREE(ctmp->fileHeader);
  ------------------
  |  |   62|    138|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 138, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 138]
  |  |  ------------------
  ------------------
  457|    138|        save = ctmp->next;
  458|       |        SNMP_FREE(ctmp);
  ------------------
  |  |   62|    138|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 138, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 138]
  |  |  ------------------
  ------------------
  459|    138|        ctmp = save;
  460|    138|        config_files = save;
  461|    138|    }
  462|     69|}
netsnmp_config_remember_free_list:
  690|     69|{
  691|     69|    struct read_config_memory *tmpmem;
  692|     69|    while (*mem) {
  ------------------
  |  Branch (692:12): [True: 0, False: 69]
  ------------------
  693|      0|        SNMP_FREE((*mem)->line);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
  694|      0|        tmpmem = (*mem)->next;
  695|       |        SNMP_FREE(*mem);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
  696|      0|        *mem = tmpmem;
  697|      0|    }
  698|     69|}
netsnmp_config_process_memory_list:
  703|    138|{
  704|       |
  705|    138|    struct read_config_memory *mem;
  706|       |
  707|    138|    if (!memp)
  ------------------
  |  Branch (707:9): [True: 0, False: 138]
  ------------------
  708|      0|        return;
  709|       |
  710|    138|    mem = *memp;
  711|       |
  712|    138|    while (mem) {
  ------------------
  |  Branch (712:12): [True: 0, False: 138]
  ------------------
  713|      0|        DEBUGMSGTL(("read_config:mem", "processing memory: %s\n", mem->line));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  714|      0|        snmp_config_when(mem->line, when);
  715|      0|        mem = mem->next;
  716|      0|    }
  717|       |
  718|    138|    if (clear)
  ------------------
  |  Branch (718:9): [True: 69, False: 69]
  ------------------
  719|     69|        netsnmp_config_remember_free_list(memp);
  720|    138|}
netsnmp_config_process_memories_when:
  741|    138|{
  742|    138|    netsnmp_config_process_memory_list(&memorylist, when, clear);
  743|    138|}
free_config:
 1018|     69|{
 1019|     69|    struct config_files *ctmp = config_files;
 1020|     69|    struct config_line *ltmp;
 1021|       |
 1022|    207|    for (; ctmp != NULL; ctmp = ctmp->next)
  ------------------
  |  Branch (1022:12): [True: 138, False: 69]
  ------------------
 1023|  7.10k|        for (ltmp = ctmp->start; ltmp != NULL; ltmp = ltmp->next)
  ------------------
  |  Branch (1023:34): [True: 6.96k, False: 138]
  ------------------
 1024|  6.96k|            if (ltmp->free_func)
  ------------------
  |  Branch (1024:17): [True: 483, False: 6.48k]
  ------------------
 1025|    483|                (*(ltmp->free_func)) ();
 1026|     69|}
read_configs:
 1071|     69|{
 1072|     69|    char *optional_config = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1073|     69|					       NETSNMP_DS_LIB_OPTIONALCONFIG);
  ------------------
  |  |  156|     69|#define NETSNMP_DS_LIB_OPTIONALCONFIG    5
  ------------------
 1074|       |
 1075|     69|    snmp_call_callbacks(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     69|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 1076|     69|                        SNMP_CALLBACK_PRE_READ_CONFIG, NULL);
  ------------------
  |  |   30|     69|#define SNMP_CALLBACK_PRE_READ_CONFIG	        7
  ------------------
 1077|       |
 1078|     69|    DEBUGMSGTL(("read_config", "reading normal configuration tokens\n"));
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
 1079|       |
 1080|     69|    if ((NULL != optional_config) && (*optional_config == '-')) {
  ------------------
  |  Branch (1080:9): [True: 0, False: 69]
  |  Branch (1080:38): [True: 0, False: 0]
  ------------------
 1081|      0|        (void)read_configs_optional(++optional_config, NORMAL_CONFIG);
  ------------------
  |  |   14|      0|#define NORMAL_CONFIG 0
  ------------------
 1082|      0|        optional_config = NULL; /* clear, so we don't read them twice */
 1083|      0|    }
 1084|       |
 1085|     69|    (void)read_config_files(NORMAL_CONFIG);
  ------------------
  |  |   14|     69|#define NORMAL_CONFIG 0
  ------------------
 1086|       |
 1087|       |    /*
 1088|       |     * do this even when the normal above wasn't done 
 1089|       |     */
 1090|     69|    if (NULL != optional_config)
  ------------------
  |  Branch (1090:9): [True: 0, False: 69]
  ------------------
 1091|      0|        (void)read_configs_optional(optional_config, NORMAL_CONFIG);
  ------------------
  |  |   14|      0|#define NORMAL_CONFIG 0
  ------------------
 1092|       |
 1093|     69|    netsnmp_config_process_memories_when(NORMAL_CONFIG, 1);
  ------------------
  |  |   14|     69|#define NORMAL_CONFIG 0
  ------------------
 1094|       |
 1095|     69|    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1096|     69|			   NETSNMP_DS_LIB_HAVE_READ_CONFIG, 1);
  ------------------
  |  |   87|     69|#define NETSNMP_DS_LIB_HAVE_READ_CONFIG    27   /* have the config tokens been processed */
  ------------------
 1097|     69|    snmp_call_callbacks(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     69|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 1098|     69|                        SNMP_CALLBACK_POST_READ_CONFIG, NULL);
  ------------------
  |  |   24|     69|#define SNMP_CALLBACK_POST_READ_CONFIG	        0
  ------------------
 1099|     69|}
read_premib_configs:
 1103|     69|{
 1104|     69|    char *optional_config = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1105|     69|					       NETSNMP_DS_LIB_OPTIONALCONFIG);
  ------------------
  |  |  156|     69|#define NETSNMP_DS_LIB_OPTIONALCONFIG    5
  ------------------
 1106|       |
 1107|     69|    snmp_call_callbacks(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     69|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 1108|     69|                        SNMP_CALLBACK_PRE_PREMIB_READ_CONFIG, NULL);
  ------------------
  |  |   31|     69|#define SNMP_CALLBACK_PRE_PREMIB_READ_CONFIG	8
  ------------------
 1109|       |
 1110|     69|    DEBUGMSGTL(("read_config", "reading premib configuration tokens\n"));
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
 1111|       |
 1112|     69|    if ((NULL != optional_config) && (*optional_config == '-')) {
  ------------------
  |  Branch (1112:9): [True: 0, False: 69]
  |  Branch (1112:38): [True: 0, False: 0]
  ------------------
 1113|      0|        (void)read_configs_optional(++optional_config, PREMIB_CONFIG);
  ------------------
  |  |   15|      0|#define PREMIB_CONFIG 1
  ------------------
 1114|      0|        optional_config = NULL; /* clear, so we don't read them twice */
 1115|      0|    }
 1116|       |
 1117|     69|    (void)read_config_files(PREMIB_CONFIG);
  ------------------
  |  |   15|     69|#define PREMIB_CONFIG 1
  ------------------
 1118|       |
 1119|     69|    if (NULL != optional_config)
  ------------------
  |  Branch (1119:9): [True: 0, False: 69]
  ------------------
 1120|      0|        (void)read_configs_optional(optional_config, PREMIB_CONFIG);
  ------------------
  |  |   15|      0|#define PREMIB_CONFIG 1
  ------------------
 1121|       |
 1122|     69|    netsnmp_config_process_memories_when(PREMIB_CONFIG, 0);
  ------------------
  |  |   15|     69|#define PREMIB_CONFIG 1
  ------------------
 1123|       |
 1124|     69|    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1125|     69|			   NETSNMP_DS_LIB_HAVE_READ_PREMIB_CONFIG, 1);
  ------------------
  |  |   86|     69|#define NETSNMP_DS_LIB_HAVE_READ_PREMIB_CONFIG 26       /* have the pre-mib parsing config tokens been processed */
  ------------------
 1126|     69|    snmp_call_callbacks(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     69|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 1127|     69|                        SNMP_CALLBACK_POST_PREMIB_READ_CONFIG, NULL);
  ------------------
  |  |   27|     69|#define SNMP_CALLBACK_POST_PREMIB_READ_CONFIG	3
  ------------------
 1128|     69|}
set_configuration_directory:
 1140|      1|{
 1141|      1|    netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1142|      1|			  NETSNMP_DS_LIB_CONFIGURATION_DIR, dir);
  ------------------
  |  |  160|      1|#define NETSNMP_DS_LIB_CONFIGURATION_DIR 9
  ------------------
 1143|      1|}
get_configuration_directory:
 1159|      1|{
 1160|      1|    char            defaultPath[SPRINT_MAX_LEN];
 1161|      1|    const char     *homepath;
 1162|       |
 1163|      1|    if (NULL == netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1163:9): [True: 1, False: 0]
  ------------------
 1164|      1|				      NETSNMP_DS_LIB_CONFIGURATION_DIR)) {
  ------------------
  |  |  160|      1|#define NETSNMP_DS_LIB_CONFIGURATION_DIR 9
  ------------------
 1165|      1|        homepath = netsnmp_gethomedir();
 1166|      1|        snprintf(defaultPath, sizeof(defaultPath), "%s%c%s%c%s%s%s%s",
 1167|      1|                SNMPCONFPATH, ENV_SEPARATOR_CHAR,
  ------------------
  |  | 2027|      1|#define SNMPCONFPATH "/usr/local/net-snmp-master/etc/snmp"
  ------------------
                              SNMPCONFPATH, ENV_SEPARATOR_CHAR,
  ------------------
  |  |   70|      1|#define ENV_SEPARATOR_CHAR ':'
  ------------------
 1168|      1|                SNMPSHAREPATH, ENV_SEPARATOR_CHAR, SNMPLIBPATH,
  ------------------
  |  | 2026|      1|#define SNMPSHAREPATH "/usr/local/net-snmp-master/share/snmp"
  ------------------
                              SNMPSHAREPATH, ENV_SEPARATOR_CHAR, SNMPLIBPATH,
  ------------------
  |  |   70|      1|#define ENV_SEPARATOR_CHAR ':'
  ------------------
                              SNMPSHAREPATH, ENV_SEPARATOR_CHAR, SNMPLIBPATH,
  ------------------
  |  | 2025|      1|#define SNMPLIBPATH "/usr/local/net-snmp-master/lib/snmp"
  ------------------
 1169|      1|                ((homepath == NULL) ? "" : ENV_SEPARATOR),
  ------------------
  |  |   67|      1|#define ENV_SEPARATOR ":"
  ------------------
  |  Branch (1169:18): [True: 0, False: 1]
  ------------------
 1170|      1|                ((homepath == NULL) ? "" : homepath),
  ------------------
  |  Branch (1170:18): [True: 0, False: 1]
  ------------------
 1171|      1|                ((homepath == NULL) ? "" : "/.snmp"));
  ------------------
  |  Branch (1171:18): [True: 0, False: 1]
  ------------------
 1172|      1|        defaultPath[ sizeof(defaultPath)-1 ] = 0;
 1173|      1|        set_configuration_directory(defaultPath);
 1174|      1|    }
 1175|      1|    return (netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1176|      1|				  NETSNMP_DS_LIB_CONFIGURATION_DIR));
  ------------------
  |  |  160|      1|#define NETSNMP_DS_LIB_CONFIGURATION_DIR 9
  ------------------
 1177|      1|}
get_persistent_directory:
 1207|      1|{
 1208|      1|    if (NULL == netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1208:9): [True: 0, False: 1]
  ------------------
 1209|      1|				      NETSNMP_DS_LIB_PERSISTENT_DIR)) {
  ------------------
  |  |  159|      1|#define NETSNMP_DS_LIB_PERSISTENT_DIR    8
  ------------------
 1210|      0|        const char *persdir = netsnmp_getenv("SNMP_PERSISTENT_DIR");
 1211|      0|        if (NULL == persdir)
  ------------------
  |  Branch (1211:13): [True: 0, False: 0]
  ------------------
 1212|      0|            persdir = NETSNMP_PERSISTENT_DIRECTORY;
  ------------------
  |  | 1997|      0|#define NETSNMP_PERSISTENT_DIRECTORY "/var/net-snmp"
  ------------------
 1213|      0|        set_persistent_directory(persdir);
 1214|      0|    }
 1215|      1|    return (netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1216|      1|				  NETSNMP_DS_LIB_PERSISTENT_DIR));
  ------------------
  |  |  159|      1|#define NETSNMP_DS_LIB_PERSISTENT_DIR    8
  ------------------
 1217|      1|}
read_config_files_of_type:
 1404|    276|{
 1405|    276|    const char     *confpath, *persfile, *envconfpath;
 1406|    276|    char           *perspath;
 1407|    276|    int             ret = SNMPERR_GENERR;
  ------------------
  |  |  218|    276|#define SNMPERR_GENERR			(-1)
  ------------------
 1408|       |
 1409|    276|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|    276|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1409:9): [True: 276, False: 0]
  ------------------
 1410|    276|                               NETSNMP_DS_LIB_DONT_PERSIST_STATE)
  ------------------
  |  |   92|    276|#define NETSNMP_DS_LIB_DONT_PERSIST_STATE  32	/* don't load config and don't load/save persistent file */
  ------------------
 1411|      0|        || netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1411:12): [True: 0, False: 0]
  ------------------
 1412|      0|                                  NETSNMP_DS_LIB_DISABLE_CONFIG_LOAD)
  ------------------
  |  |   66|      0|#define NETSNMP_DS_LIB_DISABLE_CONFIG_LOAD      NETSNMP_DS_LIB_DONT_READ_CONFIGS
  |  |  ------------------
  |  |  |  |   65|      0|#define NETSNMP_DS_LIB_DONT_READ_CONFIGS   6    /* don't read normal config files */
  |  |  ------------------
  ------------------
 1413|    276|        || (NULL == ctmp)) return ret;
  ------------------
  |  Branch (1413:12): [True: 0, False: 0]
  ------------------
 1414|       |
 1415|       |    /*
 1416|       |     * these shouldn't change
 1417|       |     */
 1418|      0|    confpath = get_configuration_directory();
 1419|      0|    persfile = netsnmp_getenv("SNMP_PERSISTENT_FILE");
 1420|      0|    envconfpath = netsnmp_getenv("SNMPCONFPATH");
 1421|       |
 1422|       |
 1423|       |        /*
 1424|       |         * read the config files. strdup() the result of
 1425|       |         * get_persistent_directory() to avoid that parsing the "persistentDir"
 1426|       |         * keyword transforms the perspath pointer into a dangling pointer.
 1427|       |         */
 1428|      0|        perspath = strdup(get_persistent_directory());
 1429|      0|        if (perspath == NULL) {
  ------------------
  |  Branch (1429:13): [True: 0, False: 0]
  ------------------
 1430|      0|            return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 1431|      0|        }
 1432|      0|        if (envconfpath == NULL) {
  ------------------
  |  Branch (1432:13): [True: 0, False: 0]
  ------------------
 1433|       |            /*
 1434|       |             * read just the config files (no persistent stuff), since
 1435|       |             * persistent path can change via conf file. Then get the
 1436|       |             * current persistent directory, and read files there.
 1437|       |             */
 1438|      0|            if ( read_config_files_in_path(confpath, ctmp, when, perspath,
  ------------------
  |  Branch (1438:18): [True: 0, False: 0]
  ------------------
 1439|      0|                                      persfile) == SNMPERR_SUCCESS )
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1440|      0|                ret = SNMPERR_SUCCESS;
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1441|      0|            free(perspath);
 1442|      0|            perspath = strdup(get_persistent_directory());
 1443|      0|            if (perspath == NULL) {
  ------------------
  |  Branch (1443:17): [True: 0, False: 0]
  ------------------
 1444|      0|                return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 1445|      0|            }
 1446|      0|            if ( read_config_files_in_path(perspath, ctmp, when, perspath,
  ------------------
  |  Branch (1446:18): [True: 0, False: 0]
  ------------------
 1447|      0|                                      persfile) == SNMPERR_SUCCESS )
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1448|      0|                ret = SNMPERR_SUCCESS;
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1449|      0|        }
 1450|      0|        else {
 1451|       |            /*
 1452|       |             * only read path specified by user
 1453|       |             */
 1454|      0|            if ( read_config_files_in_path(envconfpath, ctmp, when, perspath,
  ------------------
  |  Branch (1454:18): [True: 0, False: 0]
  ------------------
 1455|      0|                                      persfile) == SNMPERR_SUCCESS )
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1456|      0|                ret = SNMPERR_SUCCESS;
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1457|      0|        }
 1458|      0|        free(perspath);
 1459|      0|        return ret;
 1460|      0|}
read_config_files:
 1468|    138|read_config_files(int when) {
 1469|       |
 1470|    138|    struct config_files *ctmp = config_files;
 1471|    138|    int                  ret  = SNMPERR_GENERR;
  ------------------
  |  |  218|    138|#define SNMPERR_GENERR			(-1)
  ------------------
 1472|       |
 1473|    138|    config_errors = 0;
 1474|       |
 1475|    138|    if (when == PREMIB_CONFIG)
  ------------------
  |  |   15|    138|#define PREMIB_CONFIG 1
  ------------------
  |  Branch (1475:9): [True: 69, False: 69]
  ------------------
 1476|     69|        free_config();
 1477|       |
 1478|       |    /*
 1479|       |     * read all config file types 
 1480|       |     */
 1481|    414|    for (; ctmp != NULL; ctmp = ctmp->next) {
  ------------------
  |  Branch (1481:12): [True: 276, False: 138]
  ------------------
 1482|    276|        if ( read_config_files_of_type(when, ctmp) == SNMPERR_SUCCESS )
  ------------------
  |  |  217|    276|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (1482:14): [True: 0, False: 276]
  ------------------
 1483|      0|            ret = SNMPERR_SUCCESS;
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1484|    276|    }
 1485|       |
 1486|    138|    if (config_errors) {
  ------------------
  |  Branch (1486:9): [True: 0, False: 138]
  ------------------
 1487|       |        snmp_log(LOG_ERR, "net-snmp: %d error(s) in config file(s)\n",
 1488|      0|                 config_errors);
 1489|      0|    }
 1490|    138|    return ret;
 1491|    138|}
read_config_store:
 1540|    138|{
 1541|    138|#ifdef NETSNMP_PERSISTENT_DIRECTORY
 1542|    138|    char            file[512], *filep;
 1543|    138|    FILE           *fout;
 1544|    138|#ifdef NETSNMP_PERSISTENT_MASK
 1545|    138|    mode_t          oldmask;
 1546|    138|#endif
 1547|       |
 1548|    138|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|    138|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1548:9): [True: 138, False: 0]
  ------------------
 1549|    138|                               NETSNMP_DS_LIB_DONT_PERSIST_STATE)
  ------------------
  |  |   92|    138|#define NETSNMP_DS_LIB_DONT_PERSIST_STATE  32	/* don't load config and don't load/save persistent file */
  ------------------
 1550|      0|     || netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1550:9): [True: 0, False: 0]
  ------------------
 1551|    138|                               NETSNMP_DS_LIB_DISABLE_PERSISTENT_LOAD)) return;
  ------------------
  |  |   95|      0|#define NETSNMP_DS_LIB_DISABLE_PERSISTENT_LOAD  35 /* don't load persistent file */
  ------------------
 1552|       |
 1553|       |    /*
 1554|       |     * store configuration directives in the following order of preference:
 1555|       |     * 1. ENV variable SNMP_PERSISTENT_FILE
 1556|       |     * 2. configured <NETSNMP_PERSISTENT_DIRECTORY>/<type>.conf
 1557|       |     */
 1558|      0|    if ((filep = netsnmp_getenv("SNMP_PERSISTENT_FILE")) == NULL) {
  ------------------
  |  Branch (1558:9): [True: 0, False: 0]
  ------------------
 1559|      0|        snprintf(file, sizeof(file),
 1560|      0|                 "%s/%s.conf", get_persistent_directory(), type);
 1561|      0|        file[ sizeof(file)-1 ] = 0;
 1562|      0|        filep = file;
 1563|      0|    }
 1564|      0|#ifdef NETSNMP_PERSISTENT_MASK
 1565|      0|    oldmask = umask(NETSNMP_PERSISTENT_MASK);
  ------------------
  |  | 1739|      0|#define NETSNMP_PERSISTENT_MASK 077
  ------------------
 1566|      0|#endif
 1567|      0|    if (mkdirhier(filep, NETSNMP_AGENT_DIRECTORY_MODE, 1)) {
  ------------------
  |  | 2002|      0|#define NETSNMP_AGENT_DIRECTORY_MODE 0700
  ------------------
  |  Branch (1567:9): [True: 0, False: 0]
  ------------------
 1568|      0|        snmp_log(LOG_ERR,
 1569|      0|                 "Failed to create the persistent directory for %s\n",
 1570|      0|                 file);
 1571|      0|    }
 1572|      0|    if ((fout = fopen(filep, "a")) != NULL) {
  ------------------
  |  Branch (1572:9): [True: 0, False: 0]
  ------------------
 1573|      0|        fprintf(fout, "%s", line);
 1574|      0|        if (line[strlen(line)] != '\n')
  ------------------
  |  Branch (1574:13): [True: 0, False: 0]
  ------------------
 1575|      0|            fprintf(fout, "\n");
 1576|      0|        DEBUGMSGTL(("read_config:store", "storing: %s\n", line));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1577|      0|        fflush(fout);
 1578|      0|#if defined(HAVE_FSYNC)
 1579|      0|        fsync(fileno(fout));
 1580|       |#elif defined(HAVE__GET_OSFHANDLE)
 1581|       |        {
 1582|       |            int fd;
 1583|       |            HANDLE h;
 1584|       |
 1585|       |            fd = fileno(fout);
 1586|       |            netsnmp_assert(fd != -1);
 1587|       |            /*
 1588|       |             * Use size_t instead of uintptr_t because not all supported
 1589|       |             * Windows compilers support uintptr_t.
 1590|       |             */
 1591|       |            h = (HANDLE)(size_t)_get_osfhandle(fd);
 1592|       |            netsnmp_assert(h != INVALID_HANDLE_VALUE);
 1593|       |            FlushFileBuffers(h);
 1594|       |        }
 1595|       |#endif
 1596|      0|        fclose(fout);
 1597|      0|    } else {
 1598|      0|        if (strcmp(NETSNMP_APPLICATION_CONFIG_TYPE, type) != 0) {
  ------------------
  |  |   22|      0|#define NETSNMP_APPLICATION_CONFIG_TYPE "snmpapp"
  ------------------
  |  Branch (1598:13): [True: 0, False: 0]
  ------------------
 1599|       |            /*
 1600|       |             * Ignore this error in client utilities, they can run with random
 1601|       |             * UID/GID and typically cannot write to /var. Error message just
 1602|       |             * confuses people.
 1603|       |             */
 1604|      0|            snmp_log(LOG_ERR, "read_config_store open failure on %s\n", filep);
 1605|      0|        }
 1606|      0|    }
 1607|      0|#ifdef NETSNMP_PERSISTENT_MASK
 1608|      0|    umask(oldmask);
 1609|      0|#endif
 1610|       |
 1611|      0|#endif
 1612|      0|}                               /* end read_config_store() */
snmp_save_persistent:
 1645|     69|{
 1646|     69|    char            file[512], fileold[SPRINT_MAX_LEN];
 1647|     69|    struct stat     statbuf;
 1648|     69|    int             j;
 1649|       |
 1650|     69|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1650:9): [True: 69, False: 0]
  ------------------
 1651|     69|                               NETSNMP_DS_LIB_DONT_PERSIST_STATE)
  ------------------
  |  |   92|     69|#define NETSNMP_DS_LIB_DONT_PERSIST_STATE  32	/* don't load config and don't load/save persistent file */
  ------------------
 1652|      0|     || netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1652:9): [True: 0, False: 0]
  ------------------
 1653|     69|                               NETSNMP_DS_LIB_DISABLE_PERSISTENT_SAVE)) return;
  ------------------
  |  |   96|      0|#define NETSNMP_DS_LIB_DISABLE_PERSISTENT_SAVE  36 /* don't save persistent file */
  ------------------
 1654|       |
 1655|      0|    DEBUGMSGTL(("snmp_save_persistent", "saving %s files...\n", type));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1656|      0|    snprintf(file, sizeof(file),
 1657|      0|             "%s/%s.conf", get_persistent_directory(), type);
 1658|      0|    file[ sizeof(file)-1 ] = 0;
 1659|      0|    if (stat(file, &statbuf) == 0) {
  ------------------
  |  Branch (1659:9): [True: 0, False: 0]
  ------------------
 1660|      0|        for (j = 0; j <= NETSNMP_MAX_PERSISTENT_BACKUPS; j++) {
  ------------------
  |  | 2009|      0|#define NETSNMP_MAX_PERSISTENT_BACKUPS 10
  ------------------
  |  Branch (1660:21): [True: 0, False: 0]
  ------------------
 1661|      0|            snprintf(fileold, sizeof(fileold),
 1662|      0|                     "%s/%s.%d.conf", get_persistent_directory(), type, j);
 1663|      0|            fileold[ sizeof(fileold)-1 ] = 0;
 1664|      0|            if (stat(fileold, &statbuf) != 0) {
  ------------------
  |  Branch (1664:17): [True: 0, False: 0]
  ------------------
 1665|      0|                DEBUGMSGTL(("snmp_save_persistent",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1666|      0|                            " saving old config file: %s -> %s.\n", file,
 1667|      0|                            fileold));
 1668|      0|                if (rename(file, fileold)) {
  ------------------
  |  Branch (1668:21): [True: 0, False: 0]
  ------------------
 1669|      0|                    snmp_log(LOG_ERR, "Cannot rename %s to %s\n", file, fileold);
 1670|       |                     /* moving it failed, try nuking it, as leaving
 1671|       |                      * it around is very bad. */
 1672|      0|                    if (unlink(file) == -1)
  ------------------
  |  Branch (1672:25): [True: 0, False: 0]
  ------------------
 1673|      0|                        snmp_log(LOG_ERR, "Cannot unlink %s\n", file);
 1674|      0|                }
 1675|      0|                break;
 1676|      0|            }
 1677|      0|        }
 1678|      0|    }
 1679|       |    /*
 1680|       |     * save a warning header to the top of the new file 
 1681|       |     */
 1682|      0|    snprintf(fileold, sizeof(fileold),
 1683|      0|            "%s%s# Please save normal configuration tokens for %s in SNMPCONFPATH/%s.conf.\n# Only \"createUser\" tokens should be placed here by %s administrators.\n%s",
 1684|      0|            "#\n# net-snmp (or ucd-snmp) persistent data file.\n#\n############################################################################\n# STOP STOP STOP STOP STOP STOP STOP STOP STOP \n",
 1685|      0|            "#\n#          **** DO NOT EDIT THIS FILE ****\n#\n# STOP STOP STOP STOP STOP STOP STOP STOP STOP \n############################################################################\n#\n# DO NOT STORE CONFIGURATION ENTRIES HERE.\n",
 1686|      0|            type, type, type,
 1687|      0|	    "# (Did I mention: do not edit this file?)\n#\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
 1688|      0|    fileold[ sizeof(fileold)-1 ] = 0;
 1689|      0|    read_config_store(type, fileold);
 1690|      0|}
snmp_clean_persistent:
 1712|     69|{
 1713|     69|    char            file[512];
 1714|     69|    struct stat     statbuf;
 1715|     69|    int             j;
 1716|       |
 1717|     69|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1717:9): [True: 69, False: 0]
  ------------------
 1718|     69|                               NETSNMP_DS_LIB_DONT_PERSIST_STATE)
  ------------------
  |  |   92|     69|#define NETSNMP_DS_LIB_DONT_PERSIST_STATE  32	/* don't load config and don't load/save persistent file */
  ------------------
 1719|      0|     || netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1719:9): [True: 0, False: 0]
  ------------------
 1720|     69|                               NETSNMP_DS_LIB_DISABLE_PERSISTENT_SAVE)) return;
  ------------------
  |  |   96|      0|#define NETSNMP_DS_LIB_DISABLE_PERSISTENT_SAVE  36 /* don't save persistent file */
  ------------------
 1721|       |
 1722|      0|    DEBUGMSGTL(("snmp_clean_persistent", "cleaning %s files...\n", type));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1723|      0|    snprintf(file, sizeof(file),
 1724|      0|             "%s/%s.conf", get_persistent_directory(), type);
 1725|      0|    file[ sizeof(file)-1 ] = 0;
 1726|      0|    if (stat(file, &statbuf) == 0) {
  ------------------
  |  Branch (1726:9): [True: 0, False: 0]
  ------------------
 1727|      0|        for (j = 0; j <= NETSNMP_MAX_PERSISTENT_BACKUPS; j++) {
  ------------------
  |  | 2009|      0|#define NETSNMP_MAX_PERSISTENT_BACKUPS 10
  ------------------
  |  Branch (1727:21): [True: 0, False: 0]
  ------------------
 1728|      0|            snprintf(file, sizeof(file),
 1729|      0|                     "%s/%s.%d.conf", get_persistent_directory(), type, j);
 1730|      0|            file[ sizeof(file)-1 ] = 0;
 1731|      0|            if (stat(file, &statbuf) == 0) {
  ------------------
  |  Branch (1731:17): [True: 0, False: 0]
  ------------------
 1732|      0|                DEBUGMSGTL(("snmp_clean_persistent",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1733|      0|                            " removing old config file: %s\n", file));
 1734|      0|                if (unlink(file) == -1)
  ------------------
  |  Branch (1734:21): [True: 0, False: 0]
  ------------------
 1735|      0|                    snmp_log(LOG_ERR, "Cannot unlink %s\n", file);
 1736|      0|            }
 1737|      0|        }
 1738|      0|    }
 1739|      0|}
skip_white_const:
 1808|    276|{
 1809|    276|    if (ptr == NULL)
  ------------------
  |  Branch (1809:9): [True: 0, False: 276]
  ------------------
 1810|      0|        return (NULL);
 1811|    414|    while (*ptr != 0 && isspace((unsigned char)*ptr))
  ------------------
  |  Branch (1811:12): [True: 276, False: 138]
  |  Branch (1811:25): [True: 138, False: 138]
  ------------------
 1812|    138|        ptr++;
 1813|    276|    if (*ptr == 0 || *ptr == '#')
  ------------------
  |  Branch (1813:9): [True: 138, False: 138]
  |  Branch (1813:22): [True: 0, False: 138]
  ------------------
 1814|    138|        return (NULL);
 1815|    138|    return (ptr);
 1816|    276|}
copy_nword_const:
 1873|    276|{
 1874|    276|    char            quote;
 1875|    276|    if (!from || !to)
  ------------------
  |  Branch (1875:9): [True: 0, False: 276]
  |  Branch (1875:18): [True: 0, False: 276]
  ------------------
 1876|      0|        return NULL;
 1877|    276|    if ((*from == '\"') || (*from == '\'')) {
  ------------------
  |  Branch (1877:9): [True: 0, False: 276]
  |  Branch (1877:28): [True: 0, False: 276]
  ------------------
 1878|      0|        quote = *(from++);
 1879|      0|        while ((*from != quote) && (*from != 0)) {
  ------------------
  |  Branch (1879:16): [True: 0, False: 0]
  |  Branch (1879:36): [True: 0, False: 0]
  ------------------
 1880|      0|            if ((*from == '\\') && (*(from + 1) != 0)) {
  ------------------
  |  Branch (1880:17): [True: 0, False: 0]
  |  Branch (1880:36): [True: 0, False: 0]
  ------------------
 1881|      0|                if (len > 0) {  /* don't copy beyond len bytes */
  ------------------
  |  Branch (1881:21): [True: 0, False: 0]
  ------------------
 1882|      0|                    *to++ = *(from + 1);
 1883|      0|                    if (--len == 0)
  ------------------
  |  Branch (1883:25): [True: 0, False: 0]
  ------------------
 1884|      0|                        *(to - 1) = '\0';       /* null protect the last spot */
 1885|      0|                }
 1886|      0|                from = from + 2;
 1887|      0|            } else {
 1888|      0|                if (len > 0) {  /* don't copy beyond len bytes */
  ------------------
  |  Branch (1888:21): [True: 0, False: 0]
  ------------------
 1889|      0|                    *to++ = *from++;
 1890|      0|                    if (--len == 0)
  ------------------
  |  Branch (1890:25): [True: 0, False: 0]
  ------------------
 1891|      0|                        *(to - 1) = '\0';       /* null protect the last spot */
 1892|      0|                } else
 1893|      0|                    from++;
 1894|      0|            }
 1895|      0|        }
 1896|      0|        if (*from == 0) {
  ------------------
  |  Branch (1896:13): [True: 0, False: 0]
  ------------------
 1897|      0|            DEBUGMSGTL(("read_config_copy_word",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1898|      0|                        "no end quote found in config string\n"));
 1899|      0|        } else
 1900|      0|            from++;
 1901|    276|    } else {
 1902|  1.24k|        while (*from != 0 && !isspace((unsigned char)(*from))) {
  ------------------
  |  Branch (1902:16): [True: 1.10k, False: 138]
  |  Branch (1902:30): [True: 966, False: 138]
  ------------------
 1903|    966|            if ((*from == '\\') && (*(from + 1) != 0)) {
  ------------------
  |  Branch (1903:17): [True: 0, False: 966]
  |  Branch (1903:36): [True: 0, False: 0]
  ------------------
 1904|      0|                if (len > 0) {  /* don't copy beyond len bytes */
  ------------------
  |  Branch (1904:21): [True: 0, False: 0]
  ------------------
 1905|      0|                    *to++ = *(from + 1);
 1906|      0|                    if (--len == 0)
  ------------------
  |  Branch (1906:25): [True: 0, False: 0]
  ------------------
 1907|      0|                        *(to - 1) = '\0';       /* null protect the last spot */
 1908|      0|                }
 1909|      0|                from = from + 2;
 1910|    966|            } else {
 1911|    966|                if (len > 0) {  /* don't copy beyond len bytes */
  ------------------
  |  Branch (1911:21): [True: 966, False: 0]
  ------------------
 1912|    966|                    *to++ = *from++;
 1913|    966|                    if (--len == 0)
  ------------------
  |  Branch (1913:25): [True: 0, False: 966]
  ------------------
 1914|      0|                        *(to - 1) = '\0';       /* null protect the last spot */
 1915|    966|                } else
 1916|      0|                    from++;
 1917|    966|            }
 1918|    966|        }
 1919|    276|    }
 1920|    276|    if (len > 0)
  ------------------
  |  Branch (1920:9): [True: 276, False: 0]
  ------------------
 1921|    276|        *to = 0;
 1922|    276|    from = skip_white_const(from);
 1923|    276|    return (from);
 1924|    276|}                               /* copy_nword */
read_config_save_octet_string:
 1965|     69|{
 1966|     69|    size_t          i;
 1967|     69|    const u_char   *cp;
 1968|       |
 1969|       |    /*
 1970|       |     * is everything easily printable
 1971|       |     */
 1972|     69|    for (i = 0, cp = str; i < len && cp &&
  ------------------
  |  Branch (1972:27): [True: 69, False: 0]
  |  Branch (1972:38): [True: 69, False: 0]
  ------------------
 1973|     69|         (isalpha(*cp) || isdigit(*cp) || *cp == ' '); cp++, i++);
  ------------------
  |  Branch (1973:11): [True: 0, False: 69]
  |  Branch (1973:27): [True: 0, False: 69]
  |  Branch (1973:43): [True: 0, False: 69]
  ------------------
 1974|       |
 1975|     69|    if (len != 0 && i == len) {
  ------------------
  |  Branch (1975:9): [True: 69, False: 0]
  |  Branch (1975:21): [True: 0, False: 69]
  ------------------
 1976|      0|        *saveto++ = '"';
 1977|      0|        memcpy(saveto, str, len);
 1978|      0|        saveto += len;
 1979|      0|        *saveto++ = '"';
 1980|      0|        *saveto = '\0';
 1981|     69|    } else {
 1982|     69|        if (str != NULL) {
  ------------------
  |  Branch (1982:13): [True: 69, False: 0]
  ------------------
 1983|     69|            sprintf(saveto, "0x");
 1984|     69|            saveto += 2;
 1985|  1.24k|            for (i = 0; i < len; i++) {
  ------------------
  |  Branch (1985:25): [True: 1.17k, False: 69]
  ------------------
 1986|  1.17k|                sprintf(saveto, "%02x", str[i]);
 1987|  1.17k|                saveto = saveto + 2;
 1988|  1.17k|            }
 1989|     69|        } else {
 1990|      0|            sprintf(saveto, "\"\"");
 1991|      0|            saveto += 2;
 1992|      0|        }
 1993|     69|    }
 1994|     69|    return saveto;
 1995|     69|}
read_config.c:internal_register_config_handler:
  152|  7.10k|{
  153|  7.10k|    struct config_files **ctmp = &config_files;
  154|  7.10k|    struct config_line  **ltmp;
  155|  7.10k|    const char           *type = type_param;
  156|       |
  157|  7.10k|    if (type == NULL || *type == '\0') {
  ------------------
  |  Branch (157:9): [True: 138, False: 6.96k]
  |  Branch (157:25): [True: 138, False: 6.83k]
  ------------------
  158|    276|        type = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|    276|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  159|    276|				     NETSNMP_DS_LIB_APPTYPE);
  ------------------
  |  |  157|    276|#define NETSNMP_DS_LIB_APPTYPE           6
  ------------------
  160|    276|    }
  161|       |
  162|       |    /*
  163|       |     * Handle multiple types (recursively)
  164|       |     */
  165|  7.10k|    if (strchr(type, ':')) {
  ------------------
  |  Branch (165:9): [True: 138, False: 6.96k]
  ------------------
  166|    138|        struct config_line *ltmp2 = NULL;
  167|    138|        char                buf[STRINGMAX];
  168|    138|        char               *cptr = buf;
  169|       |
  170|    138|        strlcpy(buf, type, STRINGMAX);
  ------------------
  |  |   12|    138|#define STRINGMAX 1024
  ------------------
  171|    414|        while (cptr) {
  ------------------
  |  Branch (171:16): [True: 276, False: 138]
  ------------------
  172|    276|            char* c = cptr;
  173|    276|            cptr = strchr(cptr, ':');
  174|    276|            if(cptr) {
  ------------------
  |  Branch (174:16): [True: 138, False: 138]
  ------------------
  175|    138|                *cptr = '\0';
  176|    138|                ++cptr;
  177|    138|            }
  178|    276|            ltmp2 = internal_register_config_handler(c, token, parser1, parser2,
  179|    276|                                                     releaser, help, when);
  180|    276|        }
  181|    138|        return ltmp2;
  182|    138|    }
  183|       |    
  184|       |    /*
  185|       |     * Find type in current list  -OR-  create a new file type.
  186|       |     */
  187|  8.14k|    while (*ctmp != NULL && strcmp((*ctmp)->fileHeader, type)) {
  ------------------
  |  Branch (187:12): [True: 8.00k, False: 138]
  |  Branch (187:29): [True: 1.17k, False: 6.83k]
  ------------------
  188|  1.17k|        ctmp = &((*ctmp)->next);
  189|  1.17k|    }
  190|       |
  191|  6.96k|    if (*ctmp == NULL) {
  ------------------
  |  Branch (191:9): [True: 138, False: 6.83k]
  ------------------
  192|    138|        *ctmp = (struct config_files *)
  193|    138|            calloc(1, sizeof(struct config_files));
  194|    138|        if (!*ctmp) {
  ------------------
  |  Branch (194:13): [True: 0, False: 138]
  ------------------
  195|      0|            return NULL;
  196|      0|        }
  197|       |
  198|    138|        (*ctmp)->fileHeader = strdup(type);
  199|    138|        if (!(*ctmp)->fileHeader) {
  ------------------
  |  Branch (199:13): [True: 0, False: 138]
  ------------------
  200|      0|            free(*ctmp);
  201|      0|            *ctmp = NULL;
  202|      0|            return NULL;
  203|      0|        }
  204|    138|        DEBUGMSGTL(("9:read_config:type", "new type %s\n", type));
  ------------------
  |  |   66|    138|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    138|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 138]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 138]
  |  |  ------------------
  ------------------
  205|    138|    }
  206|       |
  207|  6.96k|    DEBUGMSGTL(("9:read_config:register_handler", "registering %s %s\n",
  ------------------
  |  |   66|  6.96k|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|  6.96k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 6.96k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 6.96k]
  |  |  ------------------
  ------------------
  208|  6.96k|                type, token));
  209|       |    /*
  210|       |     * Find parser type in current list  -OR-  create a new
  211|       |     * line parser entry.
  212|       |     */
  213|  6.96k|    ltmp = &((*ctmp)->start);
  214|       |
  215|   256k|    while (*ltmp != NULL && strcmp((*ltmp)->config_token, token)) {
  ------------------
  |  Branch (215:12): [True: 249k, False: 6.96k]
  |  Branch (215:29): [True: 249k, False: 0]
  ------------------
  216|   249k|        ltmp = &((*ltmp)->next);
  217|   249k|    }
  218|       |
  219|  6.96k|    if (*ltmp == NULL) {
  ------------------
  |  Branch (219:9): [True: 6.96k, False: 0]
  ------------------
  220|  6.96k|        *ltmp = (struct config_line *)
  221|  6.96k|            calloc(1, sizeof(struct config_line));
  222|  6.96k|        if (!*ltmp) {
  ------------------
  |  Branch (222:13): [True: 0, False: 6.96k]
  ------------------
  223|      0|            return NULL;
  224|      0|        }
  225|       |
  226|  6.96k|        (*ltmp)->config_time = when;
  227|  6.96k|        (*ltmp)->config_token = strdup(token);
  228|  6.96k|        if (!(*ltmp)->config_token) {
  ------------------
  |  Branch (228:13): [True: 0, False: 6.96k]
  ------------------
  229|      0|            free(*ltmp);
  230|      0|            *ltmp = NULL;
  231|      0|            return NULL;
  232|      0|        }
  233|       |
  234|  6.96k|        if (help != NULL)
  ------------------
  |  Branch (234:13): [True: 6.14k, False: 828]
  ------------------
  235|  6.14k|            (*ltmp)->help = strdup(help);
  236|  6.96k|    }
  237|       |
  238|       |    /*
  239|       |     * Add/Replace the parse/free functions for the given line type
  240|       |     * in the given file type.
  241|       |     */
  242|  6.96k|    (*ltmp)->parse_line1 = parser1;
  243|  6.96k|    (*ltmp)->parse_line2 = parser2;
  244|  6.96k|    (*ltmp)->free_func = releaser;
  245|       |
  246|  6.96k|    return (*ltmp);
  247|       |
  248|  6.96k|}                               /* end register_config_handler() */

sc_find_auth_alg_byoid:
  266|    148|{
  267|    148|    int i = 0;
  268|       |
  269|    148|    DEBUGTRACE;
  ------------------
  |  |   63|    148|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    148|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 148]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  ------------------
  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  ------------------
  |  |  |  Branch (63:67): [Folded, False: 148]
  |  |  ------------------
  ------------------
  270|       |
  271|    148|    if ((NULL == authoid) || (0 == len))
  ------------------
  |  Branch (271:9): [True: 0, False: 148]
  |  Branch (271:30): [True: 0, False: 148]
  ------------------
  272|      0|        return NULL;
  273|       |
  274|    444|    for( ; _auth_alg_info[i].type != -1; ++i) {
  ------------------
  |  Branch (274:12): [True: 444, False: 0]
  ------------------
  275|    444|        if (len != _auth_alg_info[i].oid_len)
  ------------------
  |  Branch (275:13): [True: 0, False: 444]
  ------------------
  276|      0|            continue;
  277|    444|        if (snmp_oid_compare(_auth_alg_info[i].alg_oid,
  ------------------
  |  Branch (277:13): [True: 148, False: 296]
  ------------------
  278|    444|                             _auth_alg_info[i].oid_len,
  279|    444|                             authoid, len) == 0 )
  280|    148|            return(&_auth_alg_info[i]);
  281|    444|    }
  282|       |
  283|       |/*    DEBUGMSGTL(("scapi", "No auth alg found for"));
  284|       |      DEBUGMSGOID(("scapi", authoid, len ));*/
  285|       |
  286|      0|    return NULL;
  287|    148|}
sc_find_auth_alg_bytype:
  313|    148|{
  314|    148|    int i = 0;
  315|       |
  316|    148|    DEBUGTRACE;
  ------------------
  |  |   63|    148|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    148|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 148]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  ------------------
  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  ------------------
  |  |  |  Branch (63:67): [Folded, False: 148]
  |  |  ------------------
  ------------------
  317|       |
  318|    444|    for( ; _auth_alg_info[i].type != -1; ++i) {
  ------------------
  |  Branch (318:12): [True: 444, False: 0]
  ------------------
  319|    444|        if (type != _auth_alg_info[i].type)
  ------------------
  |  Branch (319:13): [True: 296, False: 148]
  ------------------
  320|    296|            continue;
  321|    148|        return(&_auth_alg_info[i]);
  322|    444|    }
  323|       |
  324|      0|    return NULL;
  325|    148|}
sc_get_authtype:
  338|    148|{
  339|    148|    const netsnmp_auth_alg_info *aai;
  340|       |
  341|    148|    DEBUGTRACE;
  ------------------
  |  |   63|    148|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    148|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 148]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  ------------------
  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  ------------------
  |  |  |  Branch (63:67): [Folded, False: 148]
  |  |  ------------------
  ------------------
  342|       |
  343|    148|    aai = sc_find_auth_alg_byoid(hashtype, hashtype_len);
  344|    148|    if (NULL == aai)
  ------------------
  |  Branch (344:9): [True: 0, False: 148]
  ------------------
  345|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  346|       |
  347|    148|    return aai->type;
  348|    148|}
sc_get_proper_auth_length_bytype:
  395|    148|{
  396|    148|    const netsnmp_auth_alg_info *aai;
  397|       |
  398|    148|    DEBUGTRACE;
  ------------------
  |  |   63|    148|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    148|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 148]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  ------------------
  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  ------------------
  |  |  |  Branch (63:67): [Folded, False: 148]
  |  |  ------------------
  ------------------
  399|       |
  400|    148|    aai = sc_find_auth_alg_bytype(hashtype);
  401|    148|    if (NULL == aai)
  ------------------
  |  Branch (401:9): [True: 0, False: 148]
  ------------------
  402|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  403|       |
  404|    148|    return aai->proper_length;
  405|    148|}
sc_init:
  546|     69|{
  547|     69|    int             rval = SNMPERR_SUCCESS;
  ------------------
  |  |  217|     69|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  548|       |
  549|       |#if !defined(NETSNMP_USE_OPENSSL)
  550|       |#if defined(NETSNMP_USE_INTERNAL_MD5) || defined(NETSNMP_USE_INTERNAL_CRYPTO)
  551|       |    struct timeval  tv;
  552|       |
  553|       |    DEBUGTRACE;
  554|       |
  555|       |    gettimeofday(&tv, (struct timezone *) 0);
  556|       |
  557|       |    netsnmp_srandom((unsigned)(tv.tv_sec ^ tv.tv_usec));
  558|       |#elif defined(NETSNMP_USE_PKCS11)
  559|       |    DEBUGTRACE;
  560|       |    rval = pkcs_init();
  561|       |#else
  562|       |    rval = SNMPERR_SC_NOT_CONFIGURED;
  563|       |#endif                           /* NETSNMP_USE_INTERNAL_MD5 */
  564|       |    /*
  565|       |     * XXX ogud: The only reason to do anything here with openssl is to 
  566|       |     * * XXX ogud: seed random number generator 
  567|       |     */
  568|       |#endif                          /* ifndef NETSNMP_USE_OPENSSL */
  569|       |
  570|     69|    return rval;
  571|     69|}                               /* end sc_init() */
sc_random:
  586|    207|{
  587|    207|    int             rval = SNMPERR_SUCCESS;
  ------------------
  |  |  217|    207|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  588|       |#if !defined(NETSNMP_USE_OPENSSL) && !defined(NETSNMP_USE_PKCS11)
  589|       |    int             i;
  590|       |    int             rndval;
  591|       |    u_char         *ucp = buf;
  592|       |#endif
  593|       |
  594|    207|    DEBUGTRACE;
  ------------------
  |  |   63|    207|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    207|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 207]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  ------------------
  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  ------------------
  |  |  |  Branch (63:67): [Folded, False: 207]
  |  |  ------------------
  ------------------
  595|       |
  596|    207|#ifdef NETSNMP_USE_OPENSSL
  597|    207|    RAND_bytes(buf, *buflen);   /* will never fail */
  598|    207|    MAKE_MEM_DEFINED(buf, *buflen);
  ------------------
  |  |    8|    207|#define MAKE_MEM_DEFINED(ptr, len) do { } while (0)
  |  |  ------------------
  |  |  |  Branch (8:50): [Folded, False: 207]
  |  |  ------------------
  ------------------
  599|       |#elif defined(NETSNMP_USE_PKCS11)  /* NETSNMP_USE_PKCS11 */
  600|       |    pkcs_random(buf, *buflen);
  601|       |#else                           /* NETSNMP_USE_INTERNAL_MD5 */
  602|       |    /*
  603|       |     * fill the buffer with random integers.  Note that random()
  604|       |     * is defined in config.h and may not be truly the random()
  605|       |     * system call if something better existed 
  606|       |     */
  607|       |    rval = *buflen - *buflen % sizeof(rndval);
  608|       |    for (i = 0; i < rval; i += sizeof(rndval)) {
  609|       |        rndval = netsnmp_random();
  610|       |        memcpy(ucp, &rndval, sizeof(rndval));
  611|       |        ucp += sizeof(rndval);
  612|       |    }
  613|       |
  614|       |    rndval = netsnmp_random();
  615|       |    memcpy(ucp, &rndval, *buflen % sizeof(rndval));
  616|       |
  617|       |    rval = SNMPERR_SUCCESS;
  618|       |#endif                          /* NETSNMP_USE_OPENSSL */
  619|    207|    return rval;
  620|       |
  621|    207|}                               /* end sc_random() */
sc_get_openssl_hashfn:
  631|    148|{
  632|    148|    const EVP_MD   *hashfn = NULL;
  633|       |
  634|    148|    DEBUGTRACE;
  ------------------
  |  |   63|    148|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    148|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 148]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  ------------------
  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  ------------------
  |  |  |  Branch (63:67): [Folded, False: 148]
  |  |  ------------------
  ------------------
  635|       |
  636|    148|    switch (auth_type) {
  ------------------
  |  Branch (636:13): [True: 148, False: 0]
  ------------------
  637|      0|#ifndef NETSNMP_DISABLE_MD5
  638|    148|        case NETSNMP_USMAUTH_HMACMD5:
  ------------------
  |  |   21|    148|#define NETSNMP_USMAUTH_HMACMD5           2
  ------------------
  |  Branch (638:9): [True: 148, False: 0]
  ------------------
  639|    148|            hashfn = (const EVP_MD *) EVP_md5();
  640|    148|            break;
  641|      0|#endif
  642|      0|        case NETSNMP_USMAUTH_HMACSHA1:
  ------------------
  |  |   22|      0|#define NETSNMP_USMAUTH_HMACSHA1          3
  ------------------
  |  Branch (642:9): [True: 0, False: 148]
  ------------------
  643|      0|            hashfn = (const EVP_MD *) EVP_sha1();
  644|      0|            break;
  645|       |
  646|      0|#ifdef HAVE_EVP_SHA224
  647|      0|        case NETSNMP_USMAUTH_HMAC128SHA224:
  ------------------
  |  |   24|      0|#define NETSNMP_USMAUTH_HMAC128SHA224     4 /* RFC 7860; OPTIONAL */
  ------------------
  |  Branch (647:9): [True: 0, False: 148]
  ------------------
  648|      0|            hashfn = (const EVP_MD *) EVP_sha224();
  649|      0|            break;
  650|       |
  651|      0|        case NETSNMP_USMAUTH_HMAC192SHA256:
  ------------------
  |  |   25|      0|#define NETSNMP_USMAUTH_HMAC192SHA256     5 /* RFC 7860; MUST */
  ------------------
  |  Branch (651:9): [True: 0, False: 148]
  ------------------
  652|      0|            hashfn = (const EVP_MD *) EVP_sha256();
  653|      0|            break;
  654|      0|#endif /* HAVE_EVP_SHA224 */
  655|       |
  656|      0|#ifdef HAVE_EVP_SHA384
  657|      0|        case NETSNMP_USMAUTH_HMAC256SHA384:
  ------------------
  |  |   26|      0|#define NETSNMP_USMAUTH_HMAC256SHA384     6 /* RFC 7860; OPTIONAL */
  ------------------
  |  Branch (657:9): [True: 0, False: 148]
  ------------------
  658|      0|            hashfn = (const EVP_MD *) EVP_sha384();
  659|      0|            break;
  660|       |
  661|      0|        case NETSNMP_USMAUTH_HMAC384SHA512:
  ------------------
  |  |   27|      0|#define NETSNMP_USMAUTH_HMAC384SHA512     7 /* RFC 7860; SHOULD */
  ------------------
  |  Branch (661:9): [True: 0, False: 148]
  ------------------
  662|      0|            hashfn = (const EVP_MD *) EVP_sha512();
  663|      0|            break;
  664|    148|#endif /* HAVE_EVP_SHA384 */
  665|    148|    }
  666|       |
  667|    148|    return hashfn;
  668|    148|}
sc_hash:
  886|    148|{
  887|    148|    int auth_type;
  888|       |
  889|    148|    DEBUGTRACE;
  ------------------
  |  |   63|    148|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    148|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 148]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  ------------------
  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  ------------------
  |  |  |  Branch (63:67): [Folded, False: 148]
  |  |  ------------------
  ------------------
  890|       |
  891|    148|    if (hashtype == NULL)
  ------------------
  |  Branch (891:9): [True: 0, False: 148]
  ------------------
  892|      0|        return (SNMPERR_GENERR);
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  893|       |
  894|    148|    auth_type = sc_get_authtype(hashtype, hashtypelen);
  895|    148|    if (auth_type < 0 )
  ------------------
  |  Branch (895:9): [True: 0, False: 148]
  ------------------
  896|      0|        return (SNMPERR_GENERR);
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  897|       |
  898|    148|    return sc_hash_type(auth_type, buf, buf_len, MAC, MAC_len);
  899|    148|}
sc_hash_type:
  925|    148|{
  926|    148|#if defined(NETSNMP_USE_OPENSSL) || defined(NETSNMP_USE_PKCS11) || defined(NETSNMP_USE_INTERNAL_CRYPTO)
  927|    148|    int            rval = SNMPERR_SUCCESS;
  ------------------
  |  |  217|    148|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  928|    148|#endif
  929|    148|#if defined(NETSNMP_USE_OPENSSL) || defined(NETSNMP_USE_PKCS11)
  930|    148|    unsigned int   tmp_len;
  931|    148|#endif
  932|    148|    int            ret;
  933|       |
  934|    148|#ifdef NETSNMP_USE_OPENSSL
  935|    148|    const EVP_MD   *hashfn;
  936|    148|    EVP_MD_CTX     *cptr;
  937|    148|#endif
  938|       |#ifdef NETSNMP_USE_INTERNAL_CRYPTO
  939|       |    MD5_CTX        cmd5;
  940|       |    SHA_CTX        csha1;
  941|       |#endif
  942|    148|    DEBUGTRACE;
  ------------------
  |  |   63|    148|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    148|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 148]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  ------------------
  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  ------------------
  |  |  |  Branch (63:67): [Folded, False: 148]
  |  |  ------------------
  ------------------
  943|       |
  944|    148|    if (buf == NULL || buf_len <= 0 || MAC == NULL || MAC_len == NULL )
  ------------------
  |  Branch (944:9): [True: 0, False: 148]
  |  Branch (944:24): [True: 0, False: 148]
  |  Branch (944:40): [True: 0, False: 148]
  |  Branch (944:55): [True: 0, False: 148]
  ------------------
  945|      0|        return (SNMPERR_GENERR);
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  946|       |
  947|    148|    ret = sc_get_proper_auth_length_bytype(auth_type);
  948|    148|    if (( ret < 0 ) || (*MAC_len < (size_t)ret ))
  ------------------
  |  Branch (948:9): [True: 0, False: 148]
  |  Branch (948:24): [True: 0, False: 148]
  ------------------
  949|      0|        return (SNMPERR_GENERR);
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  950|       |
  951|    148|#ifdef NETSNMP_USE_OPENSSL
  952|       |    /*
  953|       |     * Determine transform type.
  954|       |     */
  955|    148|    hashfn = sc_get_openssl_hashfn(auth_type);
  956|    148|    if (NULL == hashfn)
  ------------------
  |  Branch (956:9): [True: 0, False: 148]
  ------------------
  957|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  958|       |
  959|       |/** initialize the pointer */
  960|    148|#if defined(HAVE_EVP_MD_CTX_NEW)
  961|    148|    cptr = EVP_MD_CTX_new();
  962|       |#elif defined(HAVE_EVP_MD_CTX_CREATE)
  963|       |    cptr = EVP_MD_CTX_create();
  964|       |#else
  965|       |    cptr = malloc(sizeof(*cptr));
  966|       |#if defined(OLD_DES)
  967|       |    memset(cptr, 0, sizeof(*cptr));
  968|       |#else
  969|       |    EVP_MD_CTX_init(cptr);
  970|       |#endif
  971|       |#endif
  972|    148|    if (!EVP_DigestInit(cptr, hashfn)) {
  ------------------
  |  Branch (972:9): [True: 0, False: 148]
  ------------------
  973|       |        /* requested hash function is not available */
  974|      0|        rval = SNMPERR_SC_NOT_CONFIGURED;
  ------------------
  |  |  256|      0|#define SNMPERR_SC_NOT_CONFIGURED	(-39)
  ------------------
  975|      0|        goto sc_hash_type_quit;
  976|      0|    }
  977|       |
  978|       |/** pass the data */
  979|    148|    EVP_DigestUpdate(cptr, buf, buf_len);
  980|       |
  981|       |/** do the final pass */
  982|    148|    EVP_DigestFinal(cptr, MAC, &tmp_len);
  983|    148|    *MAC_len = tmp_len;
  984|       |
  985|    148|sc_hash_type_quit:
  986|    148|#if defined(HAVE_EVP_MD_CTX_FREE)
  987|    148|    EVP_MD_CTX_free(cptr);
  988|       |#elif defined(HAVE_EVP_MD_CTX_DESTROY)
  989|       |    EVP_MD_CTX_destroy(cptr);
  990|       |#else
  991|       |#if !defined(OLD_DES)
  992|       |    EVP_MD_CTX_cleanup(cptr);
  993|       |#endif
  994|       |    free(cptr);
  995|       |#endif
  996|    148|    return (rval);
  997|       |
  998|       |#elif defined(NETSNMP_USE_INTERNAL_CRYPTO)
  999|       |#ifndef NETSNMP_DISABLE_MD5
 1000|       |    if (NETSNMP_USMAUTH_HMACMD5 == auth_type) {
 1001|       |        if (*MAC_len < MD5_DIGEST_LENGTH)
 1002|       |            return (SNMPERR_GENERR);      /* the buffer isn't big enough */
 1003|       |        MD5_Init(&cmd5);
 1004|       |        ret = !MD5_Update(&cmd5, buf, buf_len);
 1005|       |        if (ret != 0)
 1006|       |            return SNMPERR_GENERR;
 1007|       |        MD5_Final(MAC, &cmd5);
 1008|       |        *MAC_len = MD5_DIGEST_LENGTH;
 1009|       |    } else 
 1010|       |#endif
 1011|       |    if (NETSNMP_USMAUTH_HMACSHA1 == auth_type) {
 1012|       |        if (*MAC_len < SHA_DIGEST_LENGTH)
 1013|       |            return (SNMPERR_GENERR);      /* the buffer isn't big enough */
 1014|       |        SHA1_Init(&csha1);
 1015|       |        ret = !SHA1_Update(&csha1, buf, buf_len);
 1016|       |        if (ret != 0)
 1017|       |            return SNMPERR_GENERR;
 1018|       |        SHA1_Final(MAC, &csha1);
 1019|       |        *MAC_len = SHA_DIGEST_LENGTH;
 1020|       |            
 1021|       |    } else {
 1022|       |        return (SNMPERR_GENERR);
 1023|       |    }
 1024|       |    return (rval);
 1025|       |#elif defined(NETSNMP_USE_PKCS11)        /* NETSNMP_USE_PKCS11 */
 1026|       |
 1027|       |#ifndef NETSNMP_DISABLE_MD5
 1028|       |    if (NETSNMP_USMAUTH_HMACMD5 == auth_type) {
 1029|       |        rval = pkcs_digest(CKM_MD5, buf, buf_len, MAC, &tmp_len);
 1030|       |        *MAC_len = tmp_len;
 1031|       |    } else
 1032|       |#endif
 1033|       |    if (NETSNMP_USMAUTH_HMACSHA1 == auth_type) {
 1034|       |       rval = pkcs_digest(CKM_SHA_1, buf, buf_len, MAC, &tmp_len);
 1035|       |        *MAC_len = tmp_len;
 1036|       |    } else {
 1037|       |        return (SNMPERR_GENERR);
 1038|       |    }
 1039|       |
 1040|       |     return (rval);
 1041|       |
 1042|       |#else                           /* NETSNMP_USE_INTERNAL_MD5 */
 1043|       |
 1044|       |    if (MDchecksum(buf, buf_len, MAC, *MAC_len)) {
 1045|       |        return SNMPERR_GENERR;
 1046|       |    }
 1047|       |    if (*MAC_len > 16)
 1048|       |        *MAC_len = 16;
 1049|       |    return SNMPERR_SUCCESS;
 1050|       |
 1051|       |#endif                          /* NETSNMP_USE_OPENSSL */
 1052|    148|}
sc_check_keyed_hash:
 1085|      1|{
 1086|      1|    int             rval = SNMPERR_SUCCESS, auth_type, auth_size;
  ------------------
  |  |  217|      1|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1087|      1|    size_t          buf_len = SNMP_MAXBUF_SMALL;
  ------------------
  |  |   45|      1|#define SNMP_MAXBUF_SMALL	512
  ------------------
 1088|       |
 1089|      1|    u_char          buf[SNMP_MAXBUF_SMALL];
 1090|       |
 1091|      1|    DEBUGTRACE;
  ------------------
  |  |   63|      1|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  ------------------
  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  ------------------
  |  |  |  Branch (63:67): [Folded, False: 1]
  |  |  ------------------
  ------------------
 1092|       |
 1093|       |#ifdef NETSNMP_ENABLE_TESTING_CODE
 1094|       |    {
 1095|       |        int             i;
 1096|       |        DEBUGMSG(("scapi", "sc_check_keyed_hash():    key=0x"));
 1097|       |        for (i = 0; i < keylen; i++)
 1098|       |            DEBUGMSG(("scapi", "%02x", key[i] & 0xff));
 1099|       |        DEBUGMSG(("scapi", " (%d)\n", keylen));
 1100|       |    }
 1101|       |#endif                          /* NETSNMP_ENABLE_TESTING_CODE */
 1102|       |
 1103|       |    /*
 1104|       |     * Sanity check.
 1105|       |     */
 1106|      1|    if (!authtypeOID || !key || !message || !MAC
  ------------------
  |  Branch (1106:9): [True: 0, False: 1]
  |  Branch (1106:25): [True: 1, False: 0]
  |  Branch (1106:33): [True: 0, False: 0]
  |  Branch (1106:45): [True: 0, False: 0]
  ------------------
 1107|      1|        || (keylen <= 0) || (msglen <= 0) || (maclen <= 0)) {
  ------------------
  |  Branch (1107:12): [True: 0, False: 0]
  |  Branch (1107:29): [True: 0, False: 0]
  |  Branch (1107:46): [True: 0, False: 0]
  ------------------
 1108|      1|        QUITFUN(SNMPERR_GENERR, sc_check_keyed_hash_quit);
  ------------------
  |  |  117|      1|#define QUITFUN(e, l) do {                              \
  |  |  118|      1|	if (e != SNMPERR_SUCCESS) {			\
  |  |  ------------------
  |  |  |  |  217|      2|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (118:6): [True: 1, Folded]
  |  |  ------------------
  |  |  119|      1|		rval = SNMPERR_SC_GENERAL_FAILURE;	\
  |  |  ------------------
  |  |  |  |  255|      1|#define SNMPERR_SC_GENERAL_FAILURE	(-38)
  |  |  ------------------
  |  |  120|      1|		goto l ;				\
  |  |  121|      1|        }                                               \
  |  |  122|      1|    } while (0)
  |  |  ------------------
  |  |  |  Branch (122:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1109|      1|    }
 1110|       |
 1111|      0|    auth_type = sc_get_authtype(authtypeOID, authtypeOIDlen);
 1112|      0|    if (auth_type < 0 )
  ------------------
  |  Branch (1112:9): [True: 0, False: 0]
  ------------------
 1113|      0|        return (SNMPERR_GENERR);
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 1114|       |
 1115|      0|    auth_size = sc_get_auth_maclen(auth_type);
 1116|      0|    if (0 == auth_size || maclen != auth_size) {
  ------------------
  |  Branch (1116:9): [True: 0, False: 0]
  |  Branch (1116:27): [True: 0, False: 0]
  ------------------
 1117|      0|        QUITFUN(SNMPERR_GENERR, sc_check_keyed_hash_quit);
  ------------------
  |  |  117|      0|#define QUITFUN(e, l) do {                              \
  |  |  118|      0|	if (e != SNMPERR_SUCCESS) {			\
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (118:6): [True: 0, Folded]
  |  |  ------------------
  |  |  119|      0|		rval = SNMPERR_SC_GENERAL_FAILURE;	\
  |  |  ------------------
  |  |  |  |  255|      0|#define SNMPERR_SC_GENERAL_FAILURE	(-38)
  |  |  ------------------
  |  |  120|      0|		goto l ;				\
  |  |  121|      0|        }                                               \
  |  |  122|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (122:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1118|      0|    }
 1119|       |
 1120|       |    /*
 1121|       |     * Generate a full hash of the message, then compare
 1122|       |     * the result with the given MAC which may be shorter than
 1123|       |     * the full hash length.
 1124|       |     */
 1125|      0|    rval = sc_generate_keyed_hash(authtypeOID, authtypeOIDlen, key, keylen,
 1126|      0|                                  message, msglen, buf, &buf_len);
 1127|      0|    QUITFUN(rval, sc_check_keyed_hash_quit);
  ------------------
  |  |  117|      0|#define QUITFUN(e, l) do {                              \
  |  |  118|      0|	if (e != SNMPERR_SUCCESS) {			\
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (118:6): [True: 0, False: 0]
  |  |  ------------------
  |  |  119|      0|		rval = SNMPERR_SC_GENERAL_FAILURE;	\
  |  |  ------------------
  |  |  |  |  255|      0|#define SNMPERR_SC_GENERAL_FAILURE	(-38)
  |  |  ------------------
  |  |  120|      0|		goto l ;				\
  |  |  121|      0|        }                                               \
  |  |  122|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (122:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1128|       |
 1129|      0|    if (maclen > msglen) {
  ------------------
  |  Branch (1129:9): [True: 0, False: 0]
  ------------------
 1130|      0|        QUITFUN(SNMPERR_GENERR, sc_check_keyed_hash_quit);
  ------------------
  |  |  117|      0|#define QUITFUN(e, l) do {                              \
  |  |  118|      0|	if (e != SNMPERR_SUCCESS) {			\
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (118:6): [True: 0, Folded]
  |  |  ------------------
  |  |  119|      0|		rval = SNMPERR_SC_GENERAL_FAILURE;	\
  |  |  ------------------
  |  |  |  |  255|      0|#define SNMPERR_SC_GENERAL_FAILURE	(-38)
  |  |  ------------------
  |  |  120|      0|		goto l ;				\
  |  |  121|      0|        }                                               \
  |  |  122|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (122:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1131|       |
 1132|      0|    } else if (memcmp(buf, MAC, maclen) != 0) {
  ------------------
  |  Branch (1132:16): [True: 0, False: 0]
  ------------------
 1133|      0|        QUITFUN(SNMPERR_GENERR, sc_check_keyed_hash_quit);
  ------------------
  |  |  117|      0|#define QUITFUN(e, l) do {                              \
  |  |  118|      0|	if (e != SNMPERR_SUCCESS) {			\
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (118:6): [True: 0, Folded]
  |  |  ------------------
  |  |  119|      0|		rval = SNMPERR_SC_GENERAL_FAILURE;	\
  |  |  ------------------
  |  |  |  |  255|      0|#define SNMPERR_SC_GENERAL_FAILURE	(-38)
  |  |  ------------------
  |  |  120|      0|		goto l ;				\
  |  |  121|      0|        }                                               \
  |  |  122|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (122:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1134|      0|    }
 1135|       |
 1136|       |
 1137|      1|  sc_check_keyed_hash_quit:
 1138|      1|    memset(buf, 0, SNMP_MAXBUF_SMALL);
  ------------------
  |  |   45|      1|#define SNMP_MAXBUF_SMALL	512
  ------------------
 1139|       |
 1140|      1|    return rval;
 1141|       |
 1142|      0|}                               /* end sc_check_keyed_hash() */

netsnmp_sd_listen_fds:
   72|     69|int netsnmp_sd_listen_fds(int unset_environment) {
   73|       |
   74|     69|        int r, fd;
   75|     69|        const char *e;
   76|     69|        char *p = NULL;
   77|     69|        unsigned long l;
   78|       |
   79|     69|        if (!(e = getenv("LISTEN_PID"))) {
  ------------------
  |  Branch (79:13): [True: 69, False: 0]
  ------------------
   80|     69|                r = 0;
   81|     69|                goto finish;
   82|     69|        }
   83|       |
   84|     69|        errno = 0;
   85|      0|        l = strtoul(e, &p, 10);
   86|       |
   87|      0|        if (errno != 0) {
  ------------------
  |  Branch (87:13): [True: 0, False: 0]
  ------------------
   88|      0|                r = -errno;
   89|      0|                goto finish;
   90|      0|        }
   91|       |
   92|      0|        if (!p || *p || l <= 0) {
  ------------------
  |  Branch (92:13): [True: 0, False: 0]
  |  Branch (92:19): [True: 0, False: 0]
  |  Branch (92:25): [True: 0, False: 0]
  ------------------
   93|      0|                r = -EINVAL;
   94|      0|                goto finish;
   95|      0|        }
   96|       |
   97|       |        /* Is this for us? */
   98|      0|        if (getpid() != (pid_t) l) {
  ------------------
  |  Branch (98:13): [True: 0, False: 0]
  ------------------
   99|      0|                r = 0;
  100|      0|                goto finish;
  101|      0|        }
  102|       |
  103|      0|        if (!(e = getenv("LISTEN_FDS"))) {
  ------------------
  |  Branch (103:13): [True: 0, False: 0]
  ------------------
  104|      0|                r = 0;
  105|      0|                goto finish;
  106|      0|        }
  107|       |
  108|      0|        errno = 0;
  109|      0|        l = strtoul(e, &p, 10);
  110|       |
  111|      0|        if (errno != 0 || l != (int)l) {
  ------------------
  |  Branch (111:13): [True: 0, False: 0]
  |  Branch (111:27): [True: 0, False: 0]
  ------------------
  112|      0|                r = errno ? -errno : -EINVAL;
  ------------------
  |  Branch (112:21): [True: 0, False: 0]
  ------------------
  113|      0|                goto finish;
  114|      0|        }
  115|       |
  116|      0|        if (!p || *p) {
  ------------------
  |  Branch (116:13): [True: 0, False: 0]
  |  Branch (116:19): [True: 0, False: 0]
  ------------------
  117|      0|                r = -EINVAL;
  118|      0|                goto finish;
  119|      0|        }
  120|       |
  121|      0|        for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + (int) l; fd ++) {
  ------------------
  |  |   70|      0|#define SD_LISTEN_FDS_START 3
  ------------------
                      for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + (int) l; fd ++) {
  ------------------
  |  |   70|      0|#define SD_LISTEN_FDS_START 3
  ------------------
  |  Branch (121:40): [True: 0, False: 0]
  ------------------
  122|      0|                int flags;
  123|       |
  124|      0|                if ((flags = fcntl(fd, F_GETFD)) < 0) {
  ------------------
  |  Branch (124:21): [True: 0, False: 0]
  ------------------
  125|      0|                        r = -errno;
  126|      0|                        goto finish;
  127|      0|                }
  128|       |
  129|      0|                if (flags & FD_CLOEXEC)
  ------------------
  |  Branch (129:21): [True: 0, False: 0]
  ------------------
  130|      0|                        continue;
  131|       |
  132|      0|                if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) < 0) {
  ------------------
  |  Branch (132:21): [True: 0, False: 0]
  ------------------
  133|      0|                        r = -errno;
  134|      0|                        goto finish;
  135|      0|                }
  136|      0|        }
  137|       |
  138|      0|        r = (int) l;
  139|       |
  140|     69|finish:
  141|     69|        if (unset_environment) {
  ------------------
  |  Branch (141:13): [True: 0, False: 69]
  ------------------
  142|      0|                unsetenv("LISTEN_PID");
  143|      0|                unsetenv("LISTEN_FDS");
  144|      0|        }
  145|       |
  146|     69|        return r;
  147|      0|}
netsnmp_sd_find_inet_socket:
  356|     69|{
  357|     69|    int count, fd;
  358|       |
  359|     69|    count = netsnmp_sd_listen_fds(0);
  360|     69|    if (count <= 0) {
  ------------------
  |  Branch (360:9): [True: 69, False: 0]
  ------------------
  361|     69|        DEBUGMSGTL(("systemd:find_inet_socket", "No LISTEN_FDS found.\n"));
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
  362|     69|        return -1;
  363|     69|    }
  364|      0|    DEBUGMSGTL(("systemd:find_inet_socket", "LISTEN_FDS reports %d sockets.\n",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  365|      0|            count));
  366|       |
  367|      0|    for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + count; fd++) {
  ------------------
  |  |   70|      0|#define SD_LISTEN_FDS_START 3
  ------------------
                  for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + count; fd++) {
  ------------------
  |  |   70|      0|#define SD_LISTEN_FDS_START 3
  ------------------
  |  Branch (367:36): [True: 0, False: 0]
  ------------------
  368|      0|        int rc = sd_is_socket_inet(fd, family, type, listening, port);
  369|      0|        if (rc < 0)
  ------------------
  |  Branch (369:13): [True: 0, False: 0]
  ------------------
  370|      0|            DEBUGMSGTL(("systemd:find_inet_socket",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  371|      0|                    "sd_is_socket_inet error: %d\n", rc));
  372|      0|        if (rc > 0) {
  ------------------
  |  Branch (372:13): [True: 0, False: 0]
  ------------------
  373|      0|            DEBUGMSGTL(("systemd:find_inet_socket",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  374|      0|                    "Found the socket in LISTEN_FDS\n"));
  375|      0|            return fd;
  376|      0|        }
  377|      0|    }
  378|      0|    DEBUGMSGTL(("systemd:find_inet_socket", "Socket not found in LISTEN_FDS\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  379|      0|    return -1;
  380|      0|}

snmp_realloc_rbuild_var_op:
  320|      4|{
  321|      4|    size_t          start_offset = *offset;
  322|      4|    int             rc = 0;
  323|       |
  324|       |    /*
  325|       |     * Encode the value.  
  326|       |     */
  327|      4|    DEBUGDUMPHEADER("send", "Value");
  ------------------
  |  |   79|      4|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 4]
  |  |  ------------------
  ------------------
  328|       |
  329|      4|    switch (var_val_type) {
  330|      0|    case ASN_INTEGER:
  ------------------
  |  |   75|      0|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (330:5): [True: 0, False: 4]
  ------------------
  331|      0|        rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, allow_realloc,
  332|      0|                                    var_val_type, (long *) var_val,
  333|      0|                                    var_val_len);
  334|      0|        break;
  335|       |
  336|      0|    case ASN_GAUGE:
  ------------------
  |  |   90|      0|#define ASN_GAUGE	(ASN_APPLICATION | 2)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (336:5): [True: 0, False: 4]
  ------------------
  337|      4|    case ASN_COUNTER:
  ------------------
  |  |   89|      4|#define ASN_COUNTER	(ASN_APPLICATION | 1)
  |  |  ------------------
  |  |  |  |   91|      4|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (337:5): [True: 4, False: 0]
  ------------------
  338|      4|    case ASN_TIMETICKS:
  ------------------
  |  |   92|      4|#define ASN_TIMETICKS   (ASN_APPLICATION | 3)
  |  |  ------------------
  |  |  |  |   91|      4|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (338:5): [True: 0, False: 4]
  ------------------
  339|      4|    case ASN_UINTEGER:
  ------------------
  |  |  100|      4|#define ASN_UINTEGER    (ASN_APPLICATION | 7)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|      4|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (339:5): [True: 0, False: 4]
  ------------------
  340|      4|        rc = asn_realloc_rbuild_unsigned_int(pkt, pkt_len, offset,
  341|      4|                                             allow_realloc, var_val_type,
  342|      4|                                             (u_long *) var_val,
  343|      4|                                             var_val_len);
  344|      4|        break;
  345|       |
  346|      0|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
  347|      0|    case ASN_OPAQUE_COUNTER64:
  ------------------
  |  |  156|      0|#define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  146|      0|#define ASN_APP_COUNTER64 (ASN_APPLICATION | 6)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (347:5): [True: 0, False: 4]
  ------------------
  348|      0|    case ASN_OPAQUE_U64:
  ------------------
  |  |  192|      0|#define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  150|      0|#define ASN_APP_U64 (ASN_APPLICATION | 11)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (348:5): [True: 0, False: 4]
  ------------------
  349|      0|#endif
  350|      0|    case ASN_COUNTER64:
  ------------------
  |  |   99|      0|#define ASN_COUNTER64   (ASN_APPLICATION | 6)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (350:5): [True: 0, False: 4]
  ------------------
  351|      0|        rc = asn_realloc_rbuild_unsigned_int64(pkt, pkt_len, offset,
  352|      0|                                               allow_realloc, var_val_type,
  353|      0|                                               (struct counter64 *)
  354|      0|                                               var_val, var_val_len);
  355|      0|        break;
  356|       |
  357|      0|    case ASN_OCTET_STR:
  ------------------
  |  |   78|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
  |  Branch (357:5): [True: 0, False: 4]
  ------------------
  358|      0|    case ASN_IPADDRESS:
  ------------------
  |  |   88|      0|#define ASN_IPADDRESS   (ASN_APPLICATION | 0)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (358:5): [True: 0, False: 4]
  ------------------
  359|      0|    case ASN_OPAQUE:
  ------------------
  |  |   93|      0|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (359:5): [True: 0, False: 4]
  ------------------
  360|      0|    case ASN_NSAP:
  ------------------
  |  |   98|      0|#define ASN_NSAP	(ASN_APPLICATION | 5)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (360:5): [True: 0, False: 4]
  ------------------
  361|      0|        rc = asn_realloc_rbuild_string(pkt, pkt_len, offset, allow_realloc,
  362|      0|                                       var_val_type, var_val, var_val_len);
  363|      0|        break;
  364|       |
  365|      0|    case ASN_OBJECT_ID:
  ------------------
  |  |   81|      0|#define ASN_OBJECT_ID	    0x06U
  ------------------
  |  Branch (365:5): [True: 0, False: 4]
  ------------------
  366|      0|        rc = asn_realloc_rbuild_objid(pkt, pkt_len, offset, allow_realloc,
  367|      0|                                      var_val_type, (oid *) var_val,
  368|      0|                                      var_val_len / sizeof(oid));
  369|      0|        break;
  370|       |
  371|      0|    case ASN_NULL:
  ------------------
  |  |   79|      0|#define ASN_NULL	    0x05U
  ------------------
  |  Branch (371:5): [True: 0, False: 4]
  ------------------
  372|      0|        rc = asn_realloc_rbuild_null(pkt, pkt_len, offset, allow_realloc,
  373|      0|                                     var_val_type);
  374|      0|        break;
  375|       |
  376|      0|    case ASN_BIT_STR:
  ------------------
  |  |   77|      0|#define ASN_BIT_STR	    0x03U
  ------------------
  |  Branch (376:5): [True: 0, False: 4]
  ------------------
  377|      0|        rc = asn_realloc_rbuild_bitstring(pkt, pkt_len, offset,
  378|      0|                                          allow_realloc, var_val_type,
  379|      0|                                          var_val, var_val_len);
  380|      0|        break;
  381|       |
  382|      0|    case SNMP_NOSUCHOBJECT:
  ------------------
  |  |  201|      0|#define SNMP_NOSUCHOBJECT    (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) /* 80=128 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_NOSUCHOBJECT    (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) /* 80=128 */
  |  |  ------------------
  |  |  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (382:5): [True: 0, False: 4]
  ------------------
  383|      0|    case SNMP_NOSUCHINSTANCE:
  ------------------
  |  |  202|      0|#define SNMP_NOSUCHINSTANCE  (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* 81=129 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_NOSUCHINSTANCE  (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* 81=129 */
  |  |  ------------------
  |  |  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (383:5): [True: 0, False: 4]
  ------------------
  384|      0|    case SNMP_ENDOFMIBVIEW:
  ------------------
  |  |  203|      0|#define SNMP_ENDOFMIBVIEW    (ASN_CONTEXT | ASN_PRIMITIVE | 0x2) /* 82=130 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_ENDOFMIBVIEW    (ASN_CONTEXT | ASN_PRIMITIVE | 0x2) /* 82=130 */
  |  |  ------------------
  |  |  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (384:5): [True: 0, False: 4]
  ------------------
  385|      0|        rc = asn_realloc_rbuild_null(pkt, pkt_len, offset, allow_realloc,
  386|      0|                                     var_val_type);
  387|      0|        break;
  388|       |
  389|      0|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
  390|      0|    case ASN_OPAQUE_FLOAT:
  ------------------
  |  |  165|      0|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|      0|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (390:5): [True: 0, False: 4]
  ------------------
  391|      0|        rc = asn_realloc_rbuild_float(pkt, pkt_len, offset, allow_realloc,
  392|      0|                                      var_val_type, (float *) var_val,
  393|      0|                                      var_val_len);
  394|      0|        break;
  395|       |
  396|      0|    case ASN_OPAQUE_DOUBLE:
  ------------------
  |  |  174|      0|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|      0|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (396:5): [True: 0, False: 4]
  ------------------
  397|      0|        rc = asn_realloc_rbuild_double(pkt, pkt_len, offset, allow_realloc,
  398|      0|                                       var_val_type, (double *) var_val,
  399|      0|                                       var_val_len);
  400|      0|        break;
  401|       |
  402|      0|    case ASN_OPAQUE_I64:
  ------------------
  |  |  183|      0|#define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  149|      0|#define ASN_APP_I64 (ASN_APPLICATION | 10)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (402:5): [True: 0, False: 4]
  ------------------
  403|      0|        rc = asn_realloc_rbuild_signed_int64(pkt, pkt_len, offset,
  404|      0|                                             allow_realloc, var_val_type,
  405|      0|                                             (struct counter64 *) var_val,
  406|      0|                                             var_val_len);
  407|      0|        break;
  408|      0|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
  409|      0|    default:
  ------------------
  |  Branch (409:5): [True: 0, False: 4]
  ------------------
  410|      0|	{
  411|      0|	char error_buf[64];
  412|      0|	snprintf(error_buf, sizeof(error_buf),
  413|      0|		"wrong type in snmp_realloc_rbuild_var_op: %d", var_val_type);
  414|      0|        ERROR_MSG(error_buf);
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  415|      0|        rc = 0;
  416|      0|	}
  417|      4|    }
  418|      4|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
  419|       |
  420|      4|    if (rc == 0) {
  ------------------
  |  Branch (420:9): [True: 0, False: 4]
  ------------------
  421|      0|        return 0;
  422|      0|    }
  423|       |
  424|       |    /*
  425|       |     * Build the OID.  
  426|       |     */
  427|       |
  428|      4|    DEBUGDUMPHEADER("send", "Name");
  ------------------
  |  |   79|      4|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 4]
  |  |  ------------------
  ------------------
  429|      4|    rc = asn_realloc_rbuild_objid(pkt, pkt_len, offset, allow_realloc,
  430|      4|                                  (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   90|      4|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   95|      4|#define ASN_PRIMITIVE	    0x00U
  ------------------
  431|      4|                                            ASN_OBJECT_ID), var_name,
  ------------------
  |  |   81|      4|#define ASN_OBJECT_ID	    0x06U
  ------------------
  432|      4|                                  *var_name_len);
  433|      4|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
  434|      4|    if (rc == 0) {
  ------------------
  |  Branch (434:9): [True: 0, False: 4]
  ------------------
  435|      0|        ERROR_MSG("Can't build OID for variable");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
  436|      0|        return 0;
  437|      0|    }
  438|       |
  439|       |    /*
  440|       |     * Build the sequence header.  
  441|       |     */
  442|       |
  443|      4|    rc = asn_realloc_rbuild_sequence(pkt, pkt_len, offset, allow_realloc,
  444|      4|                                     (u_char) (ASN_SEQUENCE |
  ------------------
  |  |   84|      4|#define ASN_SEQUENCE	    0x10U
  ------------------
  445|      4|                                               ASN_CONSTRUCTOR),
  ------------------
  |  |   96|      4|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
  446|      4|                                     *offset - start_offset);
  447|      4|    return rc;
  448|      4|}

init_alarm_post_config:
   63|     69|{
   64|     69|    start_alarms = 1;
   65|     69|    set_an_alarm();
   66|     69|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|     69|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
   67|     69|}
init_snmp_alarm:
   71|     69|{
   72|     69|    start_alarms = 0;
   73|     69|    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     69|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
   74|     69|                           SNMP_CALLBACK_POST_READ_CONFIG,
  ------------------
  |  |   24|     69|#define SNMP_CALLBACK_POST_READ_CONFIG	        0
  ------------------
   75|       |                           init_alarm_post_config, NULL);
   76|     69|}
snmp_alarm_unregister_all:
  156|     69|{
  157|     69|  struct snmp_alarm *sa_ptr, *sa_tmp;
  158|       |
  159|     69|  for (sa_ptr = thealarms; sa_ptr != NULL; sa_ptr = sa_tmp) {
  ------------------
  |  Branch (159:28): [True: 0, False: 69]
  ------------------
  160|      0|    sa_tmp = sa_ptr->next;
  161|      0|    free(sa_ptr);
  162|      0|  }
  163|     69|  DEBUGMSGTL(("snmp_alarm", "ALL alarms unregistered\n"));
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
  164|       |  thealarms = NULL;
  165|     69|}  
sa_find_next:
  169|     69|{
  170|     69|    struct snmp_alarm *a, *lowest = NULL;
  171|       |
  172|     69|    for (a = thealarms; a != NULL; a = a->next)
  ------------------
  |  Branch (172:25): [True: 0, False: 69]
  ------------------
  173|      0|        if (!(a->flags & SA_FIRED)
  ------------------
  |  |   29|      0|#define SA_FIRED 0x10          /* Being processed in run_alarms */
  ------------------
  |  Branch (173:13): [True: 0, False: 0]
  ------------------
  174|      0|            && (lowest == NULL || timercmp(&a->t_nextM, &lowest->t_nextM, <)))
  ------------------
  |  Branch (174:17): [True: 0, False: 0]
  |  Branch (174:35): [True: 0, False: 0]
  |  Branch (174:35): [True: 0, False: 0]
  ------------------
  175|      0|            lowest = a;
  176|       |
  177|     69|    return lowest;
  178|     69|}
netsnmp_get_next_alarm_time:
  253|     69|{
  254|     69|    struct snmp_alarm *sa_ptr;
  255|       |
  256|     69|    sa_ptr = sa_find_next();
  257|       |
  258|     69|    if (sa_ptr) {
  ------------------
  |  Branch (258:9): [True: 0, False: 69]
  ------------------
  259|      0|        netsnmp_assert(alarm_tm);
  ------------------
  |  |   47|      0|#      define netsnmp_assert(x)  do { \
  |  |   48|      0|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 0, False: 0]
  |  |  ------------------
  |  |   49|      0|                 ; \
  |  |   50|      0|              else \
  |  |   51|      0|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
  260|      0|        netsnmp_assert(timerisset(&sa_ptr->t_nextM));
  ------------------
  |  |   47|      0|#      define netsnmp_assert(x)  do { \
  |  |   48|      0|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 0, False: 0]
  |  |  ------------------
  |  |   49|      0|                 ; \
  |  |   50|      0|              else \
  |  |   51|      0|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
  261|      0|        if (timercmp(&sa_ptr->t_nextM, now, >))
  ------------------
  |  Branch (261:13): [True: 0, False: 0]
  |  Branch (261:13): [True: 0, False: 0]
  ------------------
  262|      0|            *alarm_tm = sa_ptr->t_nextM;
  263|      0|        else
  264|      0|            *alarm_tm = *now;
  265|      0|        return sa_ptr->clientreg;
  266|     69|    } else {
  267|     69|        return 0;
  268|     69|    }
  269|     69|}
get_next_alarm_delay_time:
  282|     69|{
  283|     69|    struct timeval t_now, alarm_tm;
  284|     69|    int res;
  285|       |
  286|     69|    netsnmp_get_monotonic_clock(&t_now);
  287|     69|    res = netsnmp_get_next_alarm_time(&alarm_tm, &t_now);
  288|     69|    if (res)
  ------------------
  |  Branch (288:9): [True: 0, False: 69]
  ------------------
  289|      0|        NETSNMP_TIMERSUB(&alarm_tm, &t_now, delta);
  ------------------
  |  |  173|      0|#define NETSNMP_TIMERSUB(a, b, res) do {                        \
  |  |  174|      0|    (res)->tv_sec  = (a)->tv_sec  - (b)->tv_sec - 1;            \
  |  |  175|      0|    (res)->tv_usec = (a)->tv_usec - (b)->tv_usec + 1000000L;    \
  |  |  176|      0|    if ((res)->tv_usec >= 1000000L) {                           \
  |  |  ------------------
  |  |  |  Branch (176:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  177|      0|        (res)->tv_usec -= 1000000L;                             \
  |  |  178|      0|        (res)->tv_sec++;                                        \
  |  |  179|      0|    }                                                           \
  |  |  180|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (180:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
  290|     69|    return res;
  291|     69|}
set_an_alarm:
  296|     69|{
  297|     69|    struct timeval  delta;
  298|     69|    int             nextalarm = get_next_alarm_delay_time(&delta);
  299|       |
  300|       |    /*
  301|       |     * We don't use signals if they asked us nicely not to.  It's expected
  302|       |     * they'll check the next alarm time and do their own calling of
  303|       |     * run_alarms().  
  304|       |     */
  305|       |
  306|     69|    if (nextalarm && !netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (306:9): [True: 0, False: 69]
  |  Branch (306:22): [True: 0, False: 0]
  ------------------
  307|      0|					NETSNMP_DS_LIB_ALARM_DONT_USE_SIG)) {
  ------------------
  |  |   71|      0|#define NETSNMP_DS_LIB_ALARM_DONT_USE_SIG  11   /* don't use the alarm() signal */
  ------------------
  308|      0|#if defined(HAVE_SETITIMER)
  309|      0|        struct itimerval it;
  310|       |
  311|      0|        it.it_value = delta;
  312|      0|        timerclear(&it.it_interval);
  313|       |
  314|      0|        signal(SIGALRM, alarm_handler);
  315|      0|        setitimer(ITIMER_REAL, &it, NULL);
  316|      0|        DEBUGMSGTL(("snmp_alarm", "schedule alarm %d in %ld.%03ld seconds\n",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  317|      0|                    nextalarm, (long) delta.tv_sec, (long)(delta.tv_usec / 1000)));
  318|       |#elif defined(SIGALRM)
  319|       |        signal(SIGALRM, alarm_handler);
  320|       |        alarm(delta.tv_sec);
  321|       |        DEBUGMSGTL(("snmp_alarm",
  322|       |                    "schedule alarm %d in roughly %ld seconds\n", nextalarm,
  323|       |                    delta.tv_sec));
  324|       |#endif
  325|     69|    } else {
  326|     69|        DEBUGMSGTL(("snmp_alarm", "no alarms found to schedule\n"));
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
  327|     69|    }
  328|     69|}

netsnmp_max_send_msg_size:
  360|    142|{
  361|    142|    u_int max = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|    142|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  362|    142|                                   NETSNMP_DS_LIB_MSG_SEND_MAX);
  ------------------
  |  |  132|    142|#define NETSNMP_DS_LIB_MSG_SEND_MAX        16 /* global max response size */
  ------------------
  363|    142|    if (0 == max)
  ------------------
  |  Branch (363:9): [True: 142, False: 0]
  ------------------
  364|    142|        max = SNMP_MAX_PACKET_LEN;
  ------------------
  |  |   49|    142|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  365|      0|    else if (max < SNMP_MIN_MAX_LEN)
  ------------------
  |  |   48|      0|#define SNMP_MIN_MAX_LEN    484 /* minimum maximum message size */
  ------------------
  |  Branch (365:14): [True: 0, False: 0]
  ------------------
  366|      0|        max = SNMP_MIN_MAX_LEN; /* minimum max size per SNMP specs */
  ------------------
  |  |   48|      0|#define SNMP_MIN_MAX_LEN    484 /* minimum maximum message size */
  ------------------
  367|      0|    else if (max > SNMP_MAX_PACKET_LEN)
  ------------------
  |  |   49|      0|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  |  Branch (367:14): [True: 0, False: 0]
  ------------------
  368|      0|        max = SNMP_MAX_PACKET_LEN;
  ------------------
  |  |   49|      0|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  369|       |
  370|    142|    return max;
  371|    142|}
snmp_get_next_sessid:
  464|     69|{
  465|     69|    long            retVal;
  466|     69|    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSIONID);
  ------------------
  |  |   79|     69|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded, False: 69]
  |  |  ------------------
  ------------------
  467|     69|    retVal = 1 + Sessid;        /*MTCRITICAL_RESOURCE */
  468|     69|    if (!retVal)
  ------------------
  |  Branch (468:9): [True: 0, False: 69]
  ------------------
  469|      0|        retVal = 2;
  470|     69|    Sessid = retVal;
  471|     69|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS))
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS))
  ------------------
  |  |   91|     69|#define NETSNMP_DS_LIB_16BIT_IDS           31   /* restrict requestIDs, etc to 16-bit values */
  ------------------
  |  Branch (471:9): [True: 0, False: 69]
  ------------------
  472|      0|        retVal &= 0x7fff;	/* mask to 15 bits */
  473|     69|    else
  474|     69|        retVal &= 0x7fffffff;	/* mask to 31 bits */
  475|       |
  476|     69|    if (!retVal) {
  ------------------
  |  Branch (476:9): [True: 0, False: 69]
  ------------------
  477|      0|        Sessid = retVal = 2;
  478|      0|    }
  479|     69|    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSIONID);
  ------------------
  |  |   80|     69|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded, False: 69]
  |  |  ------------------
  ------------------
  480|     69|    return retVal;
  481|     69|}
snmp_get_next_transid:
  485|     68|{
  486|     68|    long            retVal;
  487|     68|    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_TRANSID);
  ------------------
  |  |   79|     68|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded, False: 68]
  |  |  ------------------
  ------------------
  488|     68|    retVal = 1 + Transid;       /*MTCRITICAL_RESOURCE */
  489|     68|    if (!retVal)
  ------------------
  |  Branch (489:9): [True: 0, False: 68]
  ------------------
  490|      0|        retVal = 2;
  491|     68|    Transid = retVal;
  492|     68|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS))
  ------------------
  |  |   48|     68|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS))
  ------------------
  |  |   91|     68|#define NETSNMP_DS_LIB_16BIT_IDS           31   /* restrict requestIDs, etc to 16-bit values */
  ------------------
  |  Branch (492:9): [True: 0, False: 68]
  ------------------
  493|      0|        retVal &= 0x7fff;	/* mask to 15 bits */
  494|     68|    else
  495|     68|        retVal &= 0x7fffffff;	/* mask to 31 bits */
  496|       |
  497|     68|    if (!retVal) {
  ------------------
  |  Branch (497:9): [True: 0, False: 68]
  ------------------
  498|      0|        Transid = retVal = 2;
  499|      0|    }
  500|     68|    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_TRANSID);
  ------------------
  |  |   80|     68|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded, False: 68]
  |  |  ------------------
  ------------------
  501|     68|    return retVal;
  502|     68|}
snmp_set_detail:
  516|    127|{
  517|    127|    if (detail_string != NULL) {
  ------------------
  |  Branch (517:9): [True: 127, False: 0]
  ------------------
  518|    127|        strlcpy(snmp_detail, detail_string, sizeof(snmp_detail));
  519|    127|        snmp_detail_f = 1;
  520|    127|    }
  521|    127|}
netsnmp_random:
  639|    207|{
  640|    207|#if defined(HAVE_RANDOM)
  641|       |    /*
  642|       |     * The function random() is a more sophisticated random number generator
  643|       |     * which uses nonlinear feedback and an internal table that is 124 bytes
  644|       |     * (992 bits) long. The function returns random values that are 32 bits in
  645|       |     * length. All of the bits generated by random() are usable. The random()
  646|       |     * function is adequate for simulations and games, but should not be used
  647|       |     * for security related applications such as picking cryptographic keys or
  648|       |     * simulating one-time pads.
  649|       |     */
  650|    207|    return random();
  651|       |#elif defined(HAVE_LRAND48)
  652|       |    /*
  653|       |     * As with random(), lrand48() provides excellent random numbers for
  654|       |     * simulations and games, but should not be used for security-related
  655|       |     * applications such as picking cryptographic keys or simulating one-time
  656|       |     * pads; linear congruential algorithms are too easy to break.
  657|       |     */
  658|       |    return lrand48();
  659|       |#elif defined(HAVE_RAND)
  660|       |    /*
  661|       |     * The original UNIX random number generator, rand(), is not a very good
  662|       |     * random number generator. It uses a 32-bit seed and maintains a 32-bit
  663|       |     * internal state.
  664|       |     */
  665|       |    return rand();
  666|       |#else
  667|       |#error "Neither random(), nor lrand48() nor rand() are available"
  668|       |#endif
  669|    207|}
netsnmp_srandom:
  672|     69|{
  673|     69|#if defined(HAVE_SRANDOM)
  674|     69|    srandom(seed);
  675|       |#elif defined(HAVE_SRAND48)
  676|       |    srand48(seed);
  677|       |#elif defined(HAVE_SRAND)
  678|       |    srand(seed);
  679|       |#else
  680|       |#error "Neither srandom(), nor srand48() nor srand() are available"
  681|       |#endif
  682|     69|}
snmp_sess_init:
  775|     69|{
  776|     69|    _init_snmp();
  777|       |
  778|       |    /*
  779|       |     * initialize session to default values 
  780|       |     */
  781|       |
  782|     69|    memset(session, 0, sizeof(netsnmp_session));
  783|     69|    session->timeout = SNMP_DEFAULT_TIMEOUT;
  ------------------
  |  |  113|     69|#define SNMP_DEFAULT_TIMEOUT	    -1
  ------------------
  784|     69|    session->retries = SNMP_DEFAULT_RETRIES;
  ------------------
  |  |  112|     69|#define SNMP_DEFAULT_RETRIES	    -1
  ------------------
  785|     69|    session->version = SNMP_DEFAULT_VERSION;
  ------------------
  |  |  123|     69|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  786|     69|    session->securityModel = SNMP_DEFAULT_SECMODEL;
  ------------------
  |  |  124|     69|#define SNMP_DEFAULT_SECMODEL	    -1
  ------------------
  787|     69|    session->rcvMsgMaxSize = netsnmp_max_send_msg_size();
  788|     69|    session->sndMsgMaxSize = netsnmp_max_send_msg_size();
  789|     69|    session->flags |= SNMP_FLAGS_DONT_PROBE;
  ------------------
  |  |  188|     69|#define SNMP_FLAGS_DONT_PROBE      0x100      /* don't probe for an engineID */
  ------------------
  790|     69|}
init_snmp:
  879|     69|{
  880|     69|    if (init_snmp_init_done) {
  ------------------
  |  Branch (880:9): [True: 0, False: 69]
  ------------------
  881|      0|        return;
  882|      0|    }
  883|       |
  884|     69|    init_snmp_init_done = 1;
  885|       |
  886|       |    /*
  887|       |     * make the type available everywhere else 
  888|       |     */
  889|     69|    if (type && !netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (889:9): [True: 69, False: 0]
  |  Branch (889:17): [True: 69, False: 0]
  ------------------
  890|     69|				       NETSNMP_DS_LIB_APPTYPE)) {
  ------------------
  |  |  157|     69|#define NETSNMP_DS_LIB_APPTYPE           6
  ------------------
  891|     69|        netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  892|     69|			      NETSNMP_DS_LIB_APPTYPE, type);
  ------------------
  |  |  157|     69|#define NETSNMP_DS_LIB_APPTYPE           6
  ------------------
  893|     69|    }
  894|       |
  895|     69|    _init_snmp();
  896|       |
  897|       |    /*
  898|       |     * set our current locale properly to initialize isprint() type functions 
  899|       |     *
  900|       |     * Do not use setlocale on qnx, it is buggy 
  901|       |     * https://www.qnx.com/developers/docs/7.1/#com.qnx.doc.neutrino.lib_ref/topic/s/setlocale.html
  902|       |     */
  903|     69|#if defined(HAVE_SETLOCALE) && !defined(__QNX__)
  904|     69|    setlocale(LC_CTYPE, "");
  905|     69|#endif
  906|       |
  907|     69|    snmp_debug_init();    /* should be done first, to turn on debugging ASAP */
  908|     69|    netsnmp_container_init_list();
  909|     69|    init_callbacks();
  910|     69|    init_snmp_logging();
  911|     69|    snmp_init_statistics();
  912|     69|    register_mib_handlers();
  913|     69|    register_default_handlers();
  914|     69|    init_snmp_transport();
  915|     69|    init_snmpv3(type);
  916|     69|    init_snmp_alarm();
  917|     69|    init_snmp_enum(type);
  918|     69|    init_vacm();
  919|     69|#if defined(NETSNMP_USE_OPENSSL) && defined(HAVE_LIBSSL) && NETSNMP_TRANSPORT_TLSBASE_DOMAIN
  920|     69|    netsnmp_certs_init();
  921|     69|#endif
  922|       |#ifdef DNSSEC_LOCAL_VALIDATION
  923|       |    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "dnssecWarnOnly",
  924|       |                               NETSNMP_DS_LIBRARY_ID,
  925|       |                               NETSNMP_DS_LIB_DNSSEC_WARN_ONLY);
  926|       |#endif
  927|       |
  928|     69|    read_premib_configs();
  929|     69|#ifndef NETSNMP_DISABLE_MIB_LOADING
  930|     69|    netsnmp_init_mib();
  931|     69|#endif /* NETSNMP_DISABLE_MIB_LOADING */
  932|       |
  933|     69|    read_configs();
  934|       |
  935|     69|}                               /* end init_snmp() */
snmp_store:
  961|     69|{
  962|     69|    DEBUGMSGTL(("snmp_store", "storing stuff...\n"));
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
  963|     69|    snmp_save_persistent(type);
  964|     69|    snmp_call_callbacks(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA, NULL);
  ------------------
  |  |   18|     69|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
                  snmp_call_callbacks(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA, NULL);
  ------------------
  |  |   25|     69|#define SNMP_CALLBACK_STORE_DATA	        1
  ------------------
  965|     69|    snmp_clean_persistent(type);
  966|     69|}
snmp_shutdown:
  979|     69|{
  980|     69|    snmp_store(type);
  981|     69|    snmp_call_callbacks(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_SHUTDOWN, NULL);
  ------------------
  |  |   18|     69|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
                  snmp_call_callbacks(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_SHUTDOWN, NULL);
  ------------------
  |  |   26|     69|#define SNMP_CALLBACK_SHUTDOWN		        2
  ------------------
  982|     69|    shutdown_snmp_logging();
  983|     69|    snmp_alarm_unregister_all();
  984|     69|    snmp_close_sessions();
  985|     69|#ifndef NETSNMP_DISABLE_MIB_LOADING
  986|     69|    shutdown_mib();
  987|     69|#endif /* NETSNMP_DISABLE_MIB_LOADING */
  988|     69|#if defined(NETSNMP_USE_OPENSSL) && defined(HAVE_LIBSSL) && NETSNMP_TRANSPORT_TLSBASE_DOMAIN
  989|     69|    netsnmp_certs_shutdown();
  990|     69|#endif
  991|     69|#if !defined(NETSNMP_FEATURE_REMOVE_FILTER_SOURCE)
  992|     69|    netsnmp_transport_filter_cleanup();
  993|     69|#endif
  994|     69|    unregister_all_config_handlers();
  995|     69|    netsnmp_container_free_list();
  996|     69|    clear_sec_mod();
  997|     69|    clear_snmp_enum();
  998|     69|    netsnmp_clear_tdomain_list();
  999|     69|    clear_callback();
 1000|     69|    netsnmp_ds_shutdown();
 1001|     69|    netsnmp_clear_default_target();
 1002|     69|    netsnmp_clear_default_domain();
 1003|     69|    shutdown_secmod();
 1004|     69|    shutdown_snmp_transport();
 1005|     69|    shutdown_data_list();
 1006|     69|    snmp_debug_shutdown();    /* should be done last */
 1007|       |
 1008|     69|    init_snmp_init_done  = 0;
 1009|     69|    _init_snmp_init_done = 0;
 1010|     69|}
snmp_session_insert:
 1016|     69|{
 1017|     69|    if (NULL == slp)
  ------------------
  |  Branch (1017:9): [True: 0, False: 69]
  ------------------
 1018|      0|        return;
 1019|       |
 1020|     69|    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   79|     69|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded, False: 69]
  |  |  ------------------
  ------------------
 1021|     69|    slp->next = Sessions;
 1022|     69|    Sessions = slp;
 1023|     69|    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   80|     69|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded, False: 69]
  |  |  ------------------
  ------------------
 1024|     69|}
netsnmp_sess_config_transport:
 1580|     69|{
 1581|       |    /* Optional supplemental transport configuration information and
 1582|       |       final call to actually open the transport */
 1583|     69|    if (transport_configuration) {
  ------------------
  |  Branch (1583:9): [True: 0, False: 69]
  ------------------
 1584|      0|        DEBUGMSGTL(("snmp_sess", "configuring transport\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1585|      0|        if (transport->f_config) {
  ------------------
  |  Branch (1585:13): [True: 0, False: 0]
  ------------------
 1586|      0|            netsnmp_iterator *iter;
 1587|      0|            netsnmp_transport_config *config_data;
 1588|      0|            int ret = 0;
 1589|       |
 1590|      0|            iter = CONTAINER_ITERATOR(transport_configuration);
  ------------------
  |  |  404|      0|#define CONTAINER_ITERATOR(x)       (x)->get_iterator(x)
  ------------------
 1591|      0|            if (NULL == iter) {
  ------------------
  |  Branch (1591:17): [True: 0, False: 0]
  ------------------
 1592|      0|                return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 1593|      0|            }
 1594|       |
 1595|      0|            for(config_data = (netsnmp_transport_config*)ITERATOR_FIRST(iter); config_data;
  ------------------
  |  |  546|      0|#define ITERATOR_FIRST(x)  x->first(x)
  ------------------
  |  Branch (1595:80): [True: 0, False: 0]
  ------------------
 1596|      0|                config_data = (netsnmp_transport_config*)ITERATOR_NEXT(iter)) {
  ------------------
  |  |  547|      0|#define ITERATOR_NEXT(x)   x->next(x)
  ------------------
 1597|      0|                ret = transport->f_config(transport, config_data->key,
 1598|      0|                                          config_data->value);
 1599|      0|                if (ret)
  ------------------
  |  Branch (1599:21): [True: 0, False: 0]
  ------------------
 1600|      0|                    break;
 1601|      0|            }
 1602|      0|            ITERATOR_RELEASE(iter);
  ------------------
  |  |  550|      0|#define ITERATOR_RELEASE(x) do { x->release(x); x = NULL; } while(0)
  |  |  ------------------
  |  |  |  Branch (550:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1603|      0|            if (ret)
  ------------------
  |  Branch (1603:17): [True: 0, False: 0]
  ------------------
 1604|      0|                return SNMPERR_TRANSPORT_CONFIG_ERROR;
  ------------------
  |  |  285|      0|#define SNMPERR_TRANSPORT_CONFIG_ERROR  (-68)
  ------------------
 1605|      0|        } else {
 1606|      0|            return SNMPERR_TRANSPORT_NO_CONFIG;
  ------------------
  |  |  284|      0|#define SNMPERR_TRANSPORT_NO_CONFIG     (-67)
  ------------------
 1607|      0|        }
 1608|      0|    }
 1609|     69|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|     69|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1610|     69|}
netsnmp_sess_config_and_open_transport:
 1642|     69|{
 1643|     69|    int rc;
 1644|       |    
 1645|     69|    DEBUGMSGTL(("snmp_sess", "opening transport: %x\n", transport->flags & NETSNMP_TRANSPORT_FLAG_OPENED));
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
 1646|       |
 1647|       |    /* don't double open */
 1648|     69|    if (transport->flags & NETSNMP_TRANSPORT_FLAG_OPENED)
  ------------------
  |  |   57|     69|#define		NETSNMP_TRANSPORT_FLAG_OPENED	 0x20  /* f_open called */
  ------------------
  |  Branch (1648:9): [True: 0, False: 69]
  ------------------
 1649|      0|        return SNMPERR_SUCCESS;
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1650|       |
 1651|     69|    if ((rc = netsnmp_sess_config_transport(in_session->transport_configuration,
  ------------------
  |  Branch (1651:9): [True: 0, False: 69]
  ------------------
 1652|     69|                                            transport)) != SNMPERR_SUCCESS) {
  ------------------
  |  |  217|     69|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1653|      0|        in_session->s_snmp_errno = rc;
 1654|      0|        in_session->s_errno = 0;
 1655|      0|        return rc;
 1656|      0|    }
 1657|       |        
 1658|     69|    if (transport->f_open)
  ------------------
  |  Branch (1658:9): [True: 0, False: 69]
  ------------------
 1659|      0|        transport = transport->f_open(transport);
 1660|       |
 1661|     69|    if (transport == NULL) {
  ------------------
  |  Branch (1661:9): [True: 0, False: 69]
  ------------------
 1662|      0|        DEBUGMSGTL(("snmp_sess", "couldn't open transport connection\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1663|      0|        in_session->s_snmp_errno = SNMPERR_BAD_ADDRESS;
  ------------------
  |  |  220|      0|#define SNMPERR_BAD_ADDRESS		(-3)
  ------------------
 1664|      0|        in_session->s_errno = errno;
 1665|      0|        snmp_set_detail(in_session->peername);
 1666|      0|        return SNMPERR_BAD_ADDRESS;
  ------------------
  |  |  220|      0|#define SNMPERR_BAD_ADDRESS		(-3)
  ------------------
 1667|      0|    }
 1668|       |
 1669|       |    /** if transport has a max size, make sure session is the same (or less) */
 1670|     69|    if (in_session->rcvMsgMaxSize > transport->msgMaxSize) {
  ------------------
  |  Branch (1670:9): [True: 69, False: 0]
  ------------------
 1671|     69|        DEBUGMSGTL(("snmp_sess",
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
 1672|     69|                    "limiting session rcv size (%" NETSNMP_PRIz "d) to transport max (%" NETSNMP_PRIz "d)\n",
 1673|     69|                    in_session->rcvMsgMaxSize, transport->msgMaxSize));
 1674|     69|        in_session->rcvMsgMaxSize = transport->msgMaxSize;
 1675|     69|    }
 1676|       |
 1677|     69|    if (in_session->sndMsgMaxSize > transport->msgMaxSize) {
  ------------------
  |  Branch (1677:9): [True: 69, False: 0]
  ------------------
 1678|     69|        DEBUGMSGTL(("snmp_sess",
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
 1679|     69|                    "limiting session snd size (%" NETSNMP_PRIz "d) to transport max (%" NETSNMP_PRIz "d)\n",
 1680|     69|                    in_session->sndMsgMaxSize, transport->msgMaxSize));
 1681|     69|        in_session->sndMsgMaxSize = transport->msgMaxSize;
 1682|     69|    }
 1683|       |
 1684|     69|    transport->flags |= NETSNMP_TRANSPORT_FLAG_OPENED;
  ------------------
  |  |   57|     69|#define		NETSNMP_TRANSPORT_FLAG_OPENED	 0x20  /* f_open called */
  ------------------
 1685|     69|    DEBUGMSGTL(("snmp_sess", "done opening transport: %x\n", transport->flags & NETSNMP_TRANSPORT_FLAG_OPENED));
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
 1686|     69|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|     69|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1687|     69|}
snmp_add:
 1800|     69|{
 1801|     69|    struct session_list *slp;
 1802|       |
 1803|     69|    slp = snmp_sess_add_ex(in_session, transport, fpre_parse, NULL,
 1804|     69|                           fpost_parse, NULL, NULL, NULL, NULL);
 1805|     69|    if (slp == NULL) {
  ------------------
  |  Branch (1805:9): [True: 0, False: 69]
  ------------------
 1806|      0|        return NULL;
 1807|      0|    }
 1808|       |
 1809|     69|    snmp_session_insert(slp);
 1810|       |
 1811|     69|    return (slp->session);
 1812|     69|}
snmp_sess_add_ex:
 1861|     69|{
 1862|     69|    struct session_list *slp;
 1863|     69|    int rc;
 1864|       |    
 1865|     69|    _init_snmp();
 1866|       |
 1867|     69|    if (transport == NULL)
  ------------------
  |  Branch (1867:9): [True: 0, False: 69]
  ------------------
 1868|      0|        return NULL;
 1869|       |
 1870|     69|    if (NULL != in_session && (in_session->rcvMsgMaxSize < SNMP_MIN_MAX_LEN ||
  ------------------
  |  |   48|    138|#define SNMP_MIN_MAX_LEN    484 /* minimum maximum message size */
  ------------------
  |  Branch (1870:9): [True: 69, False: 0]
  |  Branch (1870:32): [True: 0, False: 69]
  ------------------
 1871|     69|                               in_session->sndMsgMaxSize < SNMP_MIN_MAX_LEN)) {
  ------------------
  |  |   48|     69|#define SNMP_MIN_MAX_LEN    484 /* minimum maximum message size */
  ------------------
  |  Branch (1871:32): [True: 0, False: 69]
  ------------------
 1872|      0|        DEBUGMSGTL(("snmp_sess_add",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1873|      0|                    "invalid session (msg sizes). need snmp_sess_init"));
 1874|      0|        in_session = NULL; /* force transport cleanup below */
 1875|      0|    }
 1876|       |
 1877|     69|    if (in_session == NULL) {
  ------------------
  |  Branch (1877:9): [True: 0, False: 69]
  ------------------
 1878|      0|        transport->f_close(transport);
 1879|      0|        netsnmp_transport_free(transport);
 1880|      0|        return NULL;
 1881|      0|    }
 1882|       |
 1883|       |    /* if the transport hasn't been fully opened yet, open it now */
 1884|     69|    if ((rc = netsnmp_sess_config_and_open_transport(in_session, transport))
  ------------------
  |  Branch (1884:9): [True: 0, False: 69]
  ------------------
 1885|     69|        != SNMPERR_SUCCESS) {
  ------------------
  |  |  217|     69|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1886|      0|        return NULL;
 1887|      0|    }
 1888|       |
 1889|     69|    DEBUGMSGTL(("snmp_sess_add", "fd %d\n", transport->sock));
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
 1890|       |
 1891|     69|    if ((slp = snmp_sess_copy(in_session)) == NULL) {
  ------------------
  |  Branch (1891:9): [True: 0, False: 69]
  ------------------
 1892|      0|        transport->f_close(transport);
 1893|      0|        netsnmp_transport_free(transport);
 1894|      0|        return (NULL);
 1895|      0|    }
 1896|       |
 1897|     69|    slp->transport = transport;
 1898|     69|    slp->internal->hook_pre = fpre_parse;
 1899|     69|    slp->internal->hook_parse = fparse;
 1900|     69|    slp->internal->hook_post = fpost_parse;
 1901|     69|    slp->internal->hook_build = fbuild;
 1902|     69|    slp->internal->hook_realloc_build = frbuild;
 1903|     69|    slp->internal->check_packet = fcheck;
 1904|     69|    slp->internal->hook_create_pdu = fcreate_pdu;
 1905|       |
 1906|       |    /** don't let session max exceed transport max */
 1907|     69|    if (slp->session->rcvMsgMaxSize > transport->msgMaxSize) {
  ------------------
  |  Branch (1907:9): [True: 0, False: 69]
  ------------------
 1908|      0|        DEBUGMSGTL(("snmp_sess_add",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1909|      0|                    "limiting session rcv size (%" NETSNMP_PRIz "d) to transport max (%" NETSNMP_PRIz "d)\n",
 1910|      0|                    slp->session->rcvMsgMaxSize, transport->msgMaxSize));
 1911|      0|        slp->session->rcvMsgMaxSize = transport->msgMaxSize;
 1912|      0|    }
 1913|     69|    if (slp->session->sndMsgMaxSize > transport->msgMaxSize) {
  ------------------
  |  Branch (1913:9): [True: 0, False: 69]
  ------------------
 1914|      0|        DEBUGMSGTL(("snmp_sess_add",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1915|      0|                    "limiting session snd size (%" NETSNMP_PRIz "d) to transport max (%" NETSNMP_PRIz "d)\n",
 1916|      0|                    slp->session->sndMsgMaxSize, transport->msgMaxSize));
 1917|      0|        slp->session->sndMsgMaxSize = transport->msgMaxSize;
 1918|      0|    }
 1919|       |
 1920|     69|    if (slp->session->version == SNMP_VERSION_3) {
  ------------------
  |  |  113|     69|#define SNMP_VERSION_3     3
  ------------------
  |  Branch (1920:9): [True: 0, False: 69]
  ------------------
 1921|      0|        DEBUGMSGTL(("snmp_sess_add",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1922|      0|                    "adding v3 session -- maybe engineID probe now\n"));
 1923|      0|        if (!snmpv3_engineID_probe(slp, slp->session)) {
  ------------------
  |  Branch (1923:13): [True: 0, False: 0]
  ------------------
 1924|      0|            DEBUGMSGTL(("snmp_sess_add", "engine ID probe failed\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1925|      0|            goto close_session;
 1926|      0|        }
 1927|      0|    }
 1928|       |
 1929|     69|    slp->session->flags &= ~SNMP_FLAGS_DONT_PROBE;
  ------------------
  |  |  188|     69|#define SNMP_FLAGS_DONT_PROBE      0x100      /* don't probe for an engineID */
  ------------------
 1930|       |
 1931|     69|    if (transport->f_setup_session &&
  ------------------
  |  Branch (1931:9): [True: 69, False: 0]
  ------------------
 1932|     69|        transport->f_setup_session(transport, slp->session) != SNMPERR_SUCCESS)
  ------------------
  |  |  217|     69|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (1932:9): [True: 0, False: 69]
  ------------------
 1933|      0|        goto close_session;
 1934|       |
 1935|     69|    return slp;
 1936|       |
 1937|      0|close_session:
 1938|      0|    snmp_sess_close(slp);
 1939|       |    return NULL;
 1940|     69|}                               /*  end snmp_sess_add_ex()  */
netsnmp_cleanup_session:
 2000|     69|{
 2001|     69|    free(s->localname);
 2002|     69|    free(s->peername);
 2003|     69|    free(s->community);
 2004|     69|    free(s->contextEngineID);
 2005|     69|    free(s->contextName);
 2006|     69|    free(s->securityEngineID);
 2007|     69|    free(s->securityName);
 2008|     69|    free(s->securityAuthProto);
 2009|     69|    free(s->securityAuthLocalKey);
 2010|     69|    free(s->securityPrivProto);
 2011|     69|    free(s->securityPrivLocalKey);
 2012|     69|    free(s->paramName);
 2013|     69|#ifndef NETSNMP_NO_TRAP_STATS
 2014|     69|    free(s->trap_stats);
 2015|     69|#endif /* NETSNMP_NO_TRAP_STATS */
 2016|     69|    usm_free_user(s->sessUser);
 2017|     69|    netsnmp_free_transport_config(s->transport_configuration);
 2018|     69|    memset(s, 0, sizeof(*s));
 2019|     69|}
snmp_sess_close:
 2050|     69|{
 2051|     69|    netsnmp_transport *transport;
 2052|     69|    struct snmp_internal_session *isp;
 2053|     69|    netsnmp_session *sesp = NULL;
 2054|     69|    struct snmp_secmod_def *sptr;
 2055|       |
 2056|     69|    if (slp == NULL) {
  ------------------
  |  Branch (2056:9): [True: 0, False: 69]
  ------------------
 2057|      0|        return 0;
 2058|      0|    }
 2059|       |
 2060|     69|    if (slp->session != NULL &&
  ------------------
  |  Branch (2060:9): [True: 69, False: 0]
  ------------------
 2061|     69|        (sptr = find_sec_mod(slp->session->securityModel)) != NULL &&
  ------------------
  |  Branch (2061:9): [True: 69, False: 0]
  ------------------
 2062|     69|        sptr->session_close != NULL) {
  ------------------
  |  Branch (2062:9): [True: 0, False: 69]
  ------------------
 2063|      0|        (*sptr->session_close) (slp->session);
 2064|      0|    }
 2065|       |
 2066|     69|    isp = slp->internal;
 2067|     69|    slp->internal = NULL;
 2068|       |
 2069|     69|    if (isp) {
  ------------------
  |  Branch (2069:9): [True: 69, False: 0]
  ------------------
 2070|     69|        netsnmp_request_list *rp, *orp;
 2071|       |
 2072|     69|        SNMP_FREE(isp->packet);
  ------------------
  |  |   62|     69|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 69]
  |  |  |  Branch (62:66): [Folded, False: 69]
  |  |  ------------------
  ------------------
 2073|       |
 2074|       |        /*
 2075|       |         * Free each element in the input request list.  
 2076|       |         */
 2077|     69|        rp = isp->requests;
 2078|     69|        while (rp) {
  ------------------
  |  Branch (2078:16): [True: 0, False: 69]
  ------------------
 2079|      0|            orp = rp;
 2080|      0|            rp = rp->next_request;
 2081|      0|            if (orp->callback) {
  ------------------
  |  Branch (2081:17): [True: 0, False: 0]
  ------------------
 2082|      0|                orp->callback(NETSNMP_CALLBACK_OP_TIMED_OUT,
  ------------------
  |  |  353|      0|#define NETSNMP_CALLBACK_OP_TIMED_OUT		2
  ------------------
 2083|      0|                              slp->session, orp->pdu->reqid,
 2084|      0|                              orp->pdu, orp->cb_data);
 2085|      0|            }
 2086|      0|            snmp_free_pdu(orp->pdu);
 2087|      0|            free(orp);
 2088|      0|        }
 2089|       |
 2090|     69|        free(isp);
 2091|     69|    }
 2092|       |
 2093|     69|    transport = slp->transport;
 2094|     69|    slp->transport = NULL;
 2095|       |
 2096|     69|    if (transport) {
  ------------------
  |  Branch (2096:9): [True: 69, False: 0]
  ------------------
 2097|     69|        transport->f_close(transport);
 2098|     69|        netsnmp_transport_free(transport);
 2099|     69|    }
 2100|       |
 2101|     69|    sesp = slp->session;
 2102|     69|    slp->session = NULL;
 2103|       |
 2104|       |    /*
 2105|       |     * The following is necessary to avoid memory leakage when closing AgentX 
 2106|       |     * sessions that may have multiple subsessions.  These hang off the main
 2107|       |     * session at ->subsession, and chain through ->next.  
 2108|       |     */
 2109|       |
 2110|     69|    if (sesp != NULL && sesp->subsession != NULL) {
  ------------------
  |  Branch (2110:9): [True: 69, False: 0]
  |  Branch (2110:25): [True: 0, False: 69]
  ------------------
 2111|      0|        netsnmp_session *subsession = sesp->subsession, *tmpsub;
 2112|       |
 2113|      0|        while (subsession != NULL) {
  ------------------
  |  Branch (2113:16): [True: 0, False: 0]
  ------------------
 2114|      0|            DEBUGMSGTL(("snmp_sess_close",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2115|      0|                        "closing session %p, subsession %p\n", sesp,
 2116|      0|                        subsession));
 2117|      0|            tmpsub = subsession->next;
 2118|      0|            snmp_free_session(subsession);
 2119|      0|            subsession = tmpsub;
 2120|      0|        }
 2121|      0|    }
 2122|       |
 2123|     69|    snmp_free_session(sesp);
 2124|     69|    free(slp);
 2125|     69|    return 1;
 2126|     69|}
snmp_close:
 2130|     69|{
 2131|     69|    struct session_list *slp = NULL, *oslp = NULL;
 2132|       |
 2133|     69|    {                           /*MTCRITICAL_RESOURCE */
 2134|     69|        snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   79|     69|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded, False: 69]
  |  |  ------------------
  ------------------
 2135|     69|        if (Sessions && Sessions->session == session) { /* If first entry */
  ------------------
  |  Branch (2135:13): [True: 0, False: 69]
  |  Branch (2135:25): [True: 0, False: 0]
  ------------------
 2136|      0|            slp = Sessions;
 2137|      0|            Sessions = slp->next;
 2138|     69|        } else {
 2139|     69|            for (slp = Sessions; slp; slp = slp->next) {
  ------------------
  |  Branch (2139:34): [True: 0, False: 69]
  ------------------
 2140|      0|                if (slp->session == session) {
  ------------------
  |  Branch (2140:21): [True: 0, False: 0]
  ------------------
 2141|      0|                    if (oslp)   /* if we found entry that points here */
  ------------------
  |  Branch (2141:25): [True: 0, False: 0]
  ------------------
 2142|      0|                        oslp->next = slp->next; /* link around this entry */
 2143|      0|                    break;
 2144|      0|                }
 2145|      0|                oslp = slp;
 2146|      0|            }
 2147|     69|        }
 2148|     69|        snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   80|     69|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded, False: 69]
  |  |  ------------------
  ------------------
 2149|     69|    }                           /*END MTCRITICAL_RESOURCE */
 2150|     69|    if (slp == NULL) {
  ------------------
  |  Branch (2150:9): [True: 69, False: 0]
  ------------------
 2151|     69|        return 0;
 2152|     69|    }
 2153|      0|    return snmp_sess_close(slp);
 2154|     69|}
snmp_close_sessions:
 2158|     69|{
 2159|     69|    struct session_list *slp;
 2160|       |
 2161|     69|    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   79|     69|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded, False: 69]
  |  |  ------------------
  ------------------
 2162|    138|    while (Sessions) {
  ------------------
  |  Branch (2162:12): [True: 69, False: 69]
  ------------------
 2163|     69|        slp = Sessions;
 2164|     69|        Sessions = Sessions->next;
 2165|     69|        snmp_sess_close(slp);
 2166|     69|    }
 2167|     69|    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   80|     69|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded, False: 69]
  |  |  ------------------
  ------------------
 2168|     69|    return 1;
 2169|     69|}
snmpv3_header_realloc_rbuild:
 2534|      4|{
 2535|      4|    size_t          start_offset = *offset;
 2536|      4|    u_char          msg_flags;
 2537|      4|    long            max_size, sec_model;
 2538|      4|    int             rc = 0;
 2539|       |
 2540|       |    /*
 2541|       |     * msgSecurityModel.  
 2542|       |     */
 2543|      4|    sec_model = pdu->securityModel;
 2544|      4|    DEBUGDUMPHEADER("send", "msgSecurityModel");
  ------------------
  |  |   79|      4|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2545|      4|    rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 2546|      4|                                (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   90|      4|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                              (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   95|      4|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2547|      4|                                          ASN_INTEGER), &sec_model,
  ------------------
  |  |   75|      4|#define ASN_INTEGER	    0x02U
  ------------------
 2548|      4|                                sizeof(sec_model));
 2549|      4|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2550|      4|    if (rc == 0) {
  ------------------
  |  Branch (2550:9): [True: 0, False: 4]
  ------------------
 2551|      0|        return 0;
 2552|      0|    }
 2553|       |
 2554|       |    /*
 2555|       |     * msgFlags.  
 2556|       |     */
 2557|      4|    snmpv3_calc_msg_flags(pdu->securityLevel, pdu->command, &msg_flags);
 2558|      4|    DEBUGDUMPHEADER("send", "msgFlags");
  ------------------
  |  |   79|      4|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2559|      4|    rc = asn_realloc_rbuild_string(pkt, pkt_len, offset, 1,
 2560|      4|                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|      4|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                 (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|      4|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2561|      4|                                             | ASN_OCTET_STR), &msg_flags,
  ------------------
  |  |   78|      4|#define ASN_OCTET_STR	    0x04U
  ------------------
 2562|      4|                                   sizeof(msg_flags));
 2563|      4|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2564|      4|    if (rc == 0) {
  ------------------
  |  Branch (2564:9): [True: 0, False: 4]
  ------------------
 2565|      0|        return 0;
 2566|      0|    }
 2567|       |
 2568|       |    /*
 2569|       |     * msgMaxSize.  
 2570|       |     */
 2571|      4|    max_size = netsnmp_max_send_msg_size();
 2572|      4|    if (session->rcvMsgMaxSize < max_size)
  ------------------
  |  Branch (2572:9): [True: 4, False: 0]
  ------------------
 2573|      4|        max_size = session->rcvMsgMaxSize;
 2574|      4|    DEBUGDUMPHEADER("send:msgMaxSize2", "msgMaxSize");
  ------------------
  |  |   79|      4|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2575|      4|    rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 2576|      4|                                (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   90|      4|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                              (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   95|      4|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2577|      4|                                          ASN_INTEGER), &max_size,
  ------------------
  |  |   75|      4|#define ASN_INTEGER	    0x02U
  ------------------
 2578|      4|                                sizeof(max_size));
 2579|      4|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2580|      4|    if (rc == 0) {
  ------------------
  |  Branch (2580:9): [True: 0, False: 4]
  ------------------
 2581|      0|        return 0;
 2582|      0|    }
 2583|       |
 2584|       |    /*
 2585|       |     * msgID.  
 2586|       |     */
 2587|      4|    DEBUGDUMPHEADER("send", "msgID");
  ------------------
  |  |   79|      4|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2588|      4|    rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 2589|      4|                                (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   90|      4|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                              (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   95|      4|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2590|      4|                                          ASN_INTEGER), &pdu->msgid,
  ------------------
  |  |   75|      4|#define ASN_INTEGER	    0x02U
  ------------------
 2591|      4|                                sizeof(pdu->msgid));
 2592|      4|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2593|      4|    if (rc == 0) {
  ------------------
  |  Branch (2593:9): [True: 0, False: 4]
  ------------------
 2594|      0|        return 0;
 2595|      0|    }
 2596|       |
 2597|       |    /*
 2598|       |     * Global data sequence.  
 2599|       |     */
 2600|      4|    rc = asn_realloc_rbuild_sequence(pkt, pkt_len, offset, 1,
 2601|      4|                                     (u_char) (ASN_SEQUENCE |
  ------------------
  |  |   84|      4|#define ASN_SEQUENCE	    0x10U
  ------------------
 2602|      4|                                               ASN_CONSTRUCTOR),
  ------------------
  |  |   96|      4|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 2603|      4|                                     *offset - start_offset);
 2604|      4|    if (rc == 0) {
  ------------------
  |  Branch (2604:9): [True: 0, False: 4]
  ------------------
 2605|      0|        return 0;
 2606|      0|    }
 2607|       |
 2608|       |    /*
 2609|       |     * Store the version field - msgVersion.  
 2610|       |     */
 2611|      4|    DEBUGDUMPHEADER("send", "SNMP Version Number");
  ------------------
  |  |   79|      4|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2612|      4|    rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 2613|      4|                                (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   90|      4|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                              (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   95|      4|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2614|      4|                                          ASN_INTEGER),
  ------------------
  |  |   75|      4|#define ASN_INTEGER	    0x02U
  ------------------
 2615|      4|                                (long *) &pdu->version,
 2616|      4|                                sizeof(pdu->version));
 2617|      4|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2618|      4|    return rc;
 2619|      4|}                               /* end snmpv3_header_realloc_rbuild() */
snmpv3_scopedPDU_header_realloc_rbuild:
 2664|      4|{
 2665|      4|    size_t          start_offset = *offset;
 2666|      4|    int             rc = 0;
 2667|       |
 2668|       |    /*
 2669|       |     * contextName.  
 2670|       |     */
 2671|      4|    DEBUGDUMPHEADER("send", "contextName");
  ------------------
  |  |   79|      4|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2672|      4|    rc = asn_realloc_rbuild_string(pkt, pkt_len, offset, 1,
 2673|      4|                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|      4|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                 (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|      4|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2674|      4|                                             | ASN_OCTET_STR),
  ------------------
  |  |   78|      4|#define ASN_OCTET_STR	    0x04U
  ------------------
 2675|      4|                                   (u_char *) pdu->contextName,
 2676|      4|                                   pdu->contextNameLen);
 2677|      4|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2678|      4|    if (rc == 0) {
  ------------------
  |  Branch (2678:9): [True: 0, False: 4]
  ------------------
 2679|      0|        return 0;
 2680|      0|    }
 2681|       |
 2682|       |    /*
 2683|       |     * contextEngineID.  
 2684|       |     */
 2685|      4|    DEBUGDUMPHEADER("send", "contextEngineID");
  ------------------
  |  |   79|      4|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2686|      4|    rc = asn_realloc_rbuild_string(pkt, pkt_len, offset, 1,
 2687|      4|                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|      4|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                 (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|      4|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2688|      4|                                             | ASN_OCTET_STR),
  ------------------
  |  |   78|      4|#define ASN_OCTET_STR	    0x04U
  ------------------
 2689|      4|                                   pdu->contextEngineID,
 2690|      4|                                   pdu->contextEngineIDLen);
 2691|      4|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2692|      4|    if (rc == 0) {
  ------------------
  |  Branch (2692:9): [True: 0, False: 4]
  ------------------
 2693|      0|        return 0;
 2694|      0|    }
 2695|       |
 2696|      4|    rc = asn_realloc_rbuild_sequence(pkt, pkt_len, offset, 1,
 2697|      4|                                     (u_char) (ASN_SEQUENCE |
  ------------------
  |  |   84|      4|#define ASN_SEQUENCE	    0x10U
  ------------------
 2698|      4|                                               ASN_CONSTRUCTOR),
  ------------------
  |  |   96|      4|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 2699|      4|                                     *offset - start_offset + body_len);
 2700|       |
 2701|      4|    return rc;
 2702|      4|}                               /* end snmpv3_scopedPDU_header_realloc_rbuild() */
snmpv3_packet_realloc_rbuild:
 2714|      4|{
 2715|      4|    u_char         *scoped_pdu, *hdrbuf = NULL, *hdr = NULL;
 2716|      4|    size_t          hdrbuf_len = SNMP_MAX_MSG_V3_HDRS, hdr_offset =
  ------------------
  |  |  143|      4|#define SNMP_MAX_MSG_V3_HDRS       (4+3+4+7+7+3+7+16)   /* fudge factor=16 */
  ------------------
 2717|      4|        0, spdu_offset = 0;
 2718|      4|    size_t          body_end_offset = *offset, body_len = 0;
 2719|      4|    struct snmp_secmod_def *sptr = NULL;
 2720|      4|    int             rc = 0;
 2721|       |
 2722|       |    /*
 2723|       |     * Build a scopedPDU structure into the packet buffer.  
 2724|       |     */
 2725|      4|    DEBUGPRINTPDUTYPE("send", pdu->command);
  ------------------
  |  |  418|      4|    DEBUGDUMPSECTION(token, snmp_pdu_type(type))
  |  |  ------------------
  |  |  |  |   81|      4|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (81:56): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2726|      4|    if (pdu_data) {
  ------------------
  |  Branch (2726:9): [True: 0, False: 4]
  ------------------
 2727|      0|        while ((*pkt_len - *offset) < pdu_data_len) {
  ------------------
  |  Branch (2727:16): [True: 0, False: 0]
  ------------------
 2728|      0|            if (!asn_realloc(pkt, pkt_len)) {
  ------------------
  |  Branch (2728:17): [True: 0, False: 0]
  ------------------
 2729|      0|                return -1;
 2730|      0|            }
 2731|      0|        }
 2732|       |
 2733|      0|        *offset += pdu_data_len;
 2734|      0|        memcpy(*pkt + *pkt_len - *offset, pdu_data, pdu_data_len);
 2735|      4|    } else {
 2736|      4|        rc = snmp_pdu_realloc_rbuild(pkt, pkt_len, offset, pdu);
 2737|      4|        if (rc == 0) {
  ------------------
  |  Branch (2737:13): [True: 0, False: 4]
  ------------------
 2738|      0|            return -1;
 2739|      0|        }
 2740|      4|    }
 2741|      4|    body_len = *offset - body_end_offset;
 2742|       |
 2743|      4|    DEBUGDUMPSECTION("send", "ScopedPdu");
  ------------------
  |  |   81|      4|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2744|      4|    rc = snmpv3_scopedPDU_header_realloc_rbuild(pkt, pkt_len, offset,
 2745|      4|                                                pdu, body_len);
 2746|      4|    if (rc == 0) {
  ------------------
  |  Branch (2746:9): [True: 0, False: 4]
  ------------------
 2747|      0|        return -1;
 2748|      0|    }
 2749|      4|    spdu_offset = *offset;
 2750|      4|    DEBUGINDENTADD(-4);         /*  Return from Scoped PDU.  */
  ------------------
  |  |   73|      4|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2751|       |
 2752|      4|    if ((hdrbuf = (u_char *) malloc(hdrbuf_len)) == NULL) {
  ------------------
  |  Branch (2752:9): [True: 0, False: 4]
  ------------------
 2753|      0|        return -1;
 2754|      0|    }
 2755|       |
 2756|      4|    rc = snmpv3_header_realloc_rbuild(&hdrbuf, &hdrbuf_len, &hdr_offset,
 2757|      4|                                      session, pdu);
 2758|      4|    if (rc == 0) {
  ------------------
  |  Branch (2758:9): [True: 0, False: 4]
  ------------------
 2759|      0|        SNMP_FREE(hdrbuf);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2760|      0|        return -1;
 2761|      0|    }
 2762|      4|    hdr = hdrbuf + hdrbuf_len - hdr_offset;
 2763|      4|    scoped_pdu = *pkt + *pkt_len - spdu_offset;
 2764|       |
 2765|       |    /*
 2766|       |     * Call the security module to possibly encrypt and authenticate the
 2767|       |     * message---the entire message to transmitted on the wire is returned.  
 2768|       |     */
 2769|       |
 2770|      4|    sptr = find_sec_mod(pdu->securityModel);
 2771|      4|    DEBUGDUMPSECTION("send", "SM msgSecurityParameters");
  ------------------
  |  |   81|      4|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2772|      4|    if (sptr && sptr->encode_reverse) {
  ------------------
  |  Branch (2772:9): [True: 4, False: 0]
  |  Branch (2772:17): [True: 4, False: 0]
  ------------------
 2773|      4|        struct snmp_secmod_outgoing_params parms;
 2774|       |
 2775|      4|        parms.msgProcModel = pdu->msgParseModel;
 2776|      4|        parms.globalData = hdr;
 2777|      4|        parms.globalDataLen = hdr_offset;
 2778|      4|        parms.maxMsgSize = SNMP_MAX_MSG_SIZE;
  ------------------
  |  |  142|      4|#define SNMP_MAX_MSG_SIZE          1472 /* ethernet MTU minus IP/UDP header */
  ------------------
 2779|      4|        parms.secModel = pdu->securityModel;
 2780|      4|        parms.secEngineID = pdu->securityEngineID;
 2781|      4|        parms.secEngineIDLen = pdu->securityEngineIDLen;
 2782|      4|        parms.secName = pdu->securityName;
 2783|      4|        parms.secNameLen = pdu->securityNameLen;
 2784|      4|        parms.secLevel = pdu->securityLevel;
 2785|      4|        parms.scopedPdu = scoped_pdu;
 2786|      4|        parms.scopedPduLen = spdu_offset;
 2787|      4|        parms.secStateRef = pdu->securityStateRef;
 2788|      4|        parms.wholeMsg = pkt;
 2789|      4|        parms.wholeMsgLen = pkt_len;
 2790|      4|        parms.wholeMsgOffset = offset;
 2791|      4|        parms.session = session;
 2792|      4|        parms.pdu = pdu;
 2793|       |
 2794|      4|        rc = (*sptr->encode_reverse) (&parms);
 2795|      4|    } else {
 2796|      0|        if (!sptr) {
  ------------------
  |  Branch (2796:13): [True: 0, False: 0]
  ------------------
 2797|      0|            snmp_log(LOG_ERR,
 2798|      0|                     "no such security service available: %d\n",
 2799|      0|                     pdu->securityModel);
 2800|      0|        } else if (!sptr->encode_reverse) {
  ------------------
  |  Branch (2800:20): [True: 0, False: 0]
  ------------------
 2801|      0|            snmp_log(LOG_ERR,
 2802|      0|                     "security service %d doesn't support reverse encoding.\n",
 2803|      0|                     pdu->securityModel);
 2804|      0|        }
 2805|      0|        rc = -1;
 2806|      0|    }
 2807|       |
 2808|      4|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2809|       |    SNMP_FREE(hdrbuf);
  ------------------
  |  |   62|      4|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 4, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2810|      4|    return rc;
 2811|      4|}                               /* end snmpv3_packet_realloc_rbuild() */
snmp_build:
 3315|      4|{
 3316|      4|    int             rc;
 3317|       |
 3318|      4|    rc = _snmp_build(pkt, pkt_len, offset, pss, pdu);
 3319|      4|    if (rc) {
  ------------------
  |  Branch (3319:9): [True: 0, False: 4]
  ------------------
 3320|      0|        if (!pss->s_snmp_errno) {
  ------------------
  |  Branch (3320:13): [True: 0, False: 0]
  ------------------
 3321|      0|            snmp_log(LOG_ERR, "snmp_build: unknown failure\n");
 3322|      0|            pss->s_snmp_errno = SNMPERR_BAD_ASN1_BUILD;
  ------------------
  |  |  228|      0|#define SNMPERR_BAD_ASN1_BUILD		(-11)
  ------------------
 3323|      0|        }
 3324|      0|        SET_SNMP_ERROR(pss->s_snmp_errno);
  ------------------
  |  |   56|      0|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 3325|      0|        rc = -1;
 3326|      0|    }
 3327|      4|    return rc;
 3328|      4|}
snmp_pdu_realloc_rbuild:
 3547|      4|{
 3548|      4|#ifndef VPCACHE_SIZE
 3549|      4|#define VPCACHE_SIZE 50
 3550|      4|#endif
 3551|      4|    netsnmp_variable_list *vpcache[VPCACHE_SIZE];
 3552|      4|    netsnmp_variable_list *vp, *tmpvp;
 3553|      4|    size_t          start_offset = *offset;
 3554|      4|    int             i, wrapped = 0, notdone, final, rc = 0;
 3555|       |
 3556|      4|    DEBUGMSGTL(("snmp_pdu_realloc_rbuild", "starting\n"));
  ------------------
  |  |   66|      4|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 4]
  |  |  ------------------
  ------------------
 3557|      8|    for (vp = pdu->variables, i = VPCACHE_SIZE - 1; vp;
  ------------------
  |  | 3549|      4|#define VPCACHE_SIZE 50
  ------------------
  |  Branch (3557:53): [True: 4, False: 4]
  ------------------
 3558|      4|         vp = vp->next_variable, i--) {
 3559|       |        /*
 3560|       |         * if estimated getbulk response size exceeded packet max size,
 3561|       |         * processing was stopped before bulk cache was filled and type
 3562|       |         * was set to ASN_PRIV_STOP, indicating that the rest of the varbinds
 3563|       |         * in the cache are empty and we can stop encoding them.
 3564|       |         */
 3565|      4|        if (ASN_PRIV_STOP == vp->type)
  ------------------
  |  |  207|      4|#define ASN_PRIV_STOP       (ASN_PRIVATE | 8)   /* 200 */
  |  |  ------------------
  |  |  |  |   93|      4|#define ASN_PRIVATE	    0xC0U
  |  |  ------------------
  ------------------
  |  Branch (3565:13): [True: 0, False: 4]
  ------------------
 3566|      0|            break;
 3567|      4|        if (i < 0) {
  ------------------
  |  Branch (3567:13): [True: 0, False: 4]
  ------------------
 3568|      0|            wrapped = notdone = 1;
 3569|      0|            i = VPCACHE_SIZE - 1;
  ------------------
  |  | 3549|      0|#define VPCACHE_SIZE 50
  ------------------
 3570|      0|            DEBUGMSGTL(("snmp_pdu_realloc_rbuild", "wrapped\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3571|      0|        }
 3572|      4|        vpcache[i] = vp;
 3573|      4|    }
 3574|      4|    final = i + 1;
 3575|       |
 3576|      4|    do {
 3577|      8|        for (i = final; i < VPCACHE_SIZE; i++) {
  ------------------
  |  | 3549|      8|#define VPCACHE_SIZE 50
  ------------------
  |  Branch (3577:25): [True: 4, False: 4]
  ------------------
 3578|      4|            vp = vpcache[i];
 3579|      4|            DEBUGDUMPSECTION("send", "VarBind");
  ------------------
  |  |   81|      4|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 4]
  |  |  ------------------
  ------------------
 3580|      4|            rc = snmp_realloc_rbuild_var_op(pkt, pkt_len, offset, 1,
 3581|      4|                                            vp->name, &vp->name_length,
 3582|      4|                                            vp->type,
 3583|      4|                                            (u_char *) vp->val.string,
 3584|      4|                                            vp->val_len);
 3585|      4|            DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
 3586|      4|            if (rc == 0) {
  ------------------
  |  Branch (3586:17): [True: 0, False: 4]
  ------------------
 3587|      0|                return 0;
 3588|      0|            }
 3589|      4|        }
 3590|       |
 3591|      4|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
 3592|      4|        if (wrapped) {
  ------------------
  |  Branch (3592:13): [True: 0, False: 4]
  ------------------
 3593|      0|            notdone = 1;
 3594|      0|            for (i = 0; i < final; i++) {
  ------------------
  |  Branch (3594:25): [True: 0, False: 0]
  ------------------
 3595|      0|                vp = vpcache[i];
 3596|      0|                DEBUGDUMPSECTION("send", "VarBind");
  ------------------
  |  |   81|      0|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3597|      0|                rc = snmp_realloc_rbuild_var_op(pkt, pkt_len, offset, 1,
 3598|      0|                                                vp->name, &vp->name_length,
 3599|      0|                                                vp->type,
 3600|      0|                                                (u_char *) vp->val.string,
 3601|      0|                                                vp->val_len);
 3602|      0|                DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3603|      0|                if (rc == 0) {
  ------------------
  |  Branch (3603:21): [True: 0, False: 0]
  ------------------
 3604|      0|                    return 0;
 3605|      0|                }
 3606|      0|            }
 3607|       |
 3608|      0|            if (final == 0) {
  ------------------
  |  Branch (3608:17): [True: 0, False: 0]
  ------------------
 3609|      0|                tmpvp = vpcache[VPCACHE_SIZE - 1];
  ------------------
  |  | 3549|      0|#define VPCACHE_SIZE 50
  ------------------
 3610|      0|            } else {
 3611|      0|                tmpvp = vpcache[final - 1];
 3612|      0|            }
 3613|      0|            wrapped = 0;
 3614|       |
 3615|      0|            for (vp = pdu->variables, i = VPCACHE_SIZE - 1;
  ------------------
  |  | 3549|      0|#define VPCACHE_SIZE 50
  ------------------
 3616|      0|                 vp && vp != tmpvp; vp = vp->next_variable, i--) {
  ------------------
  |  Branch (3616:18): [True: 0, False: 0]
  |  Branch (3616:24): [True: 0, False: 0]
  ------------------
 3617|      0|                if (i < 0) {
  ------------------
  |  Branch (3617:21): [True: 0, False: 0]
  ------------------
 3618|      0|                    wrapped = 1;
 3619|      0|                    i = VPCACHE_SIZE - 1;
  ------------------
  |  | 3549|      0|#define VPCACHE_SIZE 50
  ------------------
 3620|      0|                    DEBUGMSGTL(("snmp_pdu_realloc_rbuild", "wrapped\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3621|      0|                }
 3622|      0|                vpcache[i] = vp;
 3623|      0|            }
 3624|      0|            final = i + 1;
 3625|      4|        } else {
 3626|      4|            notdone = 0;
 3627|      4|        }
 3628|      4|    } while (notdone);
  ------------------
  |  Branch (3628:14): [True: 0, False: 4]
  ------------------
 3629|       |
 3630|       |    /*
 3631|       |     * Save current location and build SEQUENCE tag and length placeholder for
 3632|       |     * variable-bindings sequence (actual length will be inserted later).  
 3633|       |     */
 3634|       |
 3635|      4|    rc = asn_realloc_rbuild_sequence(pkt, pkt_len, offset, 1,
 3636|      4|                                     (u_char) (ASN_SEQUENCE |
  ------------------
  |  |   84|      4|#define ASN_SEQUENCE	    0x10U
  ------------------
 3637|      4|                                               ASN_CONSTRUCTOR),
  ------------------
  |  |   96|      4|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3638|      4|                                     *offset - start_offset);
 3639|       |
 3640|       |    /*
 3641|       |     * Store fields in the PDU preceding the variable-bindings sequence.
 3642|       |     */
 3643|      4|    if (pdu->command != SNMP_MSG_TRAP) {
  ------------------
  |  |  135|      4|#define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   92|      4|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   96|      4|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (3643:9): [True: 4, False: 0]
  ------------------
 3644|       |        /*
 3645|       |         * Error index (getbulk max-repetitions).  
 3646|       |         */
 3647|      4|        DEBUGDUMPHEADER("send", "error index");
  ------------------
  |  |   79|      4|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 4]
  |  |  ------------------
  ------------------
 3648|      4|        rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 3649|      4|                                    (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|      4|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                  (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|      4|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3650|      4|                                              | ASN_INTEGER),
  ------------------
  |  |   75|      4|#define ASN_INTEGER	    0x02U
  ------------------
 3651|      4|                                    &pdu->errindex, sizeof(pdu->errindex));
 3652|      4|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
 3653|      4|        if (rc == 0) {
  ------------------
  |  Branch (3653:13): [True: 0, False: 4]
  ------------------
 3654|      0|            return 0;
 3655|      0|        }
 3656|       |
 3657|       |        /*
 3658|       |         * Error status (getbulk non-repeaters).  
 3659|       |         */
 3660|      4|        DEBUGDUMPHEADER("send", "error status");
  ------------------
  |  |   79|      4|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 4]
  |  |  ------------------
  ------------------
 3661|      4|        rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 3662|      4|                                    (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|      4|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                  (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|      4|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3663|      4|                                              | ASN_INTEGER),
  ------------------
  |  |   75|      4|#define ASN_INTEGER	    0x02U
  ------------------
 3664|      4|                                    &pdu->errstat, sizeof(pdu->errstat));
 3665|      4|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
 3666|      4|        if (rc == 0) {
  ------------------
  |  Branch (3666:13): [True: 0, False: 4]
  ------------------
 3667|      0|            return 0;
 3668|      0|        }
 3669|       |
 3670|       |        /*
 3671|       |         * Request ID.  
 3672|       |         */
 3673|      4|        DEBUGDUMPHEADER("send", "request_id");
  ------------------
  |  |   79|      4|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 4]
  |  |  ------------------
  ------------------
 3674|      4|        rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 3675|      4|                                    (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|      4|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                  (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|      4|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3676|      4|                                              | ASN_INTEGER), &pdu->reqid,
  ------------------
  |  |   75|      4|#define ASN_INTEGER	    0x02U
  ------------------
 3677|      4|                                    sizeof(pdu->reqid));
 3678|      4|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
 3679|      4|        if (rc == 0) {
  ------------------
  |  Branch (3679:13): [True: 0, False: 4]
  ------------------
 3680|      0|            return 0;
 3681|      0|        }
 3682|      4|    } else {
 3683|       |        /*
 3684|       |         * An SNMPv1 trap PDU.  
 3685|       |         */
 3686|       |
 3687|       |        /*
 3688|       |         * Timestamp.  
 3689|       |         */
 3690|      0|        DEBUGDUMPHEADER("send", "timestamp");
  ------------------
  |  |   79|      0|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3691|      0|        rc = asn_realloc_rbuild_unsigned_int(pkt, pkt_len, offset, 1,
 3692|      0|                                             (u_char) (ASN_TIMETICKS |
  ------------------
  |  |   92|      0|#define ASN_TIMETICKS   (ASN_APPLICATION | 3)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
 3693|      0|                                                       ASN_PRIMITIVE),
  ------------------
  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3694|      0|                                             &pdu->time,
 3695|      0|                                             sizeof(pdu->time));
 3696|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3697|      0|        if (rc == 0) {
  ------------------
  |  Branch (3697:13): [True: 0, False: 0]
  ------------------
 3698|      0|            return 0;
 3699|      0|        }
 3700|       |
 3701|       |        /*
 3702|       |         * Specific trap.  
 3703|       |         */
 3704|      0|        DEBUGDUMPHEADER("send", "specific trap number");
  ------------------
  |  |   79|      0|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3705|      0|        rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 3706|      0|                                    (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|      0|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                  (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3707|      0|                                              | ASN_INTEGER),
  ------------------
  |  |   75|      0|#define ASN_INTEGER	    0x02U
  ------------------
 3708|      0|                                    (const long *) &pdu->specific_type,
 3709|      0|                                    sizeof(pdu->specific_type));
 3710|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3711|      0|        if (rc == 0) {
  ------------------
  |  Branch (3711:13): [True: 0, False: 0]
  ------------------
 3712|      0|            return 0;
 3713|      0|        }
 3714|       |
 3715|       |        /*
 3716|       |         * Generic trap.  
 3717|       |         */
 3718|      0|        DEBUGDUMPHEADER("send", "generic trap number");
  ------------------
  |  |   79|      0|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3719|      0|        rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 3720|      0|                                    (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|      0|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                  (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3721|      0|                                              | ASN_INTEGER),
  ------------------
  |  |   75|      0|#define ASN_INTEGER	    0x02U
  ------------------
 3722|      0|                                    (const long *) &pdu->trap_type,
 3723|      0|                                    sizeof(pdu->trap_type));
 3724|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3725|      0|        if (rc == 0) {
  ------------------
  |  Branch (3725:13): [True: 0, False: 0]
  ------------------
 3726|      0|            return 0;
 3727|      0|        }
 3728|       |
 3729|       |        /*
 3730|       |         * Agent-addr.  
 3731|       |         */
 3732|      0|        DEBUGDUMPHEADER("send", "agent Address");
  ------------------
  |  |   79|      0|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3733|      0|        rc = asn_realloc_rbuild_string(pkt, pkt_len, offset, 1,
 3734|      0|                                       (u_char) (ASN_IPADDRESS |
  ------------------
  |  |   88|      0|#define ASN_IPADDRESS   (ASN_APPLICATION | 0)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
 3735|      0|                                                 ASN_PRIMITIVE),
  ------------------
  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3736|      0|                                       (const u_char *) pdu->agent_addr, 4);
 3737|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3738|      0|        if (rc == 0) {
  ------------------
  |  Branch (3738:13): [True: 0, False: 0]
  ------------------
 3739|      0|            return 0;
 3740|      0|        }
 3741|       |
 3742|       |        /*
 3743|       |         * Enterprise.  
 3744|       |         */
 3745|      0|        DEBUGDUMPHEADER("send", "enterprise OBJID");
  ------------------
  |  |   79|      0|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3746|      0|        rc = asn_realloc_rbuild_objid(pkt, pkt_len, offset, 1,
 3747|      0|                                      (u_char) (ASN_UNIVERSAL |
  ------------------
  |  |   90|      0|#define ASN_UNIVERSAL	    0x00U
  ------------------
 3748|      0|                                                ASN_PRIMITIVE |
  ------------------
  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3749|      0|                                                ASN_OBJECT_ID),
  ------------------
  |  |   81|      0|#define ASN_OBJECT_ID	    0x06U
  ------------------
 3750|      0|                                      (oid *) pdu->enterprise,
 3751|      0|                                      pdu->enterprise_length);
 3752|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3753|      0|        if (rc == 0) {
  ------------------
  |  Branch (3753:13): [True: 0, False: 0]
  ------------------
 3754|      0|            return 0;
 3755|      0|        }
 3756|      0|    }
 3757|       |
 3758|       |    /*
 3759|       |     * Build the PDU sequence.  
 3760|       |     */
 3761|      4|    rc = asn_realloc_rbuild_sequence(pkt, pkt_len, offset, 1,
 3762|      4|                                     (u_char) pdu->command,
 3763|      4|                                     *offset - start_offset);
 3764|      4|    return rc;
 3765|      4|}
snmpv3_parse:
 3798|     11|{
 3799|     11|    u_char          type, msg_flags;
 3800|     11|    long            ver, msg_sec_model;
 3801|     11|    size_t          max_size_response;
 3802|     11|    u_char          tmp_buf[SNMP_MAX_MSG_SIZE];
 3803|     11|    size_t          tmp_buf_len;
 3804|     11|    u_char          pdu_buf[SNMP_MAX_MSG_SIZE];
 3805|     11|    u_char         *mallocbuf = NULL;
 3806|     11|    size_t          pdu_buf_len = SNMP_MAX_MSG_SIZE;
  ------------------
  |  |  142|     11|#define SNMP_MAX_MSG_SIZE          1472 /* ethernet MTU minus IP/UDP header */
  ------------------
 3807|     11|    u_char         *sec_params;
 3808|     11|    u_char         *msg_data;
 3809|     11|    u_char         *cp;
 3810|     11|    size_t          asn_len, msg_len;
 3811|     11|    int             ret, ret_val;
 3812|     11|    struct snmp_secmod_def *sptr;
 3813|       |
 3814|       |
 3815|     11|    msg_data = data;
 3816|     11|    msg_len = *length;
 3817|       |
 3818|       |
 3819|       |    /*
 3820|       |     * message is an ASN.1 SEQUENCE  
 3821|       |     */
 3822|     11|    DEBUGDUMPSECTION("recv", "SNMPv3 Message");
  ------------------
  |  |   81|     11|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     11|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 11]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 11]
  |  |  ------------------
  ------------------
 3823|     11|    data = asn_parse_sequence(data, length, &type,
 3824|     11|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR), "message");
  ------------------
  |  |   84|     11|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR), "message");
  ------------------
  |  |   96|     11|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3825|     11|    if (data == NULL) {
  ------------------
  |  Branch (3825:9): [True: 0, False: 11]
  ------------------
 3826|       |        /*
 3827|       |         * error msg detail is set 
 3828|       |         */
 3829|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3830|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3831|      0|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3832|      0|    }
 3833|       |
 3834|       |    /*
 3835|       |     * parse msgVersion  
 3836|       |     */
 3837|     11|    DEBUGDUMPHEADER("recv", "SNMP Version Number");
  ------------------
  |  |   79|     11|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     11|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 11]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 11]
  |  |  ------------------
  ------------------
 3838|     11|    data = asn_parse_int(data, length, &type, &ver, sizeof(ver));
 3839|     11|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     11|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     11|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 11]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 11]
  |  |  ------------------
  ------------------
 3840|     11|    if (data == NULL) {
  ------------------
  |  Branch (3840:9): [True: 0, False: 11]
  ------------------
 3841|      0|        ERROR_MSG("bad parse of version");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3842|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3843|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3844|      0|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3845|      0|    }
 3846|     11|    pdu->version = ver;
 3847|       |
 3848|       |    /*
 3849|       |     * parse msgGlobalData sequence  
 3850|       |     */
 3851|     11|    cp = data;
 3852|     11|    asn_len = *length;
 3853|     11|    DEBUGDUMPSECTION("recv", "msgGlobalData");
  ------------------
  |  |   81|     11|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     11|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 11]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 11]
  |  |  ------------------
  ------------------
 3854|     11|    data = asn_parse_sequence(data, &asn_len, &type,
 3855|     11|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   84|     11|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   96|     11|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3856|     11|                              "msgGlobalData");
 3857|     11|    if (data == NULL) {
  ------------------
  |  Branch (3857:9): [True: 0, False: 11]
  ------------------
 3858|       |        /*
 3859|       |         * error msg detail is set 
 3860|       |         */
 3861|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3862|      0|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|      0|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3863|      0|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3864|      0|    }
 3865|     11|    *length -= data - cp;       /* subtract off the length of the header */
 3866|       |
 3867|       |    /*
 3868|       |     * msgID 
 3869|       |     */
 3870|     11|    DEBUGDUMPHEADER("recv", "msgID");
  ------------------
  |  |   79|     11|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     11|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 11]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 11]
  |  |  ------------------
  ------------------
 3871|     11|    data =
 3872|     11|        asn_parse_int(data, length, &type, &pdu->msgid,
 3873|     11|                      sizeof(pdu->msgid));
 3874|     11|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     11|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     11|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 11]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 11]
  |  |  ------------------
  ------------------
 3875|     11|    if (data == NULL || type != ASN_INTEGER) {
  ------------------
  |  |   75|     10|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (3875:9): [True: 1, False: 10]
  |  Branch (3875:25): [True: 0, False: 10]
  ------------------
 3876|      1|        ERROR_MSG("error parsing msgID");
  ------------------
  |  |  188|      1|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3877|      1|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|      1|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 1]
  |  |  ------------------
  ------------------
 3878|      1|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      1|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3879|      1|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|      1|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3880|      1|    }
 3881|       |
 3882|       |    /*
 3883|       |     * Check the msgID we received is a legal value.  If not, then increment
 3884|       |     * snmpInASNParseErrs and return the appropriate error (see RFC 2572,
 3885|       |     * para. 7.2, section 2 -- note that a bad msgID means that the received
 3886|       |     * message is NOT a serialization of an SNMPv3Message, since the msgID
 3887|       |     * field is out of bounds).  
 3888|       |     */
 3889|       |
 3890|     10|    if (pdu->msgid < 0 || pdu->msgid > SNMP_MAX_PACKET_LEN) {
  ------------------
  |  |   49|     10|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  |  Branch (3890:9): [True: 0, False: 10]
  |  Branch (3890:27): [True: 0, False: 10]
  ------------------
 3891|      0|        snmp_log(LOG_ERR, "Received bad msgID (%ld %s %s).\n", pdu->msgid,
 3892|      0|                 (pdu->msgid < 0) ? "<" : ">",
  ------------------
  |  Branch (3892:18): [True: 0, False: 0]
  ------------------
 3893|      0|                 (pdu->msgid < 0) ? "0" : "2^31 - 1");
  ------------------
  |  Branch (3893:18): [True: 0, False: 0]
  ------------------
 3894|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3895|      0|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|      0|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3896|      0|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3897|      0|    }
 3898|       |
 3899|       |    /*
 3900|       |     * msgMaxSize 
 3901|       |     */
 3902|     10|    DEBUGDUMPHEADER("recv:msgMaxSize", "msgMaxSize");
  ------------------
  |  |   79|     10|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     10|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 10]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 10]
  |  |  ------------------
  ------------------
 3903|     10|    data = asn_parse_int(data, length, &type, &pdu->msgMaxSize,
 3904|     10|                         sizeof(pdu->msgMaxSize));
 3905|     10|    DEBUGINDENTLESS();
  ------------------
  |  |   75|     10|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     10|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 10]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 10]
  |  |  ------------------
  ------------------
 3906|     10|    if (data == NULL || type != ASN_INTEGER) {
  ------------------
  |  |   75|      9|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (3906:9): [True: 1, False: 9]
  |  Branch (3906:25): [True: 0, False: 9]
  ------------------
 3907|      1|        ERROR_MSG("error parsing msgMaxSize");
  ------------------
  |  |  188|      1|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3908|      1|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      1|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3909|      1|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|      1|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 1]
  |  |  ------------------
  ------------------
 3910|      1|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|      1|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3911|      1|    }
 3912|       |
 3913|       |    /*
 3914|       |     * Check the msgMaxSize we received is a legal value.  If not, then
 3915|       |     * increment snmpInASNParseErrs and return the appropriate error (see RFC
 3916|       |     * 2572, para. 7.2, section 2 -- note that a bad msgMaxSize means that the
 3917|       |     * received message is NOT a serialization of an SNMPv3Message, since the
 3918|       |     * msgMaxSize field is out of bounds).
 3919|       |     */
 3920|       |
 3921|      9|    if (pdu->msgMaxSize < SNMP_MIN_MAX_LEN) {
  ------------------
  |  |   48|      9|#define SNMP_MIN_MAX_LEN    484 /* minimum maximum message size */
  ------------------
  |  Branch (3921:9): [True: 1, False: 8]
  ------------------
 3922|      1|        snmp_log(LOG_ERR, "Received bad msgMaxSize (%lu < 484).\n",
 3923|      1|                 pdu->msgMaxSize);
 3924|      1|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      1|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3925|      1|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|      1|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 1]
  |  |  ------------------
  ------------------
 3926|      1|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|      1|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3927|      8|    } else if (pdu->msgMaxSize > SNMP_MAX_PACKET_LEN) {
  ------------------
  |  |   49|      8|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  |  Branch (3927:16): [True: 0, False: 8]
  ------------------
 3928|      0|        snmp_log(LOG_ERR, "Received bad msgMaxSize (%lu > 2^31 - 1).\n",
 3929|      0|                 pdu->msgMaxSize);
 3930|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3931|      0|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|      0|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3932|      0|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3933|      8|    } else {
 3934|      8|        DEBUGMSGTL(("snmpv3_parse:msgMaxSize", "msgMaxSize %lu received\n",
  ------------------
  |  |   66|      8|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      8|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 8]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 8]
  |  |  ------------------
  ------------------
 3935|      8|                    pdu->msgMaxSize));
 3936|       |        /** don't increase max msg size if we've already got one */
 3937|      8|        if (sess->sndMsgMaxSize < pdu->msgMaxSize) {
  ------------------
  |  Branch (3937:13): [True: 8, False: 0]
  ------------------
 3938|      8|            DEBUGMSGTL(("snmpv3_parse:msgMaxSize",
  ------------------
  |  |   66|      8|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      8|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 8]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 8]
  |  |  ------------------
  ------------------
 3939|      8|                        "msgMaxSize %" NETSNMP_PRIz "d greater than session max %ld; reducing\n",
 3940|      8|                        sess->sndMsgMaxSize, pdu->msgMaxSize));
 3941|      8|            pdu->msgMaxSize = sess->sndMsgMaxSize;
 3942|      8|        }
 3943|      8|    }
 3944|       |
 3945|       |    /*
 3946|       |     * msgFlags 
 3947|       |     */
 3948|      8|    tmp_buf_len = SNMP_MAX_MSG_SIZE;
  ------------------
  |  |  142|      8|#define SNMP_MAX_MSG_SIZE          1472 /* ethernet MTU minus IP/UDP header */
  ------------------
 3949|      8|    DEBUGDUMPHEADER("recv", "msgFlags");
  ------------------
  |  |   79|      8|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      8|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 8]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 8]
  |  |  ------------------
  ------------------
 3950|      8|    data = asn_parse_string(data, length, &type, tmp_buf, &tmp_buf_len);
 3951|      8|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      8|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      8|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 8]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 8]
  |  |  ------------------
  ------------------
 3952|      8|    if (data == NULL || type != ASN_OCTET_STR || tmp_buf_len != 1) {
  ------------------
  |  |   78|     15|#define ASN_OCTET_STR	    0x04U
  ------------------
  |  Branch (3952:9): [True: 1, False: 7]
  |  Branch (3952:25): [True: 0, False: 7]
  |  Branch (3952:50): [True: 0, False: 7]
  ------------------
 3953|      1|        ERROR_MSG("error parsing msgFlags");
  ------------------
  |  |  188|      1|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3954|      1|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      1|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3955|      1|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|      1|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 1]
  |  |  ------------------
  ------------------
 3956|      1|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|      1|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3957|      1|    }
 3958|      7|    msg_flags = *tmp_buf;
 3959|      7|    if (msg_flags & SNMP_MSG_FLAG_RPRT_BIT)
  ------------------
  |  |  305|      7|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
  |  Branch (3959:9): [True: 3, False: 4]
  ------------------
 3960|      3|        pdu->flags |= SNMP_MSG_FLAG_RPRT_BIT;
  ------------------
  |  |  305|      3|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
 3961|      4|    else
 3962|      4|        pdu->flags &= (~SNMP_MSG_FLAG_RPRT_BIT);
  ------------------
  |  |  305|      4|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
 3963|       |
 3964|       |    /*
 3965|       |     * msgSecurityModel 
 3966|       |     */
 3967|      7|    DEBUGDUMPHEADER("recv", "msgSecurityModel");
  ------------------
  |  |   79|      7|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      7|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 7]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 7]
  |  |  ------------------
  ------------------
 3968|      7|    data = asn_parse_int(data, length, &type, &msg_sec_model,
 3969|      7|                         sizeof(msg_sec_model));
 3970|      7|    DEBUGINDENTADD(-4);         /* return from global data indent */
  ------------------
  |  |   73|      7|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      7|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 7]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 7]
  |  |  ------------------
  ------------------
 3971|      7|    if (data == NULL || type != ASN_INTEGER ||
  ------------------
  |  |   75|     14|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (3971:9): [True: 0, False: 7]
  |  Branch (3971:25): [True: 0, False: 7]
  ------------------
 3972|      7|        msg_sec_model < 1 || msg_sec_model > 0x7fffffff) {
  ------------------
  |  Branch (3972:9): [True: 2, False: 5]
  |  Branch (3972:30): [True: 0, False: 5]
  ------------------
 3973|      2|        ERROR_MSG("error parsing msgSecurityModel");
  ------------------
  |  |  188|      2|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3974|      2|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      2|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3975|      2|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      2|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      2|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 2]
  |  |  ------------------
  ------------------
 3976|      2|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|      2|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 3977|      2|    }
 3978|      5|    sptr = find_sec_mod(msg_sec_model);
 3979|      5|    if (!sptr) {
  ------------------
  |  Branch (3979:9): [True: 1, False: 4]
  ------------------
 3980|      1|        snmp_log(LOG_WARNING, "unknown security model: %ld\n",
 3981|      1|                 msg_sec_model);
 3982|      1|        snmp_increment_statistic(STAT_SNMPUNKNOWNSECURITYMODELS);
  ------------------
  |  |  644|      1|#define   STAT_SNMPUNKNOWNSECURITYMODELS     0
  ------------------
 3983|      1|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      1|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 1]
  |  |  ------------------
  ------------------
 3984|      1|        return SNMPERR_UNKNOWN_SEC_MODEL;
  ------------------
  |  |  247|      1|#define SNMPERR_UNKNOWN_SEC_MODEL 	(-30)
  ------------------
 3985|      1|    }
 3986|      4|    pdu->securityModel = msg_sec_model;
 3987|       |
 3988|      4|    if (msg_flags & SNMP_MSG_FLAG_PRIV_BIT &&
  ------------------
  |  |  304|      8|#define SNMP_MSG_FLAG_PRIV_BIT          0x02
  ------------------
  |  Branch (3988:9): [True: 0, False: 4]
  ------------------
 3989|      0|        !(msg_flags & SNMP_MSG_FLAG_AUTH_BIT)) {
  ------------------
  |  |  303|      0|#define SNMP_MSG_FLAG_AUTH_BIT          0x01
  ------------------
  |  Branch (3989:9): [True: 0, False: 0]
  ------------------
 3990|      0|        ERROR_MSG("invalid message, illegal msgFlags");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 3991|      0|        snmp_increment_statistic(STAT_SNMPINVALIDMSGS);
  ------------------
  |  |  645|      0|#define   STAT_SNMPINVALIDMSGS               1
  ------------------
 3992|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3993|      0|        return SNMPERR_INVALID_MSG;
  ------------------
  |  |  248|      0|#define SNMPERR_INVALID_MSG             (-31)
  ------------------
 3994|      0|    }
 3995|      4|    pdu->securityLevel = ((msg_flags & SNMP_MSG_FLAG_AUTH_BIT)
  ------------------
  |  |  303|      4|#define SNMP_MSG_FLAG_AUTH_BIT          0x01
  ------------------
  |  Branch (3995:27): [True: 4, False: 0]
  ------------------
 3996|      4|                          ? ((msg_flags & SNMP_MSG_FLAG_PRIV_BIT)
  ------------------
  |  |  304|      4|#define SNMP_MSG_FLAG_PRIV_BIT          0x02
  ------------------
  |  Branch (3996:30): [True: 0, False: 4]
  ------------------
 3997|      4|                             ? SNMP_SEC_LEVEL_AUTHPRIV
  ------------------
  |  |  301|      0|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
 3998|      4|                             : SNMP_SEC_LEVEL_AUTHNOPRIV)
  ------------------
  |  |  300|      4|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
 3999|      4|                          : SNMP_SEC_LEVEL_NOAUTH);
  ------------------
  |  |  299|      0|#define SNMP_SEC_LEVEL_NOAUTH		1
  ------------------
 4000|       |    /*
 4001|       |     * end of msgGlobalData 
 4002|       |     */
 4003|       |
 4004|       |    /*
 4005|       |     * securtityParameters OCTET STRING begins after msgGlobalData 
 4006|       |     */
 4007|      4|    sec_params = data;
 4008|      4|    pdu->contextEngineID = calloc(1, SNMP_MAX_ENG_SIZE);
  ------------------
  |  |  144|      4|#define SNMP_MAX_ENG_SIZE          32
  ------------------
 4009|      4|    pdu->contextEngineIDLen = SNMP_MAX_ENG_SIZE;
  ------------------
  |  |  144|      4|#define SNMP_MAX_ENG_SIZE          32
  ------------------
 4010|       |
 4011|       |    /*
 4012|       |     * Note: there is no length limit on the msgAuthoritativeEngineID field,
 4013|       |     * although we would EXPECT it to be limited to 32 (the SnmpEngineID TC
 4014|       |     * limit).  We'll use double that here to be on the safe side.  
 4015|       |     */
 4016|       |
 4017|      4|    pdu->securityEngineID = calloc(1, SNMP_MAX_ENG_SIZE * 2);
  ------------------
  |  |  144|      4|#define SNMP_MAX_ENG_SIZE          32
  ------------------
 4018|      4|    pdu->securityEngineIDLen = SNMP_MAX_ENG_SIZE * 2;
  ------------------
  |  |  144|      4|#define SNMP_MAX_ENG_SIZE          32
  ------------------
 4019|      4|    pdu->securityName = calloc(1, SNMP_MAX_SEC_NAME_SIZE);
  ------------------
  |  |  145|      4|#define SNMP_MAX_SEC_NAME_SIZE     256
  ------------------
 4020|      4|    pdu->securityNameLen = SNMP_MAX_SEC_NAME_SIZE;
  ------------------
  |  |  145|      4|#define SNMP_MAX_SEC_NAME_SIZE     256
  ------------------
 4021|       |
 4022|      4|    if ((pdu->securityName == NULL) ||
  ------------------
  |  Branch (4022:9): [True: 0, False: 4]
  ------------------
 4023|      4|        (pdu->securityEngineID == NULL) ||
  ------------------
  |  Branch (4023:9): [True: 0, False: 4]
  ------------------
 4024|      4|        (pdu->contextEngineID == NULL)) {
  ------------------
  |  Branch (4024:9): [True: 0, False: 4]
  ------------------
 4025|      0|        return SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 4026|      0|    }
 4027|       |
 4028|      4|    if (pdu_buf_len < msg_len
  ------------------
  |  Branch (4028:9): [True: 2, False: 2]
  ------------------
 4029|      2|        && pdu->securityLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|      2|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (4029:12): [True: 0, False: 2]
  ------------------
 4030|       |        /*
 4031|       |         * space needed is larger than we have in the default buffer 
 4032|       |         */
 4033|      0|        mallocbuf = calloc(1, msg_len);
 4034|      0|        pdu_buf_len = msg_len;
 4035|      0|        cp = mallocbuf;
 4036|      4|    } else {
 4037|      4|        memset(pdu_buf, 0, pdu_buf_len);
 4038|      4|        cp = pdu_buf;
 4039|      4|    }
 4040|       |
 4041|      4|    DEBUGDUMPSECTION("recv", "SM msgSecurityParameters");
  ------------------
  |  |   81|      4|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 4]
  |  |  ------------------
  ------------------
 4042|      4|    if (sptr->decode) {
  ------------------
  |  Branch (4042:9): [True: 4, False: 0]
  ------------------
 4043|      4|        struct snmp_secmod_incoming_params parms;
 4044|      4|        parms.msgProcModel = pdu->msgParseModel;
 4045|      4|        parms.maxMsgSize = pdu->msgMaxSize;
 4046|      4|        parms.secParams = sec_params;
 4047|      4|        parms.secModel = msg_sec_model;
 4048|      4|        parms.secLevel = pdu->securityLevel;
 4049|      4|        parms.wholeMsg = msg_data;
 4050|      4|        parms.wholeMsgLen = msg_len;
 4051|      4|        parms.secEngineID = pdu->securityEngineID;
 4052|      4|        parms.secEngineIDLen = &pdu->securityEngineIDLen;
 4053|      4|        parms.secName = pdu->securityName;
 4054|      4|        parms.secNameLen = &pdu->securityNameLen;
 4055|      4|        parms.scopedPdu = &cp;
 4056|      4|        parms.scopedPduLen = &pdu_buf_len;
 4057|      4|        parms.maxSizeResponse = &max_size_response;
 4058|      4|        parms.secStateRef = &pdu->securityStateRef;
 4059|      4|        parms.sess = sess;
 4060|      4|        parms.pdu = pdu;
 4061|      4|        parms.msg_flags = msg_flags;
 4062|      4|        ret_val = (*sptr->decode) (&parms);
 4063|      4|    } else {
 4064|      0|        SNMP_FREE(mallocbuf);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4065|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4066|      0|        snmp_log(LOG_WARNING, "security service %ld can't decode packets\n",
 4067|      0|                 msg_sec_model);
 4068|      0|        return (-1);
 4069|      0|    }
 4070|       |
 4071|      4|    if (ret_val != SNMPERR_SUCCESS) {
  ------------------
  |  |  217|      4|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (4071:9): [True: 4, False: 0]
  ------------------
 4072|      4|        DEBUGDUMPSECTION("recv", "ScopedPDU");
  ------------------
  |  |   81|      4|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 4]
  |  |  ------------------
  ------------------
 4073|       |        /*
 4074|       |         * Parse as much as possible -- though I don't see the point? [jbpn].  
 4075|       |         */
 4076|      4|        if (cp) {
  ------------------
  |  Branch (4076:13): [True: 4, False: 0]
  ------------------
 4077|      4|            cp = snmpv3_scopedPDU_parse(pdu, cp, &pdu_buf_len);
 4078|      4|        }
 4079|      4|        if (cp) {
  ------------------
  |  Branch (4079:13): [True: 2, False: 2]
  ------------------
 4080|      2|            DEBUGPRINTPDUTYPE("recv", *cp);
  ------------------
  |  |  418|      2|    DEBUGDUMPSECTION(token, snmp_pdu_type(type))
  |  |  ------------------
  |  |  |  |   81|      2|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      2|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 2]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (81:56): [Folded, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4081|      2|            snmp_pdu_parse(pdu, cp, &pdu_buf_len);
 4082|      2|            DEBUGINDENTADD(-8);
  ------------------
  |  |   73|      2|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      2|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 2]
  |  |  ------------------
  ------------------
 4083|      2|        } else {
 4084|      2|            DEBUGINDENTADD(-4);
  ------------------
  |  |   73|      2|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      2|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 2]
  |  |  ------------------
  ------------------
 4085|      2|        }
 4086|       |
 4087|      4|        SNMP_FREE(mallocbuf);
  ------------------
  |  |   62|      4|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 4]
  |  |  |  Branch (62:66): [Folded, False: 4]
  |  |  ------------------
  ------------------
 4088|      4|        return ret_val;
 4089|      4|    }
 4090|       |
 4091|       |    /*
 4092|       |     * parse plaintext ScopedPDU sequence 
 4093|       |     */
 4094|      0|    *length = pdu_buf_len;
 4095|      0|    DEBUGDUMPSECTION("recv", "ScopedPDU");
  ------------------
  |  |   81|      0|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4096|      0|    data = snmpv3_scopedPDU_parse(pdu, cp, length);
 4097|      0|    if (data == NULL) {
  ------------------
  |  Branch (4097:9): [True: 0, False: 0]
  ------------------
 4098|      0|        snmp_log(LOG_WARNING, "security service %ld error parsing ScopedPDU\n",
 4099|      0|                 msg_sec_model);
 4100|      0|        ERROR_MSG("error parsing PDU");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4101|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4102|      0|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|      0|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4103|      0|        SNMP_FREE(mallocbuf);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4104|      0|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 4105|      0|    }
 4106|       |
 4107|       |    /*
 4108|       |     * parse the PDU.  
 4109|       |     */
 4110|      0|    if (after_header != NULL) {
  ------------------
  |  Branch (4110:9): [True: 0, False: 0]
  ------------------
 4111|      0|        *after_header = data;
 4112|      0|        tmp_buf_len = *length;
 4113|      0|    }
 4114|       |
 4115|      0|    DEBUGPRINTPDUTYPE("recv", *data);
  ------------------
  |  |  418|      0|    DEBUGDUMPSECTION(token, snmp_pdu_type(type))
  |  |  ------------------
  |  |  |  |   81|      0|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (81:56): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4116|      0|    ret = snmp_pdu_parse(pdu, data, length);
 4117|      0|    DEBUGINDENTADD(-8);
  ------------------
  |  |   73|      0|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4118|       |
 4119|      0|    if (after_header != NULL) {
  ------------------
  |  Branch (4119:9): [True: 0, False: 0]
  ------------------
 4120|      0|        *length = tmp_buf_len;
 4121|      0|    }
 4122|       |
 4123|      0|    if (ret != SNMPERR_SUCCESS) {
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (4123:9): [True: 0, False: 0]
  ------------------
 4124|      0|        snmp_log(LOG_WARNING, "security service %ld error parsing ScopedPDU\n",
 4125|      0|                 msg_sec_model);
 4126|      0|        ERROR_MSG("error parsing PDU");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4127|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4128|      0|        SNMP_FREE(mallocbuf);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4129|      0|        return SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 4130|      0|    }
 4131|       |
 4132|      0|    SNMP_FREE(mallocbuf);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4133|      0|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 4134|      0|}                               /* end snmpv3_parse() */
snmpv3_make_report:
 4165|      4|{
 4166|       |
 4167|      4|    long            ltmp;
 4168|      4|    static const oid unknownSecurityLevel[] =
 4169|      4|        { 1, 3, 6, 1, 6, 3, 15, 1, 1, 1, 0 };
 4170|      4|    static const oid notInTimeWindow[] =
 4171|      4|        { 1, 3, 6, 1, 6, 3, 15, 1, 1, 2, 0 };
 4172|      4|    static const oid unknownUserName[] =
 4173|      4|        { 1, 3, 6, 1, 6, 3, 15, 1, 1, 3, 0 };
 4174|      4|    static const oid unknownEngineID[] =
 4175|      4|        { 1, 3, 6, 1, 6, 3, 15, 1, 1, 4, 0 };
 4176|      4|    static const oid wrongDigest[] = { 1, 3, 6, 1, 6, 3, 15, 1, 1, 5, 0 };
 4177|      4|    static const oid decryptionError[] =
 4178|      4|        { 1, 3, 6, 1, 6, 3, 15, 1, 1, 6, 0 };
 4179|      4|    const oid      *err_var;
 4180|      4|    int             err_var_len;
 4181|      4|#ifndef NETSNMP_FEATURE_REMOVE_STATISTICS
 4182|      4|    int             stat_ind;
 4183|      4|#endif
 4184|       |
 4185|      4|    switch (error) {
 4186|      2|    case SNMPERR_USM_UNKNOWNENGINEID:
  ------------------
  |  |  265|      2|#define SNMPERR_USM_UNKNOWNENGINEID		(-48)
  ------------------
  |  Branch (4186:5): [True: 2, False: 2]
  ------------------
 4187|      2|#ifndef NETSNMP_FEATURE_REMOVE_STATISTICS
 4188|      2|        stat_ind = STAT_USMSTATSUNKNOWNENGINEIDS;
  ------------------
  |  |  656|      2|#define   STAT_USMSTATSUNKNOWNENGINEIDS      6
  ------------------
 4189|      2|#endif /* !NETSNMP_FEATURE_REMOVE_STATISTICS */
 4190|      2|        err_var = unknownEngineID;
 4191|      2|        err_var_len = ERROR_STAT_LENGTH;
  ------------------
  |  | 4161|      2|#define ERROR_STAT_LENGTH 11
  ------------------
 4192|      2|        break;
 4193|      1|    case SNMPERR_USM_UNKNOWNSECURITYNAME:
  ------------------
  |  |  260|      1|#define SNMPERR_USM_UNKNOWNSECURITYNAME		(-43)
  ------------------
  |  Branch (4193:5): [True: 1, False: 3]
  ------------------
 4194|      1|#ifndef NETSNMP_FEATURE_REMOVE_STATISTICS
 4195|      1|        stat_ind = STAT_USMSTATSUNKNOWNUSERNAMES;
  ------------------
  |  |  655|      1|#define   STAT_USMSTATSUNKNOWNUSERNAMES      5
  ------------------
 4196|      1|#endif /* !NETSNMP_FEATURE_REMOVE_STATISTICS */
 4197|      1|        err_var = unknownUserName;
 4198|      1|        err_var_len = ERROR_STAT_LENGTH;
  ------------------
  |  | 4161|      1|#define ERROR_STAT_LENGTH 11
  ------------------
 4199|      1|        break;
 4200|      0|    case SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL:
  ------------------
  |  |  261|      0|#define SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL	(-44)
  ------------------
  |  Branch (4200:5): [True: 0, False: 4]
  ------------------
 4201|      0|#ifndef NETSNMP_FEATURE_REMOVE_STATISTICS
 4202|      0|        stat_ind = STAT_USMSTATSUNSUPPORTEDSECLEVELS;
  ------------------
  |  |  653|      0|#define   STAT_USMSTATSUNSUPPORTEDSECLEVELS  3
  ------------------
 4203|      0|#endif /* !NETSNMP_FEATURE_REMOVE_STATISTICS */
 4204|      0|        err_var = unknownSecurityLevel;
 4205|      0|        err_var_len = ERROR_STAT_LENGTH;
  ------------------
  |  | 4161|      0|#define ERROR_STAT_LENGTH 11
  ------------------
 4206|      0|        break;
 4207|      1|    case SNMPERR_USM_AUTHENTICATIONFAILURE:
  ------------------
  |  |  263|      1|#define SNMPERR_USM_AUTHENTICATIONFAILURE	(-46)
  ------------------
  |  Branch (4207:5): [True: 1, False: 3]
  ------------------
 4208|      1|#ifndef NETSNMP_FEATURE_REMOVE_STATISTICS
 4209|      1|        stat_ind = STAT_USMSTATSWRONGDIGESTS;
  ------------------
  |  |  657|      1|#define   STAT_USMSTATSWRONGDIGESTS          7
  ------------------
 4210|      1|#endif /* !NETSNMP_FEATURE_REMOVE_STATISTICS */
 4211|      1|        err_var = wrongDigest;
 4212|      1|        err_var_len = ERROR_STAT_LENGTH;
  ------------------
  |  | 4161|      1|#define ERROR_STAT_LENGTH 11
  ------------------
 4213|      1|        break;
 4214|      0|    case SNMPERR_USM_NOTINTIMEWINDOW:
  ------------------
  |  |  266|      0|#define SNMPERR_USM_NOTINTIMEWINDOW		(-49)
  ------------------
  |  Branch (4214:5): [True: 0, False: 4]
  ------------------
 4215|      0|#ifndef NETSNMP_FEATURE_REMOVE_STATISTICS
 4216|      0|        stat_ind = STAT_USMSTATSNOTINTIMEWINDOWS;
  ------------------
  |  |  654|      0|#define   STAT_USMSTATSNOTINTIMEWINDOWS      4
  ------------------
 4217|      0|#endif /* !NETSNMP_FEATURE_REMOVE_STATISTICS */
 4218|      0|        err_var = notInTimeWindow;
 4219|      0|        err_var_len = ERROR_STAT_LENGTH;
  ------------------
  |  | 4161|      0|#define ERROR_STAT_LENGTH 11
  ------------------
 4220|      0|        break;
 4221|      0|    case SNMPERR_USM_DECRYPTIONERROR:
  ------------------
  |  |  267|      0|#define SNMPERR_USM_DECRYPTIONERROR		(-50)
  ------------------
  |  Branch (4221:5): [True: 0, False: 4]
  ------------------
 4222|      0|#ifndef NETSNMP_FEATURE_REMOVE_STATISTICS
 4223|      0|        stat_ind = STAT_USMSTATSDECRYPTIONERRORS;
  ------------------
  |  |  658|      0|#define   STAT_USMSTATSDECRYPTIONERRORS      8
  ------------------
 4224|      0|#endif /* !NETSNMP_FEATURE_REMOVE_STATISTICS */
 4225|      0|        err_var = decryptionError;
 4226|      0|        err_var_len = ERROR_STAT_LENGTH;
  ------------------
  |  | 4161|      0|#define ERROR_STAT_LENGTH 11
  ------------------
 4227|      0|        break;
 4228|      0|    default:
  ------------------
  |  Branch (4228:5): [True: 0, False: 4]
  ------------------
 4229|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 4230|      4|    }
 4231|       |
 4232|      4|    snmp_free_varbind(pdu->variables);  /* free the current varbind */
 4233|       |
 4234|      4|    pdu->variables = NULL;
 4235|      4|    SNMP_FREE(pdu->securityEngineID);
  ------------------
  |  |   62|      4|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 4, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 4]
  |  |  ------------------
  ------------------
 4236|      4|    pdu->securityEngineID =
 4237|      4|        snmpv3_generate_engineID(&pdu->securityEngineIDLen);
 4238|      4|    SNMP_FREE(pdu->contextEngineID);
  ------------------
  |  |   62|      4|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 4, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 4]
  |  |  ------------------
  ------------------
 4239|      4|    pdu->contextEngineID =
 4240|      4|        snmpv3_generate_engineID(&pdu->contextEngineIDLen);
 4241|      4|    pdu->command = SNMP_MSG_REPORT;
  ------------------
  |  |  147|      4|#define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   92|      4|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   96|      4|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
 4242|      4|    pdu->errstat = 0;
 4243|      4|    pdu->errindex = 0;
 4244|      4|    SNMP_FREE(pdu->contextName);
  ------------------
  |  |   62|      4|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 2, False: 2]
  |  |  |  Branch (62:66): [Folded, False: 4]
  |  |  ------------------
  ------------------
 4245|      4|    pdu->contextName = strdup("");
 4246|      4|    pdu->contextNameLen = strlen(pdu->contextName);
 4247|       |
 4248|       |    /*
 4249|       |     * reports shouldn't cache previous data. 
 4250|       |     */
 4251|       |    /*
 4252|       |     * FIX - yes they should but USM needs to follow new EoP to determine
 4253|       |     * which cached values to use 
 4254|       |     */
 4255|      4|    free_securityStateRef(pdu);
 4256|       |
 4257|      4|    if (error == SNMPERR_USM_NOTINTIMEWINDOW) {
  ------------------
  |  |  266|      4|#define SNMPERR_USM_NOTINTIMEWINDOW		(-49)
  ------------------
  |  Branch (4257:9): [True: 0, False: 4]
  ------------------
 4258|      0|        pdu->securityLevel = SNMP_SEC_LEVEL_AUTHNOPRIV;
  ------------------
  |  |  300|      0|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
 4259|      4|    } else {
 4260|      4|        pdu->securityLevel = SNMP_SEC_LEVEL_NOAUTH;
  ------------------
  |  |  299|      4|#define SNMP_SEC_LEVEL_NOAUTH		1
  ------------------
 4261|      4|    }
 4262|       |
 4263|       |    /*
 4264|       |     * find the appropriate error counter  
 4265|       |     */
 4266|      4|#ifndef NETSNMP_FEATURE_REMOVE_STATISTICS
 4267|      4|    ltmp = snmp_get_statistic(stat_ind);
 4268|       |#else /* !NETSNMP_FEATURE_REMOVE_STATISTICS */
 4269|       |    ltmp = 1;
 4270|       |#endif /* !NETSNMP_FEATURE_REMOVE_STATISTICS */
 4271|       |
 4272|       |    /*
 4273|       |     * return the appropriate error counter  
 4274|       |     */
 4275|      4|    snmp_pdu_add_variable(pdu, err_var, err_var_len,
 4276|      4|                          ASN_COUNTER, & ltmp, sizeof(ltmp));
  ------------------
  |  |   89|      4|#define ASN_COUNTER	(ASN_APPLICATION | 1)
  |  |  ------------------
  |  |  |  |   91|      4|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
 4277|       |
 4278|      4|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|      4|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 4279|      4|}                               /* end snmpv3_make_report() */
snmp_parse:
 4659|     68|{
 4660|     68|    int             rc;
 4661|       |
 4662|     68|    rc = _snmp_parse(slp, pss, pdu, data, length);
 4663|     68|    if (rc) {
  ------------------
  |  Branch (4663:9): [True: 68, False: 0]
  ------------------
 4664|     68|        if (!pss->s_snmp_errno) {
  ------------------
  |  Branch (4664:13): [True: 15, False: 53]
  ------------------
 4665|     15|            pss->s_snmp_errno = SNMPERR_BAD_PARSE;
  ------------------
  |  |  230|     15|#define SNMPERR_BAD_PARSE		(-13)
  ------------------
 4666|     15|        }
 4667|     68|        SET_SNMP_ERROR(pss->s_snmp_errno);
  ------------------
  |  |   56|     68|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 4668|     68|    }
 4669|       |
 4670|     68|    return rc;
 4671|     68|}
snmp_pdu_parse:
 4675|      4|{
 4676|      4|    u_char          type;
 4677|      4|    u_char          msg_type;
 4678|      4|    u_char         *var_val;
 4679|      4|    size_t          len;
 4680|      4|    size_t          four;
 4681|      4|    netsnmp_variable_list *vp = NULL, *vplast = NULL;
 4682|      4|    oid             objid[MAX_OID_LEN];
 4683|      4|    u_char         *p;
 4684|       |
 4685|       |    /*
 4686|       |     * Get the PDU type 
 4687|       |     */
 4688|      4|    data = asn_parse_header(data, length, &msg_type);
 4689|      4|    if (data == NULL)
  ------------------
  |  Branch (4689:9): [True: 0, False: 4]
  ------------------
 4690|      0|        return -1;
 4691|      4|    DEBUGMSGTL(("dumpv_recv","    Command %s\n", snmp_pdu_type(msg_type)));
  ------------------
  |  |   66|      4|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 4]
  |  |  ------------------
  ------------------
 4692|      4|    pdu->command = msg_type;
 4693|      4|    pdu->flags &= (~UCD_MSG_FLAG_RESPONSE_PDU);
  ------------------
  |  |  311|      4|#define UCD_MSG_FLAG_RESPONSE_PDU            0x100
  ------------------
 4694|       |
 4695|       |    /*
 4696|       |     * get the fields in the PDU preceding the variable-bindings sequence
 4697|       |     */
 4698|      4|    switch (pdu->command) {
 4699|      2|    case SNMP_MSG_TRAP:
  ------------------
  |  |  135|      2|#define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   92|      2|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   96|      2|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4699:5): [True: 2, False: 2]
  ------------------
 4700|       |        /*
 4701|       |         * enterprise 
 4702|       |         */
 4703|      2|        pdu->enterprise_length = MAX_OID_LEN;
  ------------------
  |  |  106|      2|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
 4704|      2|        data = asn_parse_objid(data, length, &type, objid,
 4705|      2|                               &pdu->enterprise_length);
 4706|      2|        if (data == NULL)
  ------------------
  |  Branch (4706:13): [True: 0, False: 2]
  ------------------
 4707|      0|            return -1;
 4708|      2|        pdu->enterprise = netsnmp_memdup(objid,
 4709|      2|                                         pdu->enterprise_length * sizeof(oid));
 4710|      2|        if (pdu->enterprise == NULL) {
  ------------------
  |  Branch (4710:13): [True: 0, False: 2]
  ------------------
 4711|      0|            return -1;
 4712|      0|        }
 4713|       |
 4714|       |        /*
 4715|       |         * agent-addr 
 4716|       |         */
 4717|      2|        four = 4;
 4718|      2|        data = asn_parse_string(data, length, &type,
 4719|      2|                                (u_char *) pdu->agent_addr, &four);
 4720|      2|        if (data == NULL)
  ------------------
  |  Branch (4720:13): [True: 0, False: 2]
  ------------------
 4721|      0|            return -1;
 4722|       |
 4723|       |        /*
 4724|       |         * generic trap 
 4725|       |         */
 4726|      2|        data = asn_parse_int(data, length, &type, (long *) &pdu->trap_type,
 4727|      2|                             sizeof(pdu->trap_type));
 4728|      2|        if (data == NULL)
  ------------------
  |  Branch (4728:13): [True: 0, False: 2]
  ------------------
 4729|      0|            return -1;
 4730|       |        /*
 4731|       |         * specific trap 
 4732|       |         */
 4733|      2|        data =
 4734|      2|            asn_parse_int(data, length, &type,
 4735|      2|                          (long *) &pdu->specific_type,
 4736|      2|                          sizeof(pdu->specific_type));
 4737|      2|        if (data == NULL)
  ------------------
  |  Branch (4737:13): [True: 0, False: 2]
  ------------------
 4738|      0|            return -1;
 4739|       |
 4740|       |        /*
 4741|       |         * timestamp  
 4742|       |         */
 4743|      2|        data = asn_parse_unsigned_int(data, length, &type, &pdu->time,
 4744|      2|                                      sizeof(pdu->time));
 4745|      2|        if (data == NULL)
  ------------------
  |  Branch (4745:13): [True: 2, False: 0]
  ------------------
 4746|      2|            return -1;
 4747|       |
 4748|      0|        break;
 4749|       |
 4750|      0|    case 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
  |  |  ------------------
  ------------------
  |  Branch (4750:5): [True: 0, False: 4]
  ------------------
 4751|      0|    case SNMP_MSG_REPORT:
  ------------------
  |  |  147|      0|#define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4751:5): [True: 0, False: 4]
  ------------------
 4752|      0|        pdu->flags |= UCD_MSG_FLAG_RESPONSE_PDU;
  ------------------
  |  |  311|      0|#define UCD_MSG_FLAG_RESPONSE_PDU            0x100
  ------------------
 4753|      0|        NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2408|      0|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 4754|       |
 4755|      0|    case SNMP_MSG_TRAP2:
  ------------------
  |  |  142|      0|#define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4755:5): [True: 0, False: 4]
  ------------------
 4756|      0|    case SNMP_MSG_INFORM:
  ------------------
  |  |  141|      0|#define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4756:5): [True: 0, False: 4]
  ------------------
 4757|      0|#ifndef NETSNMP_NOTIFY_ONLY
 4758|      0|    case SNMP_MSG_GET:
  ------------------
  |  |  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 (4758:5): [True: 0, False: 4]
  ------------------
 4759|      2|    case SNMP_MSG_GETNEXT:
  ------------------
  |  |  126|      2|#define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   92|      2|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   96|      2|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4759:5): [True: 2, False: 2]
  ------------------
 4760|      2|    case SNMP_MSG_GETBULK:
  ------------------
  |  |  140|      2|#define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  ------------------
  |  |  |  |   92|      2|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  ------------------
  |  |  |  |   96|      2|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4760:5): [True: 0, False: 4]
  ------------------
 4761|      2|#endif /* ! NETSNMP_NOTIFY_ONLY */
 4762|      2|#ifndef NETSNMP_NO_WRITE_SUPPORT
 4763|      2|    case SNMP_MSG_SET:
  ------------------
  |  |  129|      2|#define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  ------------------
  |  |  |  |   92|      2|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  ------------------
  |  |  |  |   96|      2|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4763:5): [True: 0, False: 4]
  ------------------
 4764|      2|#endif /* !NETSNMP_NO_WRITE_SUPPORT */
 4765|       |        /*
 4766|       |         * PDU is not an SNMPv1 TRAP 
 4767|       |         */
 4768|       |
 4769|       |        /*
 4770|       |         * request id 
 4771|       |         */
 4772|      2|        DEBUGDUMPHEADER("recv", "request_id");
  ------------------
  |  |   79|      2|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      2|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 2]
  |  |  ------------------
  ------------------
 4773|      2|        data = asn_parse_int(data, length, &type, &pdu->reqid,
 4774|      2|                             sizeof(pdu->reqid));
 4775|      2|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      2|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      2|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 2]
  |  |  ------------------
  ------------------
 4776|      2|        if (data == NULL) {
  ------------------
  |  Branch (4776:13): [True: 0, False: 2]
  ------------------
 4777|      0|            return -1;
 4778|      0|        }
 4779|       |
 4780|       |        /*
 4781|       |         * error status (getbulk non-repeaters) 
 4782|       |         */
 4783|      2|        DEBUGDUMPHEADER("recv", "error status");
  ------------------
  |  |   79|      2|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      2|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 2]
  |  |  ------------------
  ------------------
 4784|      2|        data = asn_parse_int(data, length, &type, &pdu->errstat,
 4785|      2|                             sizeof(pdu->errstat));
 4786|      2|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      2|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      2|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 2]
  |  |  ------------------
  ------------------
 4787|      2|        if (data == NULL) {
  ------------------
  |  Branch (4787:13): [True: 2, False: 0]
  ------------------
 4788|      2|            return -1;
 4789|      2|        }
 4790|       |
 4791|       |        /*
 4792|       |         * error index (getbulk max-repetitions) 
 4793|       |         */
 4794|      0|        DEBUGDUMPHEADER("recv", "error index");
  ------------------
  |  |   79|      0|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4795|      0|        data = asn_parse_int(data, length, &type, &pdu->errindex,
 4796|      0|                             sizeof(pdu->errindex));
 4797|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4798|      0|        if (data == NULL) {
  ------------------
  |  Branch (4798:13): [True: 0, False: 0]
  ------------------
 4799|      0|            return -1;
 4800|      0|        }
 4801|      0|	break;
 4802|       |
 4803|      0|    default:
  ------------------
  |  Branch (4803:5): [True: 0, False: 4]
  ------------------
 4804|      0|        snmp_log(LOG_ERR, "Bad PDU type received: 0x%.2x\n", pdu->command);
 4805|      0|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4806|      0|        return -1;
 4807|      4|    }
 4808|       |
 4809|       |    /*
 4810|       |     * get header for variable-bindings sequence 
 4811|       |     */
 4812|      0|    DEBUGDUMPSECTION("recv", "VarBindList");
  ------------------
  |  |   81|      0|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4813|      0|    data = asn_parse_sequence(data, length, &type,
 4814|      0|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   84|      0|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 4815|      0|                              "varbinds");
 4816|      0|    if (data == NULL)
  ------------------
  |  Branch (4816:9): [True: 0, False: 0]
  ------------------
 4817|      0|        goto fail;
 4818|       |
 4819|       |    /*
 4820|       |     * get each varBind sequence 
 4821|       |     */
 4822|      0|    while ((int) *length > 0) {
  ------------------
  |  Branch (4822:12): [True: 0, False: 0]
  ------------------
 4823|      0|        vp = SNMP_MALLOC_TYPEDEF(netsnmp_variable_list);
  ------------------
  |  |   73|      0|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
 4824|      0|        if (NULL == vp)
  ------------------
  |  Branch (4824:13): [True: 0, False: 0]
  ------------------
 4825|      0|            goto fail;
 4826|       |
 4827|      0|        vp->name_length = MAX_OID_LEN;
  ------------------
  |  |  106|      0|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
 4828|      0|        DEBUGDUMPSECTION("recv", "VarBind");
  ------------------
  |  |   81|      0|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4829|      0|        data = snmp_parse_var_op(data, objid, &vp->name_length, &vp->type,
 4830|      0|                                 &vp->val_len, &var_val, length);
 4831|      0|        if (data == NULL)
  ------------------
  |  Branch (4831:13): [True: 0, False: 0]
  ------------------
 4832|      0|            goto fail;
 4833|      0|        if (snmp_set_var_objid(vp, objid, vp->name_length))
  ------------------
  |  Branch (4833:13): [True: 0, False: 0]
  ------------------
 4834|      0|            goto fail;
 4835|       |
 4836|      0|        len = SNMP_MAX_PACKET_LEN;
  ------------------
  |  |   49|      0|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
 4837|      0|        DEBUGDUMPHEADER("recv", "Value");
  ------------------
  |  |   79|      0|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4838|      0|        switch ((short) vp->type) {
 4839|      0|        case ASN_INTEGER:
  ------------------
  |  |   75|      0|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (4839:9): [True: 0, False: 0]
  ------------------
 4840|      0|            vp->val.integer = (long *) vp->buf;
 4841|      0|            vp->val_len = sizeof(long);
 4842|      0|            p = asn_parse_int(var_val, &len, &vp->type,
 4843|      0|                          (long *) vp->val.integer,
 4844|      0|                          sizeof(*vp->val.integer));
 4845|      0|            if (!p)
  ------------------
  |  Branch (4845:17): [True: 0, False: 0]
  ------------------
 4846|      0|                goto fail;
 4847|      0|            break;
 4848|      0|        case ASN_COUNTER:
  ------------------
  |  |   89|      0|#define ASN_COUNTER	(ASN_APPLICATION | 1)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4848:9): [True: 0, False: 0]
  ------------------
 4849|      0|        case ASN_GAUGE:
  ------------------
  |  |   90|      0|#define ASN_GAUGE	(ASN_APPLICATION | 2)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4849:9): [True: 0, False: 0]
  ------------------
 4850|      0|        case ASN_TIMETICKS:
  ------------------
  |  |   92|      0|#define ASN_TIMETICKS   (ASN_APPLICATION | 3)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4850:9): [True: 0, False: 0]
  ------------------
 4851|      0|        case ASN_UINTEGER:
  ------------------
  |  |  100|      0|#define ASN_UINTEGER    (ASN_APPLICATION | 7)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4851:9): [True: 0, False: 0]
  ------------------
 4852|      0|            vp->val.integer = (long *) vp->buf;
 4853|      0|            vp->val_len = sizeof(u_long);
 4854|      0|            p = asn_parse_unsigned_int(var_val, &len, &vp->type,
 4855|      0|                                   (u_long *) vp->val.integer,
 4856|      0|                                   vp->val_len);
 4857|      0|            if (!p)
  ------------------
  |  Branch (4857:17): [True: 0, False: 0]
  ------------------
 4858|      0|                goto fail;
 4859|      0|            break;
 4860|      0|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 4861|      0|        case ASN_OPAQUE_COUNTER64:
  ------------------
  |  |  156|      0|#define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_COUNTER64 (ASN_OPAQUE_TAG2 + ASN_APP_COUNTER64)
  |  |  ------------------
  |  |  |  |  146|      0|#define ASN_APP_COUNTER64 (ASN_APPLICATION | 6)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4861:9): [True: 0, False: 0]
  ------------------
 4862|      0|        case ASN_OPAQUE_U64:
  ------------------
  |  |  192|      0|#define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  150|      0|#define ASN_APP_U64 (ASN_APPLICATION | 11)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4862:9): [True: 0, False: 0]
  ------------------
 4863|      0|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 4864|      0|        case ASN_COUNTER64:
  ------------------
  |  |   99|      0|#define ASN_COUNTER64   (ASN_APPLICATION | 6)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4864:9): [True: 0, False: 0]
  ------------------
 4865|      0|            vp->val.counter64 = (struct counter64 *) vp->buf;
 4866|      0|            vp->val_len = sizeof(struct counter64);
 4867|      0|            p = asn_parse_unsigned_int64(var_val, &len, &vp->type,
 4868|      0|                                     (struct counter64 *) vp->val.
 4869|      0|                                     counter64, vp->val_len);
 4870|      0|            if (!p)
  ------------------
  |  Branch (4870:17): [True: 0, False: 0]
  ------------------
 4871|      0|                goto fail;
 4872|      0|            break;
 4873|      0|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
 4874|      0|        case ASN_OPAQUE_FLOAT:
  ------------------
  |  |  165|      0|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|      0|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4874:9): [True: 0, False: 0]
  ------------------
 4875|      0|            vp->val.floatVal = (float *) vp->buf;
 4876|      0|            vp->val_len = sizeof(float);
 4877|      0|            p = asn_parse_float(var_val, &len, &vp->type,
 4878|      0|                            vp->val.floatVal, vp->val_len);
 4879|      0|            if (!p)
  ------------------
  |  Branch (4879:17): [True: 0, False: 0]
  ------------------
 4880|      0|                goto fail;
 4881|      0|            break;
 4882|      0|        case ASN_OPAQUE_DOUBLE:
  ------------------
  |  |  174|      0|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|      0|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4882:9): [True: 0, False: 0]
  ------------------
 4883|      0|            vp->val.doubleVal = (double *) vp->buf;
 4884|      0|            vp->val_len = sizeof(double);
 4885|      0|            p = asn_parse_double(var_val, &len, &vp->type,
 4886|      0|                             vp->val.doubleVal, vp->val_len);
 4887|      0|            if (!p)
  ------------------
  |  Branch (4887:17): [True: 0, False: 0]
  ------------------
 4888|      0|                goto fail;
 4889|      0|            break;
 4890|      0|        case ASN_OPAQUE_I64:
  ------------------
  |  |  183|      0|#define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  149|      0|#define ASN_APP_I64 (ASN_APPLICATION | 10)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (4890:9): [True: 0, False: 0]
  ------------------
 4891|      0|            vp->val.counter64 = (struct counter64 *) vp->buf;
 4892|      0|            vp->val_len = sizeof(struct counter64);
 4893|      0|            p = asn_parse_signed_int64(var_val, &len, &vp->type,
 4894|      0|                                   (struct counter64 *) vp->val.counter64,
 4895|      0|                                   sizeof(*vp->val.counter64));
 4896|       |
 4897|      0|            if (!p)
  ------------------
  |  Branch (4897:17): [True: 0, False: 0]
  ------------------
 4898|      0|                goto fail;
 4899|      0|            break;
 4900|      0|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
 4901|      0|        case ASN_IPADDRESS:
  ------------------
  |  |   88|      0|#define ASN_IPADDRESS   (ASN_APPLICATION | 0)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4901:9): [True: 0, False: 0]
  ------------------
 4902|      0|            if (vp->val_len != 4)
  ------------------
  |  Branch (4902:17): [True: 0, False: 0]
  ------------------
 4903|      0|                goto fail;
 4904|      0|            NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2408|      0|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 4905|      0|        case ASN_OCTET_STR:
  ------------------
  |  |   78|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
  |  Branch (4905:9): [True: 0, False: 0]
  ------------------
 4906|      0|        case ASN_OPAQUE:
  ------------------
  |  |   93|      0|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4906:9): [True: 0, False: 0]
  ------------------
 4907|      0|        case ASN_NSAP:
  ------------------
  |  |   98|      0|#define ASN_NSAP	(ASN_APPLICATION | 5)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (4907:9): [True: 0, False: 0]
  ------------------
 4908|      0|            if (vp->val_len < sizeof(vp->buf)) {
  ------------------
  |  Branch (4908:17): [True: 0, False: 0]
  ------------------
 4909|      0|                vp->val.string = (u_char *) vp->buf;
 4910|      0|            } else {
 4911|      0|                vp->val.string = (u_char *) malloc(vp->val_len);
 4912|      0|            }
 4913|      0|            if (vp->val.string == NULL) {
  ------------------
  |  Branch (4913:17): [True: 0, False: 0]
  ------------------
 4914|      0|                goto fail;
 4915|      0|            }
 4916|      0|            p = asn_parse_string(var_val, &len, &vp->type, vp->val.string,
 4917|      0|                             &vp->val_len);
 4918|      0|            if (!p)
  ------------------
  |  Branch (4918:17): [True: 0, False: 0]
  ------------------
 4919|      0|                goto fail;
 4920|      0|            break;
 4921|      0|        case ASN_OBJECT_ID:
  ------------------
  |  |   81|      0|#define ASN_OBJECT_ID	    0x06U
  ------------------
  |  Branch (4921:9): [True: 0, False: 0]
  ------------------
 4922|      0|            vp->val_len = MAX_OID_LEN;
  ------------------
  |  |  106|      0|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
 4923|      0|            p = asn_parse_objid(var_val, &len, &vp->type, objid, &vp->val_len);
 4924|      0|            if (!p)
  ------------------
  |  Branch (4924:17): [True: 0, False: 0]
  ------------------
 4925|      0|                goto fail;
 4926|      0|            vp->val_len *= sizeof(oid);
 4927|      0|            vp->val.objid = netsnmp_memdup(objid, vp->val_len);
 4928|      0|            if (vp->val.objid == NULL)
  ------------------
  |  Branch (4928:17): [True: 0, False: 0]
  ------------------
 4929|      0|                goto fail;
 4930|      0|            break;
 4931|      0|        case SNMP_NOSUCHOBJECT:
  ------------------
  |  |  201|      0|#define SNMP_NOSUCHOBJECT    (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) /* 80=128 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_NOSUCHOBJECT    (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) /* 80=128 */
  |  |  ------------------
  |  |  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (4931:9): [True: 0, False: 0]
  ------------------
 4932|      0|        case SNMP_NOSUCHINSTANCE:
  ------------------
  |  |  202|      0|#define SNMP_NOSUCHINSTANCE  (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* 81=129 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_NOSUCHINSTANCE  (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* 81=129 */
  |  |  ------------------
  |  |  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (4932:9): [True: 0, False: 0]
  ------------------
 4933|      0|        case SNMP_ENDOFMIBVIEW:
  ------------------
  |  |  203|      0|#define SNMP_ENDOFMIBVIEW    (ASN_CONTEXT | ASN_PRIMITIVE | 0x2) /* 82=130 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_ENDOFMIBVIEW    (ASN_CONTEXT | ASN_PRIMITIVE | 0x2) /* 82=130 */
  |  |  ------------------
  |  |  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (4933:9): [True: 0, False: 0]
  ------------------
 4934|      0|        case ASN_NULL:
  ------------------
  |  |   79|      0|#define ASN_NULL	    0x05U
  ------------------
  |  Branch (4934:9): [True: 0, False: 0]
  ------------------
 4935|      0|            break;
 4936|      0|        case ASN_BIT_STR:
  ------------------
  |  |   77|      0|#define ASN_BIT_STR	    0x03U
  ------------------
  |  Branch (4936:9): [True: 0, False: 0]
  ------------------
 4937|      0|            vp->val.bitstring = (u_char *) malloc(vp->val_len);
 4938|      0|            if (vp->val.bitstring == NULL) {
  ------------------
  |  Branch (4938:17): [True: 0, False: 0]
  ------------------
 4939|      0|                goto fail;
 4940|      0|            }
 4941|      0|            p = asn_parse_bitstring(var_val, &len, &vp->type,
 4942|      0|                                vp->val.bitstring, &vp->val_len);
 4943|      0|            if (!p)
  ------------------
  |  Branch (4943:17): [True: 0, False: 0]
  ------------------
 4944|      0|                goto fail;
 4945|      0|            break;
 4946|      0|        default:
  ------------------
  |  Branch (4946:9): [True: 0, False: 0]
  ------------------
 4947|      0|            snmp_log(LOG_ERR, "bad type returned (%x)\n", vp->type);
 4948|      0|            goto fail;
 4949|      0|            break;
 4950|      0|        }
 4951|      0|        DEBUGINDENTADD(-4);
  ------------------
  |  |   73|      0|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4952|       |
 4953|      0|        if (NULL == vplast) {
  ------------------
  |  Branch (4953:13): [True: 0, False: 0]
  ------------------
 4954|      0|            pdu->variables = vp;
 4955|      0|        } else {
 4956|      0|            vplast->next_variable = vp;
 4957|      0|        }
 4958|      0|        vplast = vp;
 4959|      0|        vp = NULL;
 4960|      0|    }
 4961|      0|    return 0;
 4962|       |
 4963|      0|  fail:
 4964|      0|    {
 4965|      0|        const char *errstr = snmp_api_errstring(SNMPERR_SUCCESS);
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 4966|      0|        DEBUGMSGTL(("recv", "error while parsing VarBindList:%s\n", errstr));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4967|      0|    }
 4968|       |    /** if we were parsing a var, remove it from the pdu and free it */
 4969|      0|    if (vp)
  ------------------
  |  Branch (4969:9): [True: 0, False: 0]
  ------------------
 4970|      0|        snmp_free_var(vp);
 4971|       |
 4972|      0|    return -1;
 4973|      0|}
snmpv3_scopedPDU_parse:
 4984|      4|{
 4985|      4|    u_char          tmp_buf[SNMP_MAX_MSG_SIZE];
 4986|      4|    size_t          tmp_buf_len;
 4987|      4|    u_char          type;
 4988|      4|    size_t          asn_len;
 4989|      4|    u_char         *data;
 4990|       |
 4991|      4|    pdu->command = 0;           /* initialize so we know if it got parsed */
 4992|      4|    asn_len = *length;
 4993|      4|    data = asn_parse_sequence(cp, &asn_len, &type,
 4994|      4|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   84|      4|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   96|      4|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 4995|      4|                              "plaintext scopedPDU");
 4996|      4|    if (data == NULL) {
  ------------------
  |  Branch (4996:9): [True: 0, False: 4]
  ------------------
 4997|      0|        return NULL;
 4998|      0|    }
 4999|      4|    *length -= data - cp;
 5000|       |
 5001|       |    /*
 5002|       |     * contextEngineID from scopedPdu  
 5003|       |     */
 5004|      4|    DEBUGDUMPHEADER("recv", "contextEngineID");
  ------------------
  |  |   79|      4|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 4]
  |  |  ------------------
  ------------------
 5005|      4|    data = asn_parse_string(data, length, &type, pdu->contextEngineID,
 5006|      4|                            &pdu->contextEngineIDLen);
 5007|      4|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
 5008|      4|    if (data == NULL) {
  ------------------
  |  Branch (5008:9): [True: 0, False: 4]
  ------------------
 5009|      0|        ERROR_MSG("error parsing contextEngineID from scopedPdu");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 5010|      0|        return NULL;
 5011|      0|    }
 5012|       |
 5013|       |    /*
 5014|       |     * parse contextName from scopedPdu
 5015|       |     */
 5016|      4|    tmp_buf_len = SNMP_MAX_CONTEXT_SIZE;
  ------------------
  |  |  146|      4|#define SNMP_MAX_CONTEXT_SIZE      256
  ------------------
 5017|      4|    DEBUGDUMPHEADER("recv", "contextName");
  ------------------
  |  |   79|      4|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 4]
  |  |  ------------------
  ------------------
 5018|      4|    data = asn_parse_string(data, length, &type, tmp_buf, &tmp_buf_len);
 5019|      4|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
 5020|      4|    if (data == NULL) {
  ------------------
  |  Branch (5020:9): [True: 2, False: 2]
  ------------------
 5021|      2|        ERROR_MSG("error parsing contextName from scopedPdu");
  ------------------
  |  |  188|      2|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 5022|      2|        return NULL;
 5023|      2|    }
 5024|       |
 5025|      2|    if (tmp_buf_len) {
  ------------------
  |  Branch (5025:9): [True: 0, False: 2]
  ------------------
 5026|      0|        pdu->contextName = netsnmp_memdup(tmp_buf, tmp_buf_len);
 5027|      0|        pdu->contextNameLen = tmp_buf_len;
 5028|      2|    } else {
 5029|      2|        pdu->contextName = strdup("");
 5030|      2|        pdu->contextNameLen = 0;
 5031|      2|    }
 5032|      2|    if (pdu->contextName == NULL) {
  ------------------
  |  Branch (5032:9): [True: 0, False: 2]
  ------------------
 5033|      0|        ERROR_MSG("error copying contextName from scopedPdu");
  ------------------
  |  |  188|      0|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 5034|      0|        return NULL;
 5035|      0|    }
 5036|       |
 5037|       |    /*
 5038|       |     * Get the PDU type 
 5039|       |     */
 5040|      2|    asn_len = *length;
 5041|      2|    cp = asn_parse_header(data, &asn_len, &type);
 5042|      2|    if (cp == NULL)
  ------------------
  |  Branch (5042:9): [True: 0, False: 2]
  ------------------
 5043|      0|        return NULL;
 5044|       |
 5045|      2|    pdu->command = type;
 5046|       |
 5047|      2|    return data;
 5048|      2|}
_build_initial_pdu_packet:
 5094|      4|{
 5095|      4|    netsnmp_session *session;
 5096|      4|    struct snmp_internal_session *isp;
 5097|      4|    netsnmp_transport *transport = NULL;
 5098|      4|    u_char         *pktbuf = NULL, *packet = NULL;
 5099|      4|    size_t          pktbuf_len = 0, length = 0, orig_length = 0;
 5100|      4|    int             result, orig_count = 0, curr_count = 0;
 5101|       |
 5102|      4|    if (slp == NULL) {
  ------------------
  |  Branch (5102:9): [True: 0, False: 4]
  ------------------
 5103|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 5104|      0|    }
 5105|      4|    session = slp->session;
 5106|       |
 5107|      4|    isp = slp->internal;
 5108|      4|    transport = slp->transport;
 5109|      4|    if (!session || !isp || !transport) {
  ------------------
  |  Branch (5109:9): [True: 0, False: 4]
  |  Branch (5109:21): [True: 0, False: 4]
  |  Branch (5109:29): [True: 0, False: 4]
  ------------------
 5110|      0|        DEBUGMSGTL(("sess_async_send", "send fail: closing...\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5111|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 5112|      0|    }
 5113|       |
 5114|      4|    if (pdu == NULL) {
  ------------------
  |  Branch (5114:9): [True: 0, False: 4]
  ------------------
 5115|      0|        session->s_snmp_errno = SNMPERR_NULL_PDU;
  ------------------
  |  |  276|      0|#define SNMPERR_NULL_PDU		(-59)
  ------------------
 5116|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 5117|      0|    }
 5118|       |
 5119|      4|    SNMP_FREE(isp->obuf); /* should already be NULL */
  ------------------
  |  |   62|      4|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 4]
  |  |  |  Branch (62:66): [Folded, False: 4]
  |  |  ------------------
  ------------------
 5120|       |
 5121|      4|    session->s_snmp_errno = 0;
 5122|      4|    session->s_errno = 0;
 5123|       |
 5124|       |    /*
 5125|       |     * Check/setup the version.  
 5126|       |     */
 5127|      4|    if (pdu->version == SNMP_DEFAULT_VERSION) {
  ------------------
  |  |  123|      4|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  |  Branch (5127:9): [True: 0, False: 4]
  ------------------
 5128|      0|        if (session->version == SNMP_DEFAULT_VERSION) {
  ------------------
  |  |  123|      0|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  |  Branch (5128:13): [True: 0, False: 0]
  ------------------
 5129|      0|            session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  231|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 5130|      0|            return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 5131|      0|        }
 5132|      0|        pdu->version = session->version;
 5133|      4|    } else if (session->version == SNMP_DEFAULT_VERSION) {
  ------------------
  |  |  123|      4|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  |  Branch (5133:16): [True: 4, False: 0]
  ------------------
 5134|       |        /*
 5135|       |         * It's OK  
 5136|       |         */
 5137|      4|    } else if (pdu->version != session->version) {
  ------------------
  |  Branch (5137:16): [True: 0, False: 0]
  ------------------
 5138|       |        /*
 5139|       |         * ENHANCE: we should support multi-lingual sessions  
 5140|       |         */
 5141|      0|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  231|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 5142|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 5143|      0|    }
 5144|      4|    if (NETSNMP_RUNTIME_PROTOCOL_SKIP(pdu->version)) {
  ------------------
  |  |  246|      4|    (NETSNMP_RUNTIME_PROTOCOL_SKIP_V1(pc_ver) ||        \
  |  |  ------------------
  |  |  |  |  205|      8|    ((pc_ver) == SNMP_VERSION_1 &&                                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |  107|      8|#define SNMP_VERSION_1	   0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (205:6): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  |  |  206|      8|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (206:6): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  207|      0|                            NETSNMP_DS_LIB_DISABLE_V1))
  |  |  |  |  ------------------
  |  |  |  |  |  |  103|      0|#define NETSNMP_DS_LIB_DISABLE_V1          43 /* disable SNMPv1 */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  247|      4|     NETSNMP_RUNTIME_PROTOCOL_SKIP_V2(pc_ver) ||        \
  |  |  ------------------
  |  |  |  |  215|      8|    ((pc_ver) == SNMP_VERSION_2c &&                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|      8|#define SNMP_VERSION_2c    1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (215:6): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  |  |  216|      8|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (216:6): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  217|      0|                            NETSNMP_DS_LIB_DISABLE_V2c))
  |  |  |  |  ------------------
  |  |  |  |  |  |  104|      0|#define NETSNMP_DS_LIB_DISABLE_V2c         44 /* disable SNMPv2c */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  248|      4|     NETSNMP_RUNTIME_PROTOCOL_SKIP_V3(pc_ver))
  |  |  ------------------
  |  |  |  |  229|      4|    ((pc_ver == SNMP_VERSION_3) &&                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  113|      4|#define SNMP_VERSION_3     3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (229:6): [True: 4, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  230|      4|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|      4|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (230:6): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  |  |  231|      4|                            NETSNMP_DS_LIB_DISABLE_V3))
  |  |  |  |  ------------------
  |  |  |  |  |  |  105|      4|#define NETSNMP_DS_LIB_DISABLE_V3          45 /* disable SNMPv3 */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 5145|      0|        DEBUGMSGTL(("sess_async_send", "version disabled at runtime\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5146|      0|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  231|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 5147|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 5148|      0|    }
 5149|       |
 5150|       |    /*
 5151|       |     * do we expect a response?
 5152|       |     */
 5153|      4|    switch (pdu->command) {
 5154|       |
 5155|      0|        case 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
  |  |  ------------------
  ------------------
  |  Branch (5155:9): [True: 0, False: 4]
  ------------------
 5156|      0|        case SNMP_MSG_TRAP:
  ------------------
  |  |  135|      0|#define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (5156:9): [True: 0, False: 4]
  ------------------
 5157|      0|        case SNMP_MSG_TRAP2:
  ------------------
  |  |  142|      0|#define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (5157:9): [True: 0, False: 4]
  ------------------
 5158|      4|        case SNMP_MSG_REPORT:
  ------------------
  |  |  147|      4|#define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   92|      4|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   96|      4|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (5158:9): [True: 4, False: 0]
  ------------------
 5159|      4|        case AGENTX_MSG_CLEANUPSET:
  ------------------
  |  |   45|      4|#define AGENTX_MSG_CLEANUPSET ((u_char)11)
  ------------------
  |  Branch (5159:9): [True: 0, False: 4]
  ------------------
 5160|      4|        case AGENTX_MSG_RESPONSE:
  ------------------
  |  |   52|      4|#define AGENTX_MSG_RESPONSE    ((u_char)18)
  ------------------
  |  Branch (5160:9): [True: 0, False: 4]
  ------------------
 5161|      4|            pdu->flags &= ~UCD_MSG_FLAG_EXPECT_RESPONSE;
  ------------------
  |  |  312|      4|#define UCD_MSG_FLAG_EXPECT_RESPONSE         0x200
  ------------------
 5162|      4|            break;
 5163|       |            
 5164|      0|        default:
  ------------------
  |  Branch (5164:9): [True: 0, False: 4]
  ------------------
 5165|      0|            pdu->flags |= UCD_MSG_FLAG_EXPECT_RESPONSE;
  ------------------
  |  |  312|      0|#define UCD_MSG_FLAG_EXPECT_RESPONSE         0x200
  ------------------
 5166|      0|            break;
 5167|      4|    }
 5168|       |
 5169|       |    /*
 5170|       |     * Check if we need to perform a v3 engineID probe. Call post probe hook to
 5171|       |     * create user from information in a session even if SNMP_FLAGS_DONT_PROBE
 5172|       |     * is set, as this may indicate that probe was already sent by other means
 5173|       |     * for example asynchronously.
 5174|       |     */
 5175|      4|    if ((pdu->version == SNMP_VERSION_3) &&
  ------------------
  |  |  113|      4|#define SNMP_VERSION_3     3
  ------------------
  |  Branch (5175:9): [True: 4, False: 0]
  ------------------
 5176|      4|        (pdu->flags & UCD_MSG_FLAG_EXPECT_RESPONSE)) {
  ------------------
  |  |  312|      4|#define UCD_MSG_FLAG_EXPECT_RESPONSE         0x200
  ------------------
  |  Branch (5176:9): [True: 0, False: 4]
  ------------------
 5177|      0|        int rc;
 5178|      0|        DEBUGMSGTL(("snmpv3_build", "delayed probe for engineID\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5179|      0|        rc = snmpv3_engineID_probe(slp, session);
 5180|      0|        if (rc == 0)
  ------------------
  |  Branch (5180:13): [True: 0, False: 0]
  ------------------
 5181|      0|            return 0; /* s_snmp_errno already set */
 5182|      0|    }
 5183|       |
 5184|       |    /*
 5185|       |     * determine max packet size
 5186|       |     */
 5187|      4|    if (pdu->msgMaxSize == 0) {
  ------------------
  |  Branch (5187:9): [True: 0, False: 4]
  ------------------
 5188|      0|        pdu->msgMaxSize = netsnmp_max_send_msg_size();
 5189|      0|        if (pdu->msgMaxSize > transport->msgMaxSize)
  ------------------
  |  Branch (5189:13): [True: 0, False: 0]
  ------------------
 5190|      0|            pdu->msgMaxSize = transport->msgMaxSize;
 5191|      0|        if (pdu->msgMaxSize > session->sndMsgMaxSize)
  ------------------
  |  Branch (5191:13): [True: 0, False: 0]
  ------------------
 5192|      0|            pdu->msgMaxSize = session->sndMsgMaxSize;
 5193|      0|        DEBUGMSGTL(("sess_async_send", "max PDU size: %ld\n",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5194|      0|                    pdu->msgMaxSize));
 5195|      0|    }
 5196|      4|    netsnmp_assert(pdu->msgMaxSize > 0);
  ------------------
  |  |   47|      4|#      define netsnmp_assert(x)  do { \
  |  |   48|      4|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 4, False: 0]
  |  |  ------------------
  |  |   49|      4|                 ; \
  |  |   50|      4|              else \
  |  |   51|      4|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      4|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 4]
  |  |  ------------------
  ------------------
 5197|       |
 5198|       |    /*
 5199|       |     * allocate initial packet buffer. Buffer will be grown as needed
 5200|       |     * while building the packet.
 5201|       |     */
 5202|      4|    pktbuf_len = SNMP_MIN_MAX_LEN;
  ------------------
  |  |   48|      4|#define SNMP_MIN_MAX_LEN    484 /* minimum maximum message size */
  ------------------
 5203|      4|    if ((pktbuf = (u_char *)malloc(pktbuf_len)) == NULL) {
  ------------------
  |  Branch (5203:9): [True: 0, False: 4]
  ------------------
 5204|      0|        DEBUGMSGTL(("sess_async_send",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5205|      0|                    "couldn't malloc initial packet buffer\n"));
 5206|      0|        session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 5207|      0|        return SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 5208|      0|    }
 5209|       |
 5210|       |#ifdef TEMPORARILY_DISABLED
 5211|       |    /*
 5212|       |     *  NULL variable are allowed in certain PDU types.
 5213|       |     *  In particular, SNMPv3 engineID probes are of this form.
 5214|       |     *  There is an internal PDU flag to indicate that this
 5215|       |     *    is acceptable, but until the construction of engineID
 5216|       |     *    probes can be amended to set this flag, we'll simply
 5217|       |     *    skip this test altogether.
 5218|       |     */
 5219|       |    if (pdu->variables == NULL) {
 5220|       |        switch (pdu->command) {
 5221|       |#ifndef NETSNMP_NO_WRITE_SUPPORT
 5222|       |        case SNMP_MSG_SET:
 5223|       |#endif /* !NETSNMP_NO_WRITE_SUPPORT */
 5224|       |        case SNMP_MSG_GET:
 5225|       |        case SNMP_MSG_GETNEXT:
 5226|       |        case SNMP_MSG_GETBULK:
 5227|       |        case SNMP_MSG_RESPONSE:
 5228|       |        case SNMP_MSG_TRAP2:
 5229|       |        case SNMP_MSG_REPORT:
 5230|       |        case SNMP_MSG_INFORM:
 5231|       |            session->s_snmp_errno = snmp_errno = SNMPERR_NO_VARS;
 5232|       |            return SNMPERR_NO_VARS;
 5233|       |        case SNMP_MSG_TRAP:
 5234|       |            break;
 5235|       |        }
 5236|       |    }
 5237|       |#endif
 5238|       |
 5239|       |
 5240|       |    /*
 5241|       |     * Build the message to send. If a bulk response is too big, switch to
 5242|       |     * forward encoding and set a flag to drop varbinds to make it fit.
 5243|       |     */
 5244|      4|    do {
 5245|      4|        packet = NULL;
 5246|      4|        length = 0;
 5247|      4|        result = netsnmp_build_packet(isp, session, pdu, &pktbuf, &pktbuf_len,
 5248|      4|                                      &packet, &length);
 5249|      4|        if (0 != result)
  ------------------
  |  Branch (5249:13): [True: 0, False: 4]
  ------------------
 5250|      0|            break;
 5251|       |
 5252|      4|        if (orig_count) { /* 2nd pass, see how many varbinds remain */
  ------------------
  |  Branch (5252:13): [True: 0, False: 4]
  ------------------
 5253|      0|            curr_count = count_varbinds(pdu->variables);
 5254|      0|            DEBUGMSGTL(("sess_async_send", " vb count: %d -> %d\n", orig_count,
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5255|      0|                        curr_count));
 5256|      0|            DEBUGMSGTL(("sess_async_send", " pdu_len: %" NETSNMP_PRIz "d -> %" NETSNMP_PRIz "d (max %ld)\n",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5257|      0|                        orig_length, length, pdu->msgMaxSize));
 5258|      0|        }
 5259|       |
 5260|       |        /** if length is less than max size, we're done (success). */
 5261|      4|        if (length <= pdu->msgMaxSize)
  ------------------
  |  Branch (5261:13): [True: 4, False: 0]
  ------------------
 5262|      4|            break;
 5263|       |
 5264|      0|        DEBUGMSGTL(("sess_async_send", "length %" NETSNMP_PRIz "d exceeds maximum %ld\n",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5265|      0|                    length, pdu->msgMaxSize));
 5266|       |
 5267|       |        /** packet too big. if this is not a bulk request, we're done (err). */
 5268|      0|        if (!bulk) {
  ------------------
  |  Branch (5268:13): [True: 0, False: 0]
  ------------------
 5269|      0|           session->s_snmp_errno = SNMPERR_TOO_LONG;
  ------------------
  |  |  222|      0|#define SNMPERR_TOO_LONG		(-5)
  ------------------
 5270|      0|           break;
 5271|      0|        }
 5272|       |
 5273|       |        /** rebuild bulk response with truncation and fixed size */
 5274|      0|        pdu->flags |= UCD_MSG_FLAG_FORWARD_ENCODE | UCD_MSG_FLAG_BULK_TOOBIG;
  ------------------
  |  |  319|      0|#define UCD_MSG_FLAG_FORWARD_ENCODE         0x8000
  ------------------
                      pdu->flags |= UCD_MSG_FLAG_FORWARD_ENCODE | UCD_MSG_FLAG_BULK_TOOBIG;
  ------------------
  |  |  321|      0|#define UCD_MSG_FLAG_BULK_TOOBIG          0x010000
  ------------------
 5275|      0|        pktbuf_len = pdu->msgMaxSize;
 5276|       |
 5277|       |        /** save original number of varbinds & length */
 5278|      0|        if (0 == orig_count) {
  ------------------
  |  Branch (5278:13): [True: 0, False: 0]
  ------------------
 5279|      0|            curr_count = orig_count = count_varbinds(pdu->variables);
 5280|      0|            orig_length = length;
 5281|      0|        }
 5282|       |
 5283|      0|    } while(1);
  ------------------
  |  Branch (5283:13): [True: 0, Folded]
  ------------------
 5284|       |
 5285|      4|    DEBUGMSGTL(("sess_async_send",
  ------------------
  |  |   66|      4|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 4]
  |  |  ------------------
  ------------------
 5286|      4|                "final pktbuf_len after building packet %" NETSNMP_PRIz "u\n",
 5287|      4|                pktbuf_len));
 5288|      4|    if (curr_count != orig_count)
  ------------------
  |  Branch (5288:9): [True: 0, False: 4]
  ------------------
 5289|      0|        DEBUGMSGTL(("sess_async_send",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5290|      4|                    "sending %d of %d varbinds (-%d) from bulk response\n",
 5291|      4|                    curr_count, orig_count, orig_count - curr_count));
 5292|       |
 5293|      4|    if (length > pdu->msgMaxSize) {
  ------------------
  |  Branch (5293:9): [True: 0, False: 4]
  ------------------
 5294|      0|        DEBUGMSGTL(("sess_async_send",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5295|      0|                    "length of packet (%" NETSNMP_PRIz "u) exceeded pdu maximum (%lu)\n",
 5296|      0|                    length, pdu->msgMaxSize));
 5297|      0|        netsnmp_assert(SNMPERR_TOO_LONG == session->s_snmp_errno);
  ------------------
  |  |   47|      0|#      define netsnmp_assert(x)  do { \
  |  |   48|      0|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 0, False: 0]
  |  |  ------------------
  |  |   49|      0|                 ; \
  |  |   50|      0|              else \
  |  |   51|      0|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5298|      0|    }
 5299|       |
 5300|      4|    if ((SNMPERR_TOO_LONG == session->s_snmp_errno) || (result < 0)) {
  ------------------
  |  |  222|      4|#define SNMPERR_TOO_LONG		(-5)
  ------------------
  |  Branch (5300:9): [True: 0, False: 4]
  |  Branch (5300:56): [True: 0, False: 4]
  ------------------
 5301|      0|        DEBUGMSGTL(("sess_async_send", "encoding failure\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5302|      0|        SNMP_FREE(pktbuf);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5303|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 5304|      0|    }
 5305|       |
 5306|      4|    isp->obuf = pktbuf;
 5307|      4|    isp->obuf_size = pktbuf_len;
 5308|      4|    isp->opacket = packet;
 5309|      4|    isp->opacket_len = length;
 5310|       |
 5311|      4|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|      4|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 5312|      4|}
snmp_sess_send:
 5344|      4|{
 5345|      4|    return snmp_sess_async_send(slp, pdu, NULL, NULL);
 5346|      4|}
snmp_sess_async_send:
 5547|      4|{
 5548|      4|    int             rc;
 5549|       |
 5550|      4|    if (slp == NULL) {
  ------------------
  |  Branch (5550:9): [True: 0, False: 4]
  ------------------
 5551|      0|        snmp_errno = SNMPERR_BAD_SESSION;       /*MTCRITICAL_RESOURCE */
  ------------------
  |  |  221|      0|#define SNMPERR_BAD_SESSION		(-4)
  ------------------
 5552|      0|        return (0);
 5553|      0|    }
 5554|       |    /*
 5555|       |     * send pdu
 5556|       |     */
 5557|      4|    rc = _sess_async_send(slp, pdu, callback, cb_data);
 5558|      4|    if (rc == 0)
  ------------------
  |  Branch (5558:9): [True: 0, False: 4]
  ------------------
 5559|      0|        SET_SNMP_ERROR(slp->session->s_snmp_errno);
  ------------------
  |  |   56|      0|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 5560|      4|    return rc;
 5561|      4|}
snmp_free_var_internals:
 5569|      4|{
 5570|      4|    if (!var)
  ------------------
  |  Branch (5570:9): [True: 0, False: 4]
  ------------------
 5571|      0|        return;
 5572|       |
 5573|      4|    if (var->name != var->name_loc)
  ------------------
  |  Branch (5573:9): [True: 0, False: 4]
  ------------------
 5574|      0|        SNMP_FREE(var->name);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5575|      4|    if (var->val.string != var->buf)
  ------------------
  |  Branch (5575:9): [True: 0, False: 4]
  ------------------
 5576|      0|        SNMP_FREE(var->val.string);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5577|      4|    if (var->data) {
  ------------------
  |  Branch (5577:9): [True: 0, False: 4]
  ------------------
 5578|      0|        if (var->dataFreeHook) {
  ------------------
  |  Branch (5578:13): [True: 0, False: 0]
  ------------------
 5579|      0|            var->dataFreeHook(var->data);
 5580|      0|            var->data = NULL;
 5581|      0|        } else {
 5582|       |            SNMP_FREE(var->data);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5583|      0|        }
 5584|      0|    }
 5585|      4|}
snmp_free_var:
 5589|      4|{
 5590|      4|    snmp_free_var_internals(var);
 5591|      4|    free(var);
 5592|      4|}
snmp_free_varbind:
 5596|     76|{
 5597|     76|    netsnmp_variable_list *ptr;
 5598|     80|    while (var) {
  ------------------
  |  Branch (5598:12): [True: 4, False: 76]
  ------------------
 5599|      4|        ptr = var->next_variable;
 5600|      4|        snmp_free_var(var);
 5601|      4|        var = ptr;
 5602|      4|    }
 5603|     76|}
snmp_free_pdu:
 5610|     72|{
 5611|     72|    struct snmp_secmod_def *sptr;
 5612|       |
 5613|     72|    if (!pdu)
  ------------------
  |  Branch (5613:9): [True: 0, False: 72]
  ------------------
 5614|      0|        return;
 5615|       |
 5616|     72|    free_securityStateRef(pdu);
 5617|       |
 5618|     72|    sptr = find_sec_mod(pdu->securityModel);
 5619|     72|    if (sptr && sptr->pdu_free)
  ------------------
  |  Branch (5619:9): [True: 8, False: 64]
  |  Branch (5619:17): [True: 0, False: 8]
  ------------------
 5620|      0|        (*sptr->pdu_free)(pdu);
 5621|       |
 5622|     72|    snmp_free_varbind(pdu->variables);
 5623|     72|    free(pdu->enterprise);
 5624|     72|    free(pdu->community);
 5625|     72|    free(pdu->contextEngineID);
 5626|     72|    free(pdu->securityEngineID);
 5627|     72|    free(pdu->contextName);
 5628|     72|    free(pdu->securityName);
 5629|     72|    free(pdu->transport_data);
 5630|     72|    free(pdu);
 5631|     72|}
snmp_create_sess_pdu:
 5636|     68|{
 5637|     68|    netsnmp_pdu *pdu = calloc(1, sizeof(netsnmp_pdu));
 5638|     68|    if (pdu == NULL) {
  ------------------
  |  Branch (5638:9): [True: 0, False: 68]
  ------------------
 5639|      0|        DEBUGMSGTL(("sess_process_packet", "can't malloc space for PDU\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5640|      0|        return NULL;
 5641|      0|    }
 5642|       |
 5643|       |    /*
 5644|       |     * Save the transport-level data specific to this reception (e.g. UDP
 5645|       |     * source address).  
 5646|       |     */
 5647|       |
 5648|     68|    pdu->transport_data = opaque;
 5649|     68|    pdu->transport_data_length = olength;
 5650|     68|    pdu->tDomain = transport->domain;
 5651|     68|    pdu->tDomainLen = transport->domain_length;
 5652|     68|    return pdu;
 5653|     68|}
snmp_read:
 6025|     68|{
 6026|     68|    netsnmp_large_fd_set lfdset;
 6027|       |
 6028|       |    netsnmp_large_fd_set_init(&lfdset, FD_SETSIZE);
 6029|     68|    netsnmp_copy_fd_set_to_large_fd_set(&lfdset, fdset);
 6030|     68|    snmp_read2(&lfdset);
 6031|     68|    netsnmp_large_fd_set_cleanup(&lfdset);
 6032|     68|}
snmp_read2:
 6036|     68|{
 6037|     68|    struct session_list *slp;
 6038|     68|    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   79|     68|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded, False: 68]
  |  |  ------------------
  ------------------
 6039|    136|    for (slp = Sessions; slp; slp = slp->next) {
  ------------------
  |  Branch (6039:26): [True: 68, False: 68]
  ------------------
 6040|     68|        snmp_sess_read2(slp, fdset);
 6041|     68|    }
 6042|     68|    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   80|     68|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded, False: 68]
  |  |  ------------------
  ------------------
 6043|     68|}
_sess_read:
 6202|     68|{
 6203|     68|    netsnmp_session *sp = slp ? slp->session : NULL;
  ------------------
  |  Branch (6203:27): [True: 68, False: 0]
  ------------------
 6204|     68|    struct snmp_internal_session *isp = slp ? slp->internal : NULL;
  ------------------
  |  Branch (6204:41): [True: 68, False: 0]
  ------------------
 6205|     68|    netsnmp_transport *transport = slp ? slp->transport : NULL;
  ------------------
  |  Branch (6205:36): [True: 68, False: 0]
  ------------------
 6206|     68|    size_t          pdulen = 0, rxbuf_len = SNMP_MAX_RCV_MSG_SIZE;
  ------------------
  |  |  141|     68|#define SNMP_MAX_RCV_MSG_SIZE      65536
  ------------------
 6207|     68|    u_char         *rxbuf = NULL;
 6208|     68|    int             length = 0, olength = 0, rc = 0;
 6209|     68|    void           *opaque = NULL;
 6210|       |
 6211|     68|    if (NULL == slp || NULL == sp || NULL == isp || NULL == transport) {
  ------------------
  |  Branch (6211:9): [True: 0, False: 68]
  |  Branch (6211:24): [True: 0, False: 68]
  |  Branch (6211:38): [True: 0, False: 68]
  |  Branch (6211:53): [True: 0, False: 68]
  ------------------
 6212|      0|        snmp_log(LOG_ERR, "bad parameters to _sess_read\n");
 6213|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 6214|      0|    }
 6215|       |
 6216|       |    /* to avoid subagent crash */ 
 6217|     68|    if (transport->sock < 0) { 
  ------------------
  |  Branch (6217:9): [True: 0, False: 68]
  ------------------
 6218|      0|        snmp_log (LOG_INFO, "transport->sock got negative fd value %d\n",
 6219|      0|                  transport->sock);
 6220|      0|        return 0; 
 6221|      0|    }
 6222|       |
 6223|     68|    if (!fdset || !(NETSNMP_LARGE_FD_ISSET(transport->sock, fdset))) {
  ------------------
  |  |   50|     68|                    netsnmp_large_fd_is_set(fd, fdset)
  ------------------
  |  Branch (6223:9): [True: 0, False: 68]
  |  Branch (6223:19): [True: 0, False: 68]
  ------------------
 6224|      0|        DEBUGMSGTL(("sess_read", "not reading %d (fdset %p set %d)\n",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6225|      0|                    transport->sock, fdset,
 6226|      0|                    fdset ? NETSNMP_LARGE_FD_ISSET(transport->sock, fdset)
 6227|      0|		    : -9));
 6228|      0|        return 0;
 6229|      0|    }
 6230|       |
 6231|     68|    sp->s_snmp_errno = 0;
 6232|     68|    sp->s_errno = 0;
 6233|       |
 6234|     68|    if (transport->flags & NETSNMP_TRANSPORT_FLAG_LISTEN)
  ------------------
  |  |   52|     68|#define		NETSNMP_TRANSPORT_FLAG_LISTEN	 0x02
  ------------------
  |  Branch (6234:9): [True: 0, False: 68]
  ------------------
 6235|      0|        return _sess_read_accept(slp);
 6236|       |
 6237|     68|    if (!(transport->flags & NETSNMP_TRANSPORT_FLAG_STREAM)) {
  ------------------
  |  |   51|     68|#define		NETSNMP_TRANSPORT_FLAG_STREAM	 0x01
  ------------------
  |  Branch (6237:9): [True: 68, False: 0]
  ------------------
 6238|     68|        snmp_rcv_packet rcvp;
 6239|     68|        memset(&rcvp, 0x0, sizeof(rcvp));
 6240|       |
 6241|       |        /** read the packet */
 6242|     68|        rc = _sess_read_dgram_packet(slp, fdset, &rcvp);
 6243|     68|        if (-1 == rc) /* protocol error */
  ------------------
  |  Branch (6243:13): [True: 0, False: 68]
  ------------------
 6244|      0|            return -1;
 6245|     68|        else if (-2 == rc) /* no packet to process */
  ------------------
  |  Branch (6245:18): [True: 0, False: 68]
  ------------------
 6246|      0|            return 0;
 6247|       |
 6248|     68|        rc = _sess_process_packet(slp, sp, isp, transport,
 6249|     68|                                  rcvp.opaque, rcvp.olength,
 6250|     68|                                  rcvp.packet, rcvp.packet_len);
 6251|     68|        SNMP_FREE(rcvp.packet);
  ------------------
  |  |   62|     68|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 68, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 68]
  |  |  ------------------
  ------------------
 6252|       |        /** opaque is freed in _sess_process_packet */
 6253|     68|        return rc;
 6254|     68|    }
 6255|       |
 6256|       |    /** stream transport */
 6257|       |
 6258|      0|        if (isp->packet == NULL) {
  ------------------
  |  Branch (6258:13): [True: 0, False: 0]
  ------------------
 6259|       |            /*
 6260|       |             * We have no saved packet.  Allocate one.  
 6261|       |             */
 6262|      0|            if ((isp->packet = (u_char *) malloc(rxbuf_len)) == NULL) {
  ------------------
  |  Branch (6262:17): [True: 0, False: 0]
  ------------------
 6263|      0|                DEBUGMSGTL(("sess_read", "can't malloc %" NETSNMP_PRIz
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6264|      0|                            "u bytes for rxbuf\n", rxbuf_len));
 6265|      0|                return 0;
 6266|      0|            } else {
 6267|      0|                rxbuf = isp->packet;
 6268|      0|                isp->packet_size = rxbuf_len;
 6269|      0|                isp->packet_len = 0;
 6270|      0|            }
 6271|      0|        } else {
 6272|       |            /*
 6273|       |             * We have saved a partial packet from last time.  Extend that, if
 6274|       |             * necessary, and receive new data after the old data.  
 6275|       |             */
 6276|      0|            u_char         *newbuf;
 6277|       |
 6278|      0|            if (isp->packet_size < isp->packet_len + rxbuf_len) {
  ------------------
  |  Branch (6278:17): [True: 0, False: 0]
  ------------------
 6279|      0|                newbuf =
 6280|      0|                    (u_char *) realloc(isp->packet,
 6281|      0|                                       isp->packet_len + rxbuf_len);
 6282|      0|                if (newbuf == NULL) {
  ------------------
  |  Branch (6282:21): [True: 0, False: 0]
  ------------------
 6283|      0|                    DEBUGMSGTL(("sess_read",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6284|      0|                                "can't malloc %" NETSNMP_PRIz
 6285|      0|                                "u more for rxbuf (%" NETSNMP_PRIz "u tot)\n",
 6286|      0|                                rxbuf_len, isp->packet_len + rxbuf_len));
 6287|      0|                    return 0;
 6288|      0|                } else {
 6289|      0|                    isp->packet = newbuf;
 6290|      0|                    isp->packet_size = isp->packet_len + rxbuf_len;
 6291|      0|                    rxbuf = isp->packet + isp->packet_len;
 6292|      0|                }
 6293|      0|            } else {
 6294|      0|                rxbuf = isp->packet + isp->packet_len;
 6295|      0|                rxbuf_len = isp->packet_size - isp->packet_len;
 6296|      0|            }
 6297|      0|        }
 6298|       |
 6299|      0|    length = netsnmp_transport_recv(transport, rxbuf, rxbuf_len, &opaque,
 6300|      0|                                    &olength);
 6301|       |
 6302|      0|    if (0 == length && transport->flags & NETSNMP_TRANSPORT_FLAG_EMPTY_PKT) {
  ------------------
  |  |   56|      0|#define		NETSNMP_TRANSPORT_FLAG_EMPTY_PKT 0x10
  ------------------
  |  Branch (6302:9): [True: 0, False: 0]
  |  Branch (6302:24): [True: 0, False: 0]
  ------------------
 6303|       |        /* this allows for a transport that needs to return from
 6304|       |         * packet processing that doesn't necessarily have any
 6305|       |         * consumable data in it. */
 6306|       |
 6307|       |        /* reset the flag since it's a per-message flag */
 6308|      0|        transport->flags &= (~NETSNMP_TRANSPORT_FLAG_EMPTY_PKT);
  ------------------
  |  |   56|      0|#define		NETSNMP_TRANSPORT_FLAG_EMPTY_PKT 0x10
  ------------------
 6309|       |
 6310|      0|        return 0;
 6311|      0|    }
 6312|       |
 6313|       |    /*
 6314|       |     * Remote end closed connection.  
 6315|       |     */
 6316|      0|    if (length <= 0) {
  ------------------
  |  Branch (6316:9): [True: 0, False: 0]
  ------------------
 6317|       |        /*
 6318|       |         * Alert the application if possible.  
 6319|       |         */
 6320|      0|        if (sp->callback != NULL) {
  ------------------
  |  Branch (6320:13): [True: 0, False: 0]
  ------------------
 6321|      0|            DEBUGMSGTL(("sess_read", "perform callback with op=DISCONNECT\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6322|      0|            (void) sp->callback(NETSNMP_CALLBACK_OP_DISCONNECT, sp, 0,
  ------------------
  |  |  356|      0|#define NETSNMP_CALLBACK_OP_DISCONNECT		5
  ------------------
 6323|      0|                                NULL, sp->callback_magic);
 6324|      0|        }
 6325|       |        /*
 6326|       |         * Close socket and mark session for deletion.  
 6327|       |         */
 6328|      0|        DEBUGMSGTL(("sess_read", "fd %d closed\n", transport->sock));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6329|      0|        transport->f_close(transport);
 6330|      0|        SNMP_FREE(isp->packet);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6331|      0|        SNMP_FREE(opaque);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6332|      0|        return -1;
 6333|      0|    }
 6334|       |
 6335|      0|    {
 6336|      0|        u_char *pptr = isp->packet;
 6337|      0|	void *ocopy = NULL;
 6338|       |
 6339|      0|        isp->packet_len += length;
 6340|       |
 6341|      0|        while (isp->packet_len > 0) {
  ------------------
  |  Branch (6341:16): [True: 0, False: 0]
  ------------------
 6342|       |
 6343|       |            /*
 6344|       |             * Get the total data length we're expecting (and need to wait
 6345|       |             * for).
 6346|       |             */
 6347|      0|            if (isp->check_packet) {
  ------------------
  |  Branch (6347:17): [True: 0, False: 0]
  ------------------
 6348|      0|                pdulen = isp->check_packet(pptr, isp->packet_len);
 6349|      0|            } else {
 6350|      0|                pdulen = asn_check_packet(pptr, isp->packet_len);
 6351|      0|            }
 6352|       |
 6353|      0|            DEBUGMSGTL(("sess_read",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6354|      0|                        "  loop packet_len %" NETSNMP_PRIz "u, PDU length %"
 6355|      0|                        NETSNMP_PRIz "u\n", isp->packet_len, pdulen));
 6356|       |
 6357|      0|            if (pdulen > SNMP_MAX_PACKET_LEN) {
  ------------------
  |  |   49|      0|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  |  Branch (6357:17): [True: 0, False: 0]
  ------------------
 6358|       |                /*
 6359|       |                 * Illegal length, drop the connection.  
 6360|       |                 */
 6361|      0|                snmp_log(LOG_ERR, 
 6362|      0|			 "Received broken packet. Closing session.\n");
 6363|      0|		if (sp->callback != NULL) {
  ------------------
  |  Branch (6363:7): [True: 0, False: 0]
  ------------------
 6364|      0|		  DEBUGMSGTL(("sess_read",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6365|      0|			      "perform callback with op=DISCONNECT\n"));
 6366|      0|		  (void)sp->callback(NETSNMP_CALLBACK_OP_DISCONNECT,
  ------------------
  |  |  356|      0|#define NETSNMP_CALLBACK_OP_DISCONNECT		5
  ------------------
 6367|      0|				     sp, 0, NULL, sp->callback_magic);
 6368|      0|		}
 6369|      0|		DEBUGMSGTL(("sess_read", "fd %d closed\n", transport->sock));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6370|      0|                transport->f_close(transport);
 6371|      0|                SNMP_FREE(opaque);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6372|       |                /** XXX-rks: why no SNMP_FREE(isp->packet); ?? */
 6373|      0|                return -1;
 6374|      0|            }
 6375|       |
 6376|      0|            if (pdulen > isp->packet_len || pdulen == 0) {
  ------------------
  |  Branch (6376:17): [True: 0, False: 0]
  |  Branch (6376:45): [True: 0, False: 0]
  ------------------
 6377|       |                /*
 6378|       |                 * We don't have a complete packet yet.  If we've already
 6379|       |                 * processed a packet, break out so we'll shift this packet
 6380|       |                 * to the start of the buffer. If we're already at the
 6381|       |                 * start, simply return and wait for more data to arrive.
 6382|       |                 */
 6383|      0|                DEBUGMSGTL(("sess_read",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6384|      0|                            "pkt not complete (need %" NETSNMP_PRIz "u got %"
 6385|      0|                            NETSNMP_PRIz "u so far)\n", pdulen,
 6386|      0|                            isp->packet_len));
 6387|       |
 6388|      0|                if (pptr != isp->packet)
  ------------------
  |  Branch (6388:21): [True: 0, False: 0]
  ------------------
 6389|      0|                    break; /* opaque freed for us outside of loop. */
 6390|       |
 6391|      0|                SNMP_FREE(opaque);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6392|      0|                return 0;
 6393|      0|            }
 6394|       |
 6395|       |            /*  We have *at least* one complete packet in the buffer now.  If
 6396|       |		we have possibly more than one packet, we must copy the opaque
 6397|       |		pointer because we may need to reuse it for a later packet.  */
 6398|       |
 6399|      0|	    if (pdulen < isp->packet_len) {
  ------------------
  |  Branch (6399:10): [True: 0, False: 0]
  ------------------
 6400|      0|		if (olength > 0 && opaque != NULL) {
  ------------------
  |  Branch (6400:7): [True: 0, False: 0]
  |  Branch (6400:22): [True: 0, False: 0]
  ------------------
 6401|      0|		    ocopy = malloc(olength);
 6402|      0|		    if (ocopy != NULL) {
  ------------------
  |  Branch (6402:11): [True: 0, False: 0]
  ------------------
 6403|      0|			memcpy(ocopy, opaque, olength);
 6404|      0|		    }
 6405|      0|		}
 6406|      0|	    } else if (pdulen == isp->packet_len) {
  ------------------
  |  Branch (6406:17): [True: 0, False: 0]
  ------------------
 6407|       |		/*  Common case -- exactly one packet.  No need to copy the
 6408|       |		    opaque pointer.  */
 6409|      0|		ocopy = opaque;
 6410|      0|		opaque = NULL;
 6411|      0|	    }
 6412|       |
 6413|      0|            if ((rc = _sess_process_packet(slp, sp, isp, transport,
  ------------------
  |  Branch (6413:17): [True: 0, False: 0]
  ------------------
 6414|      0|                                           ocopy, ocopy?olength:0, pptr,
  ------------------
  |  Branch (6414:51): [True: 0, False: 0]
  ------------------
 6415|      0|                                           pdulen))) {
 6416|       |                /*
 6417|       |                 * Something went wrong while processing this packet -- set the
 6418|       |                 * errno.  
 6419|       |                 */
 6420|      0|                if (sp->s_snmp_errno != 0) {
  ------------------
  |  Branch (6420:21): [True: 0, False: 0]
  ------------------
 6421|      0|                    SET_SNMP_ERROR(sp->s_snmp_errno);
  ------------------
  |  |   56|      0|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 6422|      0|                }
 6423|      0|            }
 6424|       |
 6425|       |	    /*  ocopy has been free()d by _sess_process_packet by this point,
 6426|       |		so set it to NULL.  */
 6427|       |
 6428|      0|	    ocopy = NULL;
 6429|       |
 6430|       |	    /*  Step past the packet we've just dealt with.  */
 6431|       |
 6432|      0|            pptr += pdulen;
 6433|      0|            isp->packet_len -= pdulen;
 6434|      0|        }
 6435|       |
 6436|       |	/*  If we had more than one packet, then we were working with copies
 6437|       |	    of the opaque pointer, so we still need to free() the opaque
 6438|       |	    pointer itself.  */
 6439|       |
 6440|      0|	SNMP_FREE(opaque);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6441|       |
 6442|      0|        if (isp->packet_len >= SNMP_MAX_PACKET_LEN) {
  ------------------
  |  |   49|      0|#define SNMP_MAX_PACKET_LEN (0x7fffffff)
  ------------------
  |  Branch (6442:13): [True: 0, False: 0]
  ------------------
 6443|       |            /*
 6444|       |             * Obviously this should never happen!  
 6445|       |             */
 6446|      0|            snmp_log(LOG_ERR,
 6447|      0|                     "too large packet_len = %" NETSNMP_PRIz
 6448|      0|                     "u, dropping connection %d\n",
 6449|      0|                     isp->packet_len, transport->sock);
 6450|      0|            transport->f_close(transport);
 6451|       |            /** XXX-rks: why no SNMP_FREE(isp->packet); ?? */
 6452|      0|            return -1;
 6453|      0|        } else if (isp->packet_len == 0) {
  ------------------
  |  Branch (6453:20): [True: 0, False: 0]
  ------------------
 6454|       |            /*
 6455|       |             * This is good: it means the packet buffer contained an integral
 6456|       |             * number of PDUs, so we don't have to save any data for next
 6457|       |             * time.  We can free() the buffer now to keep the memory
 6458|       |             * footprint down.
 6459|       |             */
 6460|      0|            SNMP_FREE(isp->packet);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6461|      0|            isp->packet_size = 0;
 6462|      0|            isp->packet_len = 0;
 6463|      0|            return rc;
 6464|      0|        }
 6465|       |
 6466|       |        /*
 6467|       |         * If we get here, then there is a partial packet of length
 6468|       |         * isp->packet_len bytes starting at pptr left over.  Move that to the
 6469|       |         * start of the buffer, and then realloc() the buffer down to size to
 6470|       |         * reduce the memory footprint.  
 6471|       |         */
 6472|       |
 6473|      0|        memmove(isp->packet, pptr, isp->packet_len);
 6474|      0|        DEBUGMSGTL(("sess_read",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6475|      0|                    "end: memmove(%p, %p, %" NETSNMP_PRIz "u); realloc(%p, %"
 6476|      0|                    NETSNMP_PRIz "u)\n",
 6477|      0|                    isp->packet, pptr, isp->packet_len,
 6478|      0|		    isp->packet, isp->packet_len));
 6479|       |
 6480|      0|        if ((rxbuf = (u_char *)realloc(isp->packet, isp->packet_len)) == NULL) {
  ------------------
  |  Branch (6480:13): [True: 0, False: 0]
  ------------------
 6481|       |            /*
 6482|       |             * I don't see why this should ever fail, but it's not a big deal.
 6483|       |             */
 6484|      0|            DEBUGMSGTL(("sess_read", "realloc() failed\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6485|      0|        } else {
 6486|      0|            DEBUGMSGTL(("sess_read", "realloc() okay, old buffer %p, new %p\n",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6487|      0|                        isp->packet, rxbuf));
 6488|      0|            isp->packet = rxbuf;
 6489|      0|            isp->packet_size = isp->packet_len;
 6490|      0|        }
 6491|      0|    }
 6492|       |
 6493|      0|    return rc;
 6494|      0|}
snmp_sess_read2:
 6516|     68|{
 6517|     68|    netsnmp_session *pss;
 6518|     68|    int             rc;
 6519|       |
 6520|     68|    rc = _sess_read(slp, fdset);
 6521|     68|    pss = slp->session;
 6522|     68|    if (rc && pss->s_snmp_errno) {
  ------------------
  |  Branch (6522:9): [True: 68, False: 0]
  |  Branch (6522:15): [True: 68, False: 0]
  ------------------
 6523|     68|        SET_SNMP_ERROR(pss->s_snmp_errno);
  ------------------
  |  |   56|     68|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 6524|     68|    }
 6525|     68|    return rc;
 6526|     68|}
snmp_select_info:
 6556|     68|{
 6557|       |    return snmp_sess_select_info(NULL, numfds, fdset, timeout, block);
 6558|     68|}
snmp_sess_select_info:
 6576|     68|{
 6577|     68|    return snmp_sess_select_info_flags(slp, numfds, fdset, timeout, block,
 6578|     68|                                       NETSNMP_SELECT_NOFLAGS);
  ------------------
  |  |  170|     68|#define NETSNMP_SELECT_NOFLAGS  0x00
  ------------------
 6579|     68|}
snmp_sess_select_info_flags:
 6587|     68|{
 6588|     68|  int rc;
 6589|     68|  netsnmp_large_fd_set lfdset;
 6590|       |
 6591|     68|  netsnmp_large_fd_set_init(&lfdset, FD_SETSIZE);
 6592|     68|  netsnmp_copy_fd_set_to_large_fd_set(&lfdset, fdset);
 6593|     68|  rc = snmp_sess_select_info2_flags(slp, numfds, &lfdset, timeout,
 6594|     68|                                    block, flags);
 6595|     68|  if (netsnmp_copy_large_fd_set_to_fd_set(fdset, &lfdset) < 0) {
  ------------------
  |  Branch (6595:7): [True: 0, False: 68]
  ------------------
 6596|       |      snmp_log(LOG_ERR,
 6597|      0|	     "Use snmp_sess_select_info2() for processing"
 6598|      0|	     " large file descriptors\n");
 6599|      0|  }
 6600|     68|  netsnmp_large_fd_set_cleanup(&lfdset);
 6601|     68|  return rc;
 6602|     68|}
snmp_sess_select_info2_flags:
 6646|     68|{
 6647|     68|    struct session_list *slp, *next = NULL;
 6648|     68|    netsnmp_request_list *rp;
 6649|     68|    struct timeval  now, earliest, alarm_tm;
 6650|     68|    int             active = 0, requests = 0;
 6651|     68|    int             next_alarm = 0;
 6652|       |
 6653|     68|    timerclear(&earliest);
 6654|       |
 6655|       |    /*
 6656|       |     * For each session examined, add its socket to the fdset,
 6657|       |     * and if it is the earliest timeout to expire, mark it as lowest.
 6658|       |     * If a single session is specified, do just for that session.
 6659|       |     */
 6660|       |
 6661|     68|    DEBUGMSGTL(("sess_select", "for %s session%s: ",
  ------------------
  |  |   66|     68|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     68|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 68]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 68]
  |  |  ------------------
  ------------------
 6662|     68|                sessp ? "single" : "all", sessp ? "" : "s"));
 6663|       |
 6664|    136|    for (slp = sessp ? sessp : Sessions; slp; slp = next) {
  ------------------
  |  Branch (6664:16): [True: 0, False: 68]
  |  Branch (6664:42): [True: 68, False: 68]
  ------------------
 6665|     68|        next = slp->next;
 6666|       |
 6667|     68|        if (slp->transport == NULL) {
  ------------------
  |  Branch (6667:13): [True: 0, False: 68]
  ------------------
 6668|       |            /*
 6669|       |             * Close in progress -- skip this one.  
 6670|       |             */
 6671|      0|            DEBUGMSG(("sess_select", "skip "));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6672|      0|            continue;
 6673|      0|        }
 6674|       |
 6675|     68|        if (slp->transport->sock == -1) {
  ------------------
  |  Branch (6675:13): [True: 0, False: 68]
  ------------------
 6676|       |            /*
 6677|       |             * This session was marked for deletion.  
 6678|       |             */
 6679|      0|            DEBUGMSG(("sess_select", "delete\n"));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6680|      0|            if (sessp == NULL) {
  ------------------
  |  Branch (6680:17): [True: 0, False: 0]
  ------------------
 6681|      0|                snmp_close(slp->session);
 6682|      0|            } else {
 6683|      0|                snmp_sess_close(slp);
 6684|      0|            }
 6685|      0|            DEBUGMSGTL(("sess_select", "for %s session%s: ",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6686|      0|                        sessp ? "single" : "all", sessp ? "" : "s"));
 6687|      0|            continue;
 6688|      0|        }
 6689|       |
 6690|     68|        DEBUGMSG(("sess_select", "%d ", slp->transport->sock));
  ------------------
  |  |   61|     68|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     68|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 68]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 68]
  |  |  ------------------
  ------------------
 6691|     68|        if ((slp->transport->sock + 1) > *numfds) {
  ------------------
  |  Branch (6691:13): [True: 68, False: 0]
  ------------------
 6692|     68|            *numfds = (slp->transport->sock + 1);
 6693|     68|        }
 6694|       |
 6695|     68|        NETSNMP_LARGE_FD_SET(slp->transport->sock, fdset);
  ------------------
  |  |   35|     68|                    netsnmp_large_fd_setfd(fd, fdset)
  ------------------
 6696|     68|        if (slp->internal != NULL && slp->internal->requests) {
  ------------------
  |  Branch (6696:13): [True: 68, False: 0]
  |  Branch (6696:38): [True: 0, False: 68]
  ------------------
 6697|       |            /*
 6698|       |             * Found another session with outstanding requests.  
 6699|       |             */
 6700|      0|            requests++;
 6701|      0|            for (rp = slp->internal->requests; rp; rp = rp->next_request) {
  ------------------
  |  Branch (6701:48): [True: 0, False: 0]
  ------------------
 6702|      0|                if (!timerisset(&earliest)
  ------------------
  |  Branch (6702:21): [True: 0, False: 0]
  ------------------
 6703|      0|                    || (timerisset(&rp->expireM)
  ------------------
  |  Branch (6703:25): [True: 0, False: 0]
  ------------------
 6704|      0|                        && timercmp(&rp->expireM, &earliest, <))) {
  ------------------
  |  Branch (6704:28): [True: 0, False: 0]
  |  Branch (6704:28): [True: 0, False: 0]
  ------------------
 6705|      0|                    earliest = rp->expireM;
 6706|      0|                    DEBUGMSG(("verbose:sess_select","(to in %d.%06d sec) ",
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6707|      0|                               (int)earliest.tv_sec, (int)earliest.tv_usec));
 6708|      0|                }
 6709|      0|            }
 6710|      0|        }
 6711|       |
 6712|     68|        active++;
 6713|     68|        if (sessp) {
  ------------------
  |  Branch (6713:13): [True: 0, False: 68]
  ------------------
 6714|       |            /*
 6715|       |             * Single session processing.  
 6716|       |             */
 6717|      0|            break;
 6718|      0|        }
 6719|     68|    }
 6720|     68|    DEBUGMSG(("sess_select", "\n"));
  ------------------
  |  |   61|     68|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     68|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 68]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 68]
  |  |  ------------------
  ------------------
 6721|       |
 6722|     68|    netsnmp_get_monotonic_clock(&now);
 6723|       |
 6724|     68|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     68|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (6724:9): [True: 0, False: 68]
  ------------------
 6725|     68|                               NETSNMP_DS_LIB_ALARM_DONT_USE_SIG) &&
  ------------------
  |  |   71|     68|#define NETSNMP_DS_LIB_ALARM_DONT_USE_SIG  11   /* don't use the alarm() signal */
  ------------------
 6726|      0|        !(flags & NETSNMP_SELECT_NOALARMS)) {
  ------------------
  |  |  171|      0|#define NETSNMP_SELECT_NOALARMS 0x01
  ------------------
  |  Branch (6726:9): [True: 0, False: 0]
  ------------------
 6727|      0|        next_alarm = netsnmp_get_next_alarm_time(&alarm_tm, &now);
 6728|      0|        if (next_alarm)
  ------------------
  |  Branch (6728:13): [True: 0, False: 0]
  ------------------
 6729|      0|            DEBUGMSGT(("sess_select","next alarm at %ld.%06ld sec\n",
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6730|      0|                       (long)alarm_tm.tv_sec, (long)alarm_tm.tv_usec));
 6731|      0|    }
 6732|     68|    if (next_alarm == 0 && requests == 0) {
  ------------------
  |  Branch (6732:9): [True: 68, False: 0]
  |  Branch (6732:28): [True: 68, False: 0]
  ------------------
 6733|       |        /*
 6734|       |         * If none are active, skip arithmetic.  
 6735|       |         */
 6736|     68|        DEBUGMSGT(("sess_select","blocking:no session requests or alarms.\n"));
  ------------------
  |  |   62|     68|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     68|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 68]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 68]
  |  |  ------------------
  ------------------
 6737|     68|        *block = 1; /* can block - timeout value is undefined if no requests */
 6738|     68|        return active;
 6739|     68|    }
 6740|       |
 6741|      0|    if (next_alarm &&
  ------------------
  |  Branch (6741:9): [True: 0, False: 0]
  ------------------
 6742|      0|        (!timerisset(&earliest) || timercmp(&alarm_tm, &earliest, <)))
  ------------------
  |  Branch (6742:10): [True: 0, False: 0]
  |  Branch (6742:36): [True: 0, False: 0]
  |  Branch (6742:36): [True: 0, False: 0]
  ------------------
 6743|      0|        earliest = alarm_tm;
 6744|       |
 6745|      0|    NETSNMP_TIMERSUB(&earliest, &now, &earliest);
  ------------------
  |  |  173|      0|#define NETSNMP_TIMERSUB(a, b, res) do {                        \
  |  |  174|      0|    (res)->tv_sec  = (a)->tv_sec  - (b)->tv_sec - 1;            \
  |  |  175|      0|    (res)->tv_usec = (a)->tv_usec - (b)->tv_usec + 1000000L;    \
  |  |  176|      0|    if ((res)->tv_usec >= 1000000L) {                           \
  |  |  ------------------
  |  |  |  Branch (176:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  177|      0|        (res)->tv_usec -= 1000000L;                             \
  |  |  178|      0|        (res)->tv_sec++;                                        \
  |  |  179|      0|    }                                                           \
  |  |  180|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (180:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6746|      0|    if (earliest.tv_sec < 0) {
  ------------------
  |  Branch (6746:9): [True: 0, False: 0]
  ------------------
 6747|      0|        time_t overdue_ms = -(earliest.tv_sec * 1000 + earliest.tv_usec / 1000);
 6748|      0|        if (overdue_ms >= 10)
  ------------------
  |  Branch (6748:13): [True: 0, False: 0]
  ------------------
 6749|      0|            DEBUGMSGT(("verbose:sess_select","timer overdue by %ld ms\n",
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6750|      0|                       (long) overdue_ms));
 6751|      0|        timerclear(&earliest);
 6752|      0|    } else {
 6753|      0|        DEBUGMSGT(("verbose:sess_select","timer due in %d.%06d sec\n",
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6754|      0|                   (int)earliest.tv_sec, (int)earliest.tv_usec));
 6755|      0|    }
 6756|       |
 6757|       |    /*
 6758|       |     * if it was blocking before or our delta time is less, reset timeout 
 6759|       |     */
 6760|      0|    if ((*block || (timercmp(&earliest, timeout, <)))) {
  ------------------
  |  Branch (6760:10): [True: 0, False: 0]
  |  Branch (6760:20): [True: 0, False: 0]
  |  Branch (6760:21): [True: 0, False: 0]
  ------------------
 6761|      0|        DEBUGMSGT(("verbose:sess_select",
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6762|      0|                   "setting timer to %d.%06d sec, clear block (was %d)\n",
 6763|      0|                   (int)earliest.tv_sec, (int)earliest.tv_usec, *block));
 6764|      0|        *timeout = earliest;
 6765|      0|        *block = 0;
 6766|      0|    }
 6767|      0|    return active;
 6768|     68|}
snmp_oid_compare:
 7039|    444|{
 7040|    444|    register int    len;
 7041|    444|    register const oid *name1 = in_name1;
 7042|    444|    register const oid *name2 = in_name2;
 7043|       |
 7044|       |    /*
 7045|       |     * len = minimum of len1 and len2 
 7046|       |     */
 7047|    444|    if (len1 < len2)
  ------------------
  |  Branch (7047:9): [True: 0, False: 444]
  ------------------
 7048|      0|        len = len1;
 7049|    444|    else
 7050|    444|        len = len2;
 7051|       |    /*
 7052|       |     * find first non-matching OID 
 7053|       |     */
 7054|  4.58k|    while (len-- > 0) {
  ------------------
  |  Branch (7054:12): [True: 4.44k, False: 148]
  ------------------
 7055|       |        /*
 7056|       |         * these must be done in separate comparisons, since
 7057|       |         * subtracting them and using that result has problems with
 7058|       |         * subids > 2^31. 
 7059|       |         */
 7060|  4.44k|        if (*(name1) != *(name2)) {
  ------------------
  |  Branch (7060:13): [True: 296, False: 4.14k]
  ------------------
 7061|    296|            if (*(name1) < *(name2))
  ------------------
  |  Branch (7061:17): [True: 148, False: 148]
  ------------------
 7062|    148|                return -1;
 7063|    148|            return 1;
 7064|    296|        }
 7065|  4.14k|        name1++;
 7066|  4.14k|        name2++;
 7067|  4.14k|    }
 7068|       |    /*
 7069|       |     * both OIDs equal up to length of shorter OID 
 7070|       |     */
 7071|    148|    if (len1 < len2)
  ------------------
  |  Branch (7071:9): [True: 0, False: 148]
  ------------------
 7072|      0|        return -1;
 7073|    148|    if (len2 < len1)
  ------------------
  |  Branch (7073:9): [True: 0, False: 148]
  ------------------
 7074|      0|        return 1;
 7075|    148|    return 0;
 7076|    148|}
netsnmp_oid_equals:
 7176|  3.80k|{
 7177|  3.80k|    register const oid *name1 = in_name1;
 7178|  3.80k|    register const oid *name2 = in_name2;
 7179|  3.80k|    register int    len = len1;
 7180|       |
 7181|       |    /*
 7182|       |     * len = minimum of len1 and len2 
 7183|       |     */
 7184|  3.80k|    if (len1 != len2)
  ------------------
  |  Branch (7184:9): [True: 2.62k, False: 1.17k]
  ------------------
 7185|  2.62k|        return 1;
 7186|       |    /*
 7187|       |     * Handle 'null' OIDs
 7188|       |     */
 7189|  1.17k|    if (len1 == 0)
  ------------------
  |  Branch (7189:9): [True: 0, False: 1.17k]
  ------------------
 7190|      0|        return 0;   /* Two null OIDs are (trivially) the same */
 7191|  1.17k|    if (!name1 || !name2)
  ------------------
  |  Branch (7191:9): [True: 0, False: 1.17k]
  |  Branch (7191:19): [True: 0, False: 1.17k]
  ------------------
 7192|      0|        return 1;   /* Otherwise something's wrong, so report a non-match */
 7193|       |    /*
 7194|       |     * find first non-matching OID 
 7195|       |     */
 7196|  9.85k|    while (len-- > 0) {
  ------------------
  |  Branch (7196:12): [True: 9.85k, False: 0]
  ------------------
 7197|       |        /*
 7198|       |         * these must be done in separate comparisons, since
 7199|       |         * subtracting them and using that result has problems with
 7200|       |         * subids > 2^31. 
 7201|       |         */
 7202|  9.85k|        if (*(name1++) != *(name2++))
  ------------------
  |  Branch (7202:13): [True: 1.17k, False: 8.67k]
  ------------------
 7203|  1.17k|            return 1;
 7204|  9.85k|    }
 7205|      0|    return 0;
 7206|  1.17k|}
snmp_pdu_add_variable:
 7316|      4|{
 7317|      4|    return snmp_varlist_add_variable(&pdu->variables, name, name_length,
 7318|      4|                                     type, value, len);
 7319|      4|}
snmp_varlist_add_variable:
 7330|      4|{
 7331|      4|    netsnmp_variable_list *vars, *vtmp;
 7332|      4|    int rc;
 7333|       |
 7334|      4|    if (varlist == NULL)
  ------------------
  |  Branch (7334:9): [True: 0, False: 4]
  ------------------
 7335|      0|        return NULL;
 7336|       |
 7337|      4|    vars = SNMP_MALLOC_TYPEDEF(netsnmp_variable_list);
  ------------------
  |  |   73|      4|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
 7338|      4|    if (vars == NULL)
  ------------------
  |  Branch (7338:9): [True: 0, False: 4]
  ------------------
 7339|      0|        return NULL;
 7340|       |
 7341|      4|    vars->type = type;
 7342|       |
 7343|      4|    rc = snmp_set_var_value( vars, value, len );
 7344|      4|    if (( 0 != rc ) ||
  ------------------
  |  Branch (7344:9): [True: 0, False: 4]
  ------------------
 7345|      4|        (name != NULL && snmp_set_var_objid(vars, name, name_length))) {
  ------------------
  |  Branch (7345:10): [True: 4, False: 0]
  |  Branch (7345:26): [True: 0, False: 4]
  ------------------
 7346|      0|        snmp_free_var(vars);
 7347|      0|        return NULL;
 7348|      0|    }
 7349|       |
 7350|       |    /*
 7351|       |     * put only qualified variable onto varlist 
 7352|       |     */
 7353|      4|    if (*varlist == NULL) {
  ------------------
  |  Branch (7353:9): [True: 4, False: 0]
  ------------------
 7354|      4|        *varlist = vars;
 7355|      4|    } else {
 7356|      0|        for (vtmp = *varlist; vtmp->next_variable;
  ------------------
  |  Branch (7356:31): [True: 0, False: 0]
  ------------------
 7357|      0|             vtmp = vtmp->next_variable);
 7358|       |
 7359|      0|        vtmp->next_variable = vars;
 7360|      0|    }
 7361|       |
 7362|      4|    return vars;
 7363|      4|}
snmp_duplicate_objid:
 8002|    414|{
 8003|    414|    oid            *returnOid;
 8004|    414|    if (objToCopy != NULL && objToCopyLen != 0) {
  ------------------
  |  Branch (8004:9): [True: 414, False: 0]
  |  Branch (8004:30): [True: 414, False: 0]
  ------------------
 8005|    414|        returnOid = (oid *) malloc(objToCopyLen * sizeof(oid));
 8006|    414|        if (returnOid) {
  ------------------
  |  Branch (8006:13): [True: 414, False: 0]
  ------------------
 8007|    414|            memcpy(returnOid, objToCopy, objToCopyLen * sizeof(oid));
 8008|    414|        }
 8009|    414|    } else
 8010|      0|        returnOid = NULL;
 8011|    414|    return returnOid;
 8012|    414|}
snmp_increment_statistic:
 8022|     67|{
 8023|     67|    if (which >= 0 && which < NETSNMP_STAT_MAX_STATS) {
  ------------------
  |  |  743|     67|#define  NETSNMP_STAT_MAX_STATS              (STAT_TLSTM_STATS_END+1)
  |  |  ------------------
  |  |  |  |  739|     67|#define  STAT_TLSTM_STATS_END          STAT_TLSTM_SNMPTLSTMSESSIONINVALIDCACHES
  |  |  |  |  ------------------
  |  |  |  |  |  |  736|     67|#define  STAT_TLSTM_SNMPTLSTMSESSIONINVALIDCACHES              56
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (8023:9): [True: 67, False: 0]
  |  Branch (8023:23): [True: 67, False: 0]
  ------------------
 8024|     67|        statistics[which]++;
 8025|     67|        return statistics[which];
 8026|     67|    }
 8027|      0|    return 0;
 8028|     67|}
snmp_get_statistic:
 8042|      4|{
 8043|      4|    if (which >= 0 && which < NETSNMP_STAT_MAX_STATS)
  ------------------
  |  |  743|      4|#define  NETSNMP_STAT_MAX_STATS              (STAT_TLSTM_STATS_END+1)
  |  |  ------------------
  |  |  |  |  739|      4|#define  STAT_TLSTM_STATS_END          STAT_TLSTM_SNMPTLSTMSESSIONINVALIDCACHES
  |  |  |  |  ------------------
  |  |  |  |  |  |  736|      4|#define  STAT_TLSTM_SNMPTLSTMSESSIONINVALIDCACHES              56
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (8043:9): [True: 4, False: 0]
  |  Branch (8043:23): [True: 4, False: 0]
  ------------------
 8044|      4|        return statistics[which];
 8045|      0|    return 0;
 8046|      4|}
snmp_init_statistics:
 8050|     69|{
 8051|     69|    memset(statistics, 0, sizeof(statistics));
 8052|     69|}
snmp_api.c:_init_snmp:
  697|    207|{
  698|       |
  699|    207|    struct timeval  tv;
  700|    207|    long            tmpReqid, tmpMsgid;
  701|       |
  702|    207|    if (_init_snmp_init_done)
  ------------------
  |  Branch (702:9): [True: 138, False: 69]
  ------------------
  703|    138|        return;
  704|     69|    _init_snmp_init_done = 1;
  705|     69|    Reqid = 1;
  706|       |
  707|     69|    snmp_res_init();            /* initialize the mt locking structures */
  ------------------
  |  |   78|     69|#define snmp_res_init() do {} while (0)
  |  |  ------------------
  |  |  |  Branch (78:38): [Folded, False: 69]
  |  |  ------------------
  ------------------
  708|     69|#ifndef NETSNMP_DISABLE_MIB_LOADING
  709|     69|    netsnmp_init_mib_internals();
  710|     69|#endif /* NETSNMP_DISABLE_MIB_LOADING */
  711|     69|    netsnmp_tdomain_init();
  712|       |
  713|     69|    gettimeofday(&tv, (struct timezone *) 0);
  714|       |    /*
  715|       |     * Now = tv;
  716|       |     */
  717|       |
  718|       |    /*
  719|       |     * get pseudo-random values for request ID and message ID 
  720|       |     */
  721|     69|    netsnmp_srandom((unsigned)(tv.tv_sec ^ tv.tv_usec));
  722|     69|    tmpReqid = netsnmp_random();
  723|     69|    tmpMsgid = netsnmp_random();
  724|       |
  725|       |    /*
  726|       |     * don't allow zero value to repeat init 
  727|       |     */
  728|     69|    if (tmpReqid == 0)
  ------------------
  |  Branch (728:9): [True: 0, False: 69]
  ------------------
  729|      0|        tmpReqid = 1;
  730|     69|    if (tmpMsgid == 0)
  ------------------
  |  Branch (730:9): [True: 0, False: 69]
  ------------------
  731|      0|        tmpMsgid = 1;
  732|     69|    Reqid = tmpReqid;
  733|     69|    Msgid = tmpMsgid;
  734|       |
  735|     69|    netsnmp_register_default_domain("snmp", "udp udp6");
  736|     69|    netsnmp_register_default_domain("snmptrap", "udp udp6");
  737|       |
  738|     69|    netsnmp_register_default_target("snmp", "udp", ":161");
  739|     69|    netsnmp_register_default_target("snmp", "tcp", ":161");
  740|     69|    netsnmp_register_default_target("snmp", "udp6", ":161");
  741|     69|    netsnmp_register_default_target("snmp", "tcp6", ":161");
  742|     69|    netsnmp_register_default_target("snmp", "dtlsudp", ":10161");
  743|     69|    netsnmp_register_default_target("snmp", "tlstcp", ":10161");
  744|     69|    netsnmp_register_default_target("snmp", "ipx", "/36879");
  745|       |
  746|     69|    netsnmp_register_default_target("snmptrap", "udp", ":162");
  747|     69|    netsnmp_register_default_target("snmptrap", "tcp", ":162");
  748|     69|    netsnmp_register_default_target("snmptrap", "udp6", ":162");
  749|     69|    netsnmp_register_default_target("snmptrap", "tcp6", ":162");
  750|     69|    netsnmp_register_default_target("snmptrap", "dtlsudp", ":10162");
  751|     69|    netsnmp_register_default_target("snmptrap", "tlstcp", ":10162");
  752|     69|    netsnmp_register_default_target("snmptrap", "ipx", "/36880");
  753|       |
  754|     69|    netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  755|     69|                       NETSNMP_DS_LIB_HEX_OUTPUT_LENGTH, 16);
  ------------------
  |  |  121|     69|#define NETSNMP_DS_LIB_HEX_OUTPUT_LENGTH    6
  ------------------
  756|     69|    netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_RETRIES,
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  netsnmp_ds_set_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_RETRIES,
  ------------------
  |  |  131|     69|#define NETSNMP_DS_LIB_RETRIES             15
  ------------------
  757|     69|                       DEFAULT_RETRIES);
  ------------------
  |  |  185|     69|#define DEFAULT_RETRIES	    5
  ------------------
  758|     69|    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  759|     69|			   NETSNMP_DS_LIB_MIB_ERRORS, 1);
  ------------------
  |  |   59|     69|#define NETSNMP_DS_LIB_MIB_ERRORS          0
  ------------------
  760|       |
  761|     69|#ifdef NETSNMP_USE_REVERSE_ASNENCODING
  762|     69|    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  763|     69|			   NETSNMP_DS_LIB_REVERSE_ENCODE,
  ------------------
  |  |   80|     69|#define NETSNMP_DS_LIB_REVERSE_ENCODE      20   /* encode packets from back to front */
  ------------------
  764|     69|			   NETSNMP_DEFAULT_ASNENCODING_DIRECTION);
  ------------------
  |  | 1992|     69|#define NETSNMP_DEFAULT_ASNENCODING_DIRECTION 1 /* 1 = reverse, 0 = forwards */
  ------------------
  765|     69|#endif
  766|     69|}
snmp_api.c:register_default_handlers:
  795|     69|{
  796|     69|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "dumpPacket",
  ------------------
  |  |   72|     69|#define ASN_BOOLEAN	    0x01U
  ------------------
  797|     69|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DUMP_PACKET);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DUMP_PACKET);
  ------------------
  |  |   63|     69|#define NETSNMP_DS_LIB_DUMP_PACKET         4
  ------------------
  798|     69|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "reverseEncodeBER",
  ------------------
  |  |   72|     69|#define ASN_BOOLEAN	    0x01U
  ------------------
  799|     69|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_REVERSE_ENCODE);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_REVERSE_ENCODE);
  ------------------
  |  |   80|     69|#define NETSNMP_DS_LIB_REVERSE_ENCODE      20   /* encode packets from back to front */
  ------------------
  800|     69|    netsnmp_ds_register_config(ASN_INTEGER, "snmp", "defaultPort",
  ------------------
  |  |   75|     69|#define ASN_INTEGER	    0x02U
  ------------------
  801|     69|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DEFAULT_PORT);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DEFAULT_PORT);
  ------------------
  |  |  117|     69|#define NETSNMP_DS_LIB_DEFAULT_PORT         3
  ------------------
  802|     69|#ifndef NETSNMP_FEATURE_REMOVE_RUNTIME_DISABLE_VERSION
  803|     69|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "disableSNMPv3",
  ------------------
  |  |   72|     69|#define ASN_BOOLEAN	    0x01U
  ------------------
  804|     69|                      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_V3);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                    NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_V3);
  ------------------
  |  |  105|     69|#define NETSNMP_DS_LIB_DISABLE_V3          45 /* disable SNMPv3 */
  ------------------
  805|     69|#endif /* NETSNMP_FEATURE_REMOVE_RUNTIME_DISABLE_VERSION */
  806|     69|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
  807|     69|#ifndef NETSNMP_FEATURE_REMOVE_RUNTIME_DISABLE_VERSION
  808|     69|#if !defined(NETSNMP_DISABLE_SNMPV1)
  809|     69|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "disableSNMPv1",
  ------------------
  |  |   72|     69|#define ASN_BOOLEAN	    0x01U
  ------------------
  810|     69|                      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_V1);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                    NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_V1);
  ------------------
  |  |  103|     69|#define NETSNMP_DS_LIB_DISABLE_V1          43 /* disable SNMPv1 */
  ------------------
  811|     69|#endif
  812|     69|#if !defined(NETSNMP_DISABLE_SNMPV2C)
  813|     69|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "disableSNMPv2c",
  ------------------
  |  |   72|     69|#define ASN_BOOLEAN	    0x01U
  ------------------
  814|     69|                      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_V2c);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                    NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_V2c);
  ------------------
  |  |  104|     69|#define NETSNMP_DS_LIB_DISABLE_V2c         44 /* disable SNMPv2c */
  ------------------
  815|     69|#endif
  816|     69|#endif /* NETSNMP_FEATURE_REMOVE_RUNTIME_DISABLE_VERSION */
  817|     69|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defCommunity",
  ------------------
  |  |   78|     69|#define ASN_OCTET_STR	    0x04U
  ------------------
  818|     69|                      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_COMMUNITY);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                    NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_COMMUNITY);
  ------------------
  |  |  158|     69|#define NETSNMP_DS_LIB_COMMUNITY         7
  ------------------
  819|     69|#endif /* !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C) */
  820|     69|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "noTokenWarnings",
  ------------------
  |  |   72|     69|#define ASN_BOOLEAN	    0x01U
  ------------------
  821|     69|                      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NO_TOKEN_WARNINGS);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                    NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NO_TOKEN_WARNINGS);
  ------------------
  |  |   77|     69|#define NETSNMP_DS_LIB_NO_TOKEN_WARNINGS   17   /* no warn about unknown config tokens */
  ------------------
  822|     69|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "noRangeCheck",
  ------------------
  |  |   72|     69|#define ASN_BOOLEAN	    0x01U
  ------------------
  823|     69|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_CHECK_RANGE);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_CHECK_RANGE);
  ------------------
  |  |   76|     69|#define NETSNMP_DS_LIB_DONT_CHECK_RANGE    16   /* don't check values for ranges on send */
  ------------------
  824|     69|    netsnmp_ds_register_premib(ASN_OCTET_STR, "snmp", "persistentDir",
  ------------------
  |  |   78|     69|#define ASN_OCTET_STR	    0x04U
  ------------------
  825|     69|	              NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PERSISTENT_DIR);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              	              NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PERSISTENT_DIR);
  ------------------
  |  |  159|     69|#define NETSNMP_DS_LIB_PERSISTENT_DIR    8
  ------------------
  826|     69|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "tempFilePattern",
  ------------------
  |  |   78|     69|#define ASN_OCTET_STR	    0x04U
  ------------------
  827|     69|	              NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_TEMP_FILE_PATTERN);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              	              NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_TEMP_FILE_PATTERN);
  ------------------
  |  |  166|     69|#define NETSNMP_DS_LIB_TEMP_FILE_PATTERN 15
  ------------------
  828|     69|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "noDisplayHint",
  ------------------
  |  |   72|     69|#define ASN_BOOLEAN	    0x01U
  ------------------
  829|     69|	              NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NO_DISPLAY_HINT);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              	              NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NO_DISPLAY_HINT);
  ------------------
  |  |   90|     69|#define NETSNMP_DS_LIB_NO_DISPLAY_HINT     30 /* don't apply DISPLAY-HINTs */
  ------------------
  830|     69|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "16bitIDs",
  ------------------
  |  |   72|     69|#define ASN_BOOLEAN	    0x01U
  ------------------
  831|     69|	              NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              	              NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_16BIT_IDS);
  ------------------
  |  |   91|     69|#define NETSNMP_DS_LIB_16BIT_IDS           31   /* restrict requestIDs, etc to 16-bit values */
  ------------------
  832|     69|    netsnmp_ds_register_premib(ASN_OCTET_STR, "snmp", "clientaddr",
  ------------------
  |  |   78|     69|#define ASN_OCTET_STR	    0x04U
  ------------------
  833|     69|                      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CLIENT_ADDR);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                    NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CLIENT_ADDR);
  ------------------
  |  |  165|     69|#define NETSNMP_DS_LIB_CLIENT_ADDR       14
  ------------------
  834|     69|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "clientaddrUsesPort",
  ------------------
  |  |   72|     69|#define ASN_BOOLEAN	    0x01U
  ------------------
  835|     69|                      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CLIENT_ADDR_USES_PORT);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                    NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CLIENT_ADDR_USES_PORT);
  ------------------
  |  |  102|     69|#define NETSNMP_DS_LIB_CLIENT_ADDR_USES_PORT 42 /* NETSNMP_DS_LIB_CLIENT_ADDR includes address and also port */
  ------------------
  836|     69|    netsnmp_ds_register_config(ASN_INTEGER, "snmp", "serverSendBuf",
  ------------------
  |  |   75|     69|#define ASN_INTEGER	    0x02U
  ------------------
  837|     69|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SERVERSENDBUF);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SERVERSENDBUF);
  ------------------
  |  |  122|     69|#define NETSNMP_DS_LIB_SERVERSENDBUF        7 /* send buffer (server) */
  ------------------
  838|     69|    netsnmp_ds_register_config(ASN_INTEGER, "snmp", "serverRecvBuf",
  ------------------
  |  |   75|     69|#define ASN_INTEGER	    0x02U
  ------------------
  839|     69|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SERVERRECVBUF);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SERVERRECVBUF);
  ------------------
  |  |  123|     69|#define NETSNMP_DS_LIB_SERVERRECVBUF        8 /* receive buffer (server) */
  ------------------
  840|     69|    netsnmp_ds_register_config(ASN_INTEGER, "snmp", "clientSendBuf",
  ------------------
  |  |   75|     69|#define ASN_INTEGER	    0x02U
  ------------------
  841|     69|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CLIENTSENDBUF);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CLIENTSENDBUF);
  ------------------
  |  |  124|     69|#define NETSNMP_DS_LIB_CLIENTSENDBUF        9 /* send buffer (client) */
  ------------------
  842|     69|    netsnmp_ds_register_config(ASN_INTEGER, "snmp", "clientRecvBuf",
  ------------------
  |  |   75|     69|#define ASN_INTEGER	    0x02U
  ------------------
  843|     69|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CLIENTRECVBUF);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CLIENTRECVBUF);
  ------------------
  |  |  125|     69|#define NETSNMP_DS_LIB_CLIENTRECVBUF       10 /* receive buffer (client) */
  ------------------
  844|     69|    netsnmp_ds_register_config(ASN_INTEGER, "snmp", "sendMessageMaxSize",
  ------------------
  |  |   75|     69|#define ASN_INTEGER	    0x02U
  ------------------
  845|     69|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  846|     69|                               NETSNMP_DS_LIB_MSG_SEND_MAX);
  ------------------
  |  |  132|     69|#define NETSNMP_DS_LIB_MSG_SEND_MAX        16 /* global max response size */
  ------------------
  847|     69|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "noPersistentLoad",
  ------------------
  |  |   72|     69|#define ASN_BOOLEAN	    0x01U
  ------------------
  848|     69|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_PERSISTENT_LOAD);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_PERSISTENT_LOAD);
  ------------------
  |  |   95|     69|#define NETSNMP_DS_LIB_DISABLE_PERSISTENT_LOAD  35 /* don't load persistent file */
  ------------------
  849|     69|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "noPersistentSave",
  ------------------
  |  |   72|     69|#define ASN_BOOLEAN	    0x01U
  ------------------
  850|     69|		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_PERSISTENT_SAVE);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		      NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DISABLE_PERSISTENT_SAVE);
  ------------------
  |  |   96|     69|#define NETSNMP_DS_LIB_DISABLE_PERSISTENT_SAVE  36 /* don't save persistent file */
  ------------------
  851|     69|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp",
  ------------------
  |  |   72|     69|#define ASN_BOOLEAN	    0x01U
  ------------------
  852|     69|                               "noContextEngineIDDiscovery",
  853|     69|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  854|     69|                               NETSNMP_DS_LIB_NO_DISCOVERY);
  ------------------
  |  |   98|     69|#define NETSNMP_DS_LIB_NO_DISCOVERY        38 /* don't support RFC5343 contextEngineID discovery */
  ------------------
  855|     69|    netsnmp_ds_register_config(ASN_INTEGER, "snmp", "timeout",
  ------------------
  |  |   75|     69|#define ASN_INTEGER	    0x02U
  ------------------
  856|     69|		               NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_TIMEOUT);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		               NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_TIMEOUT);
  ------------------
  |  |  130|     69|#define NETSNMP_DS_LIB_TIMEOUT             14
  ------------------
  857|     69|    netsnmp_ds_register_config(ASN_INTEGER, "snmp", "retries",
  ------------------
  |  |   75|     69|#define ASN_INTEGER	    0x02U
  ------------------
  858|     69|		               NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_RETRIES);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              		               NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_RETRIES);
  ------------------
  |  |  131|     69|#define NETSNMP_DS_LIB_RETRIES             15
  ------------------
  859|     69|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "outputPrecision",
  ------------------
  |  |   78|     69|#define ASN_OCTET_STR	    0x04U
  ------------------
  860|     69|                               NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OUTPUT_PRECISION);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                             NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_OUTPUT_PRECISION);
  ------------------
  |  |  186|     69|#define NETSNMP_DS_LIB_OUTPUT_PRECISION  35
  ------------------
  861|       |
  862|       |
  863|     69|    netsnmp_register_service_handlers();
  864|     69|}
snmp_api.c:snmp_sess_copy:
 1366|     69|{
 1367|     69|    struct session_list *psl;
 1368|     69|    psl = _sess_copy(pss);
 1369|     69|    if (!psl) {
  ------------------
  |  Branch (1369:9): [True: 0, False: 69]
  ------------------
 1370|      0|        if (!pss->s_snmp_errno) {
  ------------------
  |  Branch (1370:13): [True: 0, False: 0]
  ------------------
 1371|      0|            pss->s_snmp_errno = SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 1372|      0|        }
 1373|      0|        SET_SNMP_ERROR(pss->s_snmp_errno);
  ------------------
  |  |   56|      0|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 1374|      0|    }
 1375|     69|    return psl;
 1376|     69|}
snmp_api.c:_sess_copy:
 1093|     69|{
 1094|     69|    struct session_list *slp;
 1095|     69|    struct snmp_internal_session *isp;
 1096|     69|    netsnmp_session *session;
 1097|     69|    struct snmp_secmod_def *sptr;
 1098|     69|    char           *cp;
 1099|     69|    u_char         *ucp;
 1100|       |
 1101|     69|    in_session->s_snmp_errno = 0;
 1102|     69|    in_session->s_errno = 0;
 1103|       |
 1104|       |    /*
 1105|       |     * Copy session structure and link into list 
 1106|       |     */
 1107|     69|    slp = calloc(1, sizeof(struct session_list));
 1108|     69|    if (slp == NULL) {
  ------------------
  |  Branch (1108:9): [True: 0, False: 69]
  ------------------
 1109|      0|        in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 1110|      0|        return (NULL);
 1111|      0|    }
 1112|       |
 1113|     69|    slp->transport = NULL;
 1114|       |
 1115|     69|    isp = calloc(1, sizeof(struct snmp_internal_session));
 1116|       |
 1117|     69|    if (isp == NULL) {
  ------------------
  |  Branch (1117:9): [True: 0, False: 69]
  ------------------
 1118|      0|        snmp_sess_close(slp);
 1119|      0|        in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 1120|      0|        return (NULL);
 1121|      0|    }
 1122|       |
 1123|     69|    slp->internal = isp;
 1124|     69|    slp->session = netsnmp_memdup(in_session, sizeof(netsnmp_session));
 1125|     69|    if (slp->session == NULL) {
  ------------------
  |  Branch (1125:9): [True: 0, False: 69]
  ------------------
 1126|      0|        snmp_sess_close(slp);
 1127|      0|        in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 1128|      0|        return (NULL);
 1129|      0|    }
 1130|     69|    session = slp->session;
 1131|       |
 1132|       |    /*
 1133|       |     * zero out pointers so if we have to free the session we wont free mem
 1134|       |     * owned by in_session 
 1135|       |     */
 1136|     69|    session->localname = NULL;
 1137|     69|    session->peername = NULL;
 1138|     69|    session->community = NULL;
 1139|     69|    session->contextEngineID = NULL;
 1140|     69|    session->contextName = NULL;
 1141|     69|    session->securityEngineID = NULL;
 1142|     69|    session->securityName = NULL;
 1143|     69|    session->securityAuthProto = NULL;
 1144|     69|    session->securityAuthLocalKey = NULL;
 1145|     69|    session->securityPrivProto = NULL;
 1146|     69|    session->securityPrivLocalKey = NULL;
 1147|     69|    session->sessUser = NULL;
 1148|       |    /*
 1149|       |     * session now points to the new structure that still contains pointers to
 1150|       |     * data allocated elsewhere.  Some of this data is copied to space malloc'd
 1151|       |     * here, and the pointer replaced with the new one.
 1152|       |     */
 1153|       |
 1154|     69|    if (in_session->peername != NULL) {
  ------------------
  |  Branch (1154:9): [True: 0, False: 69]
  ------------------
 1155|      0|        session->peername =
 1156|      0|            netsnmp_strdup_and_null((u_char*)in_session->peername,
 1157|      0|                                    strlen(in_session->peername));
 1158|      0|        if (session->peername == NULL) {
  ------------------
  |  Branch (1158:13): [True: 0, False: 0]
  ------------------
 1159|      0|            snmp_sess_close(slp);
 1160|      0|            in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 1161|      0|            return (NULL);
 1162|      0|        }
 1163|      0|    }
 1164|       |
 1165|       |    /*
 1166|       |     * Fill in defaults if necessary 
 1167|       |     */
 1168|     69|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 1169|     69|    if (in_session->community_len != SNMP_DEFAULT_COMMUNITY_LEN) {
  ------------------
  |  |  111|     69|#define SNMP_DEFAULT_COMMUNITY_LEN  0   /* to get a default community name */
  ------------------
  |  Branch (1169:9): [True: 0, False: 69]
  ------------------
 1170|      0|        ucp = netsnmp_memdup(in_session->community, in_session->community_len);
 1171|     69|    } else {
 1172|     69|        if ((cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1172:13): [True: 0, False: 69]
  ------------------
 1173|     69|					NETSNMP_DS_LIB_COMMUNITY)) != NULL) {
  ------------------
  |  |  158|     69|#define NETSNMP_DS_LIB_COMMUNITY         7
  ------------------
 1174|      0|            session->community_len = strlen(cp);
 1175|      0|            ucp = (u_char *) strdup(cp);
 1176|     69|        } else {
 1177|       |#ifdef NETSNMP_NO_ZEROLENGTH_COMMUNITY
 1178|       |            session->community_len = strlen(DEFAULT_COMMUNITY);
 1179|       |            ucp = netsnmp_memdup(DEFAULT_COMMUNITY, session->community_len);
 1180|       |#else
 1181|     69|            ucp = (u_char *) strdup("");
 1182|     69|#endif
 1183|     69|        }
 1184|     69|    }
 1185|       |
 1186|     69|    if (ucp == NULL) {
  ------------------
  |  Branch (1186:9): [True: 0, False: 69]
  ------------------
 1187|      0|        snmp_sess_close(slp);
 1188|      0|        in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 1189|      0|        return (NULL);
 1190|      0|    }
 1191|     69|    session->community = ucp;   /* replace pointer with pointer to new data */
 1192|     69|#endif
 1193|       |
 1194|     69|    if (session->securityLevel <= 0) {
  ------------------
  |  Branch (1194:9): [True: 69, False: 0]
  ------------------
 1195|     69|        session->securityLevel =
 1196|     69|            netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SECLEVEL);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                          netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SECLEVEL);
  ------------------
  |  |  115|     69|#define NETSNMP_DS_LIB_SECLEVEL             1
  ------------------
 1197|     69|    }
 1198|       |
 1199|     69|    if (in_session->securityEngineIDLen > 0) {
  ------------------
  |  Branch (1199:9): [True: 0, False: 69]
  ------------------
 1200|      0|        ucp = netsnmp_memdup(in_session->securityEngineID,
 1201|      0|                             in_session->securityEngineIDLen);
 1202|      0|        if (ucp == NULL) {
  ------------------
  |  Branch (1202:13): [True: 0, False: 0]
  ------------------
 1203|      0|            snmp_sess_close(slp);
 1204|      0|            in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 1205|      0|            return (NULL);
 1206|      0|        }
 1207|      0|        session->securityEngineID = ucp;
 1208|       |
 1209|      0|    }
 1210|       |
 1211|     69|    if (in_session->contextEngineIDLen > 0) {
  ------------------
  |  Branch (1211:9): [True: 0, False: 69]
  ------------------
 1212|      0|        ucp = netsnmp_memdup(in_session->contextEngineID,
 1213|      0|                             in_session->contextEngineIDLen);
 1214|      0|        if (ucp == NULL) {
  ------------------
  |  Branch (1214:13): [True: 0, False: 0]
  ------------------
 1215|      0|            snmp_sess_close(slp);
 1216|      0|            in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 1217|      0|            return (NULL);
 1218|      0|        }
 1219|      0|        session->contextEngineID = ucp;
 1220|     69|    } else if (in_session->securityEngineIDLen > 0) {
  ------------------
  |  Branch (1220:16): [True: 0, False: 69]
  ------------------
 1221|       |        /*
 1222|       |         * default contextEngineID to securityEngineIDLen if defined 
 1223|       |         */
 1224|      0|        ucp = netsnmp_memdup(in_session->securityEngineID,
 1225|      0|                             in_session->securityEngineIDLen);
 1226|      0|        if (ucp == NULL) {
  ------------------
  |  Branch (1226:13): [True: 0, False: 0]
  ------------------
 1227|      0|            snmp_sess_close(slp);
 1228|      0|            in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 1229|      0|            return (NULL);
 1230|      0|        }
 1231|      0|        session->contextEngineID = ucp;
 1232|      0|        session->contextEngineIDLen = in_session->securityEngineIDLen;
 1233|      0|    }
 1234|       |
 1235|     69|    if (in_session->contextName) {
  ------------------
  |  Branch (1235:9): [True: 0, False: 69]
  ------------------
 1236|      0|        session->contextName = strdup(in_session->contextName);
 1237|      0|        if (session->contextName == NULL) {
  ------------------
  |  Branch (1237:13): [True: 0, False: 0]
  ------------------
 1238|      0|            snmp_sess_close(slp);
 1239|      0|            return (NULL);
 1240|      0|        }
 1241|      0|        session->contextNameLen = in_session->contextNameLen;
 1242|     69|    } else {
 1243|     69|        if ((cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1243:13): [True: 0, False: 69]
  ------------------
 1244|     69|                                        NETSNMP_DS_LIB_CONTEXT)) != NULL)
  ------------------
  |  |  152|     69|#define NETSNMP_DS_LIB_CONTEXT           1
  ------------------
 1245|      0|            cp = strdup(cp);
 1246|     69|        else
 1247|     69|            cp = strdup(SNMP_DEFAULT_CONTEXT);
  ------------------
  |  |  125|     69|#define SNMP_DEFAULT_CONTEXT        ""
  ------------------
 1248|     69|        if (cp == NULL) {
  ------------------
  |  Branch (1248:13): [True: 0, False: 69]
  ------------------
 1249|      0|            snmp_sess_close(slp);
 1250|      0|            return (NULL);
 1251|      0|        }
 1252|     69|        session->contextName = cp;
 1253|     69|        session->contextNameLen = strlen(cp);
 1254|     69|    }
 1255|       |
 1256|     69|    if (in_session->securityName) {
  ------------------
  |  Branch (1256:9): [True: 0, False: 69]
  ------------------
 1257|      0|        session->securityName = strdup(in_session->securityName);
 1258|      0|        if (session->securityName == NULL) {
  ------------------
  |  Branch (1258:13): [True: 0, False: 0]
  ------------------
 1259|      0|            snmp_sess_close(slp);
 1260|      0|            return (NULL);
 1261|      0|        }
 1262|     69|    } else if ((cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1262:16): [True: 0, False: 69]
  ------------------
 1263|     69|					   NETSNMP_DS_LIB_SECNAME)) != NULL) {
  ------------------
  |  |  151|     69|#define NETSNMP_DS_LIB_SECNAME           0
  ------------------
 1264|      0|        cp = strdup(cp);
 1265|      0|        if (cp == NULL) {
  ------------------
  |  Branch (1265:13): [True: 0, False: 0]
  ------------------
 1266|      0|            snmp_sess_close(slp);
 1267|      0|            return (NULL);
 1268|      0|        }
 1269|      0|        session->securityName = cp;
 1270|      0|        session->securityNameLen = strlen(cp);
 1271|      0|    }
 1272|       |
 1273|     69|    if (in_session->securityAuthLocalKey) {
  ------------------
  |  Branch (1273:9): [True: 0, False: 69]
  ------------------
 1274|      0|            session->securityAuthLocalKey =
 1275|      0|                netsnmp_memdup(in_session->securityAuthLocalKey,
 1276|      0|                               in_session->securityAuthLocalKeyLen);
 1277|      0|            session->securityAuthLocalKeyLen =
 1278|      0|                in_session->securityAuthLocalKeyLen;
 1279|      0|    }
 1280|       |
 1281|     69|    if (in_session->securityPrivLocalKey) {
  ------------------
  |  Branch (1281:9): [True: 0, False: 69]
  ------------------
 1282|      0|            session->securityPrivLocalKey =
 1283|      0|                netsnmp_memdup(in_session->securityPrivLocalKey,
 1284|      0|                               in_session->securityPrivLocalKeyLen);
 1285|      0|            session->securityPrivLocalKeyLen =
 1286|      0|                in_session->securityPrivLocalKeyLen;
 1287|      0|    }
 1288|       |
 1289|     69|    if (session->transport_configuration) {
  ------------------
  |  Branch (1289:9): [True: 0, False: 69]
  ------------------
 1290|      0|        session->transport_configuration =
 1291|      0|            CONTAINER_DUP(session->transport_configuration, NULL, 0);
 1292|      0|        if (!session->transport_configuration) {
  ------------------
  |  Branch (1292:13): [True: 0, False: 0]
  ------------------
 1293|      0|            snmp_sess_close(slp);
 1294|      0|            return NULL;
 1295|      0|        }
 1296|      0|    }
 1297|       |
 1298|     69|    if (session->retries == SNMP_DEFAULT_RETRIES) {
  ------------------
  |  |  112|     69|#define SNMP_DEFAULT_RETRIES	    -1
  ------------------
  |  Branch (1298:9): [True: 69, False: 0]
  ------------------
 1299|     69|        int retry = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1300|     69|                                       NETSNMP_DS_LIB_RETRIES);
  ------------------
  |  |  131|     69|#define NETSNMP_DS_LIB_RETRIES             15
  ------------------
 1301|     69|        if (retry < 0)
  ------------------
  |  Branch (1301:13): [True: 0, False: 69]
  ------------------
 1302|      0|            session->retries = DEFAULT_RETRIES;
  ------------------
  |  |  185|      0|#define DEFAULT_RETRIES	    5
  ------------------
 1303|     69|        else
 1304|     69|            session->retries = retry;
 1305|     69|    }
 1306|     69|    if (session->timeout == SNMP_DEFAULT_TIMEOUT) {
  ------------------
  |  |  113|     69|#define SNMP_DEFAULT_TIMEOUT	    -1
  ------------------
  |  Branch (1306:9): [True: 69, False: 0]
  ------------------
 1307|     69|        int timeout = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1308|     69|                                         NETSNMP_DS_LIB_TIMEOUT);
  ------------------
  |  |  130|     69|#define NETSNMP_DS_LIB_TIMEOUT             14
  ------------------
 1309|     69|        if (timeout <= 0)
  ------------------
  |  Branch (1309:13): [True: 69, False: 0]
  ------------------
 1310|     69|            session->timeout = DEFAULT_TIMEOUT;
  ------------------
  |  |  186|     69|#define DEFAULT_TIMEOUT	    (1000L * 1000L)
  ------------------
 1311|      0|        else
 1312|      0|            session->timeout = timeout * 1000L * 1000L;
 1313|     69|    }
 1314|     69|    session->sessid = snmp_get_next_sessid();
 1315|       |
 1316|     69|    snmp_call_callbacks(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_SESSION_INIT,
  ------------------
  |  |   18|     69|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
                  snmp_call_callbacks(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_SESSION_INIT,
  ------------------
  |  |   29|     69|#define SNMP_CALLBACK_SESSION_INIT		5
  ------------------
 1317|     69|                        session);
 1318|       |
 1319|     69|    if ((sptr = find_sec_mod(session->securityModel)) != NULL) {
  ------------------
  |  Branch (1319:9): [True: 69, False: 0]
  ------------------
 1320|       |        /*
 1321|       |         * security module specific copying 
 1322|       |         */
 1323|     69|        if (sptr->session_setup) {
  ------------------
  |  Branch (1323:13): [True: 69, False: 0]
  ------------------
 1324|     69|            int ret = (*sptr->session_setup) (in_session, session);
 1325|     69|            if (ret != SNMPERR_SUCCESS) {
  ------------------
  |  |  217|     69|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (1325:17): [True: 0, False: 69]
  ------------------
 1326|      0|                snmp_sess_close(slp);
 1327|      0|                return NULL;
 1328|      0|            }
 1329|     69|        }
 1330|       |
 1331|       |        /*
 1332|       |         * security module specific opening
 1333|       |         */
 1334|     69|        if (sptr->session_open) {
  ------------------
  |  Branch (1334:13): [True: 0, False: 69]
  ------------------
 1335|      0|            int ret = (*sptr->session_open) (session);
 1336|      0|            if (ret != SNMPERR_SUCCESS) {
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (1336:17): [True: 0, False: 0]
  ------------------
 1337|      0|                snmp_sess_close(slp);
 1338|      0|                return NULL;
 1339|      0|            }
 1340|      0|        }
 1341|     69|    }
 1342|       |
 1343|     69|#ifndef NETSNMP_NO_WRITE_SUPPORT
 1344|     69|    if (in_session->sessUser) {
  ------------------
  |  Branch (1344:9): [True: 0, False: 69]
  ------------------
 1345|      0|        struct usmUser *user;
 1346|       |
 1347|      0|        user = calloc(1, sizeof(struct usmUser));
 1348|      0|        if (user == NULL) {
  ------------------
  |  Branch (1348:13): [True: 0, False: 0]
  ------------------
 1349|      0|            snmp_sess_close(slp);
 1350|      0|            return NULL;
 1351|      0|        }
 1352|      0|        session->sessUser = usm_cloneFrom_user(in_session->sessUser, user);
 1353|      0|    }
 1354|     69|#endif /* NETSNMP_NO_WRITE_SUPPORT */
 1355|       |
 1356|       |    /* Anything below this point should only be done if the transport
 1357|       |       had no say in the matter */
 1358|     69|    if (session->securityLevel == 0)
  ------------------
  |  Branch (1358:9): [True: 69, False: 0]
  ------------------
 1359|     69|        session->securityLevel = SNMP_SEC_LEVEL_NOAUTH;
  ------------------
  |  |  299|     69|#define SNMP_SEC_LEVEL_NOAUTH		1
  ------------------
 1360|       |
 1361|     69|    return (slp);
 1362|     69|}
snmp_api.c:netsnmp_free_transport_config:
 1990|     69|{
 1991|     69|    if (!tc)
  ------------------
  |  Branch (1991:9): [True: 69, False: 0]
  ------------------
 1992|     69|        return;
 1993|       |
 1994|      0|    CONTAINER_CLEAR(tc, netsnmp_free_one_tr_cfg, NULL);
 1995|      0|    CONTAINER_FREE(tc);
 1996|      0|}
snmp_api.c:snmp_free_session:
 2029|     69|{
 2030|     69|    if (!s)
  ------------------
  |  Branch (2030:9): [True: 0, False: 69]
  ------------------
 2031|      0|        return;
 2032|       |
 2033|     69|    netsnmp_cleanup_session(s);
 2034|       |
 2035|       |    /*
 2036|       |     * clear session from any callbacks
 2037|       |     */
 2038|     69|    netsnmp_callback_clear_client_arg(s, 0, 0);
 2039|       |
 2040|     69|    free(s);
 2041|     69|}
snmp_api.c:snmpv3_calc_msg_flags:
 2173|      4|{
 2174|      4|    *flags = 0;
 2175|      4|    if (sec_level == SNMP_SEC_LEVEL_AUTHNOPRIV)
  ------------------
  |  |  300|      4|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
  |  Branch (2175:9): [True: 0, False: 4]
  ------------------
 2176|      0|        *flags = SNMP_MSG_FLAG_AUTH_BIT;
  ------------------
  |  |  303|      0|#define SNMP_MSG_FLAG_AUTH_BIT          0x01
  ------------------
 2177|      4|    else if (sec_level == SNMP_SEC_LEVEL_AUTHPRIV)
  ------------------
  |  |  301|      4|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (2177:14): [True: 0, False: 4]
  ------------------
 2178|      0|        *flags = SNMP_MSG_FLAG_AUTH_BIT | SNMP_MSG_FLAG_PRIV_BIT;
  ------------------
  |  |  303|      0|#define SNMP_MSG_FLAG_AUTH_BIT          0x01
  ------------------
                      *flags = SNMP_MSG_FLAG_AUTH_BIT | SNMP_MSG_FLAG_PRIV_BIT;
  ------------------
  |  |  304|      0|#define SNMP_MSG_FLAG_PRIV_BIT          0x02
  ------------------
 2179|       |
 2180|      4|    if (SNMP_CMD_CONFIRMED(msg_command))
  ------------------
  |  |  193|      4|#define SNMP_CMD_CONFIRMED(c) (c == SNMP_MSG_INFORM || c == SNMP_MSG_GETBULK ||\
  |  |  ------------------
  |  |  |  |  141|      8|#define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|      4|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|      4|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define SNMP_CMD_CONFIRMED(c) (c == SNMP_MSG_INFORM || c == SNMP_MSG_GETBULK ||\
  |  |  ------------------
  |  |  |  |  140|      8|#define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|      4|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|      4|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (193:32): [True: 0, False: 4]
  |  |  |  Branch (193:56): [True: 0, False: 4]
  |  |  ------------------
  |  |  194|      4|                               c == SNMP_MSG_GETNEXT || c == SNMP_MSG_GET || \
  |  |  ------------------
  |  |  |  |  126|      8|#define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|      4|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|      4|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                              c == SNMP_MSG_GETNEXT || c == SNMP_MSG_GET || \
  |  |  ------------------
  |  |  |  |  125|      8|#define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|      4|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|      4|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (194:32): [True: 0, False: 4]
  |  |  |  Branch (194:57): [True: 0, False: 4]
  |  |  ------------------
  |  |  195|      4|                               c == SNMP_MSG_SET )
  |  |  ------------------
  |  |  |  |  129|      8|#define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|      4|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|      4|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (195:32): [True: 0, False: 4]
  |  |  ------------------
  ------------------
 2181|      0|        *flags |= SNMP_MSG_FLAG_RPRT_BIT;
  ------------------
  |  |  305|      0|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
 2182|       |
 2183|      4|    return;
 2184|      4|}
snmp_api.c:_snmp_build:
 2941|      4|{
 2942|      4|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 2943|      4|    u_char         *h0e = NULL;
 2944|      4|    size_t          start_offset = *offset;
 2945|      4|    long            version;
 2946|      4|    int             rc = 0;
 2947|      4|    size_t          length;
 2948|      4|#endif /* support for community based SNMP */
 2949|       |
 2950|      4|    u_char         *cp;
 2951|       |
 2952|      4|    if (NETSNMP_RUNTIME_PROTOCOL_SKIP(pdu->version)) {
  ------------------
  |  |  246|      4|    (NETSNMP_RUNTIME_PROTOCOL_SKIP_V1(pc_ver) ||        \
  |  |  ------------------
  |  |  |  |  205|      8|    ((pc_ver) == SNMP_VERSION_1 &&                                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |  107|      8|#define SNMP_VERSION_1	   0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (205:6): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  |  |  206|      8|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (206:6): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  207|      0|                            NETSNMP_DS_LIB_DISABLE_V1))
  |  |  |  |  ------------------
  |  |  |  |  |  |  103|      0|#define NETSNMP_DS_LIB_DISABLE_V1          43 /* disable SNMPv1 */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  247|      4|     NETSNMP_RUNTIME_PROTOCOL_SKIP_V2(pc_ver) ||        \
  |  |  ------------------
  |  |  |  |  215|      8|    ((pc_ver) == SNMP_VERSION_2c &&                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|      8|#define SNMP_VERSION_2c    1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (215:6): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  |  |  216|      8|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (216:6): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  217|      0|                            NETSNMP_DS_LIB_DISABLE_V2c))
  |  |  |  |  ------------------
  |  |  |  |  |  |  104|      0|#define NETSNMP_DS_LIB_DISABLE_V2c         44 /* disable SNMPv2c */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  248|      4|     NETSNMP_RUNTIME_PROTOCOL_SKIP_V3(pc_ver))
  |  |  ------------------
  |  |  |  |  229|      4|    ((pc_ver == SNMP_VERSION_3) &&                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  113|      4|#define SNMP_VERSION_3     3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (229:6): [True: 4, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  230|      4|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|      4|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (230:6): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  |  |  231|      4|                            NETSNMP_DS_LIB_DISABLE_V3))
  |  |  |  |  ------------------
  |  |  |  |  |  |  105|      4|#define NETSNMP_DS_LIB_DISABLE_V3          45 /* disable SNMPv3 */
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2953|      0|        DEBUGMSGTL(("snmp_send", "build packet (version 0x%02x disabled)\n",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2954|      0|                    (u_int)pdu->version));
 2955|      0|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  231|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 2956|      0|        return -1;
 2957|      0|    }
 2958|       |
 2959|      4|    session->s_snmp_errno = 0;
 2960|      4|    session->s_errno = 0;
 2961|       |
 2962|      4|#ifdef NETSNMP_USE_REVERSE_ASNENCODING
 2963|      4|    if ((pdu->flags & UCD_MSG_FLAG_BULK_TOOBIG) ||
  ------------------
  |  |  321|      4|#define UCD_MSG_FLAG_BULK_TOOBIG          0x010000
  ------------------
  |  Branch (2963:9): [True: 0, False: 4]
  ------------------
 2964|      4|        (0 == netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      4|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (2964:9): [True: 0, False: 4]
  ------------------
 2965|      4|                                     NETSNMP_DS_LIB_REVERSE_ENCODE))) {
  ------------------
  |  |   80|      4|#define NETSNMP_DS_LIB_REVERSE_ENCODE      20   /* encode packets from back to front */
  ------------------
 2966|      0|        pdu->flags |= UCD_MSG_FLAG_FORWARD_ENCODE;
  ------------------
  |  |  319|      0|#define UCD_MSG_FLAG_FORWARD_ENCODE         0x8000
  ------------------
 2967|      0|    }
 2968|      4|#endif /* NETSNMP_USE_REVERSE_ASNENCODING */
 2969|       |
 2970|      4|    if (pdu->version == SNMP_VERSION_3) {
  ------------------
  |  |  113|      4|#define SNMP_VERSION_3     3
  ------------------
  |  Branch (2970:9): [True: 4, False: 0]
  ------------------
 2971|      4|        return snmpv3_build(pkt, pkt_len, offset, session, pdu);
 2972|      4|    }
 2973|       |
 2974|      0|    switch (pdu->command) {
 2975|      0|    case 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
  |  |  ------------------
  ------------------
  |  Branch (2975:5): [True: 0, False: 0]
  ------------------
 2976|      0|        netsnmp_assert(0 == (pdu->flags & UCD_MSG_FLAG_EXPECT_RESPONSE));
  ------------------
  |  |   47|      0|#      define netsnmp_assert(x)  do { \
  |  |   48|      0|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 0, False: 0]
  |  |  ------------------
  |  |   49|      0|                 ; \
  |  |   50|      0|              else \
  |  |   51|      0|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2977|      0|#ifndef NETSNMP_NOTIFY_ONLY
 2978|      0|        NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2408|      0|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 2979|      0|    case SNMP_MSG_GET:
  ------------------
  |  |  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 (2979:5): [True: 0, False: 0]
  ------------------
 2980|      0|    case SNMP_MSG_GETNEXT:
  ------------------
  |  |  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 (2980:5): [True: 0, False: 0]
  ------------------
 2981|      0|        NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2408|      0|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 2982|      0|#endif /* ! NETSNMP_NOTIFY_ONLY */
 2983|      0|#ifndef NETSNMP_NO_WRITE_SUPPORT
 2984|      0|    case SNMP_MSG_SET:
  ------------------
  |  |  129|      0|#define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2984:5): [True: 0, False: 0]
  ------------------
 2985|      0|#endif /* !NETSNMP_NO_WRITE_SUPPORT */
 2986|       |        /*
 2987|       |         * all versions support these PDU types 
 2988|       |         */
 2989|       |        /*
 2990|       |         * initialize defaulted PDU fields 
 2991|       |         */
 2992|       |
 2993|      0|        if (pdu->errstat == SNMP_DEFAULT_ERRSTAT)
  ------------------
  |  |  117|      0|#define SNMP_DEFAULT_ERRSTAT	    -1
  ------------------
  |  Branch (2993:13): [True: 0, False: 0]
  ------------------
 2994|      0|            pdu->errstat = 0;
 2995|      0|        if (pdu->errindex == SNMP_DEFAULT_ERRINDEX)
  ------------------
  |  |  118|      0|#define SNMP_DEFAULT_ERRINDEX	    -1
  ------------------
  |  Branch (2995:13): [True: 0, False: 0]
  ------------------
 2996|      0|            pdu->errindex = 0;
 2997|      0|        break;
 2998|       |
 2999|      0|    case SNMP_MSG_TRAP2:
  ------------------
  |  |  142|      0|#define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2999:5): [True: 0, False: 0]
  ------------------
 3000|      0|        netsnmp_assert(0 == (pdu->flags & UCD_MSG_FLAG_EXPECT_RESPONSE));
  ------------------
  |  |   47|      0|#      define netsnmp_assert(x)  do { \
  |  |   48|      0|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 0, False: 0]
  |  |  ------------------
  |  |   49|      0|                 ; \
  |  |   50|      0|              else \
  |  |   51|      0|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3001|      0|        NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2408|      0|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 3002|      0|    case SNMP_MSG_INFORM:
  ------------------
  |  |  141|      0|#define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (3002:5): [True: 0, False: 0]
  ------------------
 3003|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 3004|       |        /*
 3005|       |         * not supported in SNMPv1 and SNMPsec 
 3006|       |         */
 3007|      0|        if (pdu->version == SNMP_VERSION_1) {
  ------------------
  |  |  107|      0|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (3007:13): [True: 0, False: 0]
  ------------------
 3008|      0|            session->s_snmp_errno = SNMPERR_V2_IN_V1;
  ------------------
  |  |  224|      0|#define SNMPERR_V2_IN_V1		(-7)
  ------------------
 3009|      0|            return -1;
 3010|      0|        }
 3011|      0|#endif
 3012|      0|        if (pdu->errstat == SNMP_DEFAULT_ERRSTAT)
  ------------------
  |  |  117|      0|#define SNMP_DEFAULT_ERRSTAT	    -1
  ------------------
  |  Branch (3012:13): [True: 0, False: 0]
  ------------------
 3013|      0|            pdu->errstat = 0;
 3014|      0|        if (pdu->errindex == SNMP_DEFAULT_ERRINDEX)
  ------------------
  |  |  118|      0|#define SNMP_DEFAULT_ERRINDEX	    -1
  ------------------
  |  Branch (3014:13): [True: 0, False: 0]
  ------------------
 3015|      0|            pdu->errindex = 0;
 3016|      0|        break;
 3017|       |
 3018|      0|#ifndef NETSNMP_NOTIFY_ONLY
 3019|      0|    case SNMP_MSG_GETBULK:
  ------------------
  |  |  140|      0|#define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (3019:5): [True: 0, False: 0]
  ------------------
 3020|       |        /*
 3021|       |         * not supported in SNMPv1 and SNMPsec 
 3022|       |         */
 3023|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 3024|      0|        if (pdu->version == SNMP_VERSION_1) {
  ------------------
  |  |  107|      0|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (3024:13): [True: 0, False: 0]
  ------------------
 3025|      0|            session->s_snmp_errno = SNMPERR_V2_IN_V1;
  ------------------
  |  |  224|      0|#define SNMPERR_V2_IN_V1		(-7)
  ------------------
 3026|      0|            return -1;
 3027|      0|        }
 3028|      0|#endif
 3029|      0|        if (pdu->max_repetitions < 0) {
  ------------------
  |  |  147|      0|#define max_repetitions errindex
  ------------------
  |  Branch (3029:13): [True: 0, False: 0]
  ------------------
 3030|      0|            session->s_snmp_errno = SNMPERR_BAD_REPETITIONS;
  ------------------
  |  |  227|      0|#define SNMPERR_BAD_REPETITIONS		(-10)
  ------------------
 3031|      0|            return -1;
 3032|      0|        }
 3033|      0|        if (pdu->non_repeaters < 0) {
  ------------------
  |  |  146|      0|#define non_repeaters	errstat
  ------------------
  |  Branch (3033:13): [True: 0, False: 0]
  ------------------
 3034|      0|            session->s_snmp_errno = SNMPERR_BAD_REPEATERS;
  ------------------
  |  |  226|      0|#define SNMPERR_BAD_REPEATERS		(-9)
  ------------------
 3035|      0|            return -1;
 3036|      0|        }
 3037|      0|        break;
 3038|      0|#endif /* ! NETSNMP_NOTIFY_ONLY */
 3039|       |
 3040|      0|    case SNMP_MSG_TRAP:
  ------------------
  |  |  135|      0|#define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (3040:5): [True: 0, False: 0]
  ------------------
 3041|       |        /*
 3042|       |         * *only* supported in SNMPv1 and SNMPsec 
 3043|       |         */
 3044|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 3045|      0|        if (pdu->version != SNMP_VERSION_1) {
  ------------------
  |  |  107|      0|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (3045:13): [True: 0, False: 0]
  ------------------
 3046|      0|            session->s_snmp_errno = SNMPERR_V1_IN_V2;
  ------------------
  |  |  225|      0|#define SNMPERR_V1_IN_V2		(-8)
  ------------------
 3047|      0|            return -1;
 3048|      0|        }
 3049|      0|#endif
 3050|       |        /*
 3051|       |         * initialize defaulted Trap PDU fields 
 3052|       |         */
 3053|      0|        pdu->reqid = 1;         /* give a bogus non-error reqid for traps */
 3054|      0|        if (pdu->enterprise_length == SNMP_DEFAULT_ENTERPRISE_LENGTH) {
  ------------------
  |  |  121|      0|#define SNMP_DEFAULT_ENTERPRISE_LENGTH	0
  ------------------
  |  Branch (3054:13): [True: 0, False: 0]
  ------------------
 3055|      0|            pdu->enterprise = netsnmp_memdup(DEFAULT_ENTERPRISE,
  ------------------
  |  |  188|      0|#define DEFAULT_ENTERPRISE  default_enterprise
  ------------------
 3056|      0|                                             sizeof(DEFAULT_ENTERPRISE));
  ------------------
  |  |  188|      0|#define DEFAULT_ENTERPRISE  default_enterprise
  ------------------
 3057|      0|            if (pdu->enterprise == NULL) {
  ------------------
  |  Branch (3057:17): [True: 0, False: 0]
  ------------------
 3058|      0|                session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 3059|      0|                return -1;
 3060|      0|            }
 3061|      0|            pdu->enterprise_length =
 3062|      0|                OID_LENGTH(DEFAULT_ENTERPRISE);
  ------------------
  |  |   64|      0|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|      0|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
 3063|      0|        }
 3064|      0|        if (pdu->time == SNMP_DEFAULT_TIME)
  ------------------
  |  |  122|      0|#define SNMP_DEFAULT_TIME	    0
  ------------------
  |  Branch (3064:13): [True: 0, False: 0]
  ------------------
 3065|      0|            pdu->time = DEFAULT_TIME;
  ------------------
  |  |  189|      0|#define DEFAULT_TIME	    0
  ------------------
 3066|       |        /*
 3067|       |         * don't expect a response 
 3068|       |         */
 3069|      0|        pdu->flags &= (~UCD_MSG_FLAG_EXPECT_RESPONSE);
  ------------------
  |  |  312|      0|#define UCD_MSG_FLAG_EXPECT_RESPONSE         0x200
  ------------------
 3070|      0|        break;
 3071|       |
 3072|      0|    case SNMP_MSG_REPORT:      /* SNMPv3 only */
  ------------------
  |  |  147|      0|#define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (3072:5): [True: 0, False: 0]
  ------------------
 3073|      0|    default:
  ------------------
  |  Branch (3073:5): [True: 0, False: 0]
  ------------------
 3074|      0|        session->s_snmp_errno = SNMPERR_UNKNOWN_PDU;
  ------------------
  |  |  240|      0|#define SNMPERR_UNKNOWN_PDU		(-23)
  ------------------
 3075|      0|        return -1;
 3076|      0|    }
 3077|       |
 3078|       |    /*
 3079|       |     * save length 
 3080|       |     */
 3081|      0|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 3082|      0|    length = *pkt_len;
 3083|      0|#endif
 3084|       |
 3085|       |    /*
 3086|       |     * setup administrative fields based on version 
 3087|       |     */
 3088|       |    /*
 3089|       |     * build the message wrapper and all the administrative fields
 3090|       |     * upto the PDU sequence
 3091|       |     * (note that actual length of message will be inserted later) 
 3092|       |     */
 3093|      0|    switch (pdu->version) {
 3094|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 3095|      0|    case SNMP_VERSION_1:
  ------------------
  |  |  107|      0|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (3095:5): [True: 0, False: 0]
  ------------------
 3096|      0|#endif
 3097|      0|#ifndef NETSNMP_DISABLE_SNMPV2C
 3098|      0|    case SNMP_VERSION_2c:
  ------------------
  |  |  110|      0|#define SNMP_VERSION_2c    1
  ------------------
  |  Branch (3098:5): [True: 0, False: 0]
  ------------------
 3099|      0|#endif
 3100|      0|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 3101|       |#ifdef NETSNMP_NO_ZEROLENGTH_COMMUNITY
 3102|       |        if (pdu->community_len == 0) {
 3103|       |            if (session->community_len == 0) {
 3104|       |                session->s_snmp_errno = SNMPERR_BAD_COMMUNITY;
 3105|       |                return -1;
 3106|       |            }
 3107|       |            pdu->community = netsnmp_memdup(session->community,
 3108|       |                                            session->community_len);
 3109|       |            if (pdu->community == NULL) {
 3110|       |                session->s_snmp_errno = SNMPERR_MALLOC;
 3111|       |                return -1;
 3112|       |            }
 3113|       |            pdu->community_len = session->community_len;
 3114|       |        }
 3115|       |#else                           /* !NETSNMP_NO_ZEROLENGTH_COMMUNITY */
 3116|      0|        if (pdu->community_len == 0 && pdu->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
  |  |  ------------------
  ------------------
  |  Branch (3116:13): [True: 0, False: 0]
  |  Branch (3116:40): [True: 0, False: 0]
  ------------------
 3117|       |            /*
 3118|       |             * copy session community exactly to pdu community 
 3119|       |             */
 3120|      0|            if (0 == session->community_len) {
  ------------------
  |  Branch (3120:17): [True: 0, False: 0]
  ------------------
 3121|      0|                SNMP_FREE(pdu->community);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3122|      0|            } else if (pdu->community_len == session->community_len) {
  ------------------
  |  Branch (3122:24): [True: 0, False: 0]
  ------------------
 3123|      0|                memmove(pdu->community,
 3124|      0|                        session->community, session->community_len);
 3125|      0|            } else {
 3126|      0|                SNMP_FREE(pdu->community);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3127|      0|                pdu->community = netsnmp_memdup(session->community,
 3128|      0|                                                session->community_len);
 3129|      0|                if (pdu->community == NULL) {
  ------------------
  |  Branch (3129:21): [True: 0, False: 0]
  ------------------
 3130|      0|                    session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 3131|      0|                    return -1;
 3132|      0|                }
 3133|      0|            }
 3134|      0|            pdu->community_len = session->community_len;
 3135|      0|        }
 3136|      0|#endif                          /* !NETSNMP_NO_ZEROLENGTH_COMMUNITY */
 3137|       |
 3138|      0|        DEBUGMSGTL(("snmp_send", "Building SNMPv%ld message...\n",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3139|      0|                    (1 + pdu->version)));
 3140|      0|#ifdef NETSNMP_USE_REVERSE_ASNENCODING
 3141|      0|        if (!(pdu->flags & UCD_MSG_FLAG_FORWARD_ENCODE)) {
  ------------------
  |  |  319|      0|#define UCD_MSG_FLAG_FORWARD_ENCODE         0x8000
  ------------------
  |  Branch (3141:13): [True: 0, False: 0]
  ------------------
 3142|      0|            DEBUGPRINTPDUTYPE("send", pdu->command);
  ------------------
  |  |  418|      0|    DEBUGDUMPSECTION(token, snmp_pdu_type(type))
  |  |  ------------------
  |  |  |  |   81|      0|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (81:56): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3143|      0|            rc = snmp_pdu_realloc_rbuild(pkt, pkt_len, offset, pdu);
 3144|      0|            if (rc == 0) {
  ------------------
  |  Branch (3144:17): [True: 0, False: 0]
  ------------------
 3145|      0|                return -1;
 3146|      0|            }
 3147|       |
 3148|      0|            DEBUGDUMPHEADER("send", "Community String");
  ------------------
  |  |   79|      0|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3149|      0|            rc = asn_realloc_rbuild_string(pkt, pkt_len, offset, 1,
 3150|      0|                                           (u_char) (ASN_UNIVERSAL |
  ------------------
  |  |   90|      0|#define ASN_UNIVERSAL	    0x00U
  ------------------
 3151|      0|                                                     ASN_PRIMITIVE |
  ------------------
  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3152|      0|                                                     ASN_OCTET_STR),
  ------------------
  |  |   78|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
 3153|      0|                                           pdu->community,
 3154|      0|                                           pdu->community_len);
 3155|      0|            DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3156|      0|            if (rc == 0) {
  ------------------
  |  Branch (3156:17): [True: 0, False: 0]
  ------------------
 3157|      0|                return -1;
 3158|      0|            }
 3159|       |
 3160|       |
 3161|       |            /*
 3162|       |             * Store the version field.  
 3163|       |             */
 3164|      0|            DEBUGDUMPHEADER("send", "SNMP Version Number");
  ------------------
  |  |   79|      0|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3165|       |
 3166|      0|            version = pdu->version;
 3167|      0|            rc = asn_realloc_rbuild_int(pkt, pkt_len, offset, 1,
 3168|      0|                                        (u_char) (ASN_UNIVERSAL |
  ------------------
  |  |   90|      0|#define ASN_UNIVERSAL	    0x00U
  ------------------
 3169|      0|                                                  ASN_PRIMITIVE |
  ------------------
  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3170|      0|                                                  ASN_INTEGER),
  ------------------
  |  |   75|      0|#define ASN_INTEGER	    0x02U
  ------------------
 3171|      0|                                        (long *) &version,
 3172|      0|                                        sizeof(version));
 3173|      0|            DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3174|      0|            if (rc == 0) {
  ------------------
  |  Branch (3174:17): [True: 0, False: 0]
  ------------------
 3175|      0|                return -1;
 3176|      0|            }
 3177|       |
 3178|       |            /*
 3179|       |             * Build the final sequence.  
 3180|       |             */
 3181|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 3182|      0|            if (pdu->version == SNMP_VERSION_1) {
  ------------------
  |  |  107|      0|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (3182:17): [True: 0, False: 0]
  ------------------
 3183|      0|                DEBUGDUMPSECTION("send", "SNMPv1 Message");
  ------------------
  |  |   81|      0|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3184|      0|            } else {
 3185|      0|#endif
 3186|      0|                DEBUGDUMPSECTION("send", "SNMPv2c Message");
  ------------------
  |  |   81|      0|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3187|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 3188|      0|            }
 3189|      0|#endif
 3190|      0|            rc = asn_realloc_rbuild_sequence(pkt, pkt_len, offset, 1,
 3191|      0|                                             (u_char) (ASN_SEQUENCE |
  ------------------
  |  |   84|      0|#define ASN_SEQUENCE	    0x10U
  ------------------
 3192|      0|                                                       ASN_CONSTRUCTOR),
  ------------------
  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3193|      0|                                             *offset - start_offset);
 3194|      0|            DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3195|       |
 3196|      0|            if (rc == 0) {
  ------------------
  |  Branch (3196:17): [True: 0, False: 0]
  ------------------
 3197|      0|                return -1;
 3198|      0|            }
 3199|      0|            return 0;
 3200|      0|        } else {
 3201|       |
 3202|      0|#endif                          /* NETSNMP_USE_REVERSE_ASNENCODING */
 3203|       |            /*
 3204|       |             * Save current location and build SEQUENCE tag and length
 3205|       |             * placeholder for SNMP message sequence
 3206|       |             * (actual length will be inserted later) 
 3207|       |             */
 3208|      0|            cp = asn_build_sequence(*pkt, pkt_len,
 3209|      0|                                    (u_char) (ASN_SEQUENCE |
  ------------------
  |  |   84|      0|#define ASN_SEQUENCE	    0x10U
  ------------------
 3210|      0|                                              ASN_CONSTRUCTOR), 0);
  ------------------
  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3211|      0|            if (cp == NULL) {
  ------------------
  |  Branch (3211:17): [True: 0, False: 0]
  ------------------
 3212|      0|                return -1;
 3213|      0|            }
 3214|      0|            h0e = cp;
 3215|       |
 3216|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 3217|      0|            if (pdu->version == SNMP_VERSION_1) {
  ------------------
  |  |  107|      0|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (3217:17): [True: 0, False: 0]
  ------------------
 3218|      0|                DEBUGDUMPSECTION("send", "SNMPv1 Message");
  ------------------
  |  |   81|      0|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3219|      0|            } else {
 3220|      0|#endif
 3221|      0|                DEBUGDUMPSECTION("send", "SNMPv2c Message");
  ------------------
  |  |   81|      0|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3222|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 3223|      0|            }
 3224|      0|#endif
 3225|       |
 3226|       |            /*
 3227|       |             * store the version field 
 3228|       |             */
 3229|      0|            DEBUGDUMPHEADER("send", "SNMP Version Number");
  ------------------
  |  |   79|      0|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3230|       |
 3231|      0|            version = pdu->version;
 3232|      0|            cp = asn_build_int(cp, pkt_len,
 3233|      0|                               (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   90|      0|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                             (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3234|      0|                                         ASN_INTEGER), (long *) &version,
  ------------------
  |  |   75|      0|#define ASN_INTEGER	    0x02U
  ------------------
 3235|      0|                               sizeof(version));
 3236|      0|            DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3237|      0|            if (cp == NULL)
  ------------------
  |  Branch (3237:17): [True: 0, False: 0]
  ------------------
 3238|      0|                return -1;
 3239|       |
 3240|       |            /*
 3241|       |             * store the community string 
 3242|       |             */
 3243|      0|            DEBUGDUMPHEADER("send", "Community String");
  ------------------
  |  |   79|      0|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3244|      0|            cp = asn_build_string(cp, pkt_len,
 3245|      0|                                  (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   90|      0|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3246|      0|                                            ASN_OCTET_STR), pdu->community,
  ------------------
  |  |   78|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
 3247|      0|                                  pdu->community_len);
 3248|      0|            DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3249|      0|            if (cp == NULL)
  ------------------
  |  Branch (3249:17): [True: 0, False: 0]
  ------------------
 3250|      0|                return -1;
 3251|      0|            break;
 3252|       |
 3253|      0|#ifdef NETSNMP_USE_REVERSE_ASNENCODING
 3254|      0|        }
 3255|      0|#endif                          /* NETSNMP_USE_REVERSE_ASNENCODING */
 3256|      0|        break;
 3257|      0|#endif /* support for community based SNMP */
 3258|      0|    case SNMP_VERSION_2p:
  ------------------
  |  |  119|      0|#define SNMP_VERSION_2p	   129  /* no longer supported by this code (> 4.0) */
  ------------------
  |  Branch (3258:5): [True: 0, False: 0]
  ------------------
 3259|      0|    case SNMP_VERSION_sec:
  ------------------
  |  |  118|      0|#define SNMP_VERSION_sec   128  /* not (will never be) supported by this code */
  ------------------
  |  Branch (3259:5): [True: 0, False: 0]
  ------------------
 3260|      0|    case SNMP_VERSION_2u:
  ------------------
  |  |  112|      0|#define SNMP_VERSION_2u    2    /* not (will never be) supported by this code */
  ------------------
  |  Branch (3260:5): [True: 0, False: 0]
  ------------------
 3261|      0|    case SNMP_VERSION_2star:
  ------------------
  |  |  120|      0|#define SNMP_VERSION_2star 130  /* not (will never be) supported by this code */
  ------------------
  |  Branch (3261:5): [True: 0, False: 0]
  ------------------
 3262|      0|    default:
  ------------------
  |  Branch (3262:5): [True: 0, False: 0]
  ------------------
 3263|      0|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  231|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 3264|      0|        return -1;
 3265|      0|    }
 3266|       |
 3267|      0|    DEBUGPRINTPDUTYPE("send", pdu->command);
  ------------------
  |  |  418|      0|    DEBUGDUMPSECTION(token, snmp_pdu_type(type))
  |  |  ------------------
  |  |  |  |   81|      0|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (81:56): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3268|      0|    cp = snmp_pdu_build(pdu, cp, pkt_len);
 3269|      0|    DEBUGINDENTADD(-4);         /* return from entire v1/v2c message */
  ------------------
  |  |   73|      0|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3270|      0|    if (cp == NULL)
  ------------------
  |  Branch (3270:9): [True: 0, False: 0]
  ------------------
 3271|      0|        return -1;
 3272|       |
 3273|       |    /*
 3274|       |     * insert the actual length of the message sequence 
 3275|       |     */
 3276|      0|    switch (pdu->version) {
 3277|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 3278|      0|    case SNMP_VERSION_1:
  ------------------
  |  |  107|      0|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (3278:5): [True: 0, False: 0]
  ------------------
 3279|      0|#endif
 3280|      0|#ifndef NETSNMP_DISABLE_SNMPV2C
 3281|      0|    case SNMP_VERSION_2c:
  ------------------
  |  |  110|      0|#define SNMP_VERSION_2c    1
  ------------------
  |  Branch (3281:5): [True: 0, False: 0]
  ------------------
 3282|      0|#endif
 3283|      0|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 3284|      0|        asn_build_sequence(*pkt, &length,
 3285|      0|                           (u_char) (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   84|      0|#define ASN_SEQUENCE	    0x10U
  ------------------
                                         (u_char) (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3286|      0|                           cp - h0e);
 3287|      0|        break;
 3288|      0|#endif /* support for community based SNMP */
 3289|       |
 3290|      0|    case SNMP_VERSION_2p:
  ------------------
  |  |  119|      0|#define SNMP_VERSION_2p	   129  /* no longer supported by this code (> 4.0) */
  ------------------
  |  Branch (3290:5): [True: 0, False: 0]
  ------------------
 3291|      0|    case SNMP_VERSION_sec:
  ------------------
  |  |  118|      0|#define SNMP_VERSION_sec   128  /* not (will never be) supported by this code */
  ------------------
  |  Branch (3291:5): [True: 0, False: 0]
  ------------------
 3292|      0|    case SNMP_VERSION_2u:
  ------------------
  |  |  112|      0|#define SNMP_VERSION_2u    2    /* not (will never be) supported by this code */
  ------------------
  |  Branch (3292:5): [True: 0, False: 0]
  ------------------
 3293|      0|    case SNMP_VERSION_2star:
  ------------------
  |  |  120|      0|#define SNMP_VERSION_2star 130  /* not (will never be) supported by this code */
  ------------------
  |  Branch (3293:5): [True: 0, False: 0]
  ------------------
 3294|      0|    default:
  ------------------
  |  Branch (3294:5): [True: 0, False: 0]
  ------------------
 3295|      0|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  231|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 3296|      0|        return -1;
 3297|      0|    }
 3298|      0|    *pkt_len = cp - *pkt;
 3299|      0|    return 0;
 3300|      0|}
snmp_api.c:snmpv3_build:
 2249|      4|{
 2250|      4|    int             ret;
 2251|       |
 2252|      4|    session->s_snmp_errno = 0;
 2253|      4|    session->s_errno = 0;
 2254|       |
 2255|       |    /*
 2256|       |     * do validation for PDU types 
 2257|       |     */
 2258|      4|    switch (pdu->command) {
 2259|      0|    case 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
  |  |  ------------------
  ------------------
  |  Branch (2259:5): [True: 0, False: 4]
  ------------------
 2260|      0|    case SNMP_MSG_TRAP2:
  ------------------
  |  |  142|      0|#define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2260:5): [True: 0, False: 4]
  ------------------
 2261|      4|    case SNMP_MSG_REPORT:
  ------------------
  |  |  147|      4|#define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   92|      4|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_REPORT     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x8) /* a8=168 */
  |  |  ------------------
  |  |  |  |   96|      4|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2261:5): [True: 4, False: 0]
  ------------------
 2262|      4|        netsnmp_assert(0 == (pdu->flags & UCD_MSG_FLAG_EXPECT_RESPONSE));
  ------------------
  |  |   47|      4|#      define netsnmp_assert(x)  do { \
  |  |   48|      4|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 4, False: 0]
  |  |  ------------------
  |  |   49|      4|                 ; \
  |  |   50|      4|              else \
  |  |   51|      4|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      4|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2263|      4|        NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2408|      4|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 2264|      4|    case SNMP_MSG_INFORM:
  ------------------
  |  |  141|      4|#define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   92|      4|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  ------------------
  |  |  |  |   96|      4|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2264:5): [True: 0, False: 4]
  ------------------
 2265|      4|#ifndef NETSNMP_NOTIFY_ONLY
 2266|      4|    case SNMP_MSG_GET:
  ------------------
  |  |  125|      4|#define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  ------------------
  |  |  |  |   92|      4|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  ------------------
  |  |  |  |   96|      4|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2266:5): [True: 0, False: 4]
  ------------------
 2267|      4|    case SNMP_MSG_GETNEXT:
  ------------------
  |  |  126|      4|#define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   92|      4|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  ------------------
  |  |  |  |   96|      4|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2267:5): [True: 0, False: 4]
  ------------------
 2268|      4|#endif /* ! NETSNMP_NOTIFY_ONLY */
 2269|      4|#ifndef NETSNMP_NO_WRITE_SUPPORT
 2270|      4|    case SNMP_MSG_SET:
  ------------------
  |  |  129|      4|#define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  ------------------
  |  |  |  |   92|      4|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  ------------------
  |  |  |  |   96|      4|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2270:5): [True: 0, False: 4]
  ------------------
 2271|      4|#endif /* !NETSNMP_NO_WRITE_SUPPORT */
 2272|      4|        if (pdu->errstat == SNMP_DEFAULT_ERRSTAT)
  ------------------
  |  |  117|      4|#define SNMP_DEFAULT_ERRSTAT	    -1
  ------------------
  |  Branch (2272:13): [True: 0, False: 4]
  ------------------
 2273|      0|            pdu->errstat = 0;
 2274|      4|        if (pdu->errindex == SNMP_DEFAULT_ERRINDEX)
  ------------------
  |  |  118|      4|#define SNMP_DEFAULT_ERRINDEX	    -1
  ------------------
  |  Branch (2274:13): [True: 0, False: 4]
  ------------------
 2275|      0|            pdu->errindex = 0;
 2276|      4|        break;
 2277|       |
 2278|      0|#ifndef NETSNMP_NOTIFY_ONLY
 2279|      0|    case SNMP_MSG_GETBULK:
  ------------------
  |  |  140|      0|#define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2279:5): [True: 0, False: 4]
  ------------------
 2280|      0|        if (pdu->max_repetitions < 0) {
  ------------------
  |  |  147|      0|#define max_repetitions errindex
  ------------------
  |  Branch (2280:13): [True: 0, False: 0]
  ------------------
 2281|      0|            session->s_snmp_errno = SNMPERR_BAD_REPETITIONS;
  ------------------
  |  |  227|      0|#define SNMPERR_BAD_REPETITIONS		(-10)
  ------------------
 2282|      0|            return -1;
 2283|      0|        }
 2284|      0|        if (pdu->non_repeaters < 0) {
  ------------------
  |  |  146|      0|#define non_repeaters	errstat
  ------------------
  |  Branch (2284:13): [True: 0, False: 0]
  ------------------
 2285|      0|            session->s_snmp_errno = SNMPERR_BAD_REPEATERS;
  ------------------
  |  |  226|      0|#define SNMPERR_BAD_REPEATERS		(-9)
  ------------------
 2286|      0|            return -1;
 2287|      0|        }
 2288|      0|        break;
 2289|      0|#endif /* ! NETSNMP_NOTIFY_ONLY */
 2290|       |
 2291|      0|    case SNMP_MSG_TRAP:
  ------------------
  |  |  135|      0|#define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP       (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x4) /* a4=164 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (2291:5): [True: 0, False: 4]
  ------------------
 2292|      0|        session->s_snmp_errno = SNMPERR_V1_IN_V2;
  ------------------
  |  |  225|      0|#define SNMPERR_V1_IN_V2		(-8)
  ------------------
 2293|      0|        return -1;
 2294|       |
 2295|      0|    default:
  ------------------
  |  Branch (2295:5): [True: 0, False: 4]
  ------------------
 2296|      0|        session->s_snmp_errno = SNMPERR_UNKNOWN_PDU;
  ------------------
  |  |  240|      0|#define SNMPERR_UNKNOWN_PDU		(-23)
  ------------------
 2297|      0|        return -1;
 2298|      4|    }
 2299|       |
 2300|       |    /* Do we need to set the session security engineid? */
 2301|      4|    if (pdu->securityEngineIDLen == 0) {
  ------------------
  |  Branch (2301:9): [True: 0, False: 4]
  ------------------
 2302|      0|        if (session->securityEngineIDLen) {
  ------------------
  |  Branch (2302:13): [True: 0, False: 0]
  ------------------
 2303|      0|            snmpv3_clone_engineID(&pdu->securityEngineID,
 2304|      0|                                  &pdu->securityEngineIDLen,
 2305|      0|                                  session->securityEngineID,
 2306|      0|                                  session->securityEngineIDLen);
 2307|      0|        }
 2308|      0|    }
 2309|       |    
 2310|       |    /* Do we need to set the session context engineid? */
 2311|      4|    if (pdu->contextEngineIDLen == 0) {
  ------------------
  |  Branch (2311:9): [True: 0, False: 4]
  ------------------
 2312|      0|        if (session->contextEngineIDLen) {
  ------------------
  |  Branch (2312:13): [True: 0, False: 0]
  ------------------
 2313|      0|            snmpv3_clone_engineID(&pdu->contextEngineID,
 2314|      0|                                  &pdu->contextEngineIDLen,
 2315|      0|                                  session->contextEngineID,
 2316|      0|                                  session->contextEngineIDLen);
 2317|      0|        } else if (pdu->securityEngineIDLen) {
  ------------------
  |  Branch (2317:20): [True: 0, False: 0]
  ------------------
 2318|      0|            snmpv3_clone_engineID(&pdu->contextEngineID,
 2319|      0|                                  &pdu->contextEngineIDLen,
 2320|      0|                                  pdu->securityEngineID,
 2321|      0|                                  pdu->securityEngineIDLen);
 2322|      0|        }
 2323|      0|    }
 2324|       |
 2325|      4|    if (pdu->contextName == NULL) {
  ------------------
  |  Branch (2325:9): [True: 0, False: 4]
  ------------------
 2326|      0|        if (!session->contextName) {
  ------------------
  |  Branch (2326:13): [True: 0, False: 0]
  ------------------
 2327|      0|            session->s_snmp_errno = SNMPERR_BAD_CONTEXT;
  ------------------
  |  |  234|      0|#define SNMPERR_BAD_CONTEXT		(-17)
  ------------------
 2328|      0|            return -1;
 2329|      0|        }
 2330|      0|        pdu->contextName = strdup(session->contextName);
 2331|      0|        if (pdu->contextName == NULL) {
  ------------------
  |  Branch (2331:13): [True: 0, False: 0]
  ------------------
 2332|      0|            session->s_snmp_errno = SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 2333|      0|            return -1;
 2334|      0|        }
 2335|      0|        pdu->contextNameLen = session->contextNameLen;
 2336|      0|    }
 2337|      4|    if (pdu->securityModel == SNMP_DEFAULT_SECMODEL) {
  ------------------
  |  |  124|      4|#define SNMP_DEFAULT_SECMODEL	    -1
  ------------------
  |  Branch (2337:9): [True: 0, False: 4]
  ------------------
 2338|      0|        pdu->securityModel = session->securityModel;
 2339|      0|        if (pdu->securityModel == SNMP_DEFAULT_SECMODEL) {
  ------------------
  |  |  124|      0|#define SNMP_DEFAULT_SECMODEL	    -1
  ------------------
  |  Branch (2339:13): [True: 0, False: 0]
  ------------------
 2340|      0|            pdu->securityModel = se_find_value_in_slist("snmp_secmods", netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SECMODEL));
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                          pdu->securityModel = se_find_value_in_slist("snmp_secmods", netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SECMODEL));
  ------------------
  |  |  161|      0|#define NETSNMP_DS_LIB_SECMODEL          10
  ------------------
 2341|       |            
 2342|      0|            if (pdu->securityModel <= 0) {
  ------------------
  |  Branch (2342:17): [True: 0, False: 0]
  ------------------
 2343|      0|                pdu->securityModel = SNMP_SEC_MODEL_USM;
  ------------------
  |  |  295|      0|#define SNMP_SEC_MODEL_USM		3
  ------------------
 2344|      0|            }
 2345|      0|        }
 2346|      0|    }
 2347|      4|    if (pdu->securityNameLen == 0 && pdu->securityName == NULL) {
  ------------------
  |  Branch (2347:9): [True: 0, False: 4]
  |  Branch (2347:38): [True: 0, False: 0]
  ------------------
 2348|      0|        if (session->securityModel != SNMP_SEC_MODEL_TSM &&
  ------------------
  |  |  296|      0|#define SNMP_SEC_MODEL_TSM              4
  ------------------
  |  Branch (2348:13): [True: 0, False: 0]
  ------------------
 2349|      0|            session->securityNameLen == 0) {
  ------------------
  |  Branch (2349:13): [True: 0, False: 0]
  ------------------
 2350|      0|            session->s_snmp_errno = SNMPERR_BAD_SEC_NAME;
  ------------------
  |  |  244|      0|#define SNMPERR_BAD_SEC_NAME 		(-27)
  ------------------
 2351|      0|            return -1;
 2352|      0|        }
 2353|      0|        if (session->securityName) {
  ------------------
  |  Branch (2353:13): [True: 0, False: 0]
  ------------------
 2354|      0|            pdu->securityName = strdup(session->securityName);
 2355|      0|            if (pdu->securityName == NULL) {
  ------------------
  |  Branch (2355:17): [True: 0, False: 0]
  ------------------
 2356|      0|                session->s_snmp_errno = SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 2357|      0|                return -1;
 2358|      0|            }
 2359|      0|            pdu->securityNameLen = session->securityNameLen;
 2360|      0|        } else {
 2361|      0|            pdu->securityName = strdup("");
 2362|      0|            session->securityName = strdup("");
 2363|      0|        }
 2364|      0|    }
 2365|      4|    if (pdu->securityLevel == 0) {
  ------------------
  |  Branch (2365:9): [True: 0, False: 4]
  ------------------
 2366|      0|        if (session->securityLevel == 0) {
  ------------------
  |  Branch (2366:13): [True: 0, False: 0]
  ------------------
 2367|      0|            session->s_snmp_errno = SNMPERR_BAD_SEC_LEVEL;
  ------------------
  |  |  245|      0|#define SNMPERR_BAD_SEC_LEVEL 		(-28)
  ------------------
 2368|      0|            return -1;
 2369|      0|        }
 2370|      0|        pdu->securityLevel = session->securityLevel;
 2371|      0|    }
 2372|      4|    DEBUGMSGTL(("snmp_build",
  ------------------
  |  |   66|      4|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2373|      4|                "Building SNMPv3 message (secName:\"%s\", secLevel:%s)...\n",
 2374|      4|                ((session->securityName) ? (char *) session->securityName :
 2375|      4|                 ((pdu->securityName) ? (char *) pdu->securityName :
 2376|      4|                  "ERROR: undefined")), secLevelName[pdu->securityLevel]));
 2377|       |
 2378|      4|    DEBUGDUMPSECTION("send", "SNMPv3 Message");
  ------------------
  |  |   81|      4|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2379|      4|#ifdef NETSNMP_USE_REVERSE_ASNENCODING
 2380|      4|    if (!(pdu->flags & UCD_MSG_FLAG_FORWARD_ENCODE)) {
  ------------------
  |  |  319|      4|#define UCD_MSG_FLAG_FORWARD_ENCODE         0x8000
  ------------------
  |  Branch (2380:9): [True: 4, False: 0]
  ------------------
 2381|      4|        ret = snmpv3_packet_realloc_rbuild(pkt, pkt_len, offset,
 2382|      4|                                           session, pdu, NULL, 0);
 2383|      4|    } else {
 2384|      0|#endif
 2385|      0|        ret = snmpv3_packet_build(session, pdu, *pkt, pkt_len, NULL, 0);
 2386|      0|#ifdef NETSNMP_USE_REVERSE_ASNENCODING
 2387|      0|    }
 2388|      4|#endif
 2389|      4|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2390|      4|    if (-1 != ret) {
  ------------------
  |  Branch (2390:9): [True: 4, False: 0]
  ------------------
 2391|      4|        session->s_snmp_errno = ret;
 2392|      4|    }
 2393|       |
 2394|      4|    return ret;
 2395|       |
 2396|      4|}                               /* end snmpv3_build() */
snmp_api.c:free_securityStateRef:
 4138|     87|{
 4139|     87|    struct snmp_secmod_def *sptr;
 4140|       |
 4141|     87|    if (!pdu->securityStateRef)
  ------------------
  |  Branch (4141:9): [True: 87, False: 0]
  ------------------
 4142|     87|        return;
 4143|       |
 4144|      0|    sptr = find_sec_mod(pdu->securityModel);
 4145|      0|    if (sptr) {
  ------------------
  |  Branch (4145:9): [True: 0, False: 0]
  ------------------
 4146|      0|        if (sptr->pdu_free_state_ref) {
  ------------------
  |  Branch (4146:13): [True: 0, False: 0]
  ------------------
 4147|      0|            (*sptr->pdu_free_state_ref) (pdu->securityStateRef);
 4148|      0|        } else {
 4149|      0|            snmp_log(LOG_ERR,
 4150|      0|                     "Security Model %d can't free state references\n",
 4151|      0|                     pdu->securityModel);
 4152|      0|	}
 4153|      0|    } else {
 4154|      0|	snmp_log(LOG_ERR,
 4155|      0|		 "Can't find security model to free ptr: %d\n",
 4156|      0|		 pdu->securityModel);
 4157|      0|    }
 4158|       |    pdu->securityStateRef = NULL;
 4159|      0|}
snmp_api.c:_snmp_parse:
 4364|     68|{
 4365|     68|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 4366|     68|    u_char          community[COMMUNITY_MAX_LEN];
 4367|     68|    size_t          community_length = COMMUNITY_MAX_LEN;
  ------------------
  |  |   41|     68|#define COMMUNITY_MAX_LEN	256
  ------------------
 4368|     68|#endif
 4369|     68|    int             result = -1;
 4370|       |
 4371|     68|    static const oid snmpEngineIDoid[]   = { 1,3,6,1,6,3,10,2,1,1,0};
 4372|     68|    static size_t   snmpEngineIDoid_len = 11;
 4373|       |
 4374|     68|    static char     ourEngineID[SNMP_SEC_PARAM_BUF_SIZE];
 4375|     68|    static size_t   ourEngineID_len = sizeof(ourEngineID);
 4376|       |
 4377|     68|    netsnmp_pdu    *pdu2 = NULL;
 4378|       |
 4379|     68|    session->s_snmp_errno = 0;
 4380|     68|    session->s_errno = 0;
 4381|       |
 4382|       |    /*
 4383|       |     * Ensure all incoming PDUs have a unique means of identification 
 4384|       |     * (This is not restricted to AgentX handling,
 4385|       |     * though that is where the need becomes visible)   
 4386|       |     */
 4387|     68|    pdu->transid = snmp_get_next_transid();
 4388|       |
 4389|     68|    if (session->version != SNMP_DEFAULT_VERSION) {
  ------------------
  |  |  123|     68|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  |  Branch (4389:9): [True: 0, False: 68]
  ------------------
 4390|      0|        pdu->version = session->version;
 4391|     68|    } else {
 4392|     68|        pdu->version = snmp_parse_version(data, length);
 4393|     68|    }
 4394|       |
 4395|     68|    switch (pdu->version) {
 4396|      0|#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
 4397|      0|#ifndef NETSNMP_DISABLE_SNMPV1
 4398|      3|    case SNMP_VERSION_1:
  ------------------
  |  |  107|      3|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (4398:5): [True: 3, False: 65]
  ------------------
 4399|      3|#endif
 4400|      3|#ifndef NETSNMP_DISABLE_SNMPV2C
 4401|      4|    case SNMP_VERSION_2c:
  ------------------
  |  |  110|      4|#define SNMP_VERSION_2c    1
  ------------------
  |  Branch (4401:5): [True: 1, False: 67]
  ------------------
 4402|      4|#endif
 4403|      4|        NETSNMP_RUNTIME_PROTOCOL_CHECK_V1V2(pdu->version,unsupported_version);
  ------------------
  |  |  220|      4|#define NETSNMP_RUNTIME_PROTOCOL_CHECK_V1V2(pc_ver, pc_target) do {    \
  |  |  221|      4|        if (NETSNMP_RUNTIME_PROTOCOL_SKIP_V1(pc_ver) ||                \
  |  |  ------------------
  |  |  |  |  205|      8|    ((pc_ver) == SNMP_VERSION_1 &&                                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |  107|      8|#define SNMP_VERSION_1	   0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (205:6): [True: 3, False: 1]
  |  |  |  |  ------------------
  |  |  |  |  206|      8|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|      3|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (206:6): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  |  |  207|      3|                            NETSNMP_DS_LIB_DISABLE_V1))
  |  |  |  |  ------------------
  |  |  |  |  |  |  103|      3|#define NETSNMP_DS_LIB_DISABLE_V1          43 /* disable SNMPv1 */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  222|      4|            NETSNMP_RUNTIME_PROTOCOL_SKIP_V2(pc_ver)) {                \
  |  |  ------------------
  |  |  |  |  215|      4|    ((pc_ver) == SNMP_VERSION_2c &&                                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  110|      8|#define SNMP_VERSION_2c    1
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (215:6): [True: 1, False: 3]
  |  |  |  |  ------------------
  |  |  |  |  216|      4|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                      \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (216:6): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  |  |  217|      1|                            NETSNMP_DS_LIB_DISABLE_V2c))
  |  |  |  |  ------------------
  |  |  |  |  |  |  104|      1|#define NETSNMP_DS_LIB_DISABLE_V2c         44 /* disable SNMPv2c */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  223|      0|            DEBUGMSGTL(("snmp:protocol:disabled", "enforced\n"));      \
  |  |  ------------------
  |  |  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  224|      0|            goto pc_target;                                            \
  |  |  225|      0|        }                                                              \
  |  |  226|      4|    } while(0)
  |  |  ------------------
  |  |  |  Branch (226:13): [Folded, False: 4]
  |  |  ------------------
  ------------------
 4404|      4|        DEBUGMSGTL(("snmp_api", "Parsing SNMPv%ld message...\n",
  ------------------
  |  |   66|      4|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 4]
  |  |  ------------------
  ------------------
 4405|      4|                    (1 + pdu->version)));
 4406|       |
 4407|       |        /*
 4408|       |         * authenticates message and returns length if valid 
 4409|       |         */
 4410|      4|#ifndef NETSNMP_DISABLE_SNMPV1
 4411|      4|        if (pdu->version == SNMP_VERSION_1) {
  ------------------
  |  |  107|      4|#define SNMP_VERSION_1	   0
  ------------------
  |  Branch (4411:13): [True: 3, False: 1]
  ------------------
 4412|      3|            DEBUGDUMPSECTION("recv", "SNMPv1 message\n");
  ------------------
  |  |   81|      3|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      3|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 3]
  |  |  ------------------
  ------------------
 4413|      3|        } else {
 4414|      1|#endif
 4415|      1|            DEBUGDUMPSECTION("recv", "SNMPv2c message\n");
  ------------------
  |  |   81|      1|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 1]
  |  |  ------------------
  ------------------
 4416|      1|#ifndef NETSNMP_DISABLE_SNMPV1
 4417|      1|        }
 4418|      4|#endif
 4419|      4|        data = snmp_comstr_parse(data, &length,
 4420|      4|                                 community, &community_length,
 4421|      4|                                 &pdu->version);
 4422|      4|        if (data == NULL)
  ------------------
  |  Branch (4422:13): [True: 2, False: 2]
  ------------------
 4423|      2|            return -1;
 4424|       |
 4425|      2|        if (pdu->version != session->version &&
  ------------------
  |  Branch (4425:13): [True: 2, False: 0]
  ------------------
 4426|      2|            session->version != SNMP_DEFAULT_VERSION) {
  ------------------
  |  |  123|      2|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
  |  Branch (4426:13): [True: 0, False: 2]
  ------------------
 4427|      0|            session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  231|      0|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 4428|      0|            return -1;
 4429|      0|        }
 4430|       |
 4431|       |        /*
 4432|       |         * maybe get the community string. 
 4433|       |         */
 4434|      2|        pdu->securityLevel = SNMP_SEC_LEVEL_NOAUTH;
  ------------------
  |  |  299|      2|#define SNMP_SEC_LEVEL_NOAUTH		1
  ------------------
 4435|      2|        pdu->securityModel = 
 4436|      2|#ifndef NETSNMP_DISABLE_SNMPV1
 4437|      2|            (pdu->version == SNMP_VERSION_1) ? SNMP_SEC_MODEL_SNMPv1 : 
  ------------------
  |  |  107|      2|#define SNMP_VERSION_1	   0
  ------------------
                          (pdu->version == SNMP_VERSION_1) ? SNMP_SEC_MODEL_SNMPv1 : 
  ------------------
  |  |  293|      2|#define SNMP_SEC_MODEL_SNMPv1		1
  ------------------
  |  Branch (4437:13): [True: 2, False: 0]
  ------------------
 4438|      2|#endif
 4439|      2|                                               SNMP_SEC_MODEL_SNMPv2c;
  ------------------
  |  |  294|      2|#define SNMP_SEC_MODEL_SNMPv2c		2
  ------------------
 4440|      2|        SNMP_FREE(pdu->community);
  ------------------
  |  |   62|      2|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 2]
  |  |  |  Branch (62:66): [Folded, False: 2]
  |  |  ------------------
  ------------------
 4441|      2|        pdu->community_len = 0;
 4442|      2|        pdu->community = (u_char *) 0;
 4443|      2|        if (community_length) {
  ------------------
  |  Branch (4443:13): [True: 0, False: 2]
  ------------------
 4444|      0|            pdu->community_len = community_length;
 4445|      0|            pdu->community = netsnmp_memdup(community, community_length);
 4446|      0|            if (pdu->community == NULL) {
  ------------------
  |  Branch (4446:17): [True: 0, False: 0]
  ------------------
 4447|      0|                session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 4448|      0|                return -1;
 4449|      0|            }
 4450|      0|        }
 4451|      2|        if (session->authenticator) {
  ------------------
  |  Branch (4451:13): [True: 0, False: 2]
  ------------------
 4452|      0|            data = session->authenticator(data, &length,
 4453|      0|                                          community, community_length);
 4454|      0|            if (data == NULL) {
  ------------------
  |  Branch (4454:17): [True: 0, False: 0]
  ------------------
 4455|      0|                session->s_snmp_errno = SNMPERR_AUTHENTICATION_FAILURE;
  ------------------
  |  |  252|      0|#define SNMPERR_AUTHENTICATION_FAILURE 	(-35)
  ------------------
 4456|      0|                return -1;
 4457|      0|            }
 4458|      0|        }
 4459|       |
 4460|      2|        DEBUGDUMPSECTION("recv", "PDU");
  ------------------
  |  |   81|      2|	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      2|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPSECTION(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  191|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  192|      0|        debugmsg("dumph_" token,"%s\n",x);\
  |  |  |  |  193|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (81:56): [Folded, False: 2]
  |  |  ------------------
  ------------------
 4461|      2|        result = snmp_pdu_parse(pdu, data, &length);
 4462|      2|        if (result < 0) {
  ------------------
  |  Branch (4462:13): [True: 2, False: 0]
  ------------------
 4463|       |            /*
 4464|       |             * This indicates a parse error.  
 4465|       |             */
 4466|      2|            snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      2|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4467|      2|        }
 4468|      2|        DEBUGINDENTADD(-6);
  ------------------
  |  |   73|      2|#define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      2|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTADD(x)  do {if (_DBG_IF_) {__DBGINDENTADD(x);} }while(0)
  |  |  ------------------
  |  |  |  |  172|      0|#define __DBGINDENTADD(x)  debug_indent_add(x)
  |  |  ------------------
  |  |  |  Branch (73:74): [Folded, False: 2]
  |  |  ------------------
  ------------------
 4469|      2|        break;
 4470|      0|#endif /* support for community based SNMP */
 4471|       |
 4472|     11|    case SNMP_VERSION_3:
  ------------------
  |  |  113|     11|#define SNMP_VERSION_3     3
  ------------------
  |  Branch (4472:5): [True: 11, False: 57]
  ------------------
 4473|     11|        NETSNMP_RUNTIME_PROTOCOL_CHECK_V3(SNMP_VERSION_3,unsupported_version);
  ------------------
  |  |  233|     11|#define NETSNMP_RUNTIME_PROTOCOL_CHECK_V3(pc_ver, pc_target) do {      \
  |  |  234|     11|        if (NETSNMP_RUNTIME_PROTOCOL_SKIP_V3(pc_ver)) {                \
  |  |  ------------------
  |  |  |  |  229|     11|    ((pc_ver == SNMP_VERSION_3) &&                                   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  113|     11|#define SNMP_VERSION_3     3
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (229:6): [True: 11, Folded]
  |  |  |  |  ------------------
  |  |  |  |  230|     11|     netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,                     \
  |  |  |  |  ------------------
  |  |  |  |  |  |   48|     11|#define NETSNMP_DS_LIBRARY_ID     0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (230:6): [True: 0, False: 11]
  |  |  |  |  ------------------
  |  |  |  |  231|     11|                            NETSNMP_DS_LIB_DISABLE_V3))
  |  |  |  |  ------------------
  |  |  |  |  |  |  105|     11|#define NETSNMP_DS_LIB_DISABLE_V3          45 /* disable SNMPv3 */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  235|      0|            DEBUGMSGTL(("snmp:protocol:disabled", "enforced\n"));      \
  |  |  ------------------
  |  |  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  236|      0|            goto pc_target;                                            \
  |  |  237|      0|        }                                                              \
  |  |  238|     11|    } while(0)
  |  |  ------------------
  |  |  |  Branch (238:13): [Folded, False: 11]
  |  |  ------------------
  ------------------
 4474|     11|        result = snmpv3_parse(pdu, data, &length, NULL, session);
 4475|     11|        DEBUGMSGTL(("snmp_parse",
  ------------------
  |  |   66|     11|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     11|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 11]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 11]
  |  |  ------------------
  ------------------
 4476|     11|                    "Parsed SNMPv3 message (secName:%s, secLevel:%s): %s\n",
 4477|     11|                    pdu->securityName, secLevelName[pdu->securityLevel],
 4478|     11|                    snmp_api_errstring(result)));
 4479|       |
 4480|     11|        if (result == SNMPERR_USM_UNKNOWNSECURITYNAME) {
  ------------------
  |  |  260|     11|#define SNMPERR_USM_UNKNOWNSECURITYNAME		(-43)
  ------------------
  |  Branch (4480:13): [True: 1, False: 10]
  ------------------
 4481|      1|            snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
  ------------------
  |  |   19|      1|#define SNMP_CALLBACK_APPLICATION 1
  ------------------
 4482|      1|                                SNMPD_CALLBACK_AUTH_FAILURE, pdu);
  ------------------
  |  |   21|      1|#define SNMPD_CALLBACK_AUTH_FAILURE             17
  ------------------
 4483|      1|        }
 4484|       |        
 4485|     11|        if (result) {
  ------------------
  |  Branch (4485:13): [True: 11, False: 0]
  ------------------
 4486|     11|            struct snmp_secmod_def *secmod =
 4487|     11|                find_sec_mod(pdu->securityModel);
 4488|     11|            if (!slp) {
  ------------------
  |  Branch (4488:17): [True: 0, False: 11]
  ------------------
 4489|      0|                session->s_snmp_errno = result;
 4490|     11|            } else {
 4491|       |                /*
 4492|       |                 * Call the security model to special handle any errors
 4493|       |                 */
 4494|       |
 4495|     11|                if (secmod && secmod->handle_report) {
  ------------------
  |  Branch (4495:21): [True: 4, False: 7]
  |  Branch (4495:31): [True: 4, False: 0]
  ------------------
 4496|      4|                    (*secmod->handle_report)(slp, slp->transport, session,
 4497|      4|                                             result, pdu);
 4498|      4|                }
 4499|     11|            }
 4500|     11|            free_securityStateRef(pdu);
 4501|     11|        }
 4502|       |
 4503|       |        /* Implement RFC5343 here for two reasons:
 4504|       |           1) From a security perspective it handles this otherwise
 4505|       |              always approved request earlier.  It bypasses the need
 4506|       |              for authorization to the snmpEngineID scalar, which is
 4507|       |              what is what RFC3415 appendix A species as ok.  Note
 4508|       |              that we haven't bypassed authentication since if there
 4509|       |              was an authentication error it would have been handled
 4510|       |              above in the if(result) part at the latest.
 4511|       |           2) From an application point of view if we let this request
 4512|       |              get all the way to the application, it'd require that
 4513|       |              all application types supporting discovery also fire up
 4514|       |              a minimal agent in order to handle just this request
 4515|       |              which seems like overkill.  Though there is no other
 4516|       |              application types that currently need discovery (NRs
 4517|       |              accept notifications from contextEngineIDs that derive
 4518|       |              from the NO not the NR).  Also a lame excuse for doing
 4519|       |              it here.
 4520|       |           3) Less important technically, but the net-snmp agent
 4521|       |              doesn't currently handle registrations of different
 4522|       |              engineIDs either and it would have been a lot more work
 4523|       |              to implement there since we'd need to support that
 4524|       |              first. :-/ Supporting multiple context engineIDs should
 4525|       |              be done anyway, so it's not a valid excuse here.
 4526|       |           4) There is a lot less to do if we trump the agent at this
 4527|       |              point; IE, the agent does a lot more unnecessary
 4528|       |              processing when the only thing that should ever be in
 4529|       |              this context by definition is the single scalar.
 4530|       |        */
 4531|       |
 4532|       |        /* special RFC5343 engineID discovery engineID check */
 4533|     11|        if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     11|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (4533:13): [True: 11, False: 0]
  ------------------
 4534|     11|                                    NETSNMP_DS_LIB_NO_DISCOVERY) &&
  ------------------
  |  |   98|     11|#define NETSNMP_DS_LIB_NO_DISCOVERY        38 /* don't support RFC5343 contextEngineID discovery */
  ------------------
 4535|     11|            SNMP_MSG_RESPONSE       != pdu->command &&
  ------------------
  |  |  127|     11|#define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   92|     11|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_RESPONSE   (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x2) /* a2=162 */
  |  |  ------------------
  |  |  |  |   96|     11|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (4535:13): [True: 11, False: 0]
  ------------------
 4536|     11|            NULL                    != pdu->contextEngineID &&
  ------------------
  |  Branch (4536:13): [True: 4, False: 7]
  ------------------
 4537|      4|            pdu->contextEngineIDLen == 5 &&
  ------------------
  |  Branch (4537:13): [True: 0, False: 4]
  ------------------
 4538|      0|            pdu->contextEngineID[0] == 0x80 &&
  ------------------
  |  Branch (4538:13): [True: 0, False: 0]
  ------------------
 4539|      0|            pdu->contextEngineID[1] == 0x00 &&
  ------------------
  |  Branch (4539:13): [True: 0, False: 0]
  ------------------
 4540|      0|            pdu->contextEngineID[2] == 0x00 &&
  ------------------
  |  Branch (4540:13): [True: 0, False: 0]
  ------------------
 4541|      0|            pdu->contextEngineID[3] == 0x00 &&
  ------------------
  |  Branch (4541:13): [True: 0, False: 0]
  ------------------
 4542|      0|            pdu->contextEngineID[4] == 0x06) {
  ------------------
  |  Branch (4542:13): [True: 0, False: 0]
  ------------------
 4543|       |
 4544|       |            /* define a result so it doesn't get past us at this point
 4545|       |               and gets dropped by future parts of the stack */
 4546|      0|            result = SNMPERR_JUST_A_CONTEXT_PROBE;
  ------------------
  |  |  283|      0|#define SNMPERR_JUST_A_CONTEXT_PROBE    (-66)
  ------------------
 4547|       |
 4548|      0|            DEBUGMSGTL(("snmpv3_contextid", "starting context ID discovery\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4549|       |            /* ensure exactly one variable */
 4550|      0|            if (NULL != pdu->variables &&
  ------------------
  |  Branch (4550:17): [True: 0, False: 0]
  ------------------
 4551|      0|                NULL == pdu->variables->next_variable &&
  ------------------
  |  Branch (4551:17): [True: 0, False: 0]
  ------------------
 4552|       |
 4553|       |                /* if it's a GET, match it exactly */
 4554|      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 (4554:19): [True: 0, False: 0]
  ------------------
 4555|      0|                  snmp_oid_compare(snmpEngineIDoid,
  ------------------
  |  Branch (4555:19): [True: 0, False: 0]
  ------------------
 4556|      0|                                   snmpEngineIDoid_len,
 4557|      0|                                   pdu->variables->name,
 4558|      0|                                   pdu->variables->name_length) == 0)
 4559|       |                 /* if it's a GETNEXT ensure it's less than the engineID oid */
 4560|      0|                 ||
 4561|      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 (4561:19): [True: 0, False: 0]
  ------------------
 4562|      0|                  snmp_oid_compare(snmpEngineIDoid,
  ------------------
  |  Branch (4562:19): [True: 0, False: 0]
  ------------------
 4563|      0|                                   snmpEngineIDoid_len,
 4564|      0|                                   pdu->variables->name,
 4565|      0|                                   pdu->variables->name_length) > 0)
 4566|      0|                    )) {
 4567|       |
 4568|      0|                DEBUGMSGTL(("snmpv3_contextid",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4569|      0|                            "  One correct variable found\n"));
 4570|       |
 4571|       |                /* Note: we're explicitly not handling a GETBULK.  Deal. */
 4572|       |
 4573|       |                /* set up the response */
 4574|      0|                pdu2 = snmp_clone_pdu(pdu);
 4575|       |
 4576|       |                /* free the current varbind */
 4577|      0|                snmp_free_varbind(pdu2->variables);
 4578|       |
 4579|       |                /* set the variables */
 4580|      0|                pdu2->variables = NULL;
 4581|      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
  |  |  ------------------
  ------------------
 4582|      0|                pdu2->errstat = 0;
 4583|      0|                pdu2->errindex = 0;
 4584|       |
 4585|      0|                ourEngineID_len =
 4586|      0|                    snmpv3_get_engineID((u_char*)ourEngineID, ourEngineID_len);
 4587|      0|                if (0 != ourEngineID_len) {
  ------------------
  |  Branch (4587:21): [True: 0, False: 0]
  ------------------
 4588|       |
 4589|      0|                    DEBUGMSGTL(("snmpv3_contextid",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4590|      0|                                "  responding with our engineID\n"));
 4591|       |
 4592|      0|                    snmp_pdu_add_variable(pdu2,
 4593|      0|                                          snmpEngineIDoid, snmpEngineIDoid_len,
 4594|      0|                                          ASN_OCTET_STR,
  ------------------
  |  |   78|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
 4595|      0|                                          ourEngineID, ourEngineID_len);
 4596|       |                    
 4597|       |                    /* send the response */
 4598|      0|                    if (0 == snmp_sess_send(slp, pdu2)) {
  ------------------
  |  Branch (4598:25): [True: 0, False: 0]
  ------------------
 4599|       |
 4600|      0|                        DEBUGMSGTL(("snmpv3_contextid",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4601|      0|                                    "  sent it off!\n"));
 4602|       |
 4603|      0|                        snmp_free_pdu(pdu2);
 4604|       |                        
 4605|      0|                        snmp_log(LOG_ERR, "sending a response to the context engineID probe failed\n");
 4606|      0|                    }
 4607|      0|                } else {
 4608|      0|                    snmp_log(LOG_ERR, "failed to get our own engineID!\n");
 4609|      0|                }
 4610|      0|            } else {
 4611|      0|                snmp_log(LOG_WARNING,
 4612|      0|                         "received an odd context engineID probe\n");
 4613|      0|            }
 4614|      0|        }
 4615|       |
 4616|     11|        break;
 4617|     50|    case SNMPERR_BAD_VERSION:
  ------------------
  |  |  231|     50|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
  |  Branch (4617:5): [True: 50, False: 18]
  ------------------
 4618|     50|        ERROR_MSG("error parsing snmp message version");
  ------------------
  |  |  188|     50|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4619|     50|        snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|     50|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4620|     50|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  231|     50|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 4621|     50|        break;
 4622|       |
 4623|      0|        unsupported_version:  /* goto label */
 4624|      0|    case SNMP_VERSION_sec:
  ------------------
  |  |  118|      0|#define SNMP_VERSION_sec   128  /* not (will never be) supported by this code */
  ------------------
  |  Branch (4624:5): [True: 0, False: 68]
  ------------------
 4625|      0|    case SNMP_VERSION_2u:
  ------------------
  |  |  112|      0|#define SNMP_VERSION_2u    2    /* not (will never be) supported by this code */
  ------------------
  |  Branch (4625:5): [True: 0, False: 68]
  ------------------
 4626|      0|    case SNMP_VERSION_2star:
  ------------------
  |  |  120|      0|#define SNMP_VERSION_2star 130  /* not (will never be) supported by this code */
  ------------------
  |  Branch (4626:5): [True: 0, False: 68]
  ------------------
 4627|      0|    case SNMP_VERSION_2p:
  ------------------
  |  |  119|      0|#define SNMP_VERSION_2p	   129  /* no longer supported by this code (> 4.0) */
  ------------------
  |  Branch (4627:5): [True: 0, False: 68]
  ------------------
 4628|      3|    default:
  ------------------
  |  Branch (4628:5): [True: 3, False: 65]
  ------------------
 4629|      3|        ERROR_MSG("unsupported snmp message version");
  ------------------
  |  |  188|      3|#define ERROR_MSG(string)	snmp_set_detail(string)
  ------------------
 4630|      3|        snmp_increment_statistic(STAT_SNMPINBADVERSIONS);
  ------------------
  |  |  667|      3|#define  STAT_SNMPINBADVERSIONS              11
  ------------------
 4631|       |
 4632|       |        /*
 4633|       |         * need better way to determine OS independent
 4634|       |         * INT32_MAX value, for now hardcode
 4635|       |         */
 4636|      3|        if (pdu->version < 0 || pdu->version > 2147483647) {
  ------------------
  |  Branch (4636:13): [True: 1, False: 2]
  |  Branch (4636:33): [True: 0, False: 2]
  ------------------
 4637|      1|            snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      1|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 4638|      1|        }
 4639|      3|        session->s_snmp_errno = SNMPERR_BAD_VERSION;
  ------------------
  |  |  231|      3|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 4640|      3|        break;
 4641|     68|    }
 4642|       |
 4643|     66|    return result;
 4644|     68|}
snmp_api.c:snmp_parse_version:
 3774|     68|{
 3775|     68|    u_char          type;
 3776|     68|    long            version = SNMPERR_BAD_VERSION;
  ------------------
  |  |  231|     68|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 3777|       |
 3778|     68|    data = asn_parse_sequence(data, &length, &type,
 3779|     68|                              (ASN_SEQUENCE | ASN_CONSTRUCTOR), "version");
  ------------------
  |  |   84|     68|#define ASN_SEQUENCE	    0x10U
  ------------------
                                            (ASN_SEQUENCE | ASN_CONSTRUCTOR), "version");
  ------------------
  |  |   96|     68|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 3780|     68|    if (data) {
  ------------------
  |  Branch (3780:9): [True: 20, False: 48]
  ------------------
 3781|     20|        DEBUGDUMPHEADER("recv", "SNMP Version");
  ------------------
  |  |   79|     20|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     20|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 20]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 20]
  |  |  ------------------
  ------------------
 3782|     20|        data =
 3783|     20|            asn_parse_int(data, &length, &type, &version, sizeof(version));
 3784|     20|        DEBUGINDENTLESS();
  ------------------
  |  |   75|     20|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|     20|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 20]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 20]
  |  |  ------------------
  ------------------
 3785|     20|        if (!data || type != ASN_INTEGER) {
  ------------------
  |  |   75|     18|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (3785:13): [True: 2, False: 18]
  |  Branch (3785:22): [True: 0, False: 18]
  ------------------
 3786|      2|            return SNMPERR_BAD_VERSION;
  ------------------
  |  |  231|      2|#define SNMPERR_BAD_VERSION		(-14)
  ------------------
 3787|      2|        }
 3788|     20|    }
 3789|     66|    return version;
 3790|     68|}
snmp_api.c:netsnmp_build_packet:
 5059|      4|{
 5060|      4|    size_t offset = 0;
 5061|      4|    int    result;
 5062|       |
 5063|      4|    if (isp && isp->hook_realloc_build) {
  ------------------
  |  Branch (5063:9): [True: 4, False: 0]
  |  Branch (5063:16): [True: 0, False: 4]
  ------------------
 5064|      0|        result = isp->hook_realloc_build(sp, pdu, pktbuf_p, pktbuf_len_p,
 5065|      0|                                         &offset);
 5066|       |
 5067|      0|        *pkt_p = *pktbuf_p;
 5068|      0|        *len_p = offset;
 5069|      4|    } else if (isp && isp->hook_build) {
  ------------------
  |  Branch (5069:16): [True: 4, False: 0]
  |  Branch (5069:23): [True: 0, False: 4]
  ------------------
 5070|      0|        *pkt_p = *pktbuf_p;
 5071|      0|        *len_p = *pktbuf_len_p;
 5072|      0|        result = isp->hook_build(sp, pdu, *pktbuf_p, len_p);
 5073|      4|    } else {
 5074|      4|#ifdef NETSNMP_USE_REVERSE_ASNENCODING
 5075|      4|        if (!(pdu->flags & UCD_MSG_FLAG_FORWARD_ENCODE)) {
  ------------------
  |  |  319|      4|#define UCD_MSG_FLAG_FORWARD_ENCODE         0x8000
  ------------------
  |  Branch (5075:13): [True: 4, False: 0]
  ------------------
 5076|      4|            result = snmp_build(pktbuf_p, pktbuf_len_p, &offset, sp, pdu);
 5077|      4|            *pkt_p = *pktbuf_p + *pktbuf_len_p - offset;
 5078|      4|            *len_p = offset;
 5079|      4|        } else {
 5080|      0|#endif
 5081|      0|            *pkt_p = *pktbuf_p;
 5082|      0|            *len_p = *pktbuf_len_p;
 5083|      0|            result = snmp_build(pktbuf_p, len_p, &offset, sp, pdu);
 5084|      0|#ifdef NETSNMP_USE_REVERSE_ASNENCODING
 5085|      0|        }
 5086|      4|#endif
 5087|      4|    }
 5088|       |
 5089|      4|    return result;
 5090|      4|}
snmp_api.c:_sess_async_send:
 5373|      4|{
 5374|      4|    netsnmp_session *session;
 5375|      4|    struct snmp_internal_session *isp;
 5376|      4|    netsnmp_transport *transport = NULL;
 5377|      4|    int             result;
 5378|      4|    long            reqid;
 5379|       |
 5380|      4|    if (slp == NULL || NULL == slp->session || NULL ==slp->internal ||
  ------------------
  |  Branch (5380:9): [True: 0, False: 4]
  |  Branch (5380:24): [True: 0, False: 4]
  |  Branch (5380:48): [True: 0, False: 4]
  ------------------
 5381|      4|                NULL == slp->transport) {
  ------------------
  |  Branch (5381:17): [True: 0, False: 4]
  ------------------
 5382|      0|        return 0;
 5383|      0|    }
 5384|       |
 5385|      4|    session = slp->session;
 5386|      4|    isp = slp->internal;
 5387|      4|    transport = slp->transport;
 5388|       |
 5389|      4|    if (NULL == isp->opacket) {
  ------------------
  |  Branch (5389:9): [True: 4, False: 0]
  ------------------
 5390|      4|        result = _build_initial_pdu_packet(slp, pdu, 0);
 5391|      4|        if ((SNMPERR_SUCCESS != result) || (NULL == isp->opacket)) {
  ------------------
  |  |  217|      4|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (5391:13): [True: 0, False: 4]
  |  Branch (5391:44): [True: 0, False: 4]
  ------------------
 5392|      0|            if (callback) {
  ------------------
  |  Branch (5392:17): [True: 0, False: 0]
  ------------------
 5393|      0|                switch (session->s_snmp_errno) {
 5394|       |                    /*
 5395|       |                     * some of these probably don't make sense here, but
 5396|       |                     * it's a rough first cut.
 5397|       |                     */
 5398|      0|                    case SNMPERR_BAD_ENG_ID:
  ------------------
  |  |  243|      0|#define SNMPERR_BAD_ENG_ID 		(-26)
  ------------------
  |  Branch (5398:21): [True: 0, False: 0]
  ------------------
 5399|      0|                    case SNMPERR_BAD_SEC_LEVEL:
  ------------------
  |  |  245|      0|#define SNMPERR_BAD_SEC_LEVEL 		(-28)
  ------------------
  |  Branch (5399:21): [True: 0, False: 0]
  ------------------
 5400|      0|                    case SNMPERR_UNKNOWN_SEC_MODEL:
  ------------------
  |  |  247|      0|#define SNMPERR_UNKNOWN_SEC_MODEL 	(-30)
  ------------------
  |  Branch (5400:21): [True: 0, False: 0]
  ------------------
 5401|      0|                    case SNMPERR_UNKNOWN_ENG_ID:
  ------------------
  |  |  249|      0|#define SNMPERR_UNKNOWN_ENG_ID          (-32)
  ------------------
  |  Branch (5401:21): [True: 0, False: 0]
  ------------------
 5402|      0|                    case SNMPERR_UNKNOWN_USER_NAME:
  ------------------
  |  |  250|      0|#define SNMPERR_UNKNOWN_USER_NAME 	(-33)
  ------------------
  |  Branch (5402:21): [True: 0, False: 0]
  ------------------
 5403|      0|                    case SNMPERR_UNSUPPORTED_SEC_LEVEL:
  ------------------
  |  |  251|      0|#define SNMPERR_UNSUPPORTED_SEC_LEVEL 	(-34)
  ------------------
  |  Branch (5403:21): [True: 0, False: 0]
  ------------------
 5404|      0|                    case SNMPERR_AUTHENTICATION_FAILURE:
  ------------------
  |  |  252|      0|#define SNMPERR_AUTHENTICATION_FAILURE 	(-35)
  ------------------
  |  Branch (5404:21): [True: 0, False: 0]
  ------------------
 5405|      0|                    case SNMPERR_NOT_IN_TIME_WINDOW:
  ------------------
  |  |  253|      0|#define SNMPERR_NOT_IN_TIME_WINDOW 	(-36)
  ------------------
  |  Branch (5405:21): [True: 0, False: 0]
  ------------------
 5406|      0|                    case SNMPERR_USM_GENERICERROR:
  ------------------
  |  |  259|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
  |  Branch (5406:21): [True: 0, False: 0]
  ------------------
 5407|      0|                    case SNMPERR_USM_UNKNOWNSECURITYNAME:
  ------------------
  |  |  260|      0|#define SNMPERR_USM_UNKNOWNSECURITYNAME		(-43)
  ------------------
  |  Branch (5407:21): [True: 0, False: 0]
  ------------------
 5408|      0|                    case SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL:
  ------------------
  |  |  261|      0|#define SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL	(-44)
  ------------------
  |  Branch (5408:21): [True: 0, False: 0]
  ------------------
 5409|      0|                    case SNMPERR_USM_ENCRYPTIONERROR:
  ------------------
  |  |  262|      0|#define SNMPERR_USM_ENCRYPTIONERROR		(-45)
  ------------------
  |  Branch (5409:21): [True: 0, False: 0]
  ------------------
 5410|      0|                    case SNMPERR_USM_AUTHENTICATIONFAILURE:
  ------------------
  |  |  263|      0|#define SNMPERR_USM_AUTHENTICATIONFAILURE	(-46)
  ------------------
  |  Branch (5410:21): [True: 0, False: 0]
  ------------------
 5411|      0|                    case SNMPERR_USM_PARSEERROR:
  ------------------
  |  |  264|      0|#define SNMPERR_USM_PARSEERROR			(-47)
  ------------------
  |  Branch (5411:21): [True: 0, False: 0]
  ------------------
 5412|      0|                    case SNMPERR_USM_UNKNOWNENGINEID:
  ------------------
  |  |  265|      0|#define SNMPERR_USM_UNKNOWNENGINEID		(-48)
  ------------------
  |  Branch (5412:21): [True: 0, False: 0]
  ------------------
 5413|      0|                    case SNMPERR_USM_NOTINTIMEWINDOW:
  ------------------
  |  |  266|      0|#define SNMPERR_USM_NOTINTIMEWINDOW		(-49)
  ------------------
  |  Branch (5413:21): [True: 0, False: 0]
  ------------------
 5414|      0|                        callback(NETSNMP_CALLBACK_OP_SEC_ERROR, session,
  ------------------
  |  |  358|      0|#define NETSNMP_CALLBACK_OP_SEC_ERROR		7
  ------------------
 5415|      0|                                 pdu->reqid, pdu, cb_data);
 5416|      0|                        break;
 5417|      0|                    case SNMPERR_TIMEOUT: /* engineID probe timed out */
  ------------------
  |  |  241|      0|#define SNMPERR_TIMEOUT 		(-24)
  ------------------
  |  Branch (5417:21): [True: 0, False: 0]
  ------------------
 5418|      0|                        callback(NETSNMP_CALLBACK_OP_TIMED_OUT, session,
  ------------------
  |  |  353|      0|#define NETSNMP_CALLBACK_OP_TIMED_OUT		2
  ------------------
 5419|      0|                                 pdu->reqid, pdu, cb_data);
 5420|      0|                        break;
 5421|      0|                    default:
  ------------------
  |  Branch (5421:21): [True: 0, False: 0]
  ------------------
 5422|      0|                        callback(NETSNMP_CALLBACK_OP_SEND_FAILED, session,
  ------------------
  |  |  354|      0|#define NETSNMP_CALLBACK_OP_SEND_FAILED		3
  ------------------
 5423|      0|                                 pdu->reqid, pdu, cb_data);
 5424|      0|                        break;
 5425|      0|                }
 5426|      0|            }
 5427|       |            /** no packet to send?? */
 5428|      0|            return 0;
 5429|      0|        }
 5430|      4|    }
 5431|       |
 5432|       |    /*
 5433|       |     * Send the message.  
 5434|       |     */
 5435|       |
 5436|      4|    DEBUGMSGTL(("sess_process_packet", "sending message id#%ld reqid#%ld len %"
  ------------------
  |  |   66|      4|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 4]
  |  |  ------------------
  ------------------
 5437|      4|                NETSNMP_PRIz "u\n", pdu->msgid, pdu->reqid, isp->opacket_len));
 5438|      4|    result = netsnmp_transport_send(transport, isp->opacket, isp->opacket_len,
 5439|      4|                                    &(pdu->transport_data),
 5440|      4|                                    &(pdu->transport_data_length));
 5441|       |
 5442|      4|    SNMP_FREE(isp->obuf);
  ------------------
  |  |   62|      4|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 4, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 4]
  |  |  ------------------
  ------------------
 5443|      4|    isp->opacket = NULL; /* opacket was in obuf, so no free needed */
 5444|      4|    isp->opacket_len = 0;
 5445|       |
 5446|      4|    if (result < 0) {
  ------------------
  |  Branch (5446:9): [True: 0, False: 4]
  ------------------
 5447|      0|        session->s_snmp_errno = SNMPERR_BAD_SENDTO;
  ------------------
  |  |  229|      0|#define SNMPERR_BAD_SENDTO		(-12)
  ------------------
 5448|      0|        session->s_errno = errno;
 5449|      0|        if (callback)
  ------------------
  |  Branch (5449:13): [True: 0, False: 0]
  ------------------
 5450|      0|            callback(NETSNMP_CALLBACK_OP_SEND_FAILED, session,
  ------------------
  |  |  354|      0|#define NETSNMP_CALLBACK_OP_SEND_FAILED		3
  ------------------
 5451|      0|                     pdu->reqid, pdu, cb_data);
 5452|      0|        return 0;
 5453|      0|    }
 5454|       |
 5455|      4|    reqid = pdu->reqid;
 5456|       |
 5457|       |    /*
 5458|       |     * Bug 2387: 0 is a valid request id, so since reqid is used as a return
 5459|       |     * code with 0 meaning an error, set reqid to 1 if there is no error. This
 5460|       |     * does not affect the request id in the packet and fixes a memory leak
 5461|       |     * for incoming PDUs with a request id of 0. This could cause some
 5462|       |     * confusion if the caller is expecting the request id to match the
 5463|       |     * return code, as the documentation states it will. Most example code
 5464|       |     * just checks for non-zero, so hopefully this wont be an issue.
 5465|       |     */
 5466|      4|    if (0 == reqid && (SNMPERR_SUCCESS == session->s_snmp_errno))
  ------------------
  |  |  217|      2|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (5466:9): [True: 2, False: 2]
  |  Branch (5466:23): [True: 2, False: 0]
  ------------------
 5467|      2|        ++reqid;
 5468|       |
 5469|       |    /*
 5470|       |     * Add to pending requests list if we expect a response.  
 5471|       |     */
 5472|      4|    if (pdu->flags & UCD_MSG_FLAG_EXPECT_RESPONSE) {
  ------------------
  |  |  312|      4|#define UCD_MSG_FLAG_EXPECT_RESPONSE         0x200
  ------------------
  |  Branch (5472:9): [True: 0, False: 4]
  ------------------
 5473|      0|        netsnmp_request_list *rp;
 5474|      0|        struct timeval  tv;
 5475|       |
 5476|      0|        rp = calloc(1, sizeof(netsnmp_request_list));
 5477|      0|        if (rp == NULL) {
  ------------------
  |  Branch (5477:13): [True: 0, False: 0]
  ------------------
 5478|      0|            session->s_snmp_errno = SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 5479|      0|            return 0;
 5480|      0|        }
 5481|       |
 5482|      0|        netsnmp_get_monotonic_clock(&tv);
 5483|      0|        rp->pdu = pdu;
 5484|      0|        rp->request_id = pdu->reqid;
 5485|      0|        rp->message_id = pdu->msgid;
 5486|      0|        rp->callback = callback;
 5487|      0|        rp->cb_data = cb_data;
 5488|      0|        rp->retries = 0;
 5489|      0|        if (pdu->flags & UCD_MSG_FLAG_PDU_TIMEOUT) {
  ------------------
  |  |  315|      0|#define UCD_MSG_FLAG_PDU_TIMEOUT            0x1000
  ------------------
  |  Branch (5489:13): [True: 0, False: 0]
  ------------------
 5490|      0|            rp->timeout = pdu->time * 1000000L;
 5491|      0|        } else {
 5492|      0|            rp->timeout = session->timeout;
 5493|      0|        }
 5494|      0|        rp->timeM = tv;
 5495|      0|        tv.tv_usec += rp->timeout;
 5496|      0|        tv.tv_sec += tv.tv_usec / 1000000L;
 5497|      0|        tv.tv_usec %= 1000000L;
 5498|      0|        rp->expireM = tv;
 5499|       |
 5500|       |        /*
 5501|       |         * XX lock should be per session ! 
 5502|       |         */
 5503|      0|        snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   79|      0|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5504|      0|        if (isp->requestsEnd) {
  ------------------
  |  Branch (5504:13): [True: 0, False: 0]
  ------------------
 5505|      0|            rp->next_request = isp->requestsEnd->next_request;
 5506|      0|            isp->requestsEnd->next_request = rp;
 5507|      0|            isp->requestsEnd = rp;
 5508|      0|        } else {
 5509|      0|            rp->next_request = isp->requests;
 5510|      0|            isp->requests = rp;
 5511|      0|            isp->requestsEnd = rp;
 5512|      0|        }
 5513|      0|        snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   80|      0|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5514|      4|    } else {
 5515|       |        /*
 5516|       |         * No response expected...  
 5517|       |         */
 5518|      4|        if (reqid) {
  ------------------
  |  Branch (5518:13): [True: 4, False: 0]
  ------------------
 5519|       |            /*
 5520|       |             * Free v1 or v2 TRAP PDU iff no error  
 5521|       |             */
 5522|      4|            snmp_free_pdu(pdu);
 5523|      4|        }
 5524|      4|    }
 5525|       |
 5526|      4|    return reqid;
 5527|      4|}
snmp_api.c:_sess_read_dgram_packet:
 6135|     68|{
 6136|     68|    netsnmp_session *sp = slp ? slp->session : NULL;
  ------------------
  |  Branch (6136:27): [True: 68, False: 0]
  ------------------
 6137|     68|    struct snmp_internal_session *isp = slp ? slp->internal : NULL;
  ------------------
  |  Branch (6137:41): [True: 68, False: 0]
  ------------------
 6138|     68|    netsnmp_transport *transport = slp ? slp->transport : NULL;
  ------------------
  |  Branch (6138:36): [True: 68, False: 0]
  ------------------
 6139|       |
 6140|     68|    if (!sp || !isp || !transport || !rcvp ) {
  ------------------
  |  Branch (6140:9): [True: 0, False: 68]
  |  Branch (6140:16): [True: 0, False: 68]
  |  Branch (6140:24): [True: 0, False: 68]
  |  Branch (6140:38): [True: 0, False: 68]
  ------------------
 6141|      0|        DEBUGMSGTL(("sess_read_packet", "missing arguments\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6142|      0|        return -2;
 6143|      0|    }
 6144|       |
 6145|     68|    if (transport->flags & NETSNMP_TRANSPORT_FLAG_STREAM)
  ------------------
  |  |   51|     68|#define		NETSNMP_TRANSPORT_FLAG_STREAM	 0x01
  ------------------
  |  Branch (6145:9): [True: 0, False: 68]
  ------------------
 6146|      0|        return -2;
 6147|       |
 6148|     68|    if (NULL != rcvp->packet) {
  ------------------
  |  Branch (6148:9): [True: 0, False: 68]
  ------------------
 6149|      0|        snmp_log(LOG_WARNING, "overwriting existing saved packet; sess %p\n",
 6150|      0|                 sp);
 6151|      0|        SNMP_FREE(rcvp->packet);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6152|      0|    }
 6153|       |
 6154|     68|    if ((rcvp->packet = (u_char *) malloc(SNMP_MAX_RCV_MSG_SIZE)) == NULL) {
  ------------------
  |  |  141|     68|#define SNMP_MAX_RCV_MSG_SIZE      65536
  ------------------
  |  Branch (6154:9): [True: 0, False: 68]
  ------------------
 6155|      0|        DEBUGMSGTL(("sess_read_packet", "can't malloc %u bytes for packet\n",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6156|      0|                    SNMP_MAX_RCV_MSG_SIZE));
 6157|      0|        return -2;
 6158|      0|    }
 6159|       |
 6160|     68|    rcvp->packet_len = netsnmp_transport_recv(transport, rcvp->packet,
 6161|     68|                                              SNMP_MAX_RCV_MSG_SIZE,
  ------------------
  |  |  141|     68|#define SNMP_MAX_RCV_MSG_SIZE      65536
  ------------------
 6162|     68|                                              &rcvp->opaque, &rcvp->olength);
 6163|     68|    if (rcvp->packet_len == -1) {
  ------------------
  |  Branch (6163:9): [True: 0, False: 68]
  ------------------
 6164|      0|        sp->s_snmp_errno = SNMPERR_BAD_RECVFROM;
  ------------------
  |  |  242|      0|#define SNMPERR_BAD_RECVFROM 		(-25)
  ------------------
 6165|      0|        sp->s_errno = errno;
 6166|      0|        snmp_set_detail(strerror(errno));
 6167|      0|        SNMP_FREE(rcvp->packet);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6168|      0|        SNMP_FREE(rcvp->opaque);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6169|      0|        return -1;
 6170|      0|    }
 6171|       |
 6172|       |    /** clear so any other sess sharing this socket won't try reading again */
 6173|     68|    NETSNMP_LARGE_FD_CLR(transport->sock, fdset);
  ------------------
  |  |   43|     68|                    netsnmp_large_fd_clr(fd, fdset)
  ------------------
 6174|       |
 6175|     68|    if (0 == rcvp->packet_len &&
  ------------------
  |  Branch (6175:9): [True: 0, False: 68]
  ------------------
 6176|      0|        transport->flags & NETSNMP_TRANSPORT_FLAG_EMPTY_PKT) {
  ------------------
  |  |   56|      0|#define		NETSNMP_TRANSPORT_FLAG_EMPTY_PKT 0x10
  ------------------
  |  Branch (6176:9): [True: 0, False: 0]
  ------------------
 6177|       |        /* this allows for a transport that needs to return from
 6178|       |         * packet processing that doesn't necessarily have any
 6179|       |         * consumable data in it. */
 6180|       |
 6181|       |        /* reset the flag since it's a per-message flag */
 6182|      0|        transport->flags &= (~NETSNMP_TRANSPORT_FLAG_EMPTY_PKT);
  ------------------
  |  |   56|      0|#define		NETSNMP_TRANSPORT_FLAG_EMPTY_PKT 0x10
  ------------------
 6183|       |
 6184|       |        /** free packet */
 6185|      0|        SNMP_FREE(rcvp->packet);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6186|      0|        SNMP_FREE(rcvp->opaque);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6187|       |
 6188|      0|        return -2;
 6189|      0|    }
 6190|       |
 6191|     68|    return 0;
 6192|     68|}
snmp_api.c:_sess_process_packet:
 5976|     68|{
 5977|     68|    netsnmp_pdu         *pdu;
 5978|     68|    int                  rc;
 5979|       |
 5980|     68|    pdu = _sess_process_packet_parse_pdu(slp, sp, isp, transport, opaque,
 5981|     68|                                         olength, packetptr, length);
 5982|     68|    if (NULL == pdu)
  ------------------
  |  Branch (5982:9): [True: 68, False: 0]
  ------------------
 5983|     68|        return -1;
 5984|       |
 5985|       |    /*
 5986|       |     * find session to process pdu. usually that will be the current session,
 5987|       |     * but with the introduction of shared transports, another session may
 5988|       |     * have the same socket.
 5989|       |     */
 5990|      0|    do {
 5991|      0|        rc = _sess_process_packet_handle_pdu(slp, sp, isp, transport, pdu);
 5992|      0|        if (-2 != rc || !(transport->flags & NETSNMP_TRANSPORT_FLAG_SHARED))
  ------------------
  |  |   58|      0|#define		NETSNMP_TRANSPORT_FLAG_SHARED	 0x40
  ------------------
  |  Branch (5992:13): [True: 0, False: 0]
  |  Branch (5992:25): [True: 0, False: 0]
  ------------------
 5993|      0|            break;
 5994|       |
 5995|       |        /** -2 means pdu not in request list. check other sessions */
 5996|      0|        do  {
 5997|      0|            slp = slp->next;
 5998|      0|        } while (slp && slp->transport->sock != transport->sock);
  ------------------
  |  Branch (5998:18): [True: 0, False: 0]
  |  Branch (5998:25): [True: 0, False: 0]
  ------------------
 5999|      0|        if (!slp)
  ------------------
  |  Branch (5999:13): [True: 0, False: 0]
  ------------------
 6000|      0|            break; /* no more sessions with same socket */
 6001|       |
 6002|      0|        sp = slp->session;
 6003|      0|        isp = slp->internal;
 6004|      0|        transport = slp->transport;
 6005|      0|    } while(slp);
  ------------------
  |  Branch (6005:13): [True: 0, False: 0]
  ------------------
 6006|       |
 6007|      0|    if (-2 == rc) { /* did not find session for pdu */
  ------------------
  |  Branch (6007:9): [True: 0, False: 0]
  ------------------
 6008|      0|        snmp_increment_statistic(STAT_SNMPUNKNOWNPDUHANDLERS);
  ------------------
  |  |  646|      0|#define   STAT_SNMPUNKNOWNPDUHANDLERS        2
  ------------------
 6009|      0|        DEBUGMSGTL(("sess_process_packet", "unhandled PDU\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6010|      0|        snmp_free_pdu(pdu);
 6011|      0|    }
 6012|       |
 6013|      0|  return rc;
 6014|     68|}
snmp_api.c:_sess_process_packet_parse_pdu:
 5665|     68|{
 5666|     68|  netsnmp_pdu    *pdu;
 5667|     68|  int             ret = 0;
 5668|     68|  int             dump = 0, filter = 0;
 5669|       |
 5670|     68|  debug_indent_reset();
 5671|       |
 5672|     68|  DEBUGMSGTL(("sess_process_packet",
  ------------------
  |  |   66|     68|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     68|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 68]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 68]
  |  |  ------------------
  ------------------
 5673|     68|	      "session %p fd %d pkt %p length %d\n", slp,
 5674|     68|	      transport->sock, packetptr, length));
 5675|       |
 5676|     68|  dump = netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     68|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 5677|     68|                                NETSNMP_DS_LIB_DUMP_PACKET);
  ------------------
  |  |   63|     68|#define NETSNMP_DS_LIB_DUMP_PACKET         4
  ------------------
 5678|     68|#ifndef NETSNMP_FEATURE_REMOVE_FILTER_SOURCE
 5679|     68|  filter = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     68|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 5680|     68|                                  NETSNMP_DS_LIB_FILTER_TYPE);
  ------------------
  |  |  133|     68|#define NETSNMP_DS_LIB_FILTER_TYPE         17 /* 0=NONE, 1=whitelist, -1=blacklist */
  ------------------
 5681|     68|#endif
 5682|     68|  if (dump || filter) {
  ------------------
  |  Branch (5682:7): [True: 0, False: 68]
  |  Branch (5682:15): [True: 0, False: 68]
  ------------------
 5683|      0|      int filtered = 0;
 5684|      0|      char *addrtxt = netsnmp_transport_peer_string(transport, opaque, olength);
 5685|      0|      snmp_log(LOG_DEBUG, "\nReceived %d byte packet from %s\n",
 5686|      0|               length, addrtxt);
 5687|       |
 5688|      0|      if (dump)
  ------------------
  |  Branch (5688:11): [True: 0, False: 0]
  ------------------
 5689|      0|          xdump(packetptr, length, "");
 5690|       |
 5691|      0|#ifndef NETSNMP_FEATURE_REMOVE_FILTER_SOURCE
 5692|      0|      if (filter) {
  ------------------
  |  Branch (5692:11): [True: 0, False: 0]
  ------------------
 5693|      0|          char *sourceaddr = NULL, *c = strchr(addrtxt, '[');
 5694|      0|          const char *dropstr = NULL;
 5695|      0|          if (c) {
  ------------------
  |  Branch (5695:15): [True: 0, False: 0]
  ------------------
 5696|      0|              sourceaddr = ++c;
 5697|      0|              c = strchr(sourceaddr, ']');
 5698|      0|              if (c)
  ------------------
  |  Branch (5698:19): [True: 0, False: 0]
  ------------------
 5699|      0|                  *c = 0;
 5700|      0|              filtered = netsnmp_transport_filter_check(sourceaddr);
 5701|      0|          }
 5702|      0|          else if (!strncmp(addrtxt, "callback", 8)) {
  ------------------
  |  Branch (5702:20): [True: 0, False: 0]
  ------------------
 5703|       |              /* do not filter internal request */
 5704|      0|              DEBUGMSGTL(("sess_process_packet:filter",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5705|      0|                          "bypass packet from %s \n",
 5706|      0|                          addrtxt));
 5707|      0|              filtered = 1;
 5708|      0|          }
 5709|      0|          if ((filter == -1) && filtered)
  ------------------
  |  Branch (5709:15): [True: 0, False: 0]
  |  Branch (5709:33): [True: 0, False: 0]
  ------------------
 5710|      0|              dropstr = "matched blacklist";
 5711|      0|          else if ((filter == 1) && !filtered)
  ------------------
  |  Branch (5711:20): [True: 0, False: 0]
  |  Branch (5711:37): [True: 0, False: 0]
  ------------------
 5712|      0|              dropstr = "didn't match whitelist";
 5713|      0|          if (dropstr) {
  ------------------
  |  Branch (5713:15): [True: 0, False: 0]
  ------------------
 5714|      0|              DEBUGMSGTL(("sess_process_packet:filter",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5715|      0|                          "packet from %s %s\n",
 5716|      0|                          sourceaddr ? sourceaddr : "UNKNOWN", dropstr));
 5717|      0|              SNMP_FREE(opaque);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5718|      0|              SNMP_FREE(addrtxt);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5719|      0|              return NULL;
 5720|      0|          }
 5721|      0|      }
 5722|      0|#endif
 5723|       |
 5724|      0|      SNMP_FREE(addrtxt);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5725|      0|  }
 5726|       |
 5727|       |  /*
 5728|       |   * Do transport-level filtering (e.g. IP-address based allow/deny).  
 5729|       |   */
 5730|       |
 5731|     68|  if (isp->hook_pre) {
  ------------------
  |  Branch (5731:7): [True: 0, False: 68]
  ------------------
 5732|      0|    if (isp->hook_pre(sp, transport, opaque, olength) == 0) {
  ------------------
  |  Branch (5732:9): [True: 0, False: 0]
  ------------------
 5733|      0|      DEBUGMSGTL(("sess_process_packet", "pre-parse fail\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5734|      0|      SNMP_FREE(opaque);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5735|      0|      return NULL;
 5736|      0|    }
 5737|      0|  }
 5738|       |
 5739|     68|  if (isp->hook_create_pdu) {
  ------------------
  |  Branch (5739:7): [True: 0, False: 68]
  ------------------
 5740|      0|    pdu = isp->hook_create_pdu(transport, opaque, olength);
 5741|     68|  } else {
 5742|     68|    pdu = snmp_create_sess_pdu(transport, opaque, olength);
 5743|     68|  }
 5744|       |
 5745|     68|  if (pdu == NULL) {
  ------------------
  |  Branch (5745:7): [True: 0, False: 68]
  ------------------
 5746|      0|    snmp_log(LOG_ERR, "pdu failed to be created\n");
 5747|      0|    SNMP_FREE(opaque);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5748|      0|    return NULL;
 5749|      0|  }
 5750|       |
 5751|       |  /* if the transport was a magic tunnel, mark the PDU as having come
 5752|       |     through one. */
 5753|     68|  if (transport->flags & NETSNMP_TRANSPORT_FLAG_TUNNELED) {
  ------------------
  |  |   53|     68|#define		NETSNMP_TRANSPORT_FLAG_TUNNELED	 0x04
  ------------------
  |  Branch (5753:7): [True: 0, False: 68]
  ------------------
 5754|      0|      pdu->flags |= UCD_MSG_FLAG_TUNNELED;
  ------------------
  |  |  317|      0|#define UCD_MSG_FLAG_TUNNELED               0x4000
  ------------------
 5755|      0|  }
 5756|       |
 5757|     68|  if (isp->hook_parse) {
  ------------------
  |  Branch (5757:7): [True: 0, False: 68]
  ------------------
 5758|      0|    ret = isp->hook_parse(sp, pdu, packetptr, length);
 5759|     68|  } else {
 5760|     68|    ret = snmp_parse(slp, sp, pdu, packetptr, length);
 5761|     68|  }
 5762|       |
 5763|     68|  DEBUGMSGTL(("sess_process_packet", "received message id#%ld reqid#%ld len "
  ------------------
  |  |   66|     68|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     68|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 68]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 68]
  |  |  ------------------
  ------------------
 5764|     68|              "%u\n", pdu->msgid, pdu->reqid, length));
 5765|       |
 5766|     68|  if (ret != SNMP_ERR_NOERROR) {
  ------------------
  |  |  212|     68|#define SNMP_ERR_NOERROR                (0)     /* XXX  Used only for PDUs? */
  ------------------
  |  Branch (5766:7): [True: 68, False: 0]
  ------------------
 5767|     68|    DEBUGMSGTL(("sess_process_packet", "parse fail\n"));
  ------------------
  |  |   66|     68|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     68|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 68]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 68]
  |  |  ------------------
  ------------------
 5768|     68|  }
 5769|       |
 5770|     68|  if (isp->hook_post) {
  ------------------
  |  Branch (5770:7): [True: 0, False: 68]
  ------------------
 5771|      0|    if (isp->hook_post(sp, pdu, ret) == 0) {
  ------------------
  |  Branch (5771:9): [True: 0, False: 0]
  ------------------
 5772|      0|      DEBUGMSGTL(("sess_process_packet", "post-parse fail\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5773|      0|      ret = SNMPERR_ASN_PARSE_ERR;
  ------------------
  |  |  246|      0|#define SNMPERR_ASN_PARSE_ERR           (-29)
  ------------------
 5774|      0|    }
 5775|      0|  }
 5776|       |
 5777|     68|  if (ret != SNMP_ERR_NOERROR) {
  ------------------
  |  |  212|     68|#define SNMP_ERR_NOERROR                (0)     /* XXX  Used only for PDUs? */
  ------------------
  |  Branch (5777:7): [True: 68, False: 0]
  ------------------
 5778|     68|    snmp_free_pdu(pdu);
 5779|     68|    return NULL;
 5780|     68|  }
 5781|       |
 5782|      0|  return pdu;
 5783|     68|}

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

snmp_clone_mem:
  307|     28|{
  308|     28|    *dstPtr = NULL;
  309|     28|    if (srcPtr) {
  ------------------
  |  Branch (309:9): [True: 18, False: 10]
  ------------------
  310|     18|        *dstPtr = malloc(len + 1);
  311|     18|        if (!*dstPtr) {
  ------------------
  |  Branch (311:13): [True: 0, False: 18]
  ------------------
  312|      0|            return 1;
  313|      0|        }
  314|     18|        memmove(*dstPtr, srcPtr, len);
  315|       |        /*
  316|       |         * this is for those routines that expect 0-terminated strings!!!
  317|       |         * someone should rather have called strdup
  318|       |         */
  319|     18|        ((char *) *dstPtr)[len] = 0;
  320|     18|    }
  321|     28|    return 0;
  322|     28|}
snmp_clone_pdu:
  590|      4|{
  591|      4|    return _clone_pdu(pdu, 0);  /* copies all variables */
  592|      4|}
snmp_set_var_objid:
  688|      4|{
  689|      4|    size_t          len = sizeof(oid) * name_length;
  690|       |
  691|      4|    if (vp->name != vp->name_loc && vp->name != NULL) {
  ------------------
  |  Branch (691:9): [True: 4, False: 0]
  |  Branch (691:37): [True: 0, False: 4]
  ------------------
  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|      4|    if (len <= sizeof(vp->name_loc)) {
  ------------------
  |  Branch (702:9): [True: 4, False: 0]
  ------------------
  703|      4|        vp->name = vp->name_loc;
  704|      4|    } 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|      4|    if (objid)
  ------------------
  |  Branch (709:9): [True: 4, False: 0]
  ------------------
  710|      4|        memmove(vp->name, objid, len);
  711|      4|    vp->name_length = name_length;
  712|      4|    return 0;
  713|      4|}
snmp_set_var_value:
  804|      4|{
  805|      4|    int             largeval = 1;
  806|       |
  807|       |    /*
  808|       |     * xxx-rks: why the unconditional free? why not use existing
  809|       |     * memory, if len < vars->val_len ?
  810|       |     */
  811|      4|    if (vars->val.string && vars->val.string != vars->buf) {
  ------------------
  |  Branch (811:9): [True: 0, False: 4]
  |  Branch (811:29): [True: 0, False: 0]
  ------------------
  812|      0|        free(vars->val.string);
  813|      0|    }
  814|      4|    vars->val.string = NULL;
  815|      4|    vars->val_len = 0;
  816|       |
  817|      4|    if (value == NULL && len > 0) {
  ------------------
  |  Branch (817:9): [True: 0, False: 4]
  |  Branch (817:26): [True: 0, False: 0]
  ------------------
  818|      0|        snmp_log(LOG_ERR, "bad size for NULL value\n");
  819|      0|        return 1;
  820|      0|    }
  821|       |
  822|       |    /*
  823|       |     * use built-in storage for smaller values 
  824|       |     */
  825|      4|    if (len <= sizeof(vars->buf)) {
  ------------------
  |  Branch (825:9): [True: 4, False: 0]
  ------------------
  826|      4|        vars->val.string = (u_char *) vars->buf;
  827|      4|        largeval = 0;
  828|      4|    }
  829|       |
  830|      4|    if ((0 == len) || (NULL == value)) {
  ------------------
  |  Branch (830:9): [True: 0, False: 4]
  |  Branch (830:23): [True: 0, False: 4]
  ------------------
  831|      0|        vars->val.string[0] = 0;
  832|      0|        return 0;
  833|      0|    }
  834|       |
  835|      4|    vars->val_len = len;
  836|      4|    switch (vars->type) {
  837|      0|    case ASN_INTEGER:
  ------------------
  |  |   75|      0|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (837:5): [True: 0, False: 4]
  ------------------
  838|      0|    case ASN_UNSIGNED:
  ------------------
  |  |   91|      0|#define ASN_UNSIGNED    (ASN_APPLICATION | 2)   /* RFC 1902 - same as GAUGE */
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (838:5): [True: 0, False: 4]
  ------------------
  839|      0|    case ASN_TIMETICKS:
  ------------------
  |  |   92|      0|#define ASN_TIMETICKS   (ASN_APPLICATION | 3)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (839:5): [True: 0, False: 4]
  ------------------
  840|      4|    case ASN_COUNTER:
  ------------------
  |  |   89|      4|#define ASN_COUNTER	(ASN_APPLICATION | 1)
  |  |  ------------------
  |  |  |  |   91|      4|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (840:5): [True: 4, False: 0]
  ------------------
  841|      4|    case ASN_UINTEGER:
  ------------------
  |  |  100|      4|#define ASN_UINTEGER    (ASN_APPLICATION | 7)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|      4|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (841:5): [True: 0, False: 4]
  ------------------
  842|      4|        if (vars->val_len == sizeof(int)) {
  ------------------
  |  Branch (842:13): [True: 0, False: 4]
  ------------------
  843|      0|            if (ASN_INTEGER == vars->type) {
  ------------------
  |  |   75|      0|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (843:17): [True: 0, False: 0]
  ------------------
  844|      0|                const int      *val_int 
  845|      0|                    = (const int *) value;
  846|      0|                *(vars->val.integer) = (long) *val_int;
  847|      0|            } else {
  848|      0|                const u_int    *val_uint
  849|      0|                    = (const u_int *) value;
  850|      0|                *(vars->val.integer) = (unsigned long) *val_uint;
  851|      0|            }
  852|      0|        }
  853|      4|        else if (vars->val_len == sizeof(long)){
  ------------------
  |  Branch (853:18): [True: 4, False: 0]
  ------------------
  854|      4|            const u_long   *val_ulong
  855|      4|                = (const u_long *) value;
  856|      4|            *(vars->val.integer) = *val_ulong;
  857|      4|            if (*(vars->val.integer) > 0xffffffff) {
  ------------------
  |  Branch (857:17): [True: 0, False: 4]
  ------------------
  858|      0|                NETSNMP_LOGONCE((LOG_INFO,
  ------------------
  |  |   37|      0|#define NETSNMP_LOGONCE(x) do { \
  |  |   38|      0|        static char logged = 0; \
  |  |   39|      0|        if (!logged) {          \
  |  |  ------------------
  |  |  |  Branch (39:13): [True: 0, False: 0]
  |  |  ------------------
  |  |   40|      0|            logged = 1;         \
  |  |   41|      0|            snmp_log x ;        \
  |  |   42|      0|        }                       \
  |  |   43|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (43:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
  859|      0|                                 "truncating integer value > 32 bits\n"));
  860|      0|                *(vars->val.integer) &= 0xffffffff;
  861|      0|            }
  862|      4|        }
  863|      0|        else if (vars->val_len == sizeof(long long)){
  ------------------
  |  Branch (863:18): [True: 0, False: 0]
  ------------------
  864|      0|            const unsigned long long   *val_ullong
  865|      0|                = (const unsigned long long *) value;
  866|      0|            *(vars->val.integer) = (long) *val_ullong;
  867|      0|            if (*(vars->val.integer) > 0xffffffff) {
  ------------------
  |  Branch (867:17): [True: 0, False: 0]
  ------------------
  868|      0|                NETSNMP_LOGONCE((LOG_INFO,
  ------------------
  |  |   37|      0|#define NETSNMP_LOGONCE(x) do { \
  |  |   38|      0|        static char logged = 0; \
  |  |   39|      0|        if (!logged) {          \
  |  |  ------------------
  |  |  |  Branch (39:13): [True: 0, False: 0]
  |  |  ------------------
  |  |   40|      0|            logged = 1;         \
  |  |   41|      0|            snmp_log x ;        \
  |  |   42|      0|        }                       \
  |  |   43|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (43:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
  869|      0|                                 "truncating integer value > 32 bits\n"));
  870|      0|                *(vars->val.integer) &= 0xffffffff;
  871|      0|            }
  872|      0|        }
  873|      0|        else if (vars->val_len == sizeof(intmax_t)){
  ------------------
  |  Branch (873:18): [True: 0, False: 0]
  ------------------
  874|      0|            const uintmax_t *val_uintmax_t
  875|      0|                = (const uintmax_t *) value;
  876|      0|            *(vars->val.integer) = (long) *val_uintmax_t;
  877|      0|            if (*(vars->val.integer) > 0xffffffff) {
  ------------------
  |  Branch (877:17): [True: 0, False: 0]
  ------------------
  878|      0|                NETSNMP_LOGONCE((LOG_INFO,
  ------------------
  |  |   37|      0|#define NETSNMP_LOGONCE(x) do { \
  |  |   38|      0|        static char logged = 0; \
  |  |   39|      0|        if (!logged) {          \
  |  |  ------------------
  |  |  |  Branch (39:13): [True: 0, False: 0]
  |  |  ------------------
  |  |   40|      0|            logged = 1;         \
  |  |   41|      0|            snmp_log x ;        \
  |  |   42|      0|        }                       \
  |  |   43|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (43:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
  879|      0|                                 "truncating integer value > 32 bits\n"));
  880|      0|                *(vars->val.integer) &= 0xffffffff;
  881|      0|            }
  882|      0|        }
  883|      0|        else if (vars->val_len == sizeof(short)) {
  ------------------
  |  Branch (883:18): [True: 0, False: 0]
  ------------------
  884|      0|            if (ASN_INTEGER == vars->type) {
  ------------------
  |  |   75|      0|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (884:17): [True: 0, False: 0]
  ------------------
  885|      0|                const short      *val_short 
  886|      0|                    = (const short *) value;
  887|      0|                *(vars->val.integer) = (long) *val_short;
  888|      0|            } else {
  889|      0|                const u_short    *val_ushort
  890|      0|                    = (const u_short *) value;
  891|      0|                *(vars->val.integer) = (unsigned long) *val_ushort;
  892|      0|            }
  893|      0|        }
  894|      0|        else if (vars->val_len == sizeof(char)) {
  ------------------
  |  Branch (894:18): [True: 0, False: 0]
  ------------------
  895|      0|            if (ASN_INTEGER == vars->type) {
  ------------------
  |  |   75|      0|#define ASN_INTEGER	    0x02U
  ------------------
  |  Branch (895:17): [True: 0, False: 0]
  ------------------
  896|      0|                const signed char   *val_char
  897|      0|                    = (const signed char *) value;
  898|      0|                *(vars->val.integer) = (long) *val_char;
  899|      0|            } else {
  900|      0|                    const u_char    *val_uchar
  901|      0|                    = (const u_char *) value;
  902|      0|                *(vars->val.integer) = (unsigned long) *val_uchar;
  903|      0|            }
  904|      0|        }
  905|      0|        else {
  906|      0|            snmp_log(LOG_ERR,"bad size for integer-like type (%d)\n",
  907|      0|                     (int)vars->val_len);
  908|      0|            return (1);
  909|      0|        }
  910|      4|        vars->val_len = sizeof(long);
  911|      4|        break;
  912|       |
  913|      0|    case ASN_OBJECT_ID:
  ------------------
  |  |   81|      0|#define ASN_OBJECT_ID	    0x06U
  ------------------
  |  Branch (913:5): [True: 0, False: 4]
  ------------------
  914|      0|    case ASN_PRIV_IMPLIED_OBJECT_ID:
  ------------------
  |  |  205|      0|#define ASN_PRIV_IMPLIED_OBJECT_ID  (ASN_PRIVATE | ASN_OBJECT_ID)       /* 6 */
  |  |  ------------------
  |  |  |  |   93|      0|#define ASN_PRIVATE	    0xC0U
  |  |  ------------------
  |  |               #define ASN_PRIV_IMPLIED_OBJECT_ID  (ASN_PRIVATE | ASN_OBJECT_ID)       /* 6 */
  |  |  ------------------
  |  |  |  |   81|      0|#define ASN_OBJECT_ID	    0x06U
  |  |  ------------------
  ------------------
  |  Branch (914:5): [True: 0, False: 4]
  ------------------
  915|      0|    case ASN_PRIV_INCL_RANGE:
  ------------------
  |  |  201|      0|#define ASN_PRIV_INCL_RANGE (ASN_PRIVATE | 2)
  |  |  ------------------
  |  |  |  |   93|      0|#define ASN_PRIVATE	    0xC0U
  |  |  ------------------
  ------------------
  |  Branch (915:5): [True: 0, False: 4]
  ------------------
  916|      0|    case ASN_PRIV_EXCL_RANGE:
  ------------------
  |  |  202|      0|#define ASN_PRIV_EXCL_RANGE (ASN_PRIVATE | 3)
  |  |  ------------------
  |  |  |  |   93|      0|#define ASN_PRIVATE	    0xC0U
  |  |  ------------------
  ------------------
  |  Branch (916:5): [True: 0, False: 4]
  ------------------
  917|      0|        if (largeval) {
  ------------------
  |  Branch (917:13): [True: 0, False: 0]
  ------------------
  918|      0|            vars->val.objid = (oid *) malloc(vars->val_len);
  919|      0|        }
  920|      0|        if (vars->val.objid == NULL) {
  ------------------
  |  Branch (920:13): [True: 0, False: 0]
  ------------------
  921|      0|            snmp_log(LOG_ERR,"no storage for OID\n");
  922|      0|            return 1;
  923|      0|        }
  924|      0|        memmove(vars->val.objid, value, vars->val_len);
  925|      0|        break;
  926|       |
  927|      0|    case ASN_IPADDRESS: /* snmp_build_var_op treats IPADDR like a string */
  ------------------
  |  |   88|      0|#define ASN_IPADDRESS   (ASN_APPLICATION | 0)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (927:5): [True: 0, False: 4]
  ------------------
  928|      0|        if (4 != vars->val_len) {
  ------------------
  |  Branch (928:13): [True: 0, False: 0]
  ------------------
  929|      0|            netsnmp_assert("ipaddress length == 4");
  ------------------
  |  |   47|      0|#      define netsnmp_assert(x)  do { \
  |  |   48|      0|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 0, False: 0]
  |  |  ------------------
  |  |   49|      0|                 ; \
  |  |   50|      0|              else \
  |  |   51|      0|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
  930|      0|        }
  931|      0|        NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2408|      0|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
  932|      0|    case ASN_PRIV_IMPLIED_OCTET_STR:
  ------------------
  |  |  204|      0|#define ASN_PRIV_IMPLIED_OCTET_STR  (ASN_PRIVATE | ASN_OCTET_STR)       /* 4 */
  |  |  ------------------
  |  |  |  |   93|      0|#define ASN_PRIVATE	    0xC0U
  |  |  ------------------
  |  |               #define ASN_PRIV_IMPLIED_OCTET_STR  (ASN_PRIVATE | ASN_OCTET_STR)       /* 4 */
  |  |  ------------------
  |  |  |  |   78|      0|#define ASN_OCTET_STR	    0x04U
  |  |  ------------------
  ------------------
  |  Branch (932:5): [True: 0, False: 4]
  ------------------
  933|      0|    case ASN_OCTET_STR:
  ------------------
  |  |   78|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
  |  Branch (933:5): [True: 0, False: 4]
  ------------------
  934|      0|    case ASN_BIT_STR:
  ------------------
  |  |   77|      0|#define ASN_BIT_STR	    0x03U
  ------------------
  |  Branch (934:5): [True: 0, False: 4]
  ------------------
  935|      0|    case ASN_OPAQUE:
  ------------------
  |  |   93|      0|#define ASN_OPAQUE	(ASN_APPLICATION | 4)   /* changed so no conflict with other includes */
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (935:5): [True: 0, False: 4]
  ------------------
  936|      0|    case ASN_NSAP:
  ------------------
  |  |   98|      0|#define ASN_NSAP	(ASN_APPLICATION | 5)   /* historic - don't use */
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (936:5): [True: 0, False: 4]
  ------------------
  937|      0|        if (vars->val_len >= sizeof(vars->buf)) {
  ------------------
  |  Branch (937:13): [True: 0, False: 0]
  ------------------
  938|      0|            vars->val.string = (u_char *) malloc(vars->val_len + 1);
  939|      0|        }
  940|      0|        if (vars->val.string == NULL) {
  ------------------
  |  Branch (940:13): [True: 0, False: 0]
  ------------------
  941|      0|            snmp_log(LOG_ERR,"no storage for string\n");
  942|      0|            return 1;
  943|      0|        }
  944|      0|        memmove(vars->val.string, value, vars->val_len);
  945|       |        /*
  946|       |         * Make sure the string is zero-terminated; some bits of code make
  947|       |         * this assumption.  Easier to do this here than fix all these wrong
  948|       |         * assumptions.  
  949|       |         */
  950|      0|        vars->val.string[vars->val_len] = '\0';
  951|      0|        break;
  952|       |
  953|      0|    case SNMP_NOSUCHOBJECT:
  ------------------
  |  |  201|      0|#define SNMP_NOSUCHOBJECT    (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) /* 80=128 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_NOSUCHOBJECT    (ASN_CONTEXT | ASN_PRIMITIVE | 0x0) /* 80=128 */
  |  |  ------------------
  |  |  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (953:5): [True: 0, False: 4]
  ------------------
  954|      0|    case SNMP_NOSUCHINSTANCE:
  ------------------
  |  |  202|      0|#define SNMP_NOSUCHINSTANCE  (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* 81=129 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_NOSUCHINSTANCE  (ASN_CONTEXT | ASN_PRIMITIVE | 0x1) /* 81=129 */
  |  |  ------------------
  |  |  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (954:5): [True: 0, False: 4]
  ------------------
  955|      0|    case SNMP_ENDOFMIBVIEW:
  ------------------
  |  |  203|      0|#define SNMP_ENDOFMIBVIEW    (ASN_CONTEXT | ASN_PRIMITIVE | 0x2) /* 82=130 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_ENDOFMIBVIEW    (ASN_CONTEXT | ASN_PRIMITIVE | 0x2) /* 82=130 */
  |  |  ------------------
  |  |  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  |  |  ------------------
  ------------------
  |  Branch (955:5): [True: 0, False: 4]
  ------------------
  956|      0|    case ASN_NULL:
  ------------------
  |  |   79|      0|#define ASN_NULL	    0x05U
  ------------------
  |  Branch (956:5): [True: 0, False: 4]
  ------------------
  957|      0|        vars->val_len = 0;
  958|      0|        vars->val.string = NULL;
  959|      0|        break;
  960|       |
  961|      0|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
  962|      0|    case ASN_OPAQUE_U64:
  ------------------
  |  |  192|      0|#define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_U64 (ASN_OPAQUE_TAG2 + ASN_APP_U64)
  |  |  ------------------
  |  |  |  |  150|      0|#define ASN_APP_U64 (ASN_APPLICATION | 11)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (962:5): [True: 0, False: 4]
  ------------------
  963|      0|    case ASN_OPAQUE_I64:
  ------------------
  |  |  183|      0|#define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_I64 (ASN_OPAQUE_TAG2 + ASN_APP_I64)
  |  |  ------------------
  |  |  |  |  149|      0|#define ASN_APP_I64 (ASN_APPLICATION | 10)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (963:5): [True: 0, False: 4]
  ------------------
  964|      0|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
  965|      0|    case ASN_COUNTER64:
  ------------------
  |  |   99|      0|#define ASN_COUNTER64   (ASN_APPLICATION | 6)
  |  |  ------------------
  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  ------------------
  ------------------
  |  Branch (965:5): [True: 0, False: 4]
  ------------------
  966|      0|        if (largeval || vars->val_len != sizeof(struct counter64)) {
  ------------------
  |  Branch (966:13): [True: 0, False: 0]
  |  Branch (966:25): [True: 0, False: 0]
  ------------------
  967|      0|            snmp_log(LOG_ERR,"bad size for counter 64 (%d)\n",
  968|      0|                     (int)vars->val_len);
  969|      0|            return (1);
  970|      0|        }
  971|      0|        vars->val_len = sizeof(struct counter64);
  972|      0|        memmove(vars->val.counter64, value, vars->val_len);
  973|      0|        break;
  974|       |
  975|      0|#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
  976|      0|    case ASN_OPAQUE_FLOAT:
  ------------------
  |  |  165|      0|#define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_FLOAT (ASN_OPAQUE_TAG2 + ASN_APP_FLOAT)
  |  |  ------------------
  |  |  |  |  147|      0|#define ASN_APP_FLOAT (ASN_APPLICATION | 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (976:5): [True: 0, False: 4]
  ------------------
  977|      0|        if (largeval) {
  ------------------
  |  Branch (977:13): [True: 0, False: 0]
  ------------------
  978|      0|            snmp_log(LOG_ERR,"bad size for opaque float (%d)\n",
  979|      0|                     (int)vars->val_len);
  980|      0|            return (1);
  981|      0|        }
  982|      0|        vars->val_len = sizeof(float);
  983|      0|        memmove(vars->val.floatVal, value, vars->val_len);
  984|      0|        break;
  985|       |
  986|      0|    case ASN_OPAQUE_DOUBLE:
  ------------------
  |  |  174|      0|#define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  136|      0|#define ASN_OPAQUE_TAG2 0x30U
  |  |  ------------------
  |  |               #define ASN_OPAQUE_DOUBLE (ASN_OPAQUE_TAG2 + ASN_APP_DOUBLE)
  |  |  ------------------
  |  |  |  |  148|      0|#define ASN_APP_DOUBLE (ASN_APPLICATION | 9)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|      0|#define ASN_APPLICATION     0x40U
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (986:5): [True: 0, False: 4]
  ------------------
  987|      0|        if (largeval) {
  ------------------
  |  Branch (987:13): [True: 0, False: 0]
  ------------------
  988|      0|            snmp_log(LOG_ERR,"bad size for opaque double (%d)\n",
  989|      0|                     (int)vars->val_len);
  990|      0|            return (1);
  991|      0|        }
  992|      0|        vars->val_len = sizeof(double);
  993|      0|        memmove(vars->val.doubleVal, value, vars->val_len);
  994|      0|        break;
  995|       |
  996|      0|#endif                          /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
  997|       |
  998|      0|    default:
  ------------------
  |  Branch (998:5): [True: 0, False: 4]
  ------------------
  999|      0|        snmp_log(LOG_ERR,"Internal error in type switching\n");
 1000|      0|        snmp_set_detail("Internal error in type switching\n");
 1001|      0|        return (1);
 1002|      4|    }
 1003|       |
 1004|      4|    return 0;
 1005|      4|}
snmp_client.c:_copy_varlist:
  425|      4|{                               /* !=0 number variables to copy */
  426|      4|    netsnmp_variable_list *newhead, *newvar, *oldvar;
  427|      4|    int             ii = 0;
  428|       |
  429|      4|    newhead = NULL;
  430|      4|    oldvar = NULL;
  431|       |
  432|      4|    while (var && (copy_count-- > 0)) {
  ------------------
  |  Branch (432:12): [True: 0, False: 4]
  |  Branch (432:19): [True: 0, False: 0]
  ------------------
  433|       |        /*
  434|       |         * Drop the specified variable (if applicable) 
  435|       |         * xxx hmm, is it intentional that dropping the errindex
  436|       |         *     counts towards copy_count?
  437|       |         */
  438|      0|        if (++ii == errindex) {
  ------------------
  |  Branch (438:13): [True: 0, False: 0]
  ------------------
  439|      0|            var = var->next_variable;
  440|      0|            continue;
  441|      0|        }
  442|       |
  443|       |        /*
  444|       |         * clone the next variable. Cleanup if alloc fails 
  445|       |         */
  446|      0|        newvar = (netsnmp_variable_list *)
  447|      0|            malloc(sizeof(netsnmp_variable_list));
  448|      0|        if (snmp_clone_var(var, newvar)) {
  ------------------
  |  Branch (448:13): [True: 0, False: 0]
  ------------------
  449|      0|            if (newvar)
  ------------------
  |  Branch (449:17): [True: 0, False: 0]
  ------------------
  450|      0|                free(newvar);
  451|      0|            snmp_free_varbind(newhead);
  452|      0|            return NULL;
  453|      0|        }
  454|       |
  455|       |        /*
  456|       |         * add cloned variable to new list  
  457|       |         */
  458|      0|        if (NULL == newhead)
  ------------------
  |  Branch (458:13): [True: 0, False: 0]
  ------------------
  459|      0|            newhead = newvar;
  460|      0|        if (oldvar)
  ------------------
  |  Branch (460:13): [True: 0, False: 0]
  ------------------
  461|      0|            oldvar->next_variable = newvar;
  462|      0|        oldvar = newvar;
  463|       |
  464|      0|        var = var->next_variable;
  465|      0|    }
  466|      4|    return newhead;
  467|      4|}
snmp_client.c:_clone_pdu:
  558|      4|{
  559|      4|    netsnmp_pdu    *newpdu;
  560|       |
  561|      4|    newpdu = _clone_pdu_header(pdu);
  562|      4|    if (!newpdu)
  ------------------
  |  Branch (562:9): [True: 0, False: 4]
  ------------------
  563|      0|        return newpdu;
  564|      4|    newpdu = _copy_pdu_vars(pdu, newpdu, drop_err, 0, 10000);   /* skip none, copy all */
  565|       |
  566|      4|    return newpdu;
  567|      4|}
snmp_client.c:_clone_pdu_header:
  361|      4|{
  362|      4|    netsnmp_pdu    *newpdu;
  363|      4|    struct snmp_secmod_def *sptr;
  364|      4|    int ret;
  365|       |
  366|      4|    if (!pdu)
  ------------------
  |  Branch (366:9): [True: 0, False: 4]
  ------------------
  367|      0|        return NULL;
  368|       |
  369|      4|    newpdu = netsnmp_memdup(pdu, sizeof(netsnmp_pdu));
  370|      4|    if (!newpdu)
  ------------------
  |  Branch (370:9): [True: 0, False: 4]
  ------------------
  371|      0|        return NULL;
  372|       |
  373|       |    /*
  374|       |     * reset copied pointers if copy fails 
  375|       |     */
  376|      4|    newpdu->variables = NULL;
  377|      4|    newpdu->enterprise = NULL;
  378|      4|    newpdu->community = NULL;
  379|      4|    newpdu->securityEngineID = NULL;
  380|      4|    newpdu->securityName = NULL;
  381|      4|    newpdu->contextEngineID = NULL;
  382|      4|    newpdu->contextName = NULL;
  383|      4|    newpdu->transport_data = NULL;
  384|       |
  385|       |    /*
  386|       |     * copy buffers individually. If any copy fails, all are freed. 
  387|       |     */
  388|      4|    if (snmp_clone_mem((void **) &newpdu->enterprise, pdu->enterprise,
  ------------------
  |  Branch (388:9): [True: 0, False: 4]
  ------------------
  389|      4|                       sizeof(oid) * pdu->enterprise_length) ||
  390|      4|        snmp_clone_mem((void **) &newpdu->community, pdu->community,
  ------------------
  |  Branch (390:9): [True: 0, False: 4]
  ------------------
  391|      4|                       pdu->community_len) ||
  392|      4|        snmp_clone_mem((void **) &newpdu->contextEngineID,
  ------------------
  |  Branch (392:9): [True: 0, False: 4]
  ------------------
  393|      4|                       pdu->contextEngineID, pdu->contextEngineIDLen)
  394|      4|        || snmp_clone_mem((void **) &newpdu->securityEngineID,
  ------------------
  |  Branch (394:12): [True: 0, False: 4]
  ------------------
  395|      4|                          pdu->securityEngineID, pdu->securityEngineIDLen)
  396|      4|        || snmp_clone_mem((void **) &newpdu->contextName, pdu->contextName,
  ------------------
  |  Branch (396:12): [True: 0, False: 4]
  ------------------
  397|      4|                          pdu->contextNameLen)
  398|      4|        || snmp_clone_mem((void **) &newpdu->securityName,
  ------------------
  |  Branch (398:12): [True: 0, False: 4]
  ------------------
  399|      4|                          pdu->securityName, pdu->securityNameLen)
  400|      4|        || snmp_clone_mem((void **) &newpdu->transport_data,
  ------------------
  |  Branch (400:12): [True: 0, False: 4]
  ------------------
  401|      4|                          pdu->transport_data,
  402|      4|                          pdu->transport_data_length)) {
  403|      0|        snmp_free_pdu(newpdu);
  404|      0|        return NULL;
  405|      0|    }
  406|       |
  407|      4|    sptr = find_sec_mod(newpdu->securityModel);
  408|      4|    if (sptr && sptr->pdu_clone) {
  ------------------
  |  Branch (408:9): [True: 4, False: 0]
  |  Branch (408:17): [True: 4, False: 0]
  ------------------
  409|       |        /* call security model if it needs to know about this */
  410|      4|        ret = sptr->pdu_clone(pdu, newpdu);
  411|      4|        if (ret) {
  ------------------
  |  Branch (411:13): [True: 0, False: 4]
  ------------------
  412|      0|            snmp_free_pdu(newpdu);
  413|      0|            return NULL;
  414|      0|        }
  415|      4|    }
  416|       |
  417|      4|    return newpdu;
  418|      4|}
snmp_client.c:_copy_pdu_vars:
  495|      4|{                               /* !=0 number of variables to copy */
  496|      4|    netsnmp_variable_list *var;
  497|       |#ifdef TEMPORARILY_DISABLED
  498|       |    int             copied;
  499|       |#endif
  500|      4|    int             drop_idx;
  501|       |
  502|      4|    if (!newpdu)
  ------------------
  |  Branch (502:9): [True: 0, False: 4]
  ------------------
  503|      0|        return NULL;            /* where is PDU to copy to ? */
  504|       |
  505|      4|    if (drop_err)
  ------------------
  |  Branch (505:9): [True: 0, False: 4]
  ------------------
  506|      0|        drop_idx = pdu->errindex - skip_count;
  507|      4|    else
  508|      4|        drop_idx = 0;
  509|       |
  510|      4|    var = pdu->variables;
  511|      4|    while (var && (skip_count-- > 0))   /* skip over pdu variables */
  ------------------
  |  Branch (511:12): [True: 0, False: 4]
  |  Branch (511:19): [True: 0, False: 0]
  ------------------
  512|      0|        var = var->next_variable;
  513|       |
  514|       |#ifdef TEMPORARILY_DISABLED
  515|       |    copied = 0;
  516|       |    if (pdu->flags & UCD_MSG_FLAG_FORCE_PDU_COPY)
  517|       |        copied = 1;             /* We're interested in 'empty' responses too */
  518|       |#endif
  519|       |
  520|      4|    newpdu->variables = _copy_varlist(var, drop_idx, copy_count);
  521|       |#ifdef TEMPORARILY_DISABLED
  522|       |    if (newpdu->variables)
  523|       |        copied = 1;
  524|       |#endif
  525|       |
  526|       |#ifdef ALSO_TEMPORARILY_DISABLED
  527|       |    /*
  528|       |     * Error if bad errindex or if target PDU has no variables copied 
  529|       |     */
  530|       |    if ((drop_err && (ii < pdu->errindex))
  531|       |#ifdef TEMPORARILY_DISABLED
  532|       |        /*
  533|       |         * SNMPv3 engineID probes are allowed to be empty.
  534|       |         * See the comment in snmp_api.c for further details 
  535|       |         */
  536|       |        || copied == 0
  537|       |#endif
  538|       |        ) {
  539|       |        snmp_free_pdu(newpdu);
  540|       |        return 0;
  541|       |    }
  542|       |#endif
  543|      4|    return newpdu;
  544|      4|}

debug_indent_reset:
  112|     68|{
  113|     68|    if (debugindent != 0)
  ------------------
  |  Branch (113:9): [True: 0, False: 68]
  ------------------
  114|      0|        DEBUGMSGTL(("dump_indent","indent reset from %d\n", debugindent));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  115|     68|    debugindent = 0;
  116|     68|}
debug_is_token_registered:
  303|     72|{
  304|     72|    int             i, rc;
  305|       |
  306|       |    /*
  307|       |     * debugging flag is on or off
  308|       |     */
  309|     72|    if (!dodebug)
  ------------------
  |  Branch (309:9): [True: 72, False: 0]
  ------------------
  310|     72|        return SNMPERR_GENERR;
  ------------------
  |  |  218|     72|#define SNMPERR_GENERR			(-1)
  ------------------
  311|       |
  312|      0|    if (debug_num_tokens == 0 || debug_print_everything) {
  ------------------
  |  Branch (312:9): [True: 0, False: 0]
  |  Branch (312:34): [True: 0, False: 0]
  ------------------
  313|       |        /*
  314|       |         * no tokens specified, print everything
  315|       |         */
  316|      0|        return SNMPERR_SUCCESS;
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  317|      0|    }
  318|      0|    else
  319|      0|        rc = SNMPERR_GENERR; /* ! found = err */
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  320|       |
  321|      0|    for (i = 0; i < debug_num_tokens; i++) {
  ------------------
  |  Branch (321:17): [True: 0, False: 0]
  ------------------
  322|      0|        if (SNMP_DEBUG_DISABLED == dbg_tokens[i].enabled)
  ------------------
  |  |   57|      0|#define SNMP_DEBUG_DISABLED           0
  ------------------
  |  Branch (322:13): [True: 0, False: 0]
  ------------------
  323|      0|            continue;
  324|      0|        if (dbg_tokens[i].token_name &&
  ------------------
  |  Branch (324:13): [True: 0, False: 0]
  ------------------
  325|      0|            strncmp(dbg_tokens[i].token_name, token,
  ------------------
  |  Branch (325:13): [True: 0, False: 0]
  ------------------
  326|      0|                    strlen(dbg_tokens[i].token_name)) == 0) {
  327|      0|            if (SNMP_DEBUG_ACTIVE == dbg_tokens[i].enabled)
  ------------------
  |  |   58|      0|#define SNMP_DEBUG_ACTIVE             1
  ------------------
  |  Branch (327:17): [True: 0, False: 0]
  ------------------
  328|      0|                return SNMPERR_SUCCESS; /* active */
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  329|      0|            else
  330|      0|                return SNMPERR_GENERR; /* excluded */
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  331|      0|        }
  332|      0|    }
  333|      0|    return rc;
  334|      0|}
snmp_get_do_debugging:
  551|  35.6k|{
  552|  35.6k|    return dodebug;
  553|  35.6k|}
snmp_debug_shutdown:
  569|     69|{
  570|     69|    int i;
  571|       |
  572|     69|    for (i = 0; i < debug_num_tokens; i++)
  ------------------
  |  Branch (572:17): [True: 0, False: 69]
  ------------------
  573|       |       SNMP_FREE(dbg_tokens[i].token_name);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
  574|     69|}
snmp_debug_init:
  722|     69|{
  723|       |#ifdef HAVE_WOLFSSL_WOLFCRYPT_LOGGING_H
  724|       |    wolfSSL_Debugging_ON();
  725|       |    wolfSSL_SetLoggingCb(snmp_log_wolfssl_msg);
  726|       |#endif
  727|       |
  728|     69|    register_prenetsnmp_mib_handler("snmp", "doDebugging",
  729|     69|                                    debug_config_turn_on_debugging, NULL,
  730|     69|                                    "(1|0)");
  731|     69|    register_prenetsnmp_mib_handler("snmp", "debugTokens",
  732|     69|                                    debug_config_register_tokens, NULL,
  733|     69|                                    "token[,token...]");
  734|     69|#ifndef NETSNMP_DISABLE_DYNAMIC_LOG_LEVEL
  735|     69|    register_prenetsnmp_mib_handler("snmp", "debugLogLevel",
  736|       |                                    debug_config_debug_log_level, NULL,
  737|     69|                                    "(emerg|alert|crit|err|warning|notice|info|debug)");
  738|     69|#endif /* NETSNMP_DISABLE_DYNAMIC_LOG_LEVEL */
  739|     69|}

init_snmp_enum:
   54|     69|{
   55|     69|    if (NULL != snmp_enum_lists)
  ------------------
  |  Branch (55:9): [True: 0, False: 69]
  ------------------
   56|      0|        return SE_OK;
  ------------------
  |  |   42|      0|#define SE_OK            0
  ------------------
   57|       |
   58|     69|    snmp_enum_lists = calloc(SE_MAX_IDS * SE_MAX_SUBIDS,
  ------------------
  |  |   21|     69|#define SE_MAX_IDS 5
  ------------------
                  snmp_enum_lists = calloc(SE_MAX_IDS * SE_MAX_SUBIDS,
  ------------------
  |  |   22|     69|#define SE_MAX_SUBIDS 32        /* needs to be a multiple of 8 */
  ------------------
   59|     69|                             sizeof(*snmp_enum_lists));
   60|     69|    if (!snmp_enum_lists)
  ------------------
  |  Branch (60:9): [True: 0, False: 69]
  ------------------
   61|      0|        return SE_NOMEM;
  ------------------
  |  |   43|      0|#define SE_NOMEM         1
  ------------------
   62|     69|    current_maj_num = SE_MAX_IDS;
  ------------------
  |  |   21|     69|#define SE_MAX_IDS 5
  ------------------
   63|     69|    current_min_num = SE_MAX_SUBIDS;
  ------------------
  |  |   22|     69|#define SE_MAX_SUBIDS 32        /* needs to be a multiple of 8 */
  ------------------
   64|       |
   65|     69|    register_const_config_handler(type, "enum", se_read_conf, NULL, NULL);
   66|     69|    return SE_OK;
  ------------------
  |  |   42|     69|#define SE_OK            0
  ------------------
   67|     69|}
se_add_pair_to_list:
  269|  1.93k|{
  270|  1.93k|    struct snmp_enum_list *lastnode = NULL, *new_node, *tmp;
  271|       |
  272|  1.93k|    if (!list) {
  ------------------
  |  Branch (272:9): [True: 0, False: 1.93k]
  ------------------
  273|      0|        free(label);
  274|      0|        return SE_DNE;
  ------------------
  |  |   45|      0|#define SE_DNE           -2
  ------------------
  275|      0|    }
  276|       |
  277|  1.93k|    tmp = *list;
  278|  5.79k|    while (tmp) {
  ------------------
  |  Branch (278:12): [True: 4.14k, False: 1.65k]
  ------------------
  279|  4.14k|        if (tmp->value == value) {
  ------------------
  |  Branch (279:13): [True: 276, False: 3.86k]
  ------------------
  280|    276|            free(label);
  281|    276|            return (SE_ALREADY_THERE);
  ------------------
  |  |   44|    276|#define SE_ALREADY_THERE 2
  ------------------
  282|    276|        }
  283|  3.86k|        lastnode = tmp;
  284|  3.86k|        tmp = tmp->next;
  285|  3.86k|    }
  286|       |
  287|  1.65k|    new_node = SNMP_MALLOC_STRUCT(snmp_enum_list);
  ------------------
  |  |   69|  1.65k|#define SNMP_MALLOC_STRUCT(s)   (struct s *) calloc(1, sizeof(struct s))
  ------------------
  288|  1.65k|    if (!new_node) {
  ------------------
  |  Branch (288:9): [True: 0, False: 1.65k]
  ------------------
  289|      0|        free(label);
  290|      0|        return (SE_NOMEM);
  ------------------
  |  |   43|      0|#define SE_NOMEM         1
  ------------------
  291|      0|    }
  292|       |
  293|  1.65k|    if (lastnode)
  ------------------
  |  Branch (293:9): [True: 1.31k, False: 345]
  ------------------
  294|  1.31k|        lastnode->next = new_node;
  295|    345|    else
  296|    345|        *list = new_node;
  297|  1.65k|    new_node->label = label;
  298|  1.65k|    new_node->value = value;
  299|  1.65k|    new_node->next = NULL;
  300|  1.65k|    return (SE_OK);
  ------------------
  |  |   42|  1.65k|#define SE_OK            0
  ------------------
  301|  1.65k|}
se_add_pair_to_slist:
  365|  1.93k|{
  366|  1.93k|    struct snmp_enum_list **list_p = se_find_slist_ptr(listname);
  367|       |
  368|  1.93k|    if (!list_p) {
  ------------------
  |  Branch (368:9): [True: 345, False: 1.58k]
  ------------------
  369|    345|        struct snmp_enum_list_str *sptr =
  370|    345|            SNMP_MALLOC_STRUCT(snmp_enum_list_str);
  ------------------
  |  |   69|    345|#define SNMP_MALLOC_STRUCT(s)   (struct s *) calloc(1, sizeof(struct s))
  ------------------
  371|    345|        if (!sptr) {
  ------------------
  |  Branch (371:13): [True: 0, False: 345]
  ------------------
  372|      0|            free(label);
  373|      0|            return SE_NOMEM;
  ------------------
  |  |   43|      0|#define SE_NOMEM         1
  ------------------
  374|      0|        }
  375|    345|        sptr->next = sliststorage;
  376|    345|        sptr->name = strdup(listname);
  377|    345|        if (!sptr->name) {
  ------------------
  |  Branch (377:13): [True: 0, False: 345]
  ------------------
  378|      0|            free(sptr);
  379|      0|            free(label);
  380|      0|            return SE_NOMEM;
  ------------------
  |  |   43|      0|#define SE_NOMEM         1
  ------------------
  381|      0|        }
  382|    345|        list_p = &sptr->list;
  383|    345|        sliststorage = sptr;
  384|    345|    }
  385|       |
  386|  1.93k|    return se_add_pair_to_list(list_p, label, value);
  387|  1.93k|}
clear_snmp_enum:
  404|     69|{
  405|     69|    struct snmp_enum_list_str *sptr = sliststorage, *next = NULL;
  406|     69|    unsigned int major, minor;
  407|       |
  408|    414|    while (sptr != NULL) {
  ------------------
  |  Branch (408:12): [True: 345, False: 69]
  ------------------
  409|    345|	next = sptr->next;
  410|    345|	free_enum_list(sptr->list);
  411|    345|	SNMP_FREE(sptr->name);
  ------------------
  |  |   62|    345|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 345, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 345]
  |  |  ------------------
  ------------------
  412|    345|	SNMP_FREE(sptr);
  ------------------
  |  |   62|    345|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 345, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 345]
  |  |  ------------------
  ------------------
  413|    345|	sptr = next;
  414|    345|    }
  415|     69|    sliststorage = NULL;
  416|       |
  417|    414|    for (major = 0; major < current_maj_num; major++) {
  ------------------
  |  Branch (417:21): [True: 345, False: 69]
  ------------------
  418|  11.3k|        for (minor = 0; minor < current_min_num; minor++) {
  ------------------
  |  Branch (418:25): [True: 11.0k, False: 345]
  ------------------
  419|  11.0k|            struct snmp_enum_list **list_ptr = se_find_list_ptr(major, minor);
  420|       |
  421|  11.0k|            if (!list_ptr || !*list_ptr)
  ------------------
  |  Branch (421:17): [True: 0, False: 11.0k]
  |  Branch (421:30): [True: 11.0k, False: 0]
  ------------------
  422|  11.0k|                continue;
  423|      0|            free_enum_list(*list_ptr);
  424|      0|        }
  425|    345|    }
  426|     69|    current_maj_num = 0;
  427|     69|    current_min_num = 0;
  428|       |    SNMP_FREE(snmp_enum_lists);
  ------------------
  |  |   62|     69|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 69, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 69]
  |  |  ------------------
  ------------------
  429|     69|}
snmp_enum.c:se_find_list_ptr:
  174|  11.0k|{
  175|  11.0k|    if (major >= current_maj_num || minor >= current_min_num)
  ------------------
  |  Branch (175:9): [True: 0, False: 11.0k]
  |  Branch (175:37): [True: 0, False: 11.0k]
  ------------------
  176|      0|        return NULL;
  177|  11.0k|    netsnmp_assert(NULL != snmp_enum_lists);
  ------------------
  |  |   47|  11.0k|#      define netsnmp_assert(x)  do { \
  |  |   48|  11.0k|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 11.0k, False: 0]
  |  |  ------------------
  |  |   49|  11.0k|                 ; \
  |  |   50|  11.0k|              else \
  |  |   51|  11.0k|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|  11.0k|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 11.0k]
  |  |  ------------------
  ------------------
  178|       |
  179|  11.0k|    return &snmp_enum_lists[major * current_min_num + minor];
  180|  11.0k|}
snmp_enum.c:se_find_slist_ptr:
  314|  1.93k|{
  315|  1.93k|    struct snmp_enum_list_str *sptr;
  316|  1.93k|    if (!listname)
  ------------------
  |  Branch (316:9): [True: 0, False: 1.93k]
  ------------------
  317|      0|        return NULL;
  318|       |
  319|  2.62k|    for (sptr = sliststorage; sptr != NULL; sptr = sptr->next)
  ------------------
  |  Branch (319:31): [True: 2.27k, False: 345]
  ------------------
  320|  2.27k|        if (sptr->name && strcmp(sptr->name, listname) == 0)
  ------------------
  |  Branch (320:13): [True: 2.27k, False: 0]
  |  Branch (320:27): [True: 1.58k, False: 690]
  ------------------
  321|  1.58k|            return &sptr->list;
  322|       |
  323|    345|    return NULL;
  324|  1.93k|}
snmp_enum.c:free_enum_list:
  391|    345|{
  392|    345|    struct snmp_enum_list *next;
  393|       |
  394|  2.00k|    while (list) {
  ------------------
  |  Branch (394:12): [True: 1.65k, False: 345]
  ------------------
  395|  1.65k|        next = list->next;
  396|  1.65k|        SNMP_FREE(list->label);
  ------------------
  |  |   62|  1.65k|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 1.65k, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 1.65k]
  |  |  ------------------
  ------------------
  397|       |        SNMP_FREE(list);
  ------------------
  |  |   62|  1.65k|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 1.65k, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 1.65k]
  |  |  ------------------
  ------------------
  398|  1.65k|        list = next;
  399|  1.65k|    }
  400|    345|}

init_snmp_logging:
  168|     69|{
  169|     69|    netsnmp_ds_register_premib(ASN_BOOLEAN, "snmp", "logTimestamp", 
  ------------------
  |  |   72|     69|#define ASN_BOOLEAN	    0x01U
  ------------------
  170|     69|			 NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_LOG_TIMESTAMP);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              			 NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_LOG_TIMESTAMP);
  ------------------
  |  |   64|     69|#define NETSNMP_DS_LIB_LOG_TIMESTAMP       5
  ------------------
  171|     69|    register_prenetsnmp_mib_handler("snmp", "logOption",
  172|     69|                                    parse_config_logOption, NULL, "string");
  173|       |
  174|     69|}
shutdown_snmp_logging:
  178|     69|{
  179|     69|   snmp_disable_log();
  180|     69|   while(NULL != logh_head)
  ------------------
  |  Branch (180:10): [True: 0, False: 69]
  ------------------
  181|      0|      netsnmp_remove_loghandler( logh_head );
  182|     69|}
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|}
snmp_disable_log:
  690|     69|{
  691|     69|    netsnmp_log_handler *logh;
  692|       |
  693|     69|    for (logh = logh_head; logh; logh = logh->next) {
  ------------------
  |  Branch (693:28): [True: 0, False: 69]
  ------------------
  694|      0|#ifndef NETSNMP_FEATURE_REMOVE_LOGGING_SYSLOG
  695|      0|        if (logh->type == NETSNMP_LOGHANDLER_SYSLOG)
  ------------------
  |  |   72|      0|#define NETSNMP_LOGHANDLER_SYSLOG	4
  ------------------
  |  Branch (695:13): [True: 0, False: 0]
  ------------------
  696|      0|            snmp_disable_syslog_entry(logh);
  697|      0|#endif /* NETSNMP_FEATURE_REMOVE_LOGGING_SYSLOG */
  698|      0|#ifndef NETSNMP_FEATURE_REMOVE_LOGGING_FILE
  699|      0|        if (logh->type == NETSNMP_LOGHANDLER_FILE)
  ------------------
  |  |   71|      0|#define NETSNMP_LOGHANDLER_FILE		3
  ------------------
  |  Branch (699:13): [True: 0, False: 0]
  ------------------
  700|      0|            snmp_disable_filelog_entry(logh);
  701|      0|#endif /* NETSNMP_FEATURE_REMOVE_LOGGING_FILE */
  702|      0|        netsnmp_disable_this_loghandler(logh);
  703|      0|    }
  704|     69|}
log_handler_stdouterr:
 1101|  3.24k|{
 1102|  3.24k|    static int      newline = 1;	 /* MTCRITICAL_RESOURCE */
 1103|  3.24k|    const char     *newline_ptr;
 1104|  3.24k|    char            sbuf[40];
 1105|       |
 1106|  3.24k|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|  3.24k|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1106:9): [True: 0, False: 3.24k]
  ------------------
 1107|  3.24k|                               NETSNMP_DS_LIB_LOG_TIMESTAMP) && newline) {
  ------------------
  |  |   64|  3.24k|#define NETSNMP_DS_LIB_LOG_TIMESTAMP       5
  ------------------
  |  Branch (1107:65): [True: 0, False: 0]
  ------------------
 1108|      0|        sprintf_stamp(NULL, sbuf);
 1109|  3.24k|    } else {
 1110|  3.24k|        strcpy(sbuf, "");
 1111|  3.24k|    }
 1112|       |    /*
 1113|       |     * Remember whether or not the current line ends with a newline for the
 1114|       |     * next call of log_handler_stdouterr().
 1115|       |     */
 1116|  3.24k|    newline_ptr = strrchr(str, '\n');
 1117|  3.24k|    newline = newline_ptr && newline_ptr[1] == 0;
  ------------------
  |  Branch (1117:15): [True: 3.24k, False: 0]
  |  Branch (1117:30): [True: 3.24k, False: 0]
  ------------------
 1118|       |
 1119|  3.24k|    if (logh->imagic)
  ------------------
  |  Branch (1119:9): [True: 0, False: 3.24k]
  ------------------
 1120|      0|       printf(         "%s%s", sbuf, str);
 1121|  3.24k|    else
 1122|  3.24k|       fprintf(stderr, "%s%s", sbuf, str);
 1123|       |
 1124|  3.24k|    return 1;
 1125|  3.24k|}
snmp_log_string:
 1292|  3.24k|{
 1293|  3.24k|#ifndef NETSNMP_FEATURE_REMOVE_LOGGING_STDIO
 1294|  3.24k|    static int stderr_enabled = 0;
 1295|  3.24k|    static netsnmp_log_handler lh = { 1, 0, 0, 0, "stderr",
 1296|  3.24k|                                      log_handler_stdouterr, 0, NULL,  NULL,
 1297|  3.24k|                                      NULL };
 1298|  3.24k|#endif /* NETSNMP_FEATURE_REMOVE_LOGGING_STDIO */
 1299|  3.24k|    netsnmp_log_handler *logh;
 1300|       |
 1301|       |    /*
 1302|       |     * We've got to be able to log messages *somewhere*!
 1303|       |     * If you don't want stderr logging, then enable something else.
 1304|       |     */
 1305|  3.24k|    if (0 == logh_enabled) {
  ------------------
  |  Branch (1305:9): [True: 3.24k, False: 0]
  ------------------
 1306|  3.24k|#ifndef NETSNMP_FEATURE_REMOVE_LOGGING_STDIO
 1307|  3.24k|        if (!stderr_enabled) {
  ------------------
  |  Branch (1307:13): [True: 1, False: 3.24k]
  ------------------
 1308|      1|            ++stderr_enabled;
 1309|      1|            netsnmp_set_line_buffering(stderr);
 1310|      1|        }
 1311|  3.24k|        log_handler_stdouterr( &lh, priority, str );
 1312|  3.24k|#endif /* NETSNMP_FEATURE_REMOVE_LOGGING_STDIO */
 1313|       |
 1314|  3.24k|        return;
 1315|  3.24k|    }
 1316|      0|#ifndef NETSNMP_FEATURE_REMOVE_LOGGING_STDIO
 1317|      0|    else if (stderr_enabled) {
  ------------------
  |  Branch (1317:14): [True: 0, False: 0]
  ------------------
 1318|      0|        stderr_enabled = 0;
 1319|      0|        log_handler_stdouterr( &lh, LOG_INFO,
 1320|      0|                               "Log handling defined - disabling stderr\n" );
 1321|      0|    }
 1322|      0|#endif /* NETSNMP_FEATURE_REMOVE_LOGGING_STDIO */
 1323|       |        
 1324|       |
 1325|       |    /*
 1326|       |     * Start at the given priority, and work "upwards"....
 1327|       |     */
 1328|      0|    if (priority > LOG_DEBUG)
  ------------------
  |  Branch (1328:9): [True: 0, False: 0]
  ------------------
 1329|      0|        priority = LOG_DEBUG;
 1330|      0|    logh = logh_priorities[priority];
 1331|      0|    for ( ; logh; logh = logh->next ) {
  ------------------
  |  Branch (1331:13): [True: 0, False: 0]
  ------------------
 1332|       |        /*
 1333|       |         * ... but skipping any handlers with a "maximum priority"
 1334|       |         *     that we have already exceeded. And don't forget to
 1335|       |         *     ensure this logging is turned on (see snmp_disable_stderrlog
 1336|       |         *     and its cohorts).
 1337|       |         */
 1338|      0|        if (logh->enabled && priority <= logh->pri_max)
  ------------------
  |  Branch (1338:13): [True: 0, False: 0]
  |  Branch (1338:30): [True: 0, False: 0]
  ------------------
 1339|      0|            logh->handler( logh, priority, str );
 1340|      0|    }
 1341|      0|}
snmp_vlog:
 1379|  3.24k|{
 1380|  3.24k|    char           *buffer = NULL;
 1381|  3.24k|    int             length;
 1382|       |
 1383|  3.24k|    length = vasprintf(&buffer, format, ap);
 1384|  3.24k|    if (length < 0) {
  ------------------
  |  Branch (1384:9): [True: 0, False: 3.24k]
  ------------------
 1385|      0|        snmp_log_string(LOG_ERR, "Could not format log-string\n");
 1386|      0|        return -1;
 1387|      0|    }
 1388|       |
 1389|  3.24k|    snmp_log_string(priority, buffer);
 1390|  3.24k|    free(buffer);
 1391|  3.24k|    return 0;
 1392|  3.24k|}
snmp_log:
 1403|  3.24k|{
 1404|  3.24k|    va_list         ap;
 1405|  3.24k|    int             ret;
 1406|  3.24k|    va_start(ap, format);
 1407|  3.24k|    ret = snmp_vlog(priority, format, ap);
 1408|       |    va_end(ap);
 1409|  3.24k|    return (ret);
 1410|  3.24k|}

netsnmp_init_openssl:
  118|     70|void netsnmp_init_openssl(void) {
  119|       |
  120|       |    /* avoid duplicate calls */
  121|     70|    if (have_started_already)
  ------------------
  |  Branch (121:9): [True: 69, False: 1]
  ------------------
  122|     69|        return;
  123|      1|    have_started_already = 1;
  124|       |
  125|      1|    DEBUGMSGTL(("snmp_openssl", "initializing\n"));
  ------------------
  |  |   66|      1|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 1]
  |  |  ------------------
  ------------------
  126|       |
  127|       |    /* Initializing OpenSSL */
  128|      1|#ifdef HAVE_SSL_LIBRARY_INIT
  129|      1|    SSL_library_init();
  130|      1|#endif
  131|      1|#ifdef HAVE_SSL_LOAD_ERROR_STRINGS
  132|      1|    SSL_load_error_strings();
  133|      1|#endif
  134|       |#ifdef HAVE_ERR_LOAD_BIO_STRINGS
  135|       |    ERR_load_BIO_strings();
  136|       |#endif
  137|      1|#ifdef HAVE_OPENSSL_ADD_ALL_ALGORITHMS
  138|       |    OpenSSL_add_all_algorithms();
  139|      1|#endif
  140|      1|}

init_secmod:
   48|     69|{
   49|     69|    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     69|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
   50|     69|                           SNMP_CALLBACK_SESSION_INIT, set_default_secmod,
  ------------------
  |  |   29|     69|#define SNMP_CALLBACK_SESSION_INIT		5
  ------------------
   51|     69|                           NULL);
   52|       |
   53|     69|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defSecurityModel",
  ------------------
  |  |   78|     69|#define ASN_OCTET_STR	    0x04U
  ------------------
   54|     69|			       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SECMODEL);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              			       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SECMODEL);
  ------------------
  |  |  161|     69|#define NETSNMP_DS_LIB_SECMODEL          10
  ------------------
   55|       |    /*
   56|       |     * this file is generated by configure for all the stuff we're using 
   57|       |     */
   58|     69|#include "snmpsm_init.h"
  ------------------
  |  |    1|       |/* This file is automatically generated by configure.  Do not modify by hand. */
  |  |    2|     69|init_usm();
  |  |    3|     69|init_tsm();
  |  |    4|     69|init_ksm();
  ------------------
   59|     69|}
shutdown_secmod:
   63|     69|{
   64|     69|    #include "snmpsm_shutdown.h"
  ------------------
  |  |    1|       |/* This file is automatically generated by configure.  Do not modify by hand. */
  |  |    2|     69|shutdown_usm();
  |  |    3|     69|shutdown_tsm();
  |  |    4|     69|shutdown_ksm();
  ------------------
   65|     69|}
register_sec_mod:
   70|    207|{
   71|    207|    int             result = 0;
   72|    207|    struct snmp_secmod_list *sptr;
   73|    207|    char           *othername, *modname2 = NULL;
   74|       |
   75|    414|    for (sptr = registered_services; sptr; sptr = sptr->next) {
  ------------------
  |  Branch (75:38): [True: 207, False: 207]
  ------------------
   76|    207|        if (sptr->securityModel == secmod) {
  ------------------
  |  Branch (76:13): [True: 0, False: 207]
  ------------------
   77|      0|            return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
   78|      0|        }
   79|    207|    }
   80|    207|    sptr = SNMP_MALLOC_STRUCT(snmp_secmod_list);
  ------------------
  |  |   69|    207|#define SNMP_MALLOC_STRUCT(s)   (struct s *) calloc(1, sizeof(struct s))
  ------------------
   81|    207|    if (sptr == NULL)
  ------------------
  |  Branch (81:9): [True: 0, False: 207]
  ------------------
   82|      0|        return SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
   83|    207|    sptr->secDef = newdef;
   84|    207|    sptr->securityModel = secmod;
   85|    207|    sptr->next = registered_services;
   86|    207|    registered_services = sptr;
   87|    207|    modname2 = strdup(modname);
   88|    207|    if (!modname2)
  ------------------
  |  Branch (88:9): [True: 0, False: 207]
  ------------------
   89|      0|        result = SE_NOMEM;
  ------------------
  |  |   43|      0|#define SE_NOMEM         1
  ------------------
   90|    207|    else
   91|    207|        result = se_add_pair_to_slist("snmp_secmods", modname2, secmod);
   92|    207|    if (result != SE_OK) {
  ------------------
  |  |   42|    207|#define SE_OK            0
  ------------------
  |  Branch (92:9): [True: 0, False: 207]
  ------------------
   93|      0|        switch (result) {
   94|      0|        case SE_NOMEM:
  ------------------
  |  |   43|      0|#define SE_NOMEM         1
  ------------------
  |  Branch (94:9): [True: 0, False: 0]
  ------------------
   95|      0|            snmp_log(LOG_CRIT, "snmp_secmod: no memory\n");
   96|      0|            break;
   97|       |
   98|      0|        case SE_ALREADY_THERE:
  ------------------
  |  |   44|      0|#define SE_ALREADY_THERE 2
  ------------------
  |  Branch (98:9): [True: 0, False: 0]
  ------------------
   99|      0|            othername = se_find_label_in_slist("snmp_secmods", secmod);
  100|      0|            if (strcmp(othername, modname) != 0) {
  ------------------
  |  Branch (100:17): [True: 0, False: 0]
  ------------------
  101|      0|                snmp_log(LOG_ERR,
  102|      0|                         "snmp_secmod: two security modules %s and %s registered with the same security number\n",
  103|      0|                         modname, othername);
  104|      0|            }
  105|      0|            break;
  106|       |
  107|      0|        default:
  ------------------
  |  Branch (107:9): [True: 0, False: 0]
  ------------------
  108|      0|            snmp_log(LOG_ERR,
  109|      0|                     "snmp_secmod: unknown error trying to register a new security module\n");
  110|      0|            break;
  111|      0|        }
  112|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  113|      0|    }
  114|    207|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|    207|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  115|    207|}
unregister_sec_mod:
  121|     69|{
  122|     69|    struct snmp_secmod_list *sptr, *lptr;
  123|       |
  124|     69|    for (sptr = registered_services, lptr = NULL; sptr;
  ------------------
  |  Branch (124:51): [True: 0, False: 69]
  ------------------
  125|     69|         lptr = sptr, sptr = sptr->next) {
  126|      0|        if (sptr->securityModel == secmod) {
  ------------------
  |  Branch (126:13): [True: 0, False: 0]
  ------------------
  127|      0|            if ( lptr )
  ------------------
  |  Branch (127:18): [True: 0, False: 0]
  ------------------
  128|      0|                lptr->next = sptr->next;
  129|      0|            else
  130|      0|                registered_services = sptr->next;
  131|      0|	    SNMP_FREE(sptr->secDef);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
  132|      0|            SNMP_FREE(sptr);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
  133|      0|            return SNMPERR_SUCCESS;
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  134|      0|        }
  135|      0|    }
  136|       |    /*
  137|       |     * not registered 
  138|       |     */
  139|     69|    return SNMPERR_GENERR;
  ------------------
  |  |  218|     69|#define SNMPERR_GENERR			(-1)
  ------------------
  140|     69|}
clear_sec_mod:
  145|     69|{
  146|     69|    struct snmp_secmod_list *tmp = registered_services, *next = NULL;
  147|       |
  148|    276|    while (tmp != NULL) {
  ------------------
  |  Branch (148:12): [True: 207, False: 69]
  ------------------
  149|    207|	next = tmp->next;
  150|    207|	SNMP_FREE(tmp->secDef);
  ------------------
  |  |   62|    207|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 207, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 207]
  |  |  ------------------
  ------------------
  151|    207|	SNMP_FREE(tmp);
  ------------------
  |  |   62|    207|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 207, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 207]
  |  |  ------------------
  ------------------
  152|    207|	tmp = next;
  153|    207|    }
  154|       |    registered_services = NULL;
  155|     69|}
find_sec_mod:
  160|    234|{
  161|    234|    struct snmp_secmod_list *sptr;
  162|       |
  163|    774|    for (sptr = registered_services; sptr; sptr = sptr->next) {
  ------------------
  |  Branch (163:38): [True: 702, False: 72]
  ------------------
  164|    702|        if (sptr->securityModel == secmod) {
  ------------------
  |  Branch (164:13): [True: 162, False: 540]
  ------------------
  165|    162|            return sptr->secDef;
  166|    162|        }
  167|    702|    }
  168|       |    /*
  169|       |     * not registered 
  170|       |     */
  171|     72|    return NULL;
  172|    234|}
snmp_secmod.c:set_default_secmod:
  189|     69|{
  190|     69|    netsnmp_session *sess = (netsnmp_session *) serverarg;
  191|     69|    char           *cptr;
  192|     69|    int             model;
  193|       |
  194|     69|    if (!sess)
  ------------------
  |  Branch (194:9): [True: 0, False: 69]
  ------------------
  195|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  196|     69|    if (sess->securityModel == SNMP_DEFAULT_SECMODEL) {
  ------------------
  |  |  124|     69|#define SNMP_DEFAULT_SECMODEL	    -1
  ------------------
  |  Branch (196:9): [True: 69, False: 0]
  ------------------
  197|     69|        if ((cptr = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (197:13): [True: 0, False: 69]
  ------------------
  198|     69|					  NETSNMP_DS_LIB_SECMODEL)) != NULL) {
  ------------------
  |  |  161|     69|#define NETSNMP_DS_LIB_SECMODEL          10
  ------------------
  199|      0|            if ((model = se_find_value_in_slist("snmp_secmods", cptr))
  ------------------
  |  Branch (199:17): [True: 0, False: 0]
  ------------------
  200|      0|		!= SE_DNE) {
  ------------------
  |  |   45|      0|#define SE_DNE           -2
  ------------------
  201|      0|                sess->securityModel = model;
  202|      0|            } else {
  203|      0|                snmp_log(LOG_ERR,
  204|      0|                         "unknown security model name: %s.  Forcing USM instead.\n",
  205|      0|                         cptr);
  206|      0|                sess->securityModel = NETSNMP_SECMOD_DEFAULT_MODEL;
  ------------------
  |  |  177|      0|#define NETSNMP_SECMOD_DEFAULT_MODEL  USM_SEC_MODEL_NUMBER
  |  |  ------------------
  |  |  |  |   40|      0|#define USM_SEC_MODEL_NUMBER            SNMP_SEC_MODEL_USM
  |  |  |  |  ------------------
  |  |  |  |  |  |  295|      0|#define SNMP_SEC_MODEL_USM		3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  207|      0|                return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  208|      0|            }
  209|     69|        } else {
  210|     69|            sess->securityModel = NETSNMP_SECMOD_DEFAULT_MODEL;
  ------------------
  |  |  177|     69|#define NETSNMP_SECMOD_DEFAULT_MODEL  USM_SEC_MODEL_NUMBER
  |  |  ------------------
  |  |  |  |   40|     69|#define USM_SEC_MODEL_NUMBER            SNMP_SEC_MODEL_USM
  |  |  |  |  ------------------
  |  |  |  |  |  |  295|     69|#define SNMP_SEC_MODEL_USM		3
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  211|     69|        }
  212|     69|    }
  213|     69|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|     69|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  214|     69|}

netsnmp_register_default_domain:
   60|    138|{
   61|    138|    struct netsnmp_lookup_domain *run = domains, *prev = NULL;
   62|    138|    int res = 0;
   63|       |
   64|    207|    while (run != NULL && strcmp(run->application, application) < 0) {
  ------------------
  |  Branch (64:12): [True: 69, False: 138]
  |  Branch (64:27): [True: 69, False: 0]
  ------------------
   65|     69|	prev = run;
   66|     69|	run = run->next;
   67|     69|    }
   68|    138|    if (run && strcmp(run->application, application) == 0) {
  ------------------
  |  Branch (68:9): [True: 0, False: 138]
  |  Branch (68:16): [True: 0, False: 0]
  ------------------
   69|      0|      if (run->domain != NULL) {
  ------------------
  |  Branch (69:11): [True: 0, False: 0]
  ------------------
   70|      0|          destroy_word_array(run->domain);
   71|      0|	  run->domain = NULL;
   72|      0|	  res = 1;
   73|      0|      }
   74|    138|    } else {
   75|    138|	run = SNMP_MALLOC_STRUCT(netsnmp_lookup_domain);
  ------------------
  |  |   69|    138|#define SNMP_MALLOC_STRUCT(s)   (struct s *) calloc(1, sizeof(struct s))
  ------------------
   76|    138|	run->application = strdup(application);
   77|    138|	run->userDomain = NULL;
   78|    138|	if (prev) {
  ------------------
  |  Branch (78:6): [True: 69, False: 69]
  ------------------
   79|     69|	    run->next = prev->next;
   80|     69|	    prev->next = run;
   81|     69|	} else {
   82|     69|	    run->next = domains;
   83|     69|	    domains = run;
   84|     69|	}
   85|    138|    }
   86|    138|    if (domain) {
  ------------------
  |  Branch (86:9): [True: 138, False: 0]
  ------------------
   87|    138|        run->domain = create_word_array(domain);
   88|    138|    } else if (run->userDomain == NULL) {
  ------------------
  |  Branch (88:16): [True: 0, False: 0]
  ------------------
   89|      0|	if (prev)
  ------------------
  |  Branch (89:6): [True: 0, False: 0]
  ------------------
   90|      0|	    prev->next = run->next;
   91|      0|	else
   92|      0|	    domains = run->next;
   93|      0|	free(run->application);
   94|      0|	free(run);
   95|      0|    }
   96|    138|    return res;
   97|    138|}
netsnmp_clear_default_domain:
  101|     69|{
  102|    207|    while (domains) {
  ------------------
  |  Branch (102:12): [True: 138, False: 69]
  ------------------
  103|    138|	struct netsnmp_lookup_domain *tmp = domains;
  104|    138|	domains = domains->next;
  105|    138|	free(tmp->application);
  106|    138|        destroy_word_array(tmp->userDomain);
  107|    138|        destroy_word_array(tmp->domain);
  108|    138|	free(tmp);
  109|    138|    }
  110|     69|}
netsnmp_lookup_default_domains:
  186|     69|{
  187|     69|    const char * const * res;
  188|       |
  189|     69|    if (application == NULL)
  ------------------
  |  Branch (189:9): [True: 0, False: 69]
  ------------------
  190|      0|	res = NULL;
  191|     69|    else {
  192|     69|        struct netsnmp_lookup_domain *run = domains;
  193|       |
  194|    207|	while (run && strcmp(run->application, application) < 0)
  ------------------
  |  Branch (194:9): [True: 138, False: 69]
  |  Branch (194:16): [True: 138, False: 0]
  ------------------
  195|    138|	    run = run->next;
  196|     69|	if (run && strcmp(run->application, application) == 0)
  ------------------
  |  Branch (196:6): [True: 0, False: 69]
  |  Branch (196:13): [True: 0, False: 0]
  ------------------
  197|      0|	    if (run->userDomain)
  ------------------
  |  Branch (197:10): [True: 0, False: 0]
  ------------------
  198|      0|                res = (const char * const *)run->userDomain;
  199|      0|	    else
  200|      0|                res = (const char * const *)run->domain;
  201|     69|	else
  202|     69|	    res = NULL;
  203|     69|    }
  204|     69|    DEBUGMSGTL(("defaults",
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
  205|     69|                "netsnmp_lookup_default_domain(\"%s\") ->",
  206|     69|                application ? application : "[NIL]"));
  207|     69|    if (res) {
  ------------------
  |  Branch (207:9): [True: 0, False: 69]
  ------------------
  208|      0|        const char * const * r = res;
  209|      0|        while(*r) {
  ------------------
  |  Branch (209:15): [True: 0, False: 0]
  ------------------
  210|      0|            DEBUGMSG(("defaults", " \"%s\"", *r));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
  211|      0|            ++r;
  212|      0|        }
  213|      0|        DEBUGMSG(("defaults", "\n"));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
  214|      0|    } else
  215|     69|        DEBUGMSG(("defaults", " \"[NIL]\"\n"));
  ------------------
  |  |   61|     69|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 69]
  |  |  ------------------
  ------------------
  216|     69|    return res;
  217|     69|}
netsnmp_register_default_target:
  248|    966|{
  249|    966|    struct netsnmp_lookup_target *run = targets, *prev = NULL;
  250|    966|    int i = 0, res = 0;
  251|  5.31k|    while (run && ((i = strcmp(run->application, application)) < 0 ||
  ------------------
  |  Branch (251:12): [True: 5.03k, False: 276]
  |  Branch (251:20): [True: 3.38k, False: 1.65k]
  ------------------
  252|  4.34k|		   (i == 0 && strcmp(run->domain, domain) < 0))) {
  ------------------
  |  Branch (252:7): [True: 1.65k, False: 0]
  |  Branch (252:17): [True: 966, False: 690]
  ------------------
  253|  4.34k|	prev = run;
  254|  4.34k|	run = run->next;
  255|  4.34k|    }
  256|    966|    if (run && i == 0 && strcmp(run->domain, domain) == 0) {
  ------------------
  |  Branch (256:9): [True: 690, False: 276]
  |  Branch (256:16): [True: 690, False: 0]
  |  Branch (256:26): [True: 0, False: 690]
  ------------------
  257|      0|      if (run->target != NULL) {
  ------------------
  |  Branch (257:11): [True: 0, False: 0]
  ------------------
  258|      0|	    free(run->target);
  259|      0|	    run->target = NULL;
  260|      0|	    res = 1;
  261|      0|      }
  262|    966|    } else {
  263|    966|	run = SNMP_MALLOC_STRUCT(netsnmp_lookup_target);
  ------------------
  |  |   69|    966|#define SNMP_MALLOC_STRUCT(s)   (struct s *) calloc(1, sizeof(struct s))
  ------------------
  264|    966|	run->application = strdup(application);
  265|    966|	run->domain = strdup(domain);
  266|    966|	run->userTarget = NULL;
  267|    966|	if (prev) {
  ------------------
  |  Branch (267:6): [True: 759, False: 207]
  ------------------
  268|    759|	    run->next = prev->next;
  269|    759|	    prev->next = run;
  270|    759|	} else {
  271|    207|	    run->next = targets;
  272|    207|	    targets = run;
  273|    207|	}
  274|    966|    }
  275|    966|    if (target) {
  ------------------
  |  Branch (275:9): [True: 966, False: 0]
  ------------------
  276|    966|	run->target = strdup(target);
  277|    966|    } else if (run->userTarget == NULL) {
  ------------------
  |  Branch (277:16): [True: 0, False: 0]
  ------------------
  278|      0|	if (prev)
  ------------------
  |  Branch (278:6): [True: 0, False: 0]
  ------------------
  279|      0|	    prev->next = run->next;
  280|      0|	else
  281|      0|	    targets = run->next;
  282|      0|	free(run->domain);
  283|      0|	free(run->application);
  284|      0|	free(run);
  285|      0|    }
  286|    966|    return res;
  287|    966|}
netsnmp_clear_default_target:
  294|     69|{
  295|  1.03k|    while (targets) {
  ------------------
  |  Branch (295:12): [True: 966, False: 69]
  ------------------
  296|    966|	struct netsnmp_lookup_target *tmp = targets;
  297|    966|	targets = targets->next;
  298|    966|	free(tmp->application);
  299|    966|	free(tmp->domain);
  300|    966|	free(tmp->userTarget);
  301|    966|	free(tmp->target);
  302|    966|	free(tmp);
  303|    966|    }
  304|     69|}
netsnmp_lookup_default_target:
  397|     69|{
  398|     69|    int i = 0;
  399|     69|    struct netsnmp_lookup_target *run = targets;
  400|     69|    const char *res;
  401|       |
  402|     69|    if (application == NULL || domain == NULL)
  ------------------
  |  Branch (402:9): [True: 0, False: 69]
  |  Branch (402:32): [True: 0, False: 69]
  ------------------
  403|      0|	res = NULL;
  404|     69|    else {
  405|  1.03k|	while (run && ((i = strcmp(run->application, application)) < 0 ||
  ------------------
  |  Branch (405:9): [True: 966, False: 69]
  |  Branch (405:17): [True: 966, False: 0]
  ------------------
  406|      0|		       (i == 0 && strcmp(run->domain, domain) < 0)))
  ------------------
  |  Branch (406:11): [True: 0, False: 0]
  |  Branch (406:21): [True: 0, False: 0]
  ------------------
  407|    966|	    run = run->next;
  408|     69|	if (run && i == 0 && strcmp(run->domain, domain) == 0)
  ------------------
  |  Branch (408:6): [True: 0, False: 69]
  |  Branch (408:13): [True: 0, False: 0]
  |  Branch (408:23): [True: 0, False: 0]
  ------------------
  409|      0|	    if (run->userTarget != NULL)
  ------------------
  |  Branch (409:10): [True: 0, False: 0]
  ------------------
  410|      0|		res = run->userTarget;
  411|      0|	    else
  412|      0|		res = run->target;
  413|     69|	else
  414|     69|	    res = NULL;
  415|     69|    }
  416|     69|    DEBUGMSGTL(("defaults",
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
  417|     69|		"netsnmp_lookup_default_target(\"%s\", \"%s\") -> \"%s\"\n",
  418|     69|		application ? application : "[NIL]",
  419|     69|		domain ? domain : "[NIL]",
  420|     69|		res ? res : "[NIL]"));
  421|     69|    return res;
  422|     69|}
netsnmp_register_service_handlers:
  426|     69|{
  427|     69|    register_config_handler("snmp:", "defDomain",
  428|     69|			    netsnmp_register_user_domain,
  429|     69|			    netsnmp_clear_user_domain,
  430|     69|			    "application domain");
  431|     69|    register_config_handler("snmp:", "defTarget",
  432|     69|			    netsnmp_register_user_target,
  433|     69|			    netsnmp_clear_user_target,
  434|     69|			    "application domain target");
  435|     69|}
snmp_service.c:destroy_word_array:
   38|    276|{
   39|    276|    if (arr) {
  ------------------
  |  Branch (39:9): [True: 138, False: 138]
  ------------------
   40|    138|        char** run = arr;
   41|    414|        while(*run) {
  ------------------
  |  Branch (41:15): [True: 276, False: 138]
  ------------------
   42|    276|            free(*run);
   43|    276|            ++run;
   44|    276|        }
   45|    138|        free(arr);
   46|    138|    }
   47|    276|}
snmp_service.c:create_word_array:
   28|    138|{
   29|    138|    size_t tmplen = strlen(cptr);
   30|    138|    char* tmp = (char*)malloc(tmplen + 1);
   31|    138|    char** res = create_word_array_helper(cptr, 0, tmp, tmplen + 1);
   32|    138|    free(tmp);
   33|    138|    return res;
   34|    138|}
snmp_service.c:create_word_array_helper:
   11|    276|{
   12|    276|    char* item;
   13|    276|    char** res;
   14|    276|    cptr = copy_nword_const(cptr, tmp, tmplen);
   15|    276|    item = strdup(tmp);
   16|    276|    if (cptr)
  ------------------
  |  Branch (16:9): [True: 138, False: 138]
  ------------------
   17|    138|        res = create_word_array_helper(cptr, idx + 1, tmp, tmplen);
   18|    138|    else {
   19|    138|        res = (char**)malloc(sizeof(char*) * (idx + 2));
   20|       |        res[idx + 1] = NULL;
   21|    138|    }
   22|    276|    res[idx] = item;
   23|    276|    return res;
   24|    276|}
snmp_service.c:netsnmp_clear_user_domain:
  161|    276|{
  162|    276|    struct netsnmp_lookup_domain *run = domains, *prev = NULL;
  163|       |
  164|    828|    while (run) {
  ------------------
  |  Branch (164:12): [True: 552, False: 276]
  ------------------
  165|    552|	if (run->userDomain != NULL) {
  ------------------
  |  Branch (165:6): [True: 0, False: 552]
  ------------------
  166|      0|            destroy_word_array(run->userDomain);
  167|      0|	    run->userDomain = NULL;
  168|      0|	}
  169|    552|	if (run->domain == NULL) {
  ------------------
  |  Branch (169:6): [True: 0, False: 552]
  ------------------
  170|      0|	    struct netsnmp_lookup_domain *tmp = run;
  171|      0|	    if (prev)
  ------------------
  |  Branch (171:10): [True: 0, False: 0]
  ------------------
  172|      0|		run = prev->next = run->next;
  173|      0|	    else
  174|      0|		run = domains = run->next;
  175|      0|	    free(tmp->application);
  176|      0|	    free(tmp);
  177|    552|	} else {
  178|    552|	    prev = run;
  179|    552|	    run = run->next;
  180|    552|	}
  181|    552|    }
  182|    276|}
snmp_service.c:netsnmp_clear_user_target:
  371|    276|{
  372|    276|    struct netsnmp_lookup_target *run = targets, *prev = NULL;
  373|       |
  374|  4.14k|    while (run) {
  ------------------
  |  Branch (374:12): [True: 3.86k, False: 276]
  ------------------
  375|  3.86k|	if (run->userTarget != NULL) {
  ------------------
  |  Branch (375:6): [True: 0, False: 3.86k]
  ------------------
  376|      0|	    free(run->userTarget);
  377|      0|	    run->userTarget = NULL;
  378|      0|	}
  379|  3.86k|	if (run->target == NULL) {
  ------------------
  |  Branch (379:6): [True: 0, False: 3.86k]
  ------------------
  380|      0|	    struct netsnmp_lookup_target *tmp = run;
  381|      0|	    if (prev)
  ------------------
  |  Branch (381:10): [True: 0, False: 0]
  ------------------
  382|      0|		run = prev->next = run->next;
  383|      0|	    else
  384|      0|		run = targets = run->next;
  385|      0|	    free(tmp->application);
  386|      0|	    free(tmp->domain);
  387|      0|	    free(tmp);
  388|  3.86k|	} else {
  389|  3.86k|	    prev = run;
  390|  3.86k|	    run = run->next;
  391|  3.86k|	}
  392|  3.86k|    }
  393|    276|}

init_snmp_transport:
  124|     69|{
  125|     69|    netsnmp_ds_register_config(ASN_BOOLEAN,
  ------------------
  |  |   72|     69|#define ASN_BOOLEAN	    0x01U
  ------------------
  126|     69|                               "snmp", "dontLoadHostConfig",
  127|     69|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  128|     69|                               NETSNMP_DS_LIB_DONT_LOAD_HOST_FILES);
  ------------------
  |  |  100|     69|#define NETSNMP_DS_LIB_DONT_LOAD_HOST_FILES 40 /* don't read host.conf files */
  ------------------
  129|     69|#ifndef NETSNMP_FEATURE_REMOVE_FILTER_SOURCE
  130|     69|    register_app_config_handler("sourceFilterType",
  131|     69|                                netsnmp_transport_parse_filterType,
  132|       |                                NULL, "none|whitelist|blacklist");
  133|     69|    register_app_config_handler("sourceFilterAddress",
  134|     69|                                netsnmp_transport_parse_filter,
  135|     69|                                netsnmp_transport_filter_cleanup,
  136|     69|                                "host");
  137|     69|#endif /* NETSNMP_FEATURE_REMOVE_FILTER_SOURCE */
  138|     69|}
shutdown_snmp_transport:
  142|     69|{
  143|     69|#ifndef NETSNMP_FEATURE_REMOVE_FILTER_SOURCE
  144|     69|    netsnmp_transport_filter_cleanup();
  145|     69|#endif
  146|     69|}
netsnmp_transport_free:
  232|    138|{
  233|    138|    if (NULL == t)
  ------------------
  |  Branch (233:9): [True: 69, False: 69]
  ------------------
  234|     69|        return;
  235|       |
  236|     69|#ifndef FEATURE_REMOVE_TRANSPORT_CACHE
  237|       |    /** don't free a transport that is currently shared */
  238|     69|    if (netsnmp_transport_cache_remove(t) == 1)
  ------------------
  |  Branch (238:9): [True: 0, False: 69]
  ------------------
  239|      0|        return;
  240|     69|#endif
  241|       |
  242|     69|    SNMP_FREE(t->local);
  ------------------
  |  |   62|     69|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 69, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 69]
  |  |  ------------------
  ------------------
  243|     69|    SNMP_FREE(t->remote);
  ------------------
  |  |   62|     69|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 69]
  |  |  |  Branch (62:66): [Folded, False: 69]
  |  |  ------------------
  ------------------
  244|     69|    SNMP_FREE(t->data);
  ------------------
  |  |   62|     69|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 69]
  |  |  |  Branch (62:66): [Folded, False: 69]
  |  |  ------------------
  ------------------
  245|     69|    netsnmp_transport_free(t->base_transport);
  246|       |
  247|       |    SNMP_FREE(t);
  ------------------
  |  |   62|     69|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 69, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 69]
  |  |  ------------------
  ------------------
  248|     69|}
netsnmp_transport_filter_cleanup:
  370|    276|{
  371|    276|    if (NULL == filtered)
  ------------------
  |  Branch (371:9): [True: 276, False: 0]
  ------------------
  372|    276|        return;
  373|      0|    CONTAINER_CLEAR(filtered, filtered->free_item, NULL);
  374|      0|    CONTAINER_FREE(filtered);
  375|       |    filtered = NULL;
  376|      0|}
netsnmp_transport_send:
  405|      4|{
  406|      4|    int dumpPacket, debugLength;
  407|       |
  408|      4|    if ((NULL == t) || (NULL == t->f_send)) {
  ------------------
  |  Branch (408:9): [True: 0, False: 4]
  |  Branch (408:24): [True: 0, False: 4]
  ------------------
  409|      0|        DEBUGMSGTL(("transport:pkt:send", "NULL transport or send function\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  410|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  411|      0|    }
  412|       |
  413|      4|    dumpPacket = netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      4|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  414|      4|                                        NETSNMP_DS_LIB_DUMP_PACKET);
  ------------------
  |  |   63|      4|#define NETSNMP_DS_LIB_DUMP_PACKET         4
  ------------------
  415|      4|    debugLength = (SNMPERR_SUCCESS ==
  ------------------
  |  |  217|      4|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  416|      4|                   debug_is_token_registered("transport:send"));
  417|       |
  418|      4|    if (dumpPacket | debugLength) {
  ------------------
  |  Branch (418:9): [True: 0, False: 4]
  ------------------
  419|      0|        char *str = netsnmp_transport_peer_string(t,
  420|      0|                                                  opaque ? *opaque : NULL,
  ------------------
  |  Branch (420:51): [True: 0, False: 0]
  ------------------
  421|      0|                                                  olength ? *olength : 0);
  ------------------
  |  Branch (421:51): [True: 0, False: 0]
  ------------------
  422|      0|        if (debugLength)
  ------------------
  |  Branch (422:13): [True: 0, False: 0]
  ------------------
  423|      0|            DEBUGMSGT_NC(("transport:send","%lu bytes to %s\n",
  ------------------
  |  |   85|      0|#define DEBUGMSGT_NC(x) do { __DBGMSGT_NC(x); }while(0)
  |  |  ------------------
  |  |  |  |  149|      0|#define __DBGMSGT_NC(x)  debug_combo_nc x
  |  |  ------------------
  |  |  |  Branch (85:54): [Folded, False: 0]
  |  |  ------------------
  ------------------
  424|      0|                          (unsigned long)length, str));
  425|      0|        if (dumpPacket)
  ------------------
  |  Branch (425:13): [True: 0, False: 0]
  ------------------
  426|      0|            snmp_log(LOG_DEBUG, "\nSending %lu bytes to %s\n", 
  427|      0|                     (unsigned long)length, str);
  428|      0|        SNMP_FREE(str);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
  429|      0|    }
  430|      4|    if (dumpPacket)
  ------------------
  |  Branch (430:9): [True: 0, False: 4]
  ------------------
  431|      0|        xdump(packet, length, "");
  432|       |
  433|      4|    return t->f_send(t, packet, length, opaque, olength);
  434|      4|}
netsnmp_transport_recv:
  439|     68|{
  440|     68|    int debugLength;
  441|       |
  442|     68|    if ((NULL == t) || (NULL == t->f_recv)) {
  ------------------
  |  Branch (442:9): [True: 0, False: 68]
  |  Branch (442:24): [True: 0, False: 68]
  ------------------
  443|      0|        DEBUGMSGTL(("transport:recv", "NULL transport or recv function\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  444|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  445|      0|    }
  446|       |
  447|     68|    length = t->f_recv(t, packet, length, opaque, olength);
  448|       |
  449|     68|    if (length <=0)
  ------------------
  |  Branch (449:9): [True: 0, False: 68]
  ------------------
  450|      0|        return length; /* don't log timeouts/socket closed */
  451|       |
  452|     68|    debugLength = (SNMPERR_SUCCESS ==
  ------------------
  |  |  217|     68|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  453|     68|                   debug_is_token_registered("transport:recv"));
  454|       |
  455|     68|    if (debugLength) {
  ------------------
  |  Branch (455:9): [True: 0, False: 68]
  ------------------
  456|      0|        char *str = netsnmp_transport_peer_string(t,
  457|      0|                                                  opaque ? *opaque : NULL,
  ------------------
  |  Branch (457:51): [True: 0, False: 0]
  ------------------
  458|      0|                                                  olength ? *olength : 0);
  ------------------
  |  Branch (458:51): [True: 0, False: 0]
  ------------------
  459|      0|        DEBUGMSGT_NC(("transport:recv","%d bytes from %s\n", length, str));
  ------------------
  |  |   85|      0|#define DEBUGMSGT_NC(x) do { __DBGMSGT_NC(x); }while(0)
  |  |  ------------------
  |  |  |  |  149|      0|#define __DBGMSGT_NC(x)  debug_combo_nc x
  |  |  ------------------
  |  |  |  Branch (85:54): [Folded, False: 0]
  |  |  ------------------
  ------------------
  460|      0|        SNMP_FREE(str);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
  461|      0|    }
  462|       |
  463|     68|    return length;
  464|     68|}
netsnmp_tdomain_init:
  492|     69|{
  493|     69|    DEBUGMSGTL(("tdomain", "netsnmp_tdomain_init() called\n"));
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
  494|       |
  495|       |/* include the configure generated list of constructor calls */
  496|     69|#include "transports/snmp_transport_inits.h"
  ------------------
  |  |    1|       |/* This file is automatically generated by configure.  Do not modify by hand. */
  |  |    2|     69|netsnmp_tlsbase_ctor();
  |  |    3|     69|netsnmp_tlstcp_ctor();
  |  |    4|     69|netsnmp_dtlsudp_ctor();
  |  |    5|     69|netsnmp_udpshared_ctor();
  |  |    6|     69|netsnmp_std_ctor();
  |  |    7|     69|netsnmp_ipx_ctor();
  |  |    8|     69|netsnmp_aal5pvc_ctor();
  |  |    9|     69|netsnmp_udpipv6_ctor();
  |  |   10|     69|netsnmp_tcpipv6_ctor();
  |  |   11|     69|netsnmp_udp_ctor();
  |  |   12|     69|netsnmp_tcp_ctor();
  |  |   13|     69|netsnmp_alias_ctor();
  |  |   14|     69|netsnmp_unix_ctor();
  ------------------
  497|       |
  498|     69|    netsnmp_tdomain_dump();
  499|       |
  500|       |
  501|     69|}
netsnmp_clear_tdomain_list:
  505|     69|{
  506|     69|    netsnmp_tdomain *list = domain_list, *next = NULL;
  507|     69|    DEBUGMSGTL(("tdomain", "clear_tdomain_list() called\n"));
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
  508|       |
  509|    829|    while (list != NULL) {
  ------------------
  |  Branch (509:12): [True: 760, False: 69]
  ------------------
  510|    760|	next = list->next;
  511|    760|	SNMP_FREE(list->prefix);
  ------------------
  |  |   62|    760|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 760, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 760]
  |  |  ------------------
  ------------------
  512|       |        /* attention!! list itself is not in the heap, so we must not free it! */
  513|    760|	list = next;
  514|    760|    }
  515|       |    domain_list = NULL;
  516|     69|}
netsnmp_tdomain_register:
  543|    760|{
  544|    760|    netsnmp_tdomain **prevNext = &domain_list, *d;
  545|       |
  546|    760|    if (n != NULL) {
  ------------------
  |  Branch (546:9): [True: 760, False: 0]
  ------------------
  547|  4.56k|        for (d = domain_list; d != NULL; d = d->next) {
  ------------------
  |  Branch (547:31): [True: 3.80k, False: 760]
  ------------------
  548|  3.80k|            if (netsnmp_oid_equals(n->name, n->name_length,
  ------------------
  |  Branch (548:17): [True: 0, False: 3.80k]
  ------------------
  549|  3.80k|                                d->name, d->name_length) == 0) {
  550|       |                /*
  551|       |                 * Already registered.  
  552|       |                 */
  553|      0|                return 0;
  554|      0|            }
  555|  3.80k|            prevNext = &(d->next);
  556|  3.80k|        }
  557|    760|        n->next = NULL;
  558|    760|        *prevNext = n;
  559|    760|        return 1;
  560|    760|    } else {
  561|      0|        return 0;
  562|      0|    }
  563|    760|}
netsnmp_tdomain_transport_tspec:
  632|     69|{
  633|     69|    const char *application, *str, *default_domain, *default_target, *source;
  634|     69|    int local;
  635|     69|    netsnmp_tdomain    *match = NULL;
  636|     69|    const char         *addr = NULL;
  637|     69|    const char * const *spec = NULL;
  638|     69|    int                 any_found = 0;
  639|     69|    char buf[SNMP_MAXPATH];
  640|     69|    const char **lspec = NULL;
  641|     69|    char *tokenized_domain = NULL;
  642|       |
  643|     69|    application = tspec->application;
  644|     69|    str = tspec->target;
  645|     69|    local = tspec->flags & NETSNMP_TSPEC_LOCAL;
  ------------------
  |  |  117|     69|#define NETSNMP_TSPEC_LOCAL                     0x01 /* 1=server, 0=client */
  ------------------
  646|     69|    default_domain = tspec->default_domain;
  647|     69|    default_target = tspec->default_target;
  648|     69|    source = tspec->source;
  649|       |    /** transport_config = tspec->transport_config; not used yet */
  650|       |
  651|     69|    DEBUGMSGTL(("tdomain",
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
  652|     69|                "tdomain_transport_spec(\"%s\", \"%s\", %d, \"%s\", \"%s\", \"%s\")\n",
  653|     69|                application, str ? str : "[NIL]", local,
  654|     69|                default_domain ? default_domain : "[NIL]",
  655|     69|                default_target ? default_target : "[NIL]",
  656|     69|                source ? source : "[NIL]"));
  657|       |
  658|       |    /* see if we can load a host-name specific set of conf files */
  659|     69|    if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (659:9): [True: 69, False: 0]
  ------------------
  660|     69|                                NETSNMP_DS_LIB_DONT_LOAD_HOST_FILES) &&
  ------------------
  |  |  100|     69|#define NETSNMP_DS_LIB_DONT_LOAD_HOST_FILES 40 /* don't read host.conf files */
  ------------------
  661|     69|        netsnmp_is_fqdn(str)) {
  ------------------
  |  Branch (661:9): [True: 0, False: 69]
  ------------------
  662|      0|        static int have_added_handler = 0;
  663|      0|        char *newhost;
  664|      0|        struct config_line *config_handlers;
  665|      0|        struct config_files file_names;
  666|      0|        char *prev_hostname;
  667|       |
  668|       |        /* register a "transport" specifier */
  669|      0|        if (!have_added_handler) {
  ------------------
  |  Branch (669:13): [True: 0, False: 0]
  ------------------
  670|      0|            have_added_handler = 1;
  671|      0|            netsnmp_ds_register_config(ASN_OCTET_STR,
  ------------------
  |  |   78|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
  672|      0|                                       "snmp", "transport",
  673|      0|                                       NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  674|      0|                                       NETSNMP_DS_LIB_HOSTNAME);
  ------------------
  |  |  178|      0|#define NETSNMP_DS_LIB_HOSTNAME          27
  ------------------
  675|      0|        }
  676|       |
  677|       |        /* we save on specific setting that we don't allow to change
  678|       |           from one transport creation to the next; ie, we don't want
  679|       |           the "transport" specifier to be a default.  It should be a
  680|       |           single invocation use only */
  681|      0|        prev_hostname = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  682|      0|                                              NETSNMP_DS_LIB_HOSTNAME);
  ------------------
  |  |  178|      0|#define NETSNMP_DS_LIB_HOSTNAME          27
  ------------------
  683|      0|        if (prev_hostname)
  ------------------
  |  Branch (683:13): [True: 0, False: 0]
  ------------------
  684|      0|            prev_hostname = strdup(prev_hostname);
  685|       |
  686|       |        /* read in the hosts/STRING.conf files */
  687|      0|        config_handlers = read_config_get_handlers("snmp");
  688|      0|        snprintf(buf, sizeof(buf)-1, "hosts/%s", str);
  689|      0|        file_names.fileHeader = buf;
  690|      0|        file_names.start = config_handlers;
  691|      0|        file_names.next = NULL;
  692|      0|        DEBUGMSGTL(("tdomain", "checking for host specific config %s\n",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  693|      0|                    buf));
  694|      0|        read_config_files_of_type(EITHER_CONFIG, &file_names);
  ------------------
  |  |   16|      0|#define EITHER_CONFIG 2
  ------------------
  695|       |
  696|      0|        if (NULL !=
  ------------------
  |  Branch (696:13): [True: 0, False: 0]
  ------------------
  697|      0|            (newhost = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  698|      0|                                             NETSNMP_DS_LIB_HOSTNAME))) {
  ------------------
  |  |  178|      0|#define NETSNMP_DS_LIB_HOSTNAME          27
  ------------------
  699|      0|            strlcpy(buf, newhost, sizeof(buf));
  700|      0|            str = buf;
  701|      0|        }
  702|       |
  703|      0|        netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  704|      0|                              NETSNMP_DS_LIB_HOSTNAME,
  ------------------
  |  |  178|      0|#define NETSNMP_DS_LIB_HOSTNAME          27
  ------------------
  705|      0|                              prev_hostname);
  706|      0|        SNMP_FREE(prev_hostname);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
  707|      0|    }
  708|       |
  709|       |    /* First try - assume that there is a domain in str (domain:target) */
  710|       |
  711|     69|    if (str != NULL) {
  ------------------
  |  Branch (711:9): [True: 69, False: 0]
  ------------------
  712|     69|        const char *cp;
  713|     69|        if ((cp = strchr(str, ':')) != NULL) {
  ------------------
  |  Branch (713:13): [True: 69, False: 0]
  ------------------
  714|     69|            char* mystring = (char*)malloc(cp + 1 - str);
  715|     69|            if (mystring == NULL)
  ------------------
  |  Branch (715:17): [True: 0, False: 69]
  ------------------
  716|      0|                return NULL;
  717|     69|            memcpy(mystring, str, cp - str);
  718|     69|            mystring[cp - str] = '\0';
  719|     69|            addr = cp + 1;
  720|       |
  721|     69|            match = find_tdomain(mystring);
  722|     69|            free(mystring);
  723|     69|        }
  724|     69|    }
  725|       |
  726|       |    /*
  727|       |     * Second try, if there is no domain in str (target), then try the
  728|       |     * default domain
  729|       |     */
  730|       |
  731|     69|    if (match == NULL) {
  ------------------
  |  Branch (731:9): [True: 69, False: 0]
  ------------------
  732|     69|        addr = str;
  733|     69|        if (addr && *addr == '/') {
  ------------------
  |  Branch (733:13): [True: 69, False: 0]
  |  Branch (733:21): [True: 0, False: 69]
  ------------------
  734|      0|            DEBUGMSGTL(("tdomain",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  735|      0|                        "Address starts with '/', so assume \"unix\" "
  736|      0|                        "domain\n"));
  737|      0|            match = find_tdomain("unix");
  738|     69|        } else if (default_domain) {
  ------------------
  |  Branch (738:20): [True: 0, False: 69]
  ------------------
  739|      0|            DEBUGMSGTL(("tdomain",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  740|      0|                        "Use user specified default domain \"%s\"\n",
  741|      0|                        default_domain));
  742|      0|            if (!strchr(default_domain, ','))
  ------------------
  |  Branch (742:17): [True: 0, False: 0]
  ------------------
  743|      0|                match = find_tdomain(default_domain);
  744|      0|            else {
  745|      0|                int commas = 0;
  746|      0|                const char *cp = default_domain;
  747|      0|                char *ptr = NULL;
  748|      0|                tokenized_domain = strdup(default_domain);
  749|      0|                if (!tokenized_domain)
  ------------------
  |  Branch (749:21): [True: 0, False: 0]
  ------------------
  750|      0|                    return NULL;
  751|       |
  752|      0|                while (*++cp) if (*cp == ',') commas++;
  ------------------
  |  Branch (752:24): [True: 0, False: 0]
  |  Branch (752:35): [True: 0, False: 0]
  ------------------
  753|      0|                lspec = calloc(commas+2, sizeof(char *));
  754|      0|                if (!lspec) {
  ------------------
  |  Branch (754:21): [True: 0, False: 0]
  ------------------
  755|      0|                    free(tokenized_domain);
  756|      0|                    return NULL;
  757|      0|                }
  758|      0|                commas = 1;
  759|      0|                lspec[0] = strtok_r(tokenized_domain, ",", &ptr);
  760|      0|                while ((lspec[commas++] = strtok_r(NULL, ",", &ptr)))
  ------------------
  |  Branch (760:24): [True: 0, False: 0]
  ------------------
  761|      0|                    ;
  762|      0|                spec = lspec;
  763|      0|            }
  764|     69|        } else {
  765|     69|            spec = netsnmp_lookup_default_domains(application);
  766|     69|            if (spec == NULL) {
  ------------------
  |  Branch (766:17): [True: 69, False: 0]
  ------------------
  767|     69|                DEBUGMSGTL(("tdomain",
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
  768|     69|                            "No default domain found, assume \"udp\"\n"));
  769|     69|                match = find_tdomain("udp");
  770|     69|            } else {
  771|      0|                const char * const * r = spec;
  772|      0|                DEBUGMSGTL(("tdomain",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  773|      0|                            "Use application default domains"));
  774|      0|                while(*r) {
  ------------------
  |  Branch (774:23): [True: 0, False: 0]
  ------------------
  775|      0|                    DEBUGMSG(("tdomain", " \"%s\"", *r));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
  776|      0|                    ++r;
  777|      0|                }
  778|      0|                DEBUGMSG(("tdomain", "\n"));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
  779|      0|            }
  780|     69|        }
  781|     69|    }
  782|       |
  783|     69|    for(;;) {
  784|     69|        if (match) {
  ------------------
  |  Branch (784:13): [True: 69, False: 0]
  ------------------
  785|     69|            netsnmp_transport *t = NULL;
  786|     69|            const char* addr2;
  787|       |
  788|     69|            any_found = 1;
  789|       |            /*
  790|       |             * Ok, we know what domain to try, lets see what default data
  791|       |             * should be used with it
  792|       |             */
  793|     69|            if (default_target != NULL)
  ------------------
  |  Branch (793:17): [True: 0, False: 69]
  ------------------
  794|      0|                addr2 = default_target;
  795|     69|            else
  796|     69|                addr2 = netsnmp_lookup_default_target(application,
  797|     69|                                                      match->prefix[0]);
  798|     69|            DEBUGMSGTL(("tdomain",
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
  799|     69|                        "trying domain \"%s\" address \"%s\" "
  800|     69|                        "default address \"%s\"\n",
  801|     69|                        match->prefix[0], addr ? addr : "[NIL]",
  802|     69|                        addr2 ? addr2 : "[NIL]"));
  803|     69|            if (match->f_create_from_tspec) {
  ------------------
  |  Branch (803:17): [True: 69, False: 0]
  ------------------
  804|     69|                netsnmp_tdomain_spec tspec_tmp;
  805|     69|                memcpy(&tspec_tmp, tspec, sizeof(tspec_tmp));
  806|       |                /** if we didn't have a default target but looked one up,
  807|       |                 *  copy the spec and use the found default. */
  808|     69|                if ((default_target == NULL) && (addr2 != NULL))
  ------------------
  |  Branch (808:21): [True: 69, False: 0]
  |  Branch (808:49): [True: 0, False: 69]
  ------------------
  809|      0|                    tspec_tmp.default_target = addr2;
  810|     69|                if (addr != tspec_tmp.target)
  ------------------
  |  Branch (810:21): [True: 0, False: 69]
  ------------------
  811|      0|                    tspec_tmp.target = addr;
  812|     69|                t = match->f_create_from_tspec(&tspec_tmp);
  813|     69|            }
  814|      0|            else {
  815|       |#if 0 /** remove warning until all transports implement tspec */
  816|       |                NETSNMP_LOGONCE((LOG_WARNING,
  817|       |                                 "transport domain %s uses deprecated f_create function\n",
  818|       |                                 match->prefix[0]));
  819|       |#endif
  820|      0|                if (match->f_create_from_tstring) {
  ------------------
  |  Branch (820:21): [True: 0, False: 0]
  ------------------
  821|      0|                    t = match->f_create_from_tstring(addr, local);
  822|      0|                }
  823|      0|                else
  824|      0|                    t = match->f_create_from_tstring_new(addr, local, addr2);
  825|      0|            }
  826|     69|            if (t) {
  ------------------
  |  Branch (826:17): [True: 69, False: 0]
  ------------------
  827|     69|                if (lspec) {
  ------------------
  |  Branch (827:21): [True: 0, False: 69]
  ------------------
  828|      0|                    free(tokenized_domain);
  829|      0|                    free(lspec);
  830|      0|                }
  831|     69|                return t;
  832|     69|            }
  833|     69|        }
  834|      0|        addr = str;
  835|      0|        if (spec && *spec)
  ------------------
  |  Branch (835:13): [True: 0, False: 0]
  |  Branch (835:21): [True: 0, False: 0]
  ------------------
  836|      0|            match = find_tdomain(*spec++);
  837|      0|        else
  838|      0|            break;
  839|      0|    }
  840|      0|    if (!any_found)
  ------------------
  |  Branch (840:9): [True: 0, False: 0]
  ------------------
  841|      0|        snmp_log(LOG_ERR, "No support for any checked transport domain\n");
  842|      0|    if (lspec) {
  ------------------
  |  Branch (842:9): [True: 0, False: 0]
  ------------------
  843|      0|        free(tokenized_domain);
  844|      0|        free(lspec);
  845|      0|    }
  846|       |    return NULL;
  847|     69|}
netsnmp_tdomain_transport_full:
  854|     69|{
  855|     69|    netsnmp_tdomain_spec tspec;
  856|     69|    memset(&tspec, 0x0, sizeof(tspec));
  857|     69|    tspec.application = application;
  858|     69|    tspec.target = str;
  859|     69|    if (local)
  ------------------
  |  Branch (859:9): [True: 69, False: 0]
  ------------------
  860|     69|        tspec.flags |= NETSNMP_TSPEC_LOCAL;
  ------------------
  |  |  117|     69|#define NETSNMP_TSPEC_LOCAL                     0x01 /* 1=server, 0=client */
  ------------------
  861|     69|    tspec.default_domain = default_domain;
  862|     69|    tspec.default_target = default_target;
  863|     69|    tspec.source = NULL;
  864|       |    tspec.transport_config = NULL;
  865|     69|    return netsnmp_tdomain_transport_tspec(&tspec);
  866|     69|}
netsnmp_transport_open_server:
  925|     69|{
  926|     69|    return netsnmp_tdomain_transport_full(application, str, 1, NULL, NULL);
  927|     69|}
_tc_find_transport:
 1229|     69|{
 1230|       |    /*
 1231|       |     * we shouldn't really have that many transports, so instead of
 1232|       |     * using an additional key, just iterate over the whole container.
 1233|       |     */
 1234|     69|    netsnmp_iterator  *itr;
 1235|     69|    trans_cache *tc;
 1236|       |
 1237|     69|    DEBUGMSGTL(("transport:cache:find_transport", "%p\n", t));
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
 1238|       |
 1239|     69|    if (NULL == _container)
  ------------------
  |  Branch (1239:9): [True: 69, False: 0]
  ------------------
 1240|     69|        return NULL;
 1241|       |
 1242|      0|    itr = CONTAINER_ITERATOR(_container);
  ------------------
  |  |  404|      0|#define CONTAINER_ITERATOR(x)       (x)->get_iterator(x)
  ------------------
 1243|      0|    if (NULL == itr) {
  ------------------
  |  Branch (1243:9): [True: 0, False: 0]
  ------------------
 1244|      0|        snmp_log(LOG_ERR, "could not get iterator for transport cache\n");
 1245|      0|        return NULL;
 1246|      0|    }
 1247|       |
 1248|      0|    tc = ITERATOR_FIRST(itr);
  ------------------
  |  |  546|      0|#define ITERATOR_FIRST(x)  x->first(x)
  ------------------
 1249|      0|    for( ; tc; tc = ITERATOR_NEXT(itr))
  ------------------
  |  |  547|      0|#define ITERATOR_NEXT(x)   x->next(x)
  ------------------
  |  Branch (1249:12): [True: 0, False: 0]
  ------------------
 1250|      0|        if (tc->t == t)
  ------------------
  |  Branch (1250:13): [True: 0, False: 0]
  ------------------
 1251|      0|            break;
 1252|      0|    ITERATOR_RELEASE(itr);
  ------------------
  |  |  550|      0|#define ITERATOR_RELEASE(x) do { x->release(x); x = NULL; } while(0)
  |  |  ------------------
  |  |  |  Branch (550:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1253|       |
 1254|      0|    DEBUGMSGT(("transport:cache:find_transport","found %p\n", tc));
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1255|       |
 1256|      0|    return tc;
 1257|      0|}
netsnmp_transport_cache_remove:
 1261|     69|{
 1262|     69|    trans_cache *tc;
 1263|       |
 1264|     69|    DEBUGMSGTL(("transport:cache:close", "%p\n", t));
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
 1265|       |
 1266|     69|    if (NULL == t)
  ------------------
  |  Branch (1266:9): [True: 0, False: 69]
  ------------------
 1267|      0|        return 0;
 1268|       |
 1269|       |    /** transport in cache? */
 1270|     69|    tc = _tc_find_transport(t);
 1271|     69|    if (NULL == tc) {
  ------------------
  |  Branch (1271:9): [True: 69, False: 0]
  ------------------
 1272|     69|        DEBUGMSGTL(("transport:cache:close", "%p not found in cache\n", t));
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
 1273|     69|        return 0;
 1274|     69|    }
 1275|       |
 1276|      0|    --tc->count;
 1277|       |
 1278|       |    /** still in use? */
 1279|      0|    if (tc->count > 0) {
  ------------------
  |  Branch (1279:9): [True: 0, False: 0]
  ------------------
 1280|      0|        DEBUGMSGTL(("transport:cache:close", "still %d user(s) of %p\n",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1281|      0|                    tc->count, t));
 1282|      0|        return 1;
 1283|      0|    }
 1284|       |
 1285|       |    /** unbalanced get/close? */
 1286|      0|    if (tc->count < 0)
  ------------------
  |  Branch (1286:9): [True: 0, False: 0]
  ------------------
 1287|      0|        snmp_log(LOG_WARNING, "transport cache get/close mismatch\n");
 1288|       |
 1289|      0|    _tc_remove(tc);
 1290|      0|    _tc_free(tc); /* also does close */
 1291|       |
 1292|      0|    return 0;
 1293|      0|}
snmp_transport.c:netsnmp_tdomain_dump:
  521|     69|{
  522|     69|    netsnmp_tdomain *d;
  523|     69|    int i = 0;
  524|       |
  525|     69|    DEBUGMSGTL(("tdomain", "domain_list -> "));
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
  526|    829|    for (d = domain_list; d != NULL; d = d->next) {
  ------------------
  |  Branch (526:27): [True: 760, False: 69]
  ------------------
  527|    760|        DEBUGMSG(("tdomain", "{ "));
  ------------------
  |  |   61|    760|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    760|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 760]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 760]
  |  |  ------------------
  ------------------
  528|    760|        DEBUGMSGOID(("tdomain", d->name, d->name_length));
  ------------------
  |  |   67|    760|#define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    760|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 760]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  165|      0|#define __DBGMSGOID(x)     debugmsg_oid x
  |  |  ------------------
  |  |  |  Branch (67:71): [Folded, False: 760]
  |  |  ------------------
  ------------------
  529|    760|        DEBUGMSG(("tdomain", ", \""));
  ------------------
  |  |   61|    760|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    760|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 760]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 760]
  |  |  ------------------
  ------------------
  530|  2.21k|        for (i = 0; d->prefix[i] != NULL; i++) {
  ------------------
  |  Branch (530:21): [True: 1.45k, False: 760]
  ------------------
  531|  1.45k|            DEBUGMSG(("tdomain", "%s%s", d->prefix[i],
  ------------------
  |  |   61|  1.45k|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|  1.45k|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1.45k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:56): [True: 0, False: 0]
  |  |  |  Branch (61:67): [Folded, False: 1.45k]
  |  |  ------------------
  ------------------
  532|  1.45k|		      (d->prefix[i + 1]) ? "/" : ""));
  533|  1.45k|        }
  534|    760|        DEBUGMSG(("tdomain", "\" } -> "));
  ------------------
  |  |   61|    760|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|    760|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 760]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 760]
  |  |  ------------------
  ------------------
  535|    760|    }
  536|     69|    DEBUGMSG(("tdomain", "[NIL]\n"));
  ------------------
  |  |   61|     69|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 69]
  |  |  ------------------
  ------------------
  537|     69|}
snmp_transport.c:netsnmp_is_fqdn:
  612|     69|{
  613|     69|    if (!thename)
  ------------------
  |  Branch (613:9): [True: 0, False: 69]
  ------------------
  614|      0|        return 0;
  615|    690|    while(*thename) {
  ------------------
  |  Branch (615:11): [True: 690, False: 0]
  ------------------
  616|    690|        if (*thename != '.' && !isupper((unsigned char)*thename) &&
  ------------------
  |  Branch (616:13): [True: 483, False: 207]
  |  Branch (616:32): [True: 483, False: 0]
  ------------------
  617|    483|            !islower((unsigned char)*thename) &&
  ------------------
  |  Branch (617:13): [True: 483, False: 0]
  ------------------
  618|    483|            !isdigit((unsigned char)*thename) && *thename != '-') {
  ------------------
  |  Branch (618:13): [True: 69, False: 414]
  |  Branch (618:50): [True: 69, False: 0]
  ------------------
  619|     69|            return 0;
  620|     69|        }
  621|    621|        thename++;
  622|    621|    }
  623|      0|    return 1;
  624|     69|}
snmp_transport.c:find_tdomain:
  594|    138|{
  595|    138|    netsnmp_tdomain *d;
  596|  1.38k|    for (d = domain_list; d != NULL; d = d->next) {
  ------------------
  |  Branch (596:27): [True: 1.31k, False: 69]
  ------------------
  597|  1.31k|        int i;
  598|  3.93k|        for (i = 0; d->prefix[i] != NULL; i++)
  ------------------
  |  Branch (598:21): [True: 2.69k, False: 1.24k]
  ------------------
  599|  2.69k|            if (strcasecmp(d->prefix[i], spec) == 0) {
  ------------------
  |  Branch (599:17): [True: 69, False: 2.62k]
  ------------------
  600|     69|                DEBUGMSGTL(("tdomain",
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
  601|     69|                            "Found domain \"%s\" from specifier \"%s\"\n",
  602|     69|                            d->prefix[0], spec));
  603|     69|                return d;
  604|     69|            }
  605|  1.31k|    }
  606|     69|    DEBUGMSGTL(("tdomain", "Found no domain from specifier \"%s\"\n", spec));
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
  607|       |    return NULL;
  608|    138|}

init_ksm:
  218|     69|{
  219|     69|    krb5_error_code retval;
  220|     69|    struct snmp_secmod_def *def;
  221|     69|    int             i;
  222|       |
  223|     69|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defKSMKeytab",
  ------------------
  |  |   78|     69|#define ASN_OCTET_STR	    0x04U
  ------------------
  224|     69|                               NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_KSM_KEYTAB);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                                             NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_KSM_KEYTAB);
  ------------------
  |  |  172|     69|#define NETSNMP_DS_LIB_KSM_KEYTAB        21
  ------------------
  225|     69|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defKSMServiceName",
  ------------------
  |  |   78|     69|#define ASN_OCTET_STR	    0x04U
  ------------------
  226|     69|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  227|     69|			       NETSNMP_DS_LIB_KSM_SERVICE_NAME);
  ------------------
  |  |  173|     69|#define NETSNMP_DS_LIB_KSM_SERVICE_NAME  22
  ------------------
  228|     69|    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     69|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
  229|     69|			   SNMP_CALLBACK_POST_READ_CONFIG,
  ------------------
  |  |   24|     69|#define SNMP_CALLBACK_POST_READ_CONFIG	        0
  ------------------
  230|     69|			   init_snmpksm_post_config, NULL);
  231|       |
  232|       |
  233|     69|    if (kcontext == NULL) {
  ------------------
  |  Branch (233:9): [True: 69, False: 0]
  ------------------
  234|     69|        retval = krb5_init_context(&kcontext);
  235|       |
  236|     69|        if (retval) {
  ------------------
  |  Branch (236:13): [True: 0, False: 69]
  ------------------
  237|      0|            DEBUGMSGTL(("ksm", "krb5_init_context failed (%s), not "
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  238|      0|                        "registering KSM\n", error_message(retval)));
  239|      0|            return;
  240|      0|        }
  241|     69|    }
  242|       |
  243|  4.48k|    for (i = 0; i < HASHSIZE; i++)
  ------------------
  |  |  129|  4.48k|#define HASHSIZE	64
  ------------------
  |  Branch (243:17): [True: 4.41k, False: 69]
  ------------------
  244|  4.41k|        ksm_hash_table[i] = NULL;
  245|       |
  246|     69|    def = SNMP_MALLOC_STRUCT(snmp_secmod_def);
  ------------------
  |  |   69|     69|#define SNMP_MALLOC_STRUCT(s)   (struct s *) calloc(1, sizeof(struct s))
  ------------------
  247|       |
  248|     69|    if (!def) {
  ------------------
  |  Branch (248:9): [True: 0, False: 69]
  ------------------
  249|      0|        DEBUGMSGTL(("ksm", "Unable to malloc snmp_secmod struct, not "
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  250|      0|                    "registering KSM\n"));
  251|      0|        return;
  252|      0|    }
  253|       |
  254|     69|    def->encode_reverse = ksm_rgenerate_out_msg;
  255|     69|    def->decode = ksm_process_in_msg;
  256|     69|    def->session_open = ksm_session_init;
  257|     69|    def->pdu_free_state_ref = ksm_free_state_ref;
  258|     69|    def->pdu_free = ksm_free_pdu;
  259|     69|    def->pdu_clone = ksm_clone_pdu;
  260|       |
  261|     69|    register_sec_mod(NETSNMP_SEC_MODEL_KSM, "ksm", def);
  ------------------
  |  |   13|     69|#define NETSNMP_SEC_MODEL_KSM     2066432
  ------------------
  262|     69|}
shutdown_ksm:
  265|     69|{
  266|     69|    unregister_sec_mod(NETSNMP_SEC_MODEL_KSM);
  ------------------
  |  |   13|     69|#define NETSNMP_SEC_MODEL_KSM     2066432
  ------------------
  267|     69|    if (kcontext)
  ------------------
  |  Branch (267:9): [True: 69, False: 0]
  ------------------
  268|     69|        krb5_free_context(kcontext);
  269|       |    kcontext = NULL;
  270|     69|}
snmpksm.c:init_snmpksm_post_config:
  169|     69|{
  170|       |
  171|     69|    if (kcontext == NULL) {
  ------------------
  |  Branch (171:9): [True: 0, False: 69]
  ------------------
  172|       |	/* not reached, I'd imagine */
  173|      0|        return SNMPERR_KRB5;
  ------------------
  |  |  280|      0|#define SNMPERR_KRB5			(-63)
  ------------------
  174|      0|    }
  175|       |
  176|     69|    if (service_name == NULL) {
  ------------------
  |  Branch (176:9): [True: 1, False: 68]
  ------------------
  177|       |	/* always reached, I'd imagine */
  178|      1|	char *c = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  179|      1|					NETSNMP_DS_LIB_KSM_SERVICE_NAME);
  ------------------
  |  |  173|      1|#define NETSNMP_DS_LIB_KSM_SERVICE_NAME  22
  ------------------
  180|      1|	if (c != NULL) {
  ------------------
  |  Branch (180:6): [True: 0, False: 1]
  ------------------
  181|      0|		service_name = c;
  182|      0|	}
  183|      1|	else {
  184|      1|		service_name = service_host;
  185|      1|	}
  186|      1|    }
  187|       |
  188|     69|    if (keytab_setup == 0) {
  ------------------
  |  Branch (188:9): [True: 1, False: 68]
  ------------------
  189|       |	/* always reached, I'd imagine */
  190|      1|	char *c = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  191|      1|					NETSNMP_DS_LIB_KSM_KEYTAB);
  ------------------
  |  |  172|      1|#define NETSNMP_DS_LIB_KSM_KEYTAB        21
  ------------------
  192|      1|	if (c) {
  ------------------
  |  Branch (192:6): [True: 0, False: 1]
  ------------------
  193|      0|	    krb5_error_code retval;
  194|      0|	    DEBUGMSGTL(("ksm", "Using keytab %s\n", c));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  195|      0|	    retval = krb5_kt_resolve(kcontext, c, &keytab);
  196|      0|	    if (retval) {
  ------------------
  |  Branch (196:10): [True: 0, False: 0]
  ------------------
  197|      0|		DEBUGMSGTL(("ksm", "krb5_kt_resolve(\"%s\") failed. KSM "
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  198|      0|			    "config callback failing\n", error_message(retval)));
  199|      0|		return SNMPERR_KRB5;
  ------------------
  |  |  280|      0|#define SNMPERR_KRB5			(-63)
  ------------------
  200|      0|	    }
  201|      0|	}
  202|      1|	else {
  203|      1|	    DEBUGMSGTL(("ksm", "Using default keytab\n"));
  ------------------
  |  |   66|      1|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 1]
  |  |  ------------------
  ------------------
  204|      1|	}
  205|      1|	keytab_setup = 1;
  206|      1|    }
  207|       |
  208|     69|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|     69|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  209|     69|}

init_tsm:
   43|     69|{
   44|     69|    struct snmp_secmod_def *def;
   45|     69|    int ret;
   46|       |
   47|     69|    def = SNMP_MALLOC_STRUCT(snmp_secmod_def);
  ------------------
  |  |   69|     69|#define SNMP_MALLOC_STRUCT(s)   (struct s *) calloc(1, sizeof(struct s))
  ------------------
   48|       |
   49|     69|    if (!def) {
  ------------------
  |  Branch (49:9): [True: 0, False: 69]
  ------------------
   50|      0|        snmp_log(LOG_ERR,
   51|      0|                 "Unable to malloc snmp_secmod struct, not registering TSM\n");
   52|      0|        return;
   53|      0|    }
   54|       |
   55|     69|    def->encode_reverse = tsm_rgenerate_out_msg;
   56|     69|    def->decode = tsm_process_in_msg;
   57|     69|    def->session_open = tsm_session_init;
   58|     69|    def->pdu_free_state_ref = tsm_free_state_ref;
   59|     69|    def->pdu_clone = tsm_clone_pdu;
   60|     69|    def->pdu_free = tsm_free_pdu;
   61|     69|    def->probe_engineid = snmpv3_probe_contextEngineID_rfc5343;
   62|       |
   63|     69|    DEBUGMSGTL(("tsm","registering ourselves\n"));
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
   64|     69|    ret = register_sec_mod(SNMP_SEC_MODEL_TSM, "tsm", def);
  ------------------
  |  |  296|     69|#define SNMP_SEC_MODEL_TSM              4
  ------------------
   65|     69|    DEBUGMSGTL(("tsm"," returned %d\n", ret));
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
   66|       |
   67|     69|    netsnmp_ds_register_config(ASN_BOOLEAN, "snmp", "tsmUseTransportPrefix",
  ------------------
  |  |   72|     69|#define ASN_BOOLEAN	    0x01U
  ------------------
   68|     69|			       NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
   69|     69|                               NETSNMP_DS_LIB_TSM_USE_PREFIX);
  ------------------
  |  |   99|     69|#define NETSNMP_DS_LIB_TSM_USE_PREFIX      39 /* TSM's simple security name mapping */
  ------------------
   70|     69|}
shutdown_tsm:
   75|     69|{
   76|     69|}

usm_get_user2:
  517|      4|{
  518|      4|    DEBUGMSGTL(("usm", "getting user %.*s\n", (int)nameLen,
  ------------------
  |  |   66|      4|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 4]
  |  |  ------------------
  ------------------
  519|      4|                (const char *)name));
  520|      4|    return usm_get_user_from_list(engineID, engineIDLen, name, nameLen,
  521|      4|                                  userList, 1);
  522|      4|}
usm_free_user:
  749|    207|{
  750|    207|    if (user == NULL)
  ------------------
  |  Branch (750:9): [True: 138, False: 69]
  ------------------
  751|    138|        return NULL;
  752|       |
  753|     69|    SNMP_FREE(user->engineID);
  ------------------
  |  |   62|     69|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 69]
  |  |  |  Branch (62:66): [Folded, False: 69]
  |  |  ------------------
  ------------------
  754|     69|    SNMP_FREE(user->name);
  ------------------
  |  |   62|     69|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 69, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 69]
  |  |  ------------------
  ------------------
  755|     69|    SNMP_FREE(user->secName);
  ------------------
  |  |   62|     69|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 69, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 69]
  |  |  ------------------
  ------------------
  756|     69|    SNMP_FREE(user->cloneFrom);
  ------------------
  |  |   62|     69|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 69, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 69]
  |  |  ------------------
  ------------------
  757|     69|    SNMP_FREE(user->userPublicString);
  ------------------
  |  |   62|     69|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 69]
  |  |  |  Branch (62:66): [Folded, False: 69]
  |  |  ------------------
  ------------------
  758|     69|    SNMP_FREE(user->authProtocol);
  ------------------
  |  |   62|     69|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 69, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 69]
  |  |  ------------------
  ------------------
  759|     69|    SNMP_FREE(user->privProtocol);
  ------------------
  |  |   62|     69|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 69, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 69]
  |  |  ------------------
  ------------------
  760|       |
  761|     69|    if (user->authKey != NULL) {
  ------------------
  |  Branch (761:9): [True: 0, False: 69]
  ------------------
  762|      0|        SNMP_ZERO(user->authKey, user->authKeyLen);
  ------------------
  |  |   77|      0|#define SNMP_ZERO(s,l)	do { if (s) memset(s, 0, l); } while(0)
  |  |  ------------------
  |  |  |  Branch (77:33): [True: 0, False: 0]
  |  |  |  Branch (77:61): [Folded, False: 0]
  |  |  ------------------
  ------------------
  763|      0|        SNMP_FREE(user->authKey);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
  764|      0|    }
  765|       |
  766|     69|    if (user->privKey != NULL) {
  ------------------
  |  Branch (766:9): [True: 0, False: 69]
  ------------------
  767|      0|        SNMP_ZERO(user->privKey, user->privKeyLen);
  ------------------
  |  |   77|      0|#define SNMP_ZERO(s,l)	do { if (s) memset(s, 0, l); } while(0)
  |  |  ------------------
  |  |  |  Branch (77:33): [True: 0, False: 0]
  |  |  |  Branch (77:61): [Folded, False: 0]
  |  |  ------------------
  ------------------
  768|      0|        SNMP_FREE(user->privKey);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
  769|      0|    }
  770|       |
  771|     69|    if (user->authKeyKu != NULL) {
  ------------------
  |  Branch (771:9): [True: 0, False: 69]
  ------------------
  772|      0|        SNMP_ZERO(user->authKeyKu, user->authKeyKuLen);
  ------------------
  |  |   77|      0|#define SNMP_ZERO(s,l)	do { if (s) memset(s, 0, l); } while(0)
  |  |  ------------------
  |  |  |  Branch (77:33): [True: 0, False: 0]
  |  |  |  Branch (77:61): [Folded, False: 0]
  |  |  ------------------
  ------------------
  773|      0|        SNMP_FREE(user->authKeyKu);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
  774|      0|    }
  775|       |
  776|     69|    if (user->privKeyKu != NULL) {
  ------------------
  |  Branch (776:9): [True: 0, False: 69]
  ------------------
  777|      0|        SNMP_ZERO(user->privKeyKu, user->privKeyKuLen);
  ------------------
  |  |   77|      0|#define SNMP_ZERO(s,l)	do { if (s) memset(s, 0, l); } while(0)
  |  |  ------------------
  |  |  |  Branch (77:33): [True: 0, False: 0]
  |  |  |  Branch (77:61): [Folded, False: 0]
  |  |  ------------------
  ------------------
  778|      0|        SNMP_FREE(user->privKeyKu);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
  779|      0|    }
  780|       |
  781|     69|#ifdef NETSNMP_USE_OPENSSL
  782|     69|    if (user->usmDHUserAuthKeyChange)
  ------------------
  |  Branch (782:9): [True: 0, False: 69]
  ------------------
  783|      0|    {
  784|      0|        DH_free(user->usmDHUserAuthKeyChange);
  785|      0|        user->usmDHUserAuthKeyChange = NULL;
  786|      0|    }
  787|       |
  788|     69|    if (user->usmDHUserPrivKeyChange)
  ------------------
  |  Branch (788:9): [True: 0, False: 69]
  ------------------
  789|      0|    {
  790|      0|        DH_free(user->usmDHUserPrivKeyChange);
  791|      0|        user->usmDHUserPrivKeyChange = NULL;
  792|      0|    }
  793|     69|#endif
  794|       |
  795|       |    /*
  796|       |     * FIX  Why not put this check *first?*
  797|       |     */
  798|     69|    if (user->prev != NULL && user->prev != (struct usmUser *)-1) {   /* ack, this shouldn't happen */
  ------------------
  |  Branch (798:9): [True: 0, False: 69]
  |  Branch (798:31): [True: 0, False: 0]
  ------------------
  799|      0|        user->prev->next = user->next;
  800|      0|    }
  801|     69|    if (user->next != NULL && user->next != (struct usmUser *)-1) {
  ------------------
  |  Branch (801:9): [True: 0, False: 69]
  |  Branch (801:31): [True: 0, False: 0]
  ------------------
  802|      0|        user->next->prev = user->prev;
  803|      0|        if (user->prev != NULL) /* ack this is really bad, because it means
  ------------------
  |  Branch (803:13): [True: 0, False: 0]
  ------------------
  804|       |                                 * * we'll loose the head of some structure tree */
  805|      0|            DEBUGMSGTL(("usm",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  806|      0|                        "Severe: Asked to free the head of a usmUser tree somewhere."));
  807|      0|    }
  808|       |
  809|       |
  810|     69|    SNMP_ZERO(user, sizeof(*user));
  ------------------
  |  |   77|     69|#define SNMP_ZERO(s,l)	do { if (s) memset(s, 0, l); } while(0)
  |  |  ------------------
  |  |  |  Branch (77:33): [True: 69, False: 0]
  |  |  |  Branch (77:61): [Folded, False: 69]
  |  |  ------------------
  ------------------
  811|     69|    SNMP_FREE(user);
  ------------------
  |  |   62|     69|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 69, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 69]
  |  |  ------------------
  ------------------
  812|       |
  813|     69|    return NULL;                /* for convenience to returns from calling functions */
  814|       |
  815|    207|}                               /* end usm_free_user() */
usm_create_user:
 4096|     69|{
 4097|     69|    struct usmUser *newUser;
 4098|       |
 4099|       |    /*
 4100|       |     * create the new user 
 4101|       |     */
 4102|     69|    newUser = calloc(1, sizeof(struct usmUser));
 4103|     69|    if (newUser == NULL)
  ------------------
  |  Branch (4103:9): [True: 0, False: 69]
  ------------------
 4104|      0|        return NULL;
 4105|       |
 4106|       |    /*
 4107|       |     * fill the auth/priv protocols 
 4108|       |     */
 4109|     69|    if ((newUser->authProtocol =
  ------------------
  |  Branch (4109:9): [True: 0, False: 69]
  ------------------
 4110|     69|         snmp_duplicate_objid(usmNoAuthProtocol,
 4111|     69|                              OID_LENGTH(usmNoAuthProtocol))) ==
  ------------------
  |  |   64|     69|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|     69|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
 4112|     69|        NULL)
 4113|      0|        return usm_free_user(newUser);
 4114|     69|    newUser->authProtocolLen = OID_LENGTH(usmNoAuthProtocol);
  ------------------
  |  |   64|     69|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|     69|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
 4115|       |
 4116|     69|    if ((newUser->privProtocol =
  ------------------
  |  Branch (4116:9): [True: 0, False: 69]
  ------------------
 4117|     69|         snmp_duplicate_objid(usmNoPrivProtocol,
 4118|     69|                              OID_LENGTH(usmNoPrivProtocol))) ==
  ------------------
  |  |   64|     69|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|     69|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
 4119|     69|        NULL)
 4120|      0|        return usm_free_user(newUser);
 4121|     69|    newUser->privProtocolLen = OID_LENGTH(usmNoPrivProtocol);
  ------------------
  |  |   64|     69|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|     69|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
 4122|       |
 4123|       |    /*
 4124|       |     * set the storage type to nonvolatile, and the status to ACTIVE 
 4125|       |     */
 4126|     69|    newUser->userStorageType = ST_NONVOLATILE;
  ------------------
  |  |   52|     69|#define ST_NONVOLATILE	3
  ------------------
 4127|     69|    newUser->userStatus = RS_ACTIVE;
  ------------------
  |  |   35|     69|#define RS_ACTIVE	        1
  ------------------
 4128|     69|    return newUser;
 4129|       |
 4130|     69|}                               /* end usm_clone_user() */
get_default_authtype:
 5075|    138|{
 5076|    138|    if (defaultAuthType == NULL) {
  ------------------
  |  Branch (5076:9): [True: 1, False: 137]
  ------------------
 5077|      1|        defaultAuthType = SNMP_DEFAULT_AUTH_PROTO;
  ------------------
  |  |  127|      1|#define SNMP_DEFAULT_AUTH_PROTO     usmHMACMD5AuthProtocol
  ------------------
 5078|      1|        defaultAuthTypeLen = SNMP_DEFAULT_AUTH_PROTOLEN;
  ------------------
  |  |  131|      1|#define SNMP_DEFAULT_AUTH_PROTOLEN  OID_LENGTH(SNMP_DEFAULT_AUTH_PROTO)
  |  |  ------------------
  |  |  |  |   64|      1|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |  |  |   65|      1|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  |  |  ------------------
  ------------------
 5079|      1|    }
 5080|    138|    if (len)
  ------------------
  |  Branch (5080:9): [True: 69, False: 69]
  ------------------
 5081|     69|        *len = defaultAuthTypeLen;
 5082|    138|    return defaultAuthType;
 5083|    138|}
get_default_privtype:
 5097|    138|{
 5098|    138|    if (defaultPrivType == NULL) {
  ------------------
  |  Branch (5098:9): [True: 1, False: 137]
  ------------------
 5099|      1|        defaultPrivType = SNMP_DEFAULT_PRIV_PROTO;
  ------------------
  |  |  133|      1|#define SNMP_DEFAULT_PRIV_PROTO     usmDESPrivProtocol
  ------------------
 5100|      1|        defaultPrivTypeLen = SNMP_DEFAULT_PRIV_PROTOLEN;
  ------------------
  |  |  137|      1|#define SNMP_DEFAULT_PRIV_PROTOLEN  OID_LENGTH(SNMP_DEFAULT_PRIV_PROTO)
  |  |  ------------------
  |  |  |  |   64|      1|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |  |  |   65|      1|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  |  |  ------------------
  ------------------
 5101|      1|    }
 5102|    138|    if (len)
  ------------------
  |  Branch (5102:9): [True: 69, False: 69]
  ------------------
 5103|     69|        *len = defaultPrivTypeLen;
 5104|    138|    return defaultPrivType;
 5105|    138|}
init_usm:
 5197|     69|{
 5198|     69|    struct snmp_secmod_def *def;
 5199|     69|    char *type;
 5200|       |
 5201|     69|    DEBUGMSGTL(("init_usm", "unit_usm: %" NETSNMP_PRIo "u %" NETSNMP_PRIo "u\n",
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
 5202|     69|                usmNoPrivProtocol[0], usmNoPrivProtocol[1]));
 5203|       |
 5204|     69|    sc_init();                  /* initialize scapi code */
 5205|       |
 5206|       |    /*
 5207|       |     * register ourselves as a security service
 5208|       |     */
 5209|     69|    def = SNMP_MALLOC_STRUCT(snmp_secmod_def);
  ------------------
  |  |   69|     69|#define SNMP_MALLOC_STRUCT(s)   (struct s *) calloc(1, sizeof(struct s))
  ------------------
 5210|     69|    if (def == NULL)
  ------------------
  |  Branch (5210:9): [True: 0, False: 69]
  ------------------
 5211|      0|        return;
 5212|       |    /*
 5213|       |     * XXX: def->init_sess_secmod move stuff from snmp_api.c
 5214|       |     */
 5215|     69|    def->encode_reverse = usm_secmod_rgenerate_out_msg;
 5216|     69|    def->encode_forward = usm_secmod_generate_out_msg;
 5217|     69|    def->decode = usm_secmod_process_in_msg;
 5218|     69|    def->pdu_clone = usm_clone;
 5219|     69|    def->pdu_free_state_ref = usm_free_usmStateReference;
 5220|     69|    def->session_setup = usm_session_init;
 5221|     69|    def->handle_report = usm_handle_report;
 5222|     69|    def->probe_engineid = usm_discover_engineid;
 5223|     69|    def->post_probe_engineid = usm_create_user_from_session_hook;
 5224|     69|    if (register_sec_mod(USM_SEC_MODEL_NUMBER, "usm", def) != SNMPERR_SUCCESS) {
  ------------------
  |  |   40|     69|#define USM_SEC_MODEL_NUMBER            SNMP_SEC_MODEL_USM
  |  |  ------------------
  |  |  |  |  295|     69|#define SNMP_SEC_MODEL_USM		3
  |  |  ------------------
  ------------------
                  if (register_sec_mod(USM_SEC_MODEL_NUMBER, "usm", def) != SNMPERR_SUCCESS) {
  ------------------
  |  |  217|     69|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  |  Branch (5224:9): [True: 0, False: 69]
  ------------------
 5225|      0|        SNMP_FREE(def);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5226|      0|        snmp_log(LOG_ERR, "could not register usm sec mod\n");
 5227|      0|        return;
 5228|      0|    }
 5229|       |
 5230|     69|    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     69|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 5231|     69|                           SNMP_CALLBACK_POST_PREMIB_READ_CONFIG,
  ------------------
  |  |   27|     69|#define SNMP_CALLBACK_POST_PREMIB_READ_CONFIG	3
  ------------------
 5232|     69|                           init_usm_post_config, NULL);
 5233|       |
 5234|     69|    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     69|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 5235|     69|                           SNMP_CALLBACK_SHUTDOWN,
  ------------------
  |  |   26|     69|#define SNMP_CALLBACK_SHUTDOWN		        2
  ------------------
 5236|     69|                           deinit_usm_post_config, NULL);
 5237|       |
 5238|     69|    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     69|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 5239|     69|                           SNMP_CALLBACK_SHUTDOWN,
  ------------------
  |  |   26|     69|#define SNMP_CALLBACK_SHUTDOWN		        2
  ------------------
 5240|     69|                           free_engineID, NULL);
 5241|       |
 5242|     69|    register_config_handler("snmp", "defAuthType", snmpv3_authtype_conf,
 5243|     69|                            NULL, "MD5|SHA|SHA-512|SHA-384|SHA-256|SHA-224");
 5244|     69|    register_config_handler("snmp", "defPrivType", snmpv3_privtype_conf,
 5245|     69|                            NULL,
 5246|     69|                            "DES"
 5247|     69|#ifdef HAVE_AES
 5248|     69|                            "|AES|AES-128"
 5249|     69|#ifdef NETSNMP_DRAFT_BLUMENTHAL_AES_04
 5250|     69|                            "|AES-192|AES-256"
 5251|     69|#endif /* NETSNMP_DRAFT_BLUMENTHAL_AES_04 */
 5252|       |#else
 5253|       |                            " (AES support not available)"
 5254|       |#endif
 5255|     69|                           );
 5256|       |
 5257|       |    /*
 5258|       |     * Free stuff at shutdown time
 5259|       |     */
 5260|     69|    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     69|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 5261|     69|                           SNMP_CALLBACK_SHUTDOWN,
  ------------------
  |  |   26|     69|#define SNMP_CALLBACK_SHUTDOWN		        2
  ------------------
 5262|     69|                           free_enginetime_on_shutdown, NULL);
 5263|       |
 5264|       |
 5265|     69|    type = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_APPTYPE);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  type = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_APPTYPE);
  ------------------
  |  |  157|     69|#define NETSNMP_DS_LIB_APPTYPE           6
  ------------------
 5266|       |
 5267|     69|    register_config_handler(type, "userSetAuthPass", usm_set_password,
 5268|     69|                            NULL, NULL);
 5269|     69|    register_config_handler(type, "userSetPrivPass", usm_set_password,
 5270|     69|                            NULL, NULL);
 5271|     69|    register_config_handler(type, "userSetAuthKey", usm_set_password, NULL,
 5272|     69|                            NULL);
 5273|     69|    register_config_handler(type, "userSetPrivKey", usm_set_password, NULL,
 5274|     69|                            NULL);
 5275|     69|    register_config_handler(type, "userSetAuthLocalKey", usm_set_password,
 5276|     69|                            NULL, NULL);
 5277|     69|    register_config_handler(type, "userSetPrivLocalKey", usm_set_password,
 5278|     69|                            NULL, NULL);
 5279|     69|}
shutdown_usm:
 5283|     69|{
 5284|     69|    free_etimelist();
 5285|     69|    clear_user_list();
 5286|     69|}
snmpusm.c:usm_get_user_from_list:
  482|      6|{
  483|      6|    struct usmUser *ptr;
  484|       |
  485|      6|    for (ptr = puserList; ptr != NULL; ptr = ptr->next) {
  ------------------
  |  Branch (485:27): [True: 0, False: 6]
  ------------------
  486|      0|        if (ptr->name && strlen(ptr->name) == nameLen &&
  ------------------
  |  Branch (486:13): [True: 0, False: 0]
  |  Branch (486:26): [True: 0, False: 0]
  ------------------
  487|      0|            memcmp(ptr->name, name, nameLen) == 0) {
  ------------------
  |  Branch (487:13): [True: 0, False: 0]
  ------------------
  488|      0|          DEBUGMSGTL(("usm", "match on user %s\n", ptr->name));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  489|      0|          if (ptr->engineIDLen == engineIDLen &&
  ------------------
  |  Branch (489:15): [True: 0, False: 0]
  ------------------
  490|      0|            ((ptr->engineID == NULL && engineID == NULL) ||
  ------------------
  |  Branch (490:15): [True: 0, False: 0]
  |  Branch (490:40): [True: 0, False: 0]
  ------------------
  491|      0|             (ptr->engineID != NULL && engineID != NULL &&
  ------------------
  |  Branch (491:15): [True: 0, False: 0]
  |  Branch (491:40): [True: 0, False: 0]
  ------------------
  492|      0|              memcmp(ptr->engineID, engineID, engineIDLen) == 0)))
  ------------------
  |  Branch (492:15): [True: 0, False: 0]
  ------------------
  493|      0|            return ptr;
  494|      0|          DEBUGMSGTL(("usm", "no match on engineID ("));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  495|      0|          if (engineID) {
  ------------------
  |  Branch (495:15): [True: 0, False: 0]
  ------------------
  496|      0|              DEBUGMSGHEX(("usm", engineID, engineIDLen));
  ------------------
  |  |   71|      0|#define DEBUGMSGHEX(x)     do {if (_DBG_IF_) {__DBGMSGHEX(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGHEX(x)     do {if (_DBG_IF_) {__DBGMSGHEX(x);} }while(0)
  |  |  ------------------
  |  |  |  |  169|      0|#define __DBGMSGHEX(x)     debugmsg_hex x
  |  |  ------------------
  |  |  |  Branch (71:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  497|      0|          } else {
  498|      0|              DEBUGMSGTL(("usm", "Empty EngineID"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  499|      0|          }
  500|      0|          DEBUGMSG(("usm", ")\n"));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
  501|      0|        }
  502|      0|    }
  503|       |
  504|       |    /*
  505|       |     * return "" user used to facilitate engineID discovery
  506|       |     */
  507|      6|    if (use_default && !strcmp(name, "")) {
  ------------------
  |  Branch (507:9): [True: 6, False: 0]
  |  Branch (507:24): [True: 2, False: 4]
  ------------------
  508|      2|        DEBUGMSGTL(("usm", "return noNameUser\n"));
  ------------------
  |  |   66|      2|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      2|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 2]
  |  |  ------------------
  ------------------
  509|      2|        return noNameUser;
  510|      2|    }
  511|      4|    return NULL;
  512|      6|}
snmpusm.c:usm_secmod_rgenerate_out_msg:
 2430|      4|{
 2431|      4|    if (!parms)
  ------------------
  |  Branch (2431:9): [True: 0, False: 4]
  ------------------
 2432|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 2433|       |
 2434|      4|    return usm_rgenerate_out_msg(parms->msgProcModel,
 2435|      4|                                 parms->globalData, parms->globalDataLen,
 2436|      4|                                 parms->maxMsgSize, parms->secModel,
 2437|      4|                                 parms->secEngineID, parms->secEngineIDLen,
 2438|      4|                                 parms->secName, parms->secNameLen,
 2439|      4|                                 parms->secLevel,
 2440|      4|                                 parms->scopedPdu, parms->scopedPduLen,
 2441|      4|                                 parms->secStateRef,
 2442|      4|                                 parms->session->sessUser,
 2443|      4|                                 parms->wholeMsg, parms->wholeMsgLen,
 2444|      4|                                 parms->wholeMsgOffset);
 2445|      4|}
snmpusm.c:usm_rgenerate_out_msg:
 1977|      4|{
 1978|      4|    size_t          msgAuthParmLen = 0;
 1979|      4|    u_int           boots_uint;
 1980|      4|    u_int           time_uint;
 1981|      4|    long            boots_long;
 1982|      4|    long            time_long;
 1983|       |
 1984|       |    /*
 1985|       |     * Indirection because secStateRef values override parameters.
 1986|       |     * 
 1987|       |     * None of these are to be free'd - they are either pointing to
 1988|       |     * what's in the secStateRef or to something either in the
 1989|       |     * actual parameter list or the user list.
 1990|       |     */
 1991|       |
 1992|      4|    const char     *theName = NULL;
 1993|      4|    u_int           theNameLength = 0;
 1994|      4|    const u_char   *theEngineID = NULL;
 1995|      4|    u_int           theEngineIDLength = 0;
 1996|      4|    u_char         *theAuthKey = NULL;
 1997|      4|    u_int           theAuthKeyLength = 0;
 1998|      4|    const oid      *theAuthProtocol = NULL;
 1999|      4|    u_int           theAuthProtocolLength = 0;
 2000|      4|    u_char         *thePrivKey = NULL;
 2001|      4|    u_int           thePrivKeyLength = 0;
 2002|      4|    const oid      *thePrivProtocol = NULL;
 2003|      4|    u_int           thePrivProtocolLength = 0;
 2004|      4|    int             theSecLevel = 0;    /* No defined const for bad
 2005|       |                                         * value (other then err). */
 2006|      4|    size_t          salt_length = 0, save_salt_length = 0;
 2007|      4|    u_char          salt[BYTESIZE(USM_MAX_SALT_LENGTH)];
 2008|      4|    u_char          authParams[USM_MAX_AUTHSIZE];
 2009|      4|    u_char          iv[BYTESIZE(USM_MAX_SALT_LENGTH)];
 2010|      4|    size_t          sp_offset = 0, mac_offset = 0;
 2011|      4|    int             rc = 0;
 2012|       |
 2013|      4|    DEBUGMSGTL(("usm", "USM processing has begun (offset %d)\n", (int)*offset));
  ------------------
  |  |   66|      4|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2014|       |
 2015|      4|    if (secStateRef != NULL) {
  ------------------
  |  Branch (2015:9): [True: 0, False: 4]
  ------------------
 2016|       |        /*
 2017|       |         * To hush the compiler for now.  XXX 
 2018|       |         */
 2019|      0|        const struct usmStateReference *ref = secStateRef;
 2020|       |
 2021|      0|        theName = ref->usr_name;
 2022|      0|        theNameLength = ref->usr_name_length;
 2023|      0|        theEngineID = ref->usr_engine_id;
 2024|      0|        theEngineIDLength = ref->usr_engine_id_length;
 2025|       |
 2026|      0|        if (!theEngineIDLength) {
  ------------------
  |  Branch (2026:13): [True: 0, False: 0]
  ------------------
 2027|      0|            theEngineID = secEngineID;
 2028|      0|            theEngineIDLength = secEngineIDLen;
 2029|      0|        }
 2030|       |
 2031|      0|        theAuthProtocol = ref->usr_auth_protocol;
 2032|      0|        theAuthProtocolLength = ref->usr_auth_protocol_length;
 2033|      0|        theAuthKey = ref->usr_auth_key;
 2034|      0|        theAuthKeyLength = ref->usr_auth_key_length;
 2035|      0|        thePrivProtocol = ref->usr_priv_protocol;
 2036|      0|        thePrivProtocolLength = ref->usr_priv_protocol_length;
 2037|      0|        thePrivKey = ref->usr_priv_key;
 2038|      0|        thePrivKeyLength = ref->usr_priv_key_length;
 2039|      0|        theSecLevel = ref->usr_sec_level;
 2040|      0|    }
 2041|       |
 2042|       |    /*
 2043|       |     * * Identify the user record.
 2044|       |     */
 2045|      4|    else {
 2046|      4|        struct usmUser *user;
 2047|       |
 2048|       |        /*
 2049|       |         * we do allow an unknown user name for
 2050|       |         * unauthenticated requests. 
 2051|       |         */
 2052|      4|        if (sessUser)
  ------------------
  |  Branch (2052:13): [True: 0, False: 4]
  ------------------
 2053|      0|            user = sessUser;
 2054|      4|        else
 2055|      4|            user = usm_get_user2(secEngineID, secEngineIDLen, secName, secNameLen);
 2056|       |
 2057|      4|        if (user == NULL && secLevel != SNMP_SEC_LEVEL_NOAUTH) {
  ------------------
  |  |  299|      3|#define SNMP_SEC_LEVEL_NOAUTH		1
  ------------------
  |  Branch (2057:13): [True: 3, False: 1]
  |  Branch (2057:29): [True: 0, False: 3]
  ------------------
 2058|      0|            DEBUGMSGTL(("usm", "Unknown User\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2059|      0|            return SNMPERR_USM_UNKNOWNSECURITYNAME;
  ------------------
  |  |  260|      0|#define SNMPERR_USM_UNKNOWNSECURITYNAME		(-43)
  ------------------
 2060|      0|        }
 2061|       |
 2062|      4|        theName = secName;
 2063|      4|        theNameLength = secNameLen;
 2064|      4|        theEngineID = secEngineID;
 2065|      4|        theSecLevel = secLevel;
 2066|      4|        theEngineIDLength = secEngineIDLen;
 2067|      4|        if (user) {
  ------------------
  |  Branch (2067:13): [True: 1, False: 3]
  ------------------
 2068|      1|            theAuthProtocol = user->authProtocol;
 2069|      1|            theAuthProtocolLength = user->authProtocolLen;
 2070|      1|            theAuthKey = user->authKey;
 2071|      1|            theAuthKeyLength = user->authKeyLen;
 2072|      1|            thePrivProtocol = user->privProtocol;
 2073|      1|            thePrivProtocolLength = user->privProtocolLen;
 2074|      1|            thePrivKey = user->privKey;
 2075|      1|            thePrivKeyLength = user->privKeyLen;
 2076|      3|        } else {
 2077|       |            /*
 2078|       |             * unknown users can not do authentication (obviously) 
 2079|       |             */
 2080|      3|            theAuthProtocol = usmNoAuthProtocol;
 2081|      3|            theAuthProtocolLength =
 2082|      3|                OID_LENGTH(usmNoAuthProtocol);
  ------------------
  |  |   64|      3|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|      3|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
 2083|      3|            theAuthKey = NULL;
 2084|      3|            theAuthKeyLength = 0;
 2085|      3|            thePrivProtocol = usmNoPrivProtocol;
 2086|      3|            thePrivProtocolLength =
 2087|      3|                OID_LENGTH(usmNoPrivProtocol);
  ------------------
  |  |   64|      3|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|      3|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
 2088|      3|            thePrivKey = NULL;
 2089|      3|            thePrivKeyLength = 0;
 2090|      3|        }
 2091|      4|    }                           /* endif -- secStateRef==NULL */
 2092|       |
 2093|       |
 2094|       |    /*
 2095|       |     * From here to the end of the function, avoid reference to
 2096|       |     * secName, secEngineID, secLevel, and associated lengths.
 2097|       |     */
 2098|       |
 2099|       |
 2100|       |    /*
 2101|       |     * Check to see if the user can use the requested sec services.
 2102|       |     */
 2103|      4|    if (usm_check_secLevel_vs_protocols(theSecLevel,
  ------------------
  |  Branch (2103:9): [True: 0, False: 4]
  ------------------
 2104|      4|                                        theAuthProtocol,
 2105|      4|                                        theAuthProtocolLength,
 2106|      4|                                        thePrivProtocol,
 2107|      4|                                        thePrivProtocolLength) == 1) {
 2108|      0|        DEBUGMSGTL(("usm", "Unsupported Security Level or type (%d)\n",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2109|      0|                    theSecLevel));
 2110|       |
 2111|      0|        return SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL;
  ------------------
  |  |  261|      0|#define SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL	(-44)
  ------------------
 2112|      0|    }
 2113|       |
 2114|       |
 2115|       |    /*
 2116|       |     * * Retrieve the engine information.
 2117|       |     * *
 2118|       |     * * XXX    No error is declared in the EoP when sending messages to
 2119|       |     * *        unknown engines, processing continues w/ boots/time == (0,0).
 2120|       |     */
 2121|      4|    if (get_enginetime(theEngineID, theEngineIDLength,
  ------------------
  |  Branch (2121:9): [True: 0, False: 4]
  ------------------
 2122|      4|                       &boots_uint, &time_uint, FALSE) == -1) {
  ------------------
  |  |  125|      4|#define FALSE 0
  ------------------
 2123|      0|        DEBUGMSGTL(("usm", "%s\n", "Failed to find engine data."));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2124|      0|    }
 2125|       |
 2126|      4|    boots_long = boots_uint;
 2127|      4|    time_long = time_uint;
 2128|       |
 2129|      4|    if (theSecLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|      4|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (2129:9): [True: 0, False: 4]
  ------------------
 2130|       |        /*
 2131|       |         * Initially assume that the ciphertext will end up the same size as
 2132|       |         * the plaintext plus some padding.  Really sc_encrypt ought to be able
 2133|       |         * to grow this for us, a la asn_realloc_rbuild_<type> functions, but
 2134|       |         * this will do for now.  
 2135|       |         */
 2136|      0|        u_char         *ciphertext = NULL;
 2137|      0|        size_t          ciphertextlen = scopedPduLen + 64;
 2138|      0|        int             priv_type = sc_get_privtype(thePrivProtocol,
 2139|      0|                                                    thePrivProtocolLength);
 2140|       |
 2141|      0|        if ((ciphertext = (u_char *) malloc(ciphertextlen)) == NULL) {
  ------------------
  |  Branch (2141:13): [True: 0, False: 0]
  ------------------
 2142|      0|            DEBUGMSGTL(("usm",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2143|      0|                        "couldn't malloc %d bytes for encrypted PDU\n",
 2144|      0|                        (int)ciphertextlen));
 2145|      0|            return SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 2146|      0|        }
 2147|       |
 2148|       |        /*
 2149|       |         * XXX Hardwired to seek into a 1DES private key!  
 2150|       |         */
 2151|      0|#ifdef HAVE_AES
 2152|      0|        if (USM_CREATE_USER_PRIV_AES == (priv_type & USM_PRIV_MASK_ALG)) {
  ------------------
  |  |  176|      0|#define USM_CREATE_USER_PRIV_AES            0x02
  ------------------
                      if (USM_CREATE_USER_PRIV_AES == (priv_type & USM_PRIV_MASK_ALG)) {
  ------------------
  |  |  166|      0|#define USM_PRIV_MASK_ALG                   0x0000ff
  ------------------
  |  Branch (2152:13): [True: 0, False: 0]
  ------------------
 2153|      0|            salt_length = BYTESIZE(USM_AES_SALT_LENGTH);
  ------------------
  |  |   55|      0|#define BYTESIZE(bitsize)       ((bitsize + 7) >> 3)
  ------------------
 2154|      0|            save_salt_length = BYTESIZE(USM_AES_SALT_LENGTH)/2;
  ------------------
  |  |   55|      0|#define BYTESIZE(bitsize)       ((bitsize + 7) >> 3)
  ------------------
 2155|      0|            if (!thePrivKey ||
  ------------------
  |  Branch (2155:17): [True: 0, False: 0]
  ------------------
 2156|      0|                usm_set_aes_iv(salt, &salt_length,
  ------------------
  |  Branch (2156:17): [True: 0, False: 0]
  ------------------
 2157|      0|                               htonl(boots_uint), htonl(time_uint),
 2158|      0|                               iv) == -1) {
 2159|      0|                DEBUGMSGTL(("usm", "Can't set AES iv.\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2160|      0|                SNMP_FREE(ciphertext);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2161|      0|                return SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  259|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 2162|      0|            }
 2163|      0|        } 
 2164|      0|#endif
 2165|      0|#ifndef NETSNMP_DISABLE_DES
 2166|      0|        if (USM_CREATE_USER_PRIV_DES == (priv_type & USM_PRIV_MASK_ALG)) {
  ------------------
  |  |  172|      0|#define USM_CREATE_USER_PRIV_DES            0x01
  ------------------
                      if (USM_CREATE_USER_PRIV_DES == (priv_type & USM_PRIV_MASK_ALG)) {
  ------------------
  |  |  166|      0|#define USM_PRIV_MASK_ALG                   0x0000ff
  ------------------
  |  Branch (2166:13): [True: 0, False: 0]
  ------------------
 2167|      0|            salt_length = BYTESIZE(USM_DES_SALT_LENGTH);
  ------------------
  |  |   55|      0|#define BYTESIZE(bitsize)       ((bitsize + 7) >> 3)
  ------------------
 2168|      0|            save_salt_length = BYTESIZE(USM_DES_SALT_LENGTH);
  ------------------
  |  |   55|      0|#define BYTESIZE(bitsize)       ((bitsize + 7) >> 3)
  ------------------
 2169|      0|            if (!thePrivKey || (usm_set_salt(salt, &salt_length,
  ------------------
  |  Branch (2169:17): [True: 0, False: 0]
  |  Branch (2169:32): [True: 0, False: 0]
  ------------------
 2170|      0|                                             thePrivKey + 8,
 2171|      0|                                             thePrivKeyLength - 8,
 2172|      0|                                             iv) == -1)) {
 2173|      0|                DEBUGMSGTL(("usm", "Can't set DES-CBC salt.\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2174|      0|                SNMP_FREE(ciphertext);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2175|      0|                return SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  259|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 2176|      0|            }
 2177|      0|        }
 2178|      0|#endif
 2179|       |#ifdef NETSNMP_ENABLE_TESTING_CODE
 2180|       |        if (debug_is_token_registered("usm/dump") == SNMPERR_SUCCESS) {
 2181|       |            dump_chunk("usm/dump", "This data was encrypted:",
 2182|       |                       scopedPdu, scopedPduLen);
 2183|       |        }
 2184|       |#endif
 2185|       |
 2186|      0|        if (sc_encrypt(thePrivProtocol, thePrivProtocolLength,
  ------------------
  |  Branch (2186:13): [True: 0, False: 0]
  ------------------
 2187|      0|                       thePrivKey, thePrivKeyLength,
 2188|      0|                       salt, salt_length,
 2189|      0|                       scopedPdu, scopedPduLen,
 2190|      0|                       ciphertext, &ciphertextlen) != SNMP_ERR_NOERROR) {
  ------------------
  |  |  212|      0|#define SNMP_ERR_NOERROR                (0)     /* XXX  Used only for PDUs? */
  ------------------
 2191|      0|            DEBUGMSGTL(("usm", "encryption error.\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2192|      0|            SNMP_FREE(ciphertext);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2193|      0|            return SNMPERR_USM_ENCRYPTIONERROR;
  ------------------
  |  |  262|      0|#define SNMPERR_USM_ENCRYPTIONERROR		(-45)
  ------------------
 2194|      0|        }
 2195|       |
 2196|       |        /*
 2197|       |         * Write the encrypted scopedPdu back into the packet buffer.  
 2198|       |         */
 2199|       |
 2200|      0|        *offset = 0;
 2201|      0|        rc = asn_realloc_rbuild_string(wholeMsg, wholeMsgLen, offset, 1,
 2202|      0|                                       (u_char) (ASN_UNIVERSAL |
  ------------------
  |  |   90|      0|#define ASN_UNIVERSAL	    0x00U
  ------------------
 2203|      0|                                                 ASN_PRIMITIVE |
  ------------------
  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2204|      0|                                                 ASN_OCTET_STR),
  ------------------
  |  |   78|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
 2205|      0|                                       ciphertext, ciphertextlen);
 2206|      0|        if (rc == 0) {
  ------------------
  |  Branch (2206:13): [True: 0, False: 0]
  ------------------
 2207|      0|            DEBUGMSGTL(("usm", "Encryption failed.\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2208|      0|            SNMP_FREE(ciphertext);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2209|      0|            return SNMPERR_USM_ENCRYPTIONERROR;
  ------------------
  |  |  262|      0|#define SNMPERR_USM_ENCRYPTIONERROR		(-45)
  ------------------
 2210|      0|        }
 2211|       |
 2212|       |#ifdef NETSNMP_ENABLE_TESTING_CODE
 2213|       |        if (debug_is_token_registered("usm/dump") == SNMPERR_SUCCESS) {
 2214|       |            dump_chunk("usm/dump", "salt + Encrypted form: ", salt,
 2215|       |                       salt_length);
 2216|       |            dump_chunk("usm/dump", "wholeMsg:",
 2217|       |                       (*wholeMsg + *wholeMsgLen - *offset), *offset);
 2218|       |        }
 2219|       |#endif
 2220|       |
 2221|      0|        DEBUGMSGTL(("usm", "Encryption successful.\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2222|      0|        SNMP_FREE(ciphertext);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2223|      4|    } else {
 2224|       |        /*
 2225|       |         * theSecLevel != SNMP_SEC_LEVEL_AUTHPRIV  
 2226|       |         */
 2227|      4|    }
 2228|       |
 2229|       |    /*
 2230|       |     * Start encoding the msgSecurityParameters.  
 2231|       |     */
 2232|       |
 2233|      4|    sp_offset = *offset;
 2234|       |
 2235|      4|    DEBUGDUMPHEADER("send", "msgPrivacyParameters");
  ------------------
  |  |   79|      4|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2236|       |    /*
 2237|       |     * msgPrivacyParameters (warning: assumes DES salt).  
 2238|       |     */
 2239|      4|    rc = asn_realloc_rbuild_string(wholeMsg, wholeMsgLen, offset, 1,
 2240|      4|                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|      4|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                 (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|      4|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2241|      4|                                             | ASN_OCTET_STR),
  ------------------
  |  |   78|      4|#define ASN_OCTET_STR	    0x04U
  ------------------
 2242|      4|                                   iv,
 2243|      4|                                   save_salt_length);
 2244|      4|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2245|      4|    if (rc == 0) {
  ------------------
  |  Branch (2245:9): [True: 0, False: 4]
  ------------------
 2246|      0|        DEBUGMSGTL(("usm", "building privParams failed.\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2247|      0|        return SNMPERR_TOO_LONG;
  ------------------
  |  |  222|      0|#define SNMPERR_TOO_LONG		(-5)
  ------------------
 2248|      0|    }
 2249|       |
 2250|      4|    DEBUGDUMPHEADER("send", "msgAuthenticationParameters");
  ------------------
  |  |   79|      4|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2251|       |    /*
 2252|       |     * msgAuthenticationParameters.
 2253|       |     */
 2254|      4|    if (theSecLevel == SNMP_SEC_LEVEL_AUTHNOPRIV
  ------------------
  |  |  300|      8|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
  |  Branch (2254:9): [True: 0, False: 4]
  ------------------
 2255|      4|        || theSecLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|      4|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (2255:12): [True: 0, False: 4]
  ------------------
 2256|      0|        memset(authParams, 0, sizeof(authParams));
 2257|      0|        msgAuthParmLen =
 2258|      0|            sc_get_auth_maclen(sc_get_authtype(theAuthProtocol,
 2259|      0|                                               theAuthProtocolLength));
 2260|      0|    }
 2261|       |
 2262|      4|    rc = asn_realloc_rbuild_string(wholeMsg, wholeMsgLen, offset, 1,
 2263|      4|                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|      4|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                 (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|      4|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2264|      4|                                             | ASN_OCTET_STR), authParams,
  ------------------
  |  |   78|      4|#define ASN_OCTET_STR	    0x04U
  ------------------
 2265|      4|                                   msgAuthParmLen);
 2266|      4|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2267|      4|    if (rc == 0) {
  ------------------
  |  Branch (2267:9): [True: 0, False: 4]
  ------------------
 2268|      0|        DEBUGMSGTL(("usm", "building authParams failed.\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2269|      0|        return SNMPERR_TOO_LONG;
  ------------------
  |  |  222|      0|#define SNMPERR_TOO_LONG		(-5)
  ------------------
 2270|      0|    }
 2271|       |
 2272|       |    /*
 2273|       |     * Remember where to put the actual HMAC we calculate later on.  An
 2274|       |     * encoded OCTET STRING of length USM_MD5_AND_SHA_AUTH_LEN has an ASN.1
 2275|       |     * header of length 2, hence the fudge factor.  This works as long as
 2276|       |     * auth lengths stay < 127.
 2277|       |     */
 2278|      4|    mac_offset = *offset - 2;
 2279|       |
 2280|       |    /*
 2281|       |     * msgUserName.  
 2282|       |     */
 2283|      4|    DEBUGDUMPHEADER("send", "msgUserName");
  ------------------
  |  |   79|      4|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2284|      4|    rc = asn_realloc_rbuild_string(wholeMsg, wholeMsgLen, offset, 1,
 2285|      4|                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|      4|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                 (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|      4|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2286|      4|                                             | ASN_OCTET_STR),
  ------------------
  |  |   78|      4|#define ASN_OCTET_STR	    0x04U
  ------------------
 2287|      4|                                   (const u_char *) theName, theNameLength);
 2288|      4|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2289|      4|    if (rc == 0) {
  ------------------
  |  Branch (2289:9): [True: 0, False: 4]
  ------------------
 2290|      0|        DEBUGMSGTL(("usm", "building authParams failed.\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2291|      0|        return SNMPERR_TOO_LONG;
  ------------------
  |  |  222|      0|#define SNMPERR_TOO_LONG		(-5)
  ------------------
 2292|      0|    }
 2293|       |
 2294|       |    /*
 2295|       |     * msgAuthoritativeEngineTime.  
 2296|       |     */
 2297|      4|    DEBUGDUMPHEADER("send", "msgAuthoritativeEngineTime");
  ------------------
  |  |   79|      4|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2298|      4|    rc = asn_realloc_rbuild_int(wholeMsg, wholeMsgLen, offset, 1,
 2299|      4|                                (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   90|      4|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                              (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   95|      4|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2300|      4|                                          ASN_INTEGER), &time_long,
  ------------------
  |  |   75|      4|#define ASN_INTEGER	    0x02U
  ------------------
 2301|      4|                                sizeof(long));
 2302|      4|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2303|      4|    if (rc == 0) {
  ------------------
  |  Branch (2303:9): [True: 0, False: 4]
  ------------------
 2304|      0|        DEBUGMSGTL(("usm",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2305|      0|                    "building msgAuthoritativeEngineTime failed.\n"));
 2306|      0|        return SNMPERR_TOO_LONG;
  ------------------
  |  |  222|      0|#define SNMPERR_TOO_LONG		(-5)
  ------------------
 2307|      0|    }
 2308|       |
 2309|       |    /*
 2310|       |     * msgAuthoritativeEngineBoots.  
 2311|       |     */
 2312|      4|    DEBUGDUMPHEADER("send", "msgAuthoritativeEngineBoots");
  ------------------
  |  |   79|      4|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2313|      4|    rc = asn_realloc_rbuild_int(wholeMsg, wholeMsgLen, offset, 1,
 2314|      4|                                (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   90|      4|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                              (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   95|      4|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2315|      4|                                          ASN_INTEGER), &boots_long,
  ------------------
  |  |   75|      4|#define ASN_INTEGER	    0x02U
  ------------------
 2316|      4|                                sizeof(long));
 2317|      4|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2318|      4|    if (rc == 0) {
  ------------------
  |  Branch (2318:9): [True: 0, False: 4]
  ------------------
 2319|      0|        DEBUGMSGTL(("usm",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2320|      0|                    "building msgAuthoritativeEngineBoots failed.\n"));
 2321|      0|        return SNMPERR_TOO_LONG;
  ------------------
  |  |  222|      0|#define SNMPERR_TOO_LONG		(-5)
  ------------------
 2322|      0|    }
 2323|       |
 2324|      4|    DEBUGDUMPHEADER("send", "msgAuthoritativeEngineID");
  ------------------
  |  |   79|      4|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2325|      4|    rc = asn_realloc_rbuild_string(wholeMsg, wholeMsgLen, offset, 1,
 2326|      4|                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|      4|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                 (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|      4|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2327|      4|                                             | ASN_OCTET_STR), theEngineID,
  ------------------
  |  |   78|      4|#define ASN_OCTET_STR	    0x04U
  ------------------
 2328|      4|                                   theEngineIDLength);
 2329|      4|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2330|      4|    if (rc == 0) {
  ------------------
  |  Branch (2330:9): [True: 0, False: 4]
  ------------------
 2331|      0|        DEBUGMSGTL(("usm", "building msgAuthoritativeEngineID failed.\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2332|      0|        return SNMPERR_TOO_LONG;
  ------------------
  |  |  222|      0|#define SNMPERR_TOO_LONG		(-5)
  ------------------
 2333|      0|    }
 2334|       |
 2335|       |    /*
 2336|       |     * USM msgSecurityParameters sequence header  
 2337|       |     */
 2338|      4|    rc = asn_realloc_rbuild_sequence(wholeMsg, wholeMsgLen, offset, 1,
 2339|      4|                                     (u_char) (ASN_SEQUENCE |
  ------------------
  |  |   84|      4|#define ASN_SEQUENCE	    0x10U
  ------------------
 2340|      4|                                               ASN_CONSTRUCTOR),
  ------------------
  |  |   96|      4|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 2341|      4|                                     *offset - sp_offset);
 2342|      4|    if (rc == 0) {
  ------------------
  |  Branch (2342:9): [True: 0, False: 4]
  ------------------
 2343|      0|        DEBUGMSGTL(("usm", "building usm security parameters failed.\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2344|      0|        return SNMPERR_TOO_LONG;
  ------------------
  |  |  222|      0|#define SNMPERR_TOO_LONG		(-5)
  ------------------
 2345|      0|    }
 2346|       |
 2347|       |    /*
 2348|       |     * msgSecurityParameters OCTET STRING wrapper.  
 2349|       |     */
 2350|      4|    rc = asn_realloc_rbuild_header(wholeMsg, wholeMsgLen, offset, 1,
 2351|      4|                                   (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|      4|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                 (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|      4|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2352|      4|                                             | ASN_OCTET_STR),
  ------------------
  |  |   78|      4|#define ASN_OCTET_STR	    0x04U
  ------------------
 2353|      4|                                   *offset - sp_offset);
 2354|       |
 2355|      4|    if (rc == 0) {
  ------------------
  |  Branch (2355:9): [True: 0, False: 4]
  ------------------
 2356|      0|        DEBUGMSGTL(("usm", "building msgSecurityParameters failed.\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2357|      0|        return SNMPERR_TOO_LONG;
  ------------------
  |  |  222|      0|#define SNMPERR_TOO_LONG		(-5)
  ------------------
 2358|      0|    }
 2359|       |
 2360|       |    /*
 2361|       |     * Copy in the msgGlobalData and msgVersion.  
 2362|       |     */
 2363|      4|    while ((*wholeMsgLen - *offset) < globalDataLen) {
  ------------------
  |  Branch (2363:12): [True: 0, False: 4]
  ------------------
 2364|      0|        if (!asn_realloc(wholeMsg, wholeMsgLen)) {
  ------------------
  |  Branch (2364:13): [True: 0, False: 0]
  ------------------
 2365|      0|            DEBUGMSGTL(("usm", "building global data failed.\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2366|      0|            return SNMPERR_TOO_LONG;
  ------------------
  |  |  222|      0|#define SNMPERR_TOO_LONG		(-5)
  ------------------
 2367|      0|        }
 2368|      0|    }
 2369|       |
 2370|      4|    *offset += globalDataLen;
 2371|      4|    memcpy(*wholeMsg + *wholeMsgLen - *offset, globalData, globalDataLen);
 2372|       |
 2373|       |    /*
 2374|       |     * Total packet sequence.  
 2375|       |     */
 2376|      4|    rc = asn_realloc_rbuild_sequence(wholeMsg, wholeMsgLen, offset, 1,
 2377|      4|                                     (u_char) (ASN_SEQUENCE |
  ------------------
  |  |   84|      4|#define ASN_SEQUENCE	    0x10U
  ------------------
 2378|      4|                                               ASN_CONSTRUCTOR), *offset);
  ------------------
  |  |   96|      4|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 2379|      4|    if (rc == 0) {
  ------------------
  |  Branch (2379:9): [True: 0, False: 4]
  ------------------
 2380|      0|        DEBUGMSGTL(("usm", "building master packet sequence failed.\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2381|      0|        return SNMPERR_TOO_LONG;
  ------------------
  |  |  222|      0|#define SNMPERR_TOO_LONG		(-5)
  ------------------
 2382|      0|    }
 2383|       |
 2384|       |    /*
 2385|       |     * Now consider / do authentication.  
 2386|       |     */
 2387|       |
 2388|      4|    if (theSecLevel == SNMP_SEC_LEVEL_AUTHNOPRIV ||
  ------------------
  |  |  300|      8|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
  |  Branch (2388:9): [True: 0, False: 4]
  ------------------
 2389|      4|        theSecLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|      4|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (2389:9): [True: 0, False: 4]
  ------------------
 2390|      0|        size_t          temp_sig_len = msgAuthParmLen;
 2391|      0|        u_char         *temp_sig = (u_char *) malloc(temp_sig_len);
 2392|      0|        u_char         *proto_msg = *wholeMsg + *wholeMsgLen - *offset;
 2393|      0|        size_t          proto_msg_len = *offset;
 2394|       |
 2395|       |
 2396|      0|        if (temp_sig == NULL) {
  ------------------
  |  Branch (2396:13): [True: 0, False: 0]
  ------------------
 2397|      0|            DEBUGMSGTL(("usm", "Out of memory.\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2398|      0|            return SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  259|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 2399|      0|        }
 2400|       |
 2401|      0|        if (sc_generate_keyed_hash(theAuthProtocol, theAuthProtocolLength,
  ------------------
  |  Branch (2401:13): [True: 0, False: 0]
  ------------------
 2402|      0|                                   theAuthKey, theAuthKeyLength,
 2403|      0|                                   proto_msg, proto_msg_len,
 2404|      0|                                   temp_sig, &temp_sig_len)
 2405|      0|            != SNMP_ERR_NOERROR) {
  ------------------
  |  |  212|      0|#define SNMP_ERR_NOERROR                (0)     /* XXX  Used only for PDUs? */
  ------------------
 2406|      0|            SNMP_FREE(temp_sig);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2407|      0|            DEBUGMSGTL(("usm", "Signing failed.\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2408|      0|            return SNMPERR_USM_AUTHENTICATIONFAILURE;
  ------------------
  |  |  263|      0|#define SNMPERR_USM_AUTHENTICATIONFAILURE	(-46)
  ------------------
 2409|      0|        }
 2410|       |
 2411|      0|        if (temp_sig_len != msgAuthParmLen) {
  ------------------
  |  Branch (2411:13): [True: 0, False: 0]
  ------------------
 2412|      0|            SNMP_FREE(temp_sig);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2413|      0|            DEBUGMSGTL(("usm", "Signing lengths failed.\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2414|      0|            return SNMPERR_USM_AUTHENTICATIONFAILURE;
  ------------------
  |  |  263|      0|#define SNMPERR_USM_AUTHENTICATIONFAILURE	(-46)
  ------------------
 2415|      0|        }
 2416|       |
 2417|      0|        memcpy(*wholeMsg + *wholeMsgLen - mac_offset, temp_sig,
 2418|      0|               msgAuthParmLen);
 2419|      0|        SNMP_FREE(temp_sig);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2420|      0|    }
 2421|       |    /*
 2422|       |     * endif -- create keyed hash 
 2423|       |     */
 2424|      4|    DEBUGMSGTL(("usm", "USM processing completed.\n"));
  ------------------
  |  |   66|      4|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2425|      4|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|      4|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 2426|      4|}                               /* end usm_rgenerate_out_msg() */
snmpusm.c:usm_check_secLevel_vs_protocols:
 1356|      4|{
 1357|       |
 1358|      4|    if (level == SNMP_SEC_LEVEL_AUTHPRIV
  ------------------
  |  |  301|      8|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (1358:9): [True: 0, False: 4]
  ------------------
 1359|      0|        &&
 1360|      0|        (netsnmp_oid_equals
  ------------------
  |  Branch (1360:9): [True: 0, False: 0]
  ------------------
 1361|      0|         (privProtocol, privProtocolLen, usmNoPrivProtocol,
 1362|      0|          OID_LENGTH(usmNoPrivProtocol)) == 0)) {
  ------------------
  |  |   64|      0|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|      0|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
 1363|      0|        DEBUGMSGTL(("usm", "Level: %d\n", level));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1364|      0|        DEBUGMSGTL(("usm", "Auth Protocol: "));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1365|      0|        DEBUGMSGOID(("usm", authProtocol, authProtocolLen));
  ------------------
  |  |   67|      0|#define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  165|      0|#define __DBGMSGOID(x)     debugmsg_oid x
  |  |  ------------------
  |  |  |  Branch (67:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1366|      0|        DEBUGMSG(("usm", ", Priv Protocol: "));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1367|      0|        DEBUGMSGOID(("usm", privProtocol, privProtocolLen));
  ------------------
  |  |   67|      0|#define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  165|      0|#define __DBGMSGOID(x)     debugmsg_oid x
  |  |  ------------------
  |  |  |  Branch (67:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1368|      0|        DEBUGMSG(("usm", "\n"));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1369|      0|        return 1;
 1370|      0|    }
 1371|      4|    if ((level == SNMP_SEC_LEVEL_AUTHPRIV
  ------------------
  |  |  301|      8|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (1371:10): [True: 0, False: 4]
  ------------------
 1372|      4|         || level == SNMP_SEC_LEVEL_AUTHNOPRIV)
  ------------------
  |  |  300|      4|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
  |  Branch (1372:13): [True: 0, False: 4]
  ------------------
 1373|      0|        &&
 1374|      0|        (netsnmp_oid_equals
  ------------------
  |  Branch (1374:9): [True: 0, False: 0]
  ------------------
 1375|      0|         (authProtocol, authProtocolLen, usmNoAuthProtocol,
 1376|      0|          OID_LENGTH(usmNoAuthProtocol)) == 0)) {
  ------------------
  |  |   64|      0|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|      0|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
 1377|      0|        DEBUGMSGTL(("usm", "Level: %d\n", level));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1378|      0|        DEBUGMSGTL(("usm", "Auth Protocol: "));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1379|      0|        DEBUGMSGOID(("usm", authProtocol, authProtocolLen));
  ------------------
  |  |   67|      0|#define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  165|      0|#define __DBGMSGOID(x)     debugmsg_oid x
  |  |  ------------------
  |  |  |  Branch (67:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1380|      0|        DEBUGMSG(("usm", ", Priv Protocol: "));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1381|      0|        DEBUGMSGOID(("usm", privProtocol, privProtocolLen));
  ------------------
  |  |   67|      0|#define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  165|      0|#define __DBGMSGOID(x)     debugmsg_oid x
  |  |  ------------------
  |  |  |  Branch (67:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1382|      0|        DEBUGMSG(("usm", "\n"));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1383|      0|        return 1;
 1384|      0|    }
 1385|       |
 1386|      4|    return 0;
 1387|       |
 1388|      4|}                               /* end usm_check_secLevel_vs_protocols() */
snmpusm.c:usm_secmod_process_in_msg:
 3357|      4|{
 3358|      4|    if (!parms)
  ------------------
  |  Branch (3358:9): [True: 0, False: 4]
  ------------------
 3359|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 3360|       |
 3361|      4|    return usm_process_in_msg(parms->msgProcModel,
 3362|      4|                              parms->maxMsgSize,
 3363|      4|                              parms->secParams,
 3364|      4|                              parms->secModel,
 3365|      4|                              parms->secLevel,
 3366|      4|                              parms->wholeMsg,
 3367|      4|                              parms->wholeMsgLen,
 3368|      4|                              parms->secEngineID,
 3369|      4|                              parms->secEngineIDLen,
 3370|      4|                              parms->secName,
 3371|      4|                              parms->secNameLen,
 3372|      4|                              parms->scopedPdu,
 3373|      4|                              parms->scopedPduLen,
 3374|      4|                              parms->maxSizeResponse,
 3375|      4|                              parms->secStateRef,
 3376|      4|                              parms->sess, parms->msg_flags);
 3377|      4|}
snmpusm.c:usm_process_in_msg:
 2956|      4|{                               /* IN     - v3 Message flags.              */
 2957|      4|    size_t          remaining = wholeMsgLen - (secParams - wholeMsg);
 2958|      4|    u_int           boots_uint;
 2959|      4|    u_int           time_uint;
 2960|      4|#ifdef HAVE_AES
 2961|      4|    u_int           net_boots, net_time;
 2962|      4|#endif
 2963|      4|#ifndef NETSNMP_DISABLE_DES
 2964|      4|    int             i;
 2965|      4|#endif
 2966|      4|    u_char          signature[USM_MAX_AUTHSIZE];
 2967|      4|    size_t          signature_length = USM_MAX_AUTHSIZE;
  ------------------
  |  |   38|      4|#define USM_MAX_AUTHSIZE                USM_HMAC384SHA512_AUTH_LEN
  |  |  ------------------
  |  |  |  |   37|      4|#define USM_HMAC384SHA512_AUTH_LEN      48      /* SHOULD */
  |  |  ------------------
  ------------------
 2968|      4|    u_char          salt[BYTESIZE(USM_MAX_SALT_LENGTH)];
 2969|      4|    size_t          salt_length = BYTESIZE(USM_MAX_SALT_LENGTH);
  ------------------
  |  |   55|      4|#define BYTESIZE(bitsize)       ((bitsize + 7) >> 3)
  ------------------
 2970|      4|    u_char          iv[BYTESIZE(USM_MAX_SALT_LENGTH)];
 2971|      4|    u_int           iv_length = BYTESIZE(USM_MAX_SALT_LENGTH);
  ------------------
  |  |   55|      4|#define BYTESIZE(bitsize)       ((bitsize + 7) >> 3)
  ------------------
 2972|      4|    u_char         *data_ptr;
 2973|      4|    u_char         *value_ptr;
 2974|      4|    u_char          type_value;
 2975|      4|    u_char         *end_of_overhead = NULL;
 2976|      4|    int             error;
 2977|      4|    int             rc = 0;
 2978|      4|    struct usmStateReference **secStateRef =
 2979|      4|        (struct usmStateReference **) secStateRf;
 2980|       |
 2981|      4|    struct usmUser *user;
 2982|       |
 2983|       |
 2984|      4|    DEBUGMSGTL(("usm", "USM processing begun...\n"));
  ------------------
  |  |   66|      4|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2985|       |
 2986|      4|    netsnmp_assert(secStateRef);
  ------------------
  |  |   47|      4|#      define netsnmp_assert(x)  do { \
  |  |   48|      4|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 4, False: 0]
  |  |  ------------------
  |  |   49|      4|                 ; \
  |  |   50|      4|              else \
  |  |   51|      4|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      4|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2987|       |
 2988|      4|    usm_free_usmStateReference(*secStateRef);
 2989|      4|    *secStateRef = usm_malloc_usmStateReference();
 2990|      4|    if (*secStateRef == NULL) {
  ------------------
  |  Branch (2990:9): [True: 0, False: 4]
  ------------------
 2991|      0|        DEBUGMSGTL(("usm", "Out of memory.\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2992|      0|        return SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  259|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 2993|      0|    }
 2994|       |
 2995|       |    /*
 2996|       |     * Make sure the *secParms is an OCTET STRING.
 2997|       |     * Extract the user name, engine ID, and security level.
 2998|       |     */
 2999|      4|    if ((rc = usm_parse_security_parameters(secParams, remaining,
  ------------------
  |  Branch (2999:9): [True: 0, False: 4]
  ------------------
 3000|      4|                                            secEngineID, secEngineIDLen,
 3001|      4|                                            &boots_uint, &time_uint,
 3002|      4|                                            secName, secNameLen,
 3003|      4|                                            signature, &signature_length,
 3004|      4|                                            salt, &salt_length,
 3005|      4|                                            &data_ptr)) < 0) {
 3006|      0|        DEBUGMSGTL(("usm", "Parsing failed (rc %d).\n", rc));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3007|      0|        if (rc == -2) {
  ------------------
  |  Branch (3007:13): [True: 0, False: 0]
  ------------------
 3008|       |            /*
 3009|       |             * This indicates a decryptionError.  
 3010|       |             */
 3011|      0|            snmp_increment_statistic(STAT_USMSTATSDECRYPTIONERRORS);
  ------------------
  |  |  658|      0|#define   STAT_USMSTATSDECRYPTIONERRORS      8
  ------------------
 3012|      0|            error = SNMPERR_USM_DECRYPTIONERROR;
  ------------------
  |  |  267|      0|#define SNMPERR_USM_DECRYPTIONERROR		(-50)
  ------------------
 3013|      0|        } else {
 3014|      0|            snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3015|      0|            error = SNMPERR_USM_PARSEERROR;
  ------------------
  |  |  264|      0|#define SNMPERR_USM_PARSEERROR			(-47)
  ------------------
 3016|      0|        }
 3017|      0|        goto err;
 3018|      0|    }
 3019|       |
 3020|       |    /*
 3021|       |     * RFC 2574 section 8.3.2
 3022|       |     * 1)  If the privParameters field is not an 8-octet OCTET STRING,
 3023|       |     * then an error indication (decryptionError) is returned to the
 3024|       |     * calling module.
 3025|       |     */
 3026|      4|    if ((secLevel == SNMP_SEC_LEVEL_AUTHPRIV) && (salt_length != 8)) {
  ------------------
  |  |  301|      4|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (3026:9): [True: 0, False: 4]
  |  Branch (3026:50): [True: 0, False: 0]
  ------------------
 3027|      0|        snmp_increment_statistic(STAT_USMSTATSDECRYPTIONERRORS);
  ------------------
  |  |  658|      0|#define   STAT_USMSTATSDECRYPTIONERRORS      8
  ------------------
 3028|      0|        error = SNMPERR_USM_DECRYPTIONERROR;
  ------------------
  |  |  267|      0|#define SNMPERR_USM_DECRYPTIONERROR		(-50)
  ------------------
 3029|      0|        goto err;
 3030|      0|    }
 3031|       |
 3032|      4|    if (secLevel != SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|      4|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (3032:9): [True: 4, False: 0]
  ------------------
 3033|       |        /*
 3034|       |         * pull these out now so reports can use them 
 3035|       |         */
 3036|      4|        *scopedPdu = data_ptr;
 3037|      4|        *scopedPduLen = wholeMsgLen - (data_ptr - wholeMsg);
 3038|      4|        end_of_overhead = data_ptr;
 3039|      4|    }
 3040|       |
 3041|       |    /*
 3042|       |     * Cache the name, engine ID, and security level,
 3043|       |     * * per step 2 (section 3.2)
 3044|       |     */
 3045|      4|    if (usm_set_usmStateReference_name
  ------------------
  |  Branch (3045:9): [True: 0, False: 4]
  ------------------
 3046|      4|        (*secStateRef, secName, *secNameLen) == -1) {
 3047|      0|        DEBUGMSGTL(("usm", "%s\n", "Couldn't cache name."));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3048|      0|        error = SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  259|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 3049|      0|        goto err;
 3050|      0|    }
 3051|       |
 3052|      4|    if (usm_set_usmStateReference_engine_id
  ------------------
  |  Branch (3052:9): [True: 0, False: 4]
  ------------------
 3053|      4|        (*secStateRef, secEngineID, *secEngineIDLen) == -1) {
 3054|      0|        DEBUGMSGTL(("usm", "%s\n", "Couldn't cache engine id."));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3055|      0|        error = SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  259|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 3056|      0|        goto err;
 3057|      0|    }
 3058|       |
 3059|      4|    if (usm_set_usmStateReference_sec_level(*secStateRef, secLevel) ==
  ------------------
  |  Branch (3059:9): [True: 0, False: 4]
  ------------------
 3060|      4|        -1) {
 3061|      0|        DEBUGMSGTL(("usm", "%s\n", "Couldn't cache security level."));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3062|      0|        error = SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  259|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 3063|      0|        goto err;
 3064|      0|    }
 3065|       |
 3066|       |    /*
 3067|       |     * Locate the engine ID record.
 3068|       |     * If it is unknown, then either create one or note this as an error.
 3069|       |     */
 3070|      4|    if ((sess && (sess->isAuthoritative == SNMP_SESS_AUTHORITATIVE ||
  ------------------
  |  |  158|      8|#define SNMP_SESS_AUTHORITATIVE    1    /* don't learn engineIDs */
  ------------------
  |  Branch (3070:10): [True: 4, False: 0]
  |  Branch (3070:19): [True: 0, False: 4]
  ------------------
 3071|      4|                  (sess->isAuthoritative == SNMP_SESS_UNKNOWNAUTH &&
  ------------------
  |  |  159|      8|#define SNMP_SESS_UNKNOWNAUTH      2    /* sometimes (like NRs) */
  ------------------
  |  Branch (3071:20): [True: 4, False: 0]
  ------------------
 3072|      4|                   (msg_flags & SNMP_MSG_FLAG_RPRT_BIT)))) ||
  ------------------
  |  |  305|      4|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
  |  Branch (3072:20): [True: 2, False: 2]
  ------------------
 3073|      2|        (!sess && (msg_flags & SNMP_MSG_FLAG_RPRT_BIT))) {
  ------------------
  |  |  305|      0|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
  |  Branch (3073:10): [True: 0, False: 2]
  |  Branch (3073:19): [True: 0, False: 0]
  ------------------
 3074|      2|        if (ISENGINEKNOWN(secEngineID, *secEngineIDLen) == FALSE) {
  ------------------
  |  |   82|      2|	( (get_enginetime(e, e_l,				\
  |  |  ------------------
  |  |  |  Branch (82:4): [True: 0, False: 2]
  |  |  ------------------
  |  |   83|      2|		&dummy_eboot, &dummy_etime, TRUE) == SNMPERR_SUCCESS)	\
  |  |  ------------------
  |  |  |  |  128|      2|#define TRUE  1
  |  |  ------------------
  |  |               		&dummy_eboot, &dummy_etime, TRUE) == SNMPERR_SUCCESS)	\
  |  |  ------------------
  |  |  |  |  217|      2|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |   84|      2|		? TRUE						\
  |  |  ------------------
  |  |  |  |  128|      0|#define TRUE  1
  |  |  ------------------
  |  |   85|      2|		: FALSE )
  |  |  ------------------
  |  |  |  |  125|      2|#define FALSE 0
  |  |  ------------------
  ------------------
                      if (ISENGINEKNOWN(secEngineID, *secEngineIDLen) == FALSE) {
  ------------------
  |  |  125|      2|#define FALSE 0
  ------------------
  |  Branch (3074:13): [True: 2, False: 0]
  ------------------
 3075|      2|            DEBUGMSGTL(("usm", "Unknown Engine ID.\n"));
  ------------------
  |  |   66|      2|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      2|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 2]
  |  |  ------------------
  ------------------
 3076|      2|            snmp_increment_statistic(STAT_USMSTATSUNKNOWNENGINEIDS);
  ------------------
  |  |  656|      2|#define   STAT_USMSTATSUNKNOWNENGINEIDS      6
  ------------------
 3077|      2|            error = SNMPERR_USM_UNKNOWNENGINEID;
  ------------------
  |  |  265|      2|#define SNMPERR_USM_UNKNOWNENGINEID		(-48)
  ------------------
 3078|      2|            goto err;
 3079|      2|        }
 3080|      2|    } else {
 3081|      2|        if (ENSURE_ENGINE_RECORD(secEngineID, *secEngineIDLen)
  ------------------
  |  |   88|      2|	( (set_enginetime(e, e_l, 0, 0, FALSE) == SNMPERR_SUCCESS)	\
  |  |  ------------------
  |  |  |  |  125|      2|#define FALSE 0
  |  |  ------------------
  |  |               	( (set_enginetime(e, e_l, 0, 0, FALSE) == SNMPERR_SUCCESS)	\
  |  |  ------------------
  |  |  |  |  217|      2|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (88:4): [True: 2, False: 0]
  |  |  ------------------
  |  |   89|      2|		? SNMPERR_SUCCESS				\
  |  |  ------------------
  |  |  |  |  217|      2|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |   90|      2|		: SNMPERR_GENERR )
  |  |  ------------------
  |  |  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  |  |  ------------------
  ------------------
  |  Branch (3081:13): [True: 0, False: 2]
  ------------------
 3082|      2|            != SNMPERR_SUCCESS) {
  ------------------
  |  |  217|      2|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 3083|      0|            DEBUGMSGTL(("usm", "%s\n", "Couldn't ensure engine record."));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3084|      0|            error = SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  259|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 3085|      0|            goto err;
 3086|      0|        }
 3087|       |
 3088|      2|    }
 3089|       |
 3090|       |
 3091|       |    /*
 3092|       |     * Locate the User record.
 3093|       |     * If the user/engine ID is unknown, report this as an error.
 3094|       |     */
 3095|      2|    if (sess && sess->sessUser)
  ------------------
  |  Branch (3095:9): [True: 2, False: 0]
  |  Branch (3095:17): [True: 0, False: 2]
  ------------------
 3096|      0|        user = sess->sessUser;
 3097|      2|    else
 3098|      2|        user = usm_get_user_from_list(secEngineID, *secEngineIDLen,
 3099|      2|                                       secName, *secNameLen, userList,
 3100|      2|                                       (((sess && sess->isAuthoritative ==
  ------------------
  |  Branch (3100:43): [True: 2, False: 0]
  |  Branch (3100:51): [True: 0, False: 2]
  ------------------
 3101|      2|                                          SNMP_SESS_AUTHORITATIVE) ||
  ------------------
  |  |  158|      2|#define SNMP_SESS_AUTHORITATIVE    1    /* don't learn engineIDs */
  ------------------
 3102|      2|                                         (!sess)) ? 0 : 1));
  ------------------
  |  Branch (3102:42): [True: 0, False: 2]
  ------------------
 3103|       |
 3104|      2|    if (user == NULL) {
  ------------------
  |  Branch (3104:9): [True: 1, False: 1]
  ------------------
 3105|      1|        DEBUGMSGTL(("usm", "Unknown User(%s)\n", secName));
  ------------------
  |  |   66|      1|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 1]
  |  |  ------------------
  ------------------
 3106|      1|        snmp_increment_statistic(STAT_USMSTATSUNKNOWNUSERNAMES);
  ------------------
  |  |  655|      1|#define   STAT_USMSTATSUNKNOWNUSERNAMES      5
  ------------------
 3107|      1|        error = SNMPERR_USM_UNKNOWNSECURITYNAME;
  ------------------
  |  |  260|      1|#define SNMPERR_USM_UNKNOWNSECURITYNAME		(-43)
  ------------------
 3108|      1|        goto err;
 3109|      1|    }
 3110|       |
 3111|       |    /* ensure the user is active */
 3112|      1|    if (user->userStatus != RS_ACTIVE) {
  ------------------
  |  |   35|      1|#define RS_ACTIVE	        1
  ------------------
  |  Branch (3112:9): [True: 0, False: 1]
  ------------------
 3113|      0|        DEBUGMSGTL(("usm", "Attempt to use an inactive user.\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3114|      0|        error = SNMPERR_USM_UNKNOWNSECURITYNAME;
  ------------------
  |  |  260|      0|#define SNMPERR_USM_UNKNOWNSECURITYNAME		(-43)
  ------------------
 3115|      0|        goto err;
 3116|      0|    }
 3117|       |
 3118|       |    /*
 3119|       |     * Make sure the security level is appropriate.
 3120|       |     */
 3121|       |
 3122|      1|    rc = usm_check_secLevel(secLevel, user);
 3123|      1|    if (1 == rc) {
  ------------------
  |  Branch (3123:9): [True: 0, False: 1]
  ------------------
 3124|      0|        DEBUGMSGTL(("usm", "Unsupported Security Level (%d).\n",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3125|      0|                    secLevel));
 3126|      0|        snmp_increment_statistic(STAT_USMSTATSUNSUPPORTEDSECLEVELS);
  ------------------
  |  |  653|      0|#define   STAT_USMSTATSUNSUPPORTEDSECLEVELS  3
  ------------------
 3127|      0|        error = SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL;
  ------------------
  |  |  261|      0|#define SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL	(-44)
  ------------------
 3128|      0|        goto err;
 3129|      1|    } else if (rc != 0) {
  ------------------
  |  Branch (3129:16): [True: 0, False: 1]
  ------------------
 3130|      0|        DEBUGMSGTL(("usm", "Unknown issue.\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3131|      0|        error = SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  259|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 3132|      0|        goto err;
 3133|      0|    }
 3134|       |
 3135|       |    /*
 3136|       |     * Check the authentication credentials of the message.
 3137|       |     */
 3138|      1|    if (secLevel == SNMP_SEC_LEVEL_AUTHNOPRIV
  ------------------
  |  |  300|      2|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
  |  Branch (3138:9): [True: 1, False: 0]
  ------------------
 3139|      1|        || secLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|      0|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (3139:12): [True: 0, False: 0]
  ------------------
 3140|      1|        if (sc_check_keyed_hash(user->authProtocol, user->authProtocolLen,
  ------------------
  |  Branch (3140:13): [True: 1, False: 0]
  ------------------
 3141|      1|                                user->authKey, user->authKeyLen,
 3142|      1|                                wholeMsg, wholeMsgLen,
 3143|      1|                                signature, signature_length)
 3144|      1|            != SNMP_ERR_NOERROR) {
  ------------------
  |  |  212|      1|#define SNMP_ERR_NOERROR                (0)     /* XXX  Used only for PDUs? */
  ------------------
 3145|      1|            DEBUGMSGTL(("usm", "Verification failed.\n"));
  ------------------
  |  |   66|      1|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 1]
  |  |  ------------------
  ------------------
 3146|      1|            snmp_increment_statistic(STAT_USMSTATSWRONGDIGESTS);
  ------------------
  |  |  657|      1|#define   STAT_USMSTATSWRONGDIGESTS          7
  ------------------
 3147|      1|	    snmp_log(LOG_WARNING, "Authentication failed for %s\n",
 3148|      1|				user->name);
 3149|      1|            error = SNMPERR_USM_AUTHENTICATIONFAILURE;
  ------------------
  |  |  263|      1|#define SNMPERR_USM_AUTHENTICATIONFAILURE	(-46)
  ------------------
 3150|      1|            goto err;
 3151|      1|        }
 3152|       |
 3153|      0|        DEBUGMSGTL(("usm", "Verification succeeded.\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3154|      0|    }
 3155|       |
 3156|       |
 3157|       |    /*
 3158|       |     * Steps 10-11  user is already set - relocated before timeliness 
 3159|       |     * check in case it fails - still save user data for response.
 3160|       |     *
 3161|       |     * Cache the keys and protocol oids, per step 11 (s3.2).
 3162|       |     */
 3163|      0|    if (usm_set_usmStateReference_auth_protocol(*secStateRef,
  ------------------
  |  Branch (3163:9): [True: 0, False: 0]
  ------------------
 3164|      0|                                                user->authProtocol,
 3165|      0|                                                user->
 3166|      0|                                                authProtocolLen) == -1) {
 3167|      0|        DEBUGMSGTL(("usm", "%s\n",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3168|      0|                    "Couldn't cache authentication protocol."));
 3169|      0|        error = SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  259|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 3170|      0|        goto err;
 3171|      0|    }
 3172|       |
 3173|      0|    if (usm_set_usmStateReference_auth_key(*secStateRef,
  ------------------
  |  Branch (3173:9): [True: 0, False: 0]
  ------------------
 3174|      0|                                           user->authKey,
 3175|      0|                                           user->authKeyLen) == -1) {
 3176|      0|        DEBUGMSGTL(("usm", "%s\n",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3177|      0|                    "Couldn't cache authentication key."));
 3178|      0|        error = SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  259|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 3179|      0|        goto err;
 3180|      0|    }
 3181|       |
 3182|      0|    if (usm_set_usmStateReference_priv_protocol(*secStateRef,
  ------------------
  |  Branch (3182:9): [True: 0, False: 0]
  ------------------
 3183|      0|                                                user->privProtocol,
 3184|      0|                                                user->
 3185|      0|                                                privProtocolLen) == -1) {
 3186|      0|        DEBUGMSGTL(("usm", "%s\n",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3187|      0|                    "Couldn't cache privacy protocol."));
 3188|      0|        error = SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  259|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 3189|      0|        goto err;
 3190|      0|    }
 3191|       |
 3192|      0|    if (usm_set_usmStateReference_priv_key(*secStateRef,
  ------------------
  |  Branch (3192:9): [True: 0, False: 0]
  ------------------
 3193|      0|                                           user->privKey,
 3194|      0|                                           user->privKeyLen) == -1) {
 3195|      0|        DEBUGMSGTL(("usm", "%s\n", "Couldn't cache privacy key."));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3196|      0|        error = SNMPERR_USM_GENERICERROR;
  ------------------
  |  |  259|      0|#define SNMPERR_USM_GENERICERROR		(-42)
  ------------------
 3197|      0|        goto err;
 3198|      0|    }
 3199|       |
 3200|       |
 3201|       |    /*
 3202|       |     * Perform the timeliness/time manager functions.
 3203|       |     */
 3204|      0|    if (secLevel == SNMP_SEC_LEVEL_AUTHNOPRIV
  ------------------
  |  |  300|      0|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
  |  Branch (3204:9): [True: 0, False: 0]
  ------------------
 3205|      0|        || secLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|      0|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (3205:12): [True: 0, False: 0]
  ------------------
 3206|      0|        if (usm_check_and_update_timeliness(secEngineID, *secEngineIDLen,
  ------------------
  |  Branch (3206:13): [True: 0, False: 0]
  ------------------
 3207|      0|                                            boots_uint, time_uint,
 3208|      0|                                            &error) == -1) {
 3209|      0|            goto err;
 3210|      0|        }
 3211|      0|    }
 3212|      0|#ifdef							LCD_TIME_SYNC_OPT
 3213|       |    /*
 3214|       |     * Cache the unauthenticated time to use in case we don't have
 3215|       |     * anything better - this guess will be no worse than (0,0)
 3216|       |     * that we normally use.
 3217|       |     */
 3218|      0|    else {
 3219|      0|        set_enginetime(secEngineID, *secEngineIDLen,
 3220|      0|                       boots_uint, time_uint, FALSE);
  ------------------
  |  |  125|      0|#define FALSE 0
  ------------------
 3221|      0|    }
 3222|      0|#endif                          /* LCD_TIME_SYNC_OPT */
 3223|       |
 3224|       |
 3225|       |    /*
 3226|       |     * If needed, decrypt the scoped PDU.
 3227|       |     */
 3228|      0|    if (secLevel == SNMP_SEC_LEVEL_AUTHPRIV) {
  ------------------
  |  |  301|      0|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (3228:9): [True: 0, False: 0]
  ------------------
 3229|      0|        int priv_type = sc_get_privtype(user->privProtocol,
 3230|      0|                                        user->privProtocolLen);
 3231|      0|        remaining = wholeMsgLen - (data_ptr - wholeMsg);
 3232|       |
 3233|      0|        if ((value_ptr = asn_parse_sequence(data_ptr, &remaining,
  ------------------
  |  Branch (3233:13): [True: 0, False: 0]
  ------------------
 3234|      0|                                            &type_value,
 3235|      0|                                            (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   90|      0|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                          (ASN_UNIVERSAL | ASN_PRIMITIVE
  ------------------
  |  |   95|      0|#define ASN_PRIMITIVE	    0x00U
  ------------------
 3236|      0|                                             | ASN_OCTET_STR),
  ------------------
  |  |   78|      0|#define ASN_OCTET_STR	    0x04U
  ------------------
 3237|      0|                                            "encrypted sPDU")) == NULL) {
 3238|      0|            DEBUGMSGTL(("usm", "%s\n",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3239|      0|                        "Failed while parsing encrypted sPDU."));
 3240|      0|            snmp_increment_statistic(STAT_SNMPINASNPARSEERRS);
  ------------------
  |  |  670|      0|#define  STAT_SNMPINASNPARSEERRS             14
  ------------------
 3241|      0|            usm_free_usmStateReference(*secStateRef);
 3242|      0|            *secStateRef = NULL;
 3243|      0|            error = SNMPERR_USM_PARSEERROR;
  ------------------
  |  |  264|      0|#define SNMPERR_USM_PARSEERROR			(-47)
  ------------------
 3244|      0|            goto err;
 3245|      0|        }
 3246|       |
 3247|      0|#ifndef NETSNMP_DISABLE_DES
 3248|      0|        if (USM_CREATE_USER_PRIV_DES == (priv_type & USM_PRIV_MASK_ALG)) {
  ------------------
  |  |  172|      0|#define USM_CREATE_USER_PRIV_DES            0x01
  ------------------
                      if (USM_CREATE_USER_PRIV_DES == (priv_type & USM_PRIV_MASK_ALG)) {
  ------------------
  |  |  166|      0|#define USM_PRIV_MASK_ALG                   0x0000ff
  ------------------
  |  Branch (3248:13): [True: 0, False: 0]
  ------------------
 3249|       |            /*
 3250|       |             * From RFC2574:
 3251|       |             * 
 3252|       |             * "Before decryption, the encrypted data length is verified.
 3253|       |             * If the length of the OCTET STRING to be decrypted is not
 3254|       |             * an integral multiple of 8 octets, the decryption process
 3255|       |             * is halted and an appropriate exception noted."  
 3256|       |             */
 3257|       |
 3258|      0|            if (remaining % 8 != 0) {
  ------------------
  |  Branch (3258:17): [True: 0, False: 0]
  ------------------
 3259|      0|                DEBUGMSGTL(("usm",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3260|      0|                            "Ciphertext is %lu bytes, not an integer multiple of 8 (rem %lu)\n",
 3261|      0|                            (unsigned long)remaining, (unsigned long)remaining % 8));
 3262|      0|                snmp_increment_statistic(STAT_USMSTATSDECRYPTIONERRORS);
  ------------------
  |  |  658|      0|#define   STAT_USMSTATSDECRYPTIONERRORS      8
  ------------------
 3263|      0|                usm_free_usmStateReference(*secStateRef);
 3264|      0|                *secStateRef = NULL;
 3265|      0|                error = SNMPERR_USM_DECRYPTIONERROR;
  ------------------
  |  |  267|      0|#define SNMPERR_USM_DECRYPTIONERROR		(-50)
  ------------------
 3266|      0|                goto err;
 3267|      0|            }
 3268|       |
 3269|      0|            end_of_overhead = value_ptr;
 3270|       |
 3271|      0|            if ( !user->privKey ) {
  ------------------
  |  Branch (3271:18): [True: 0, False: 0]
  ------------------
 3272|      0|                DEBUGMSGTL(("usm", "No privacy pass phrase for %s\n", user->secName));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3273|      0|                snmp_increment_statistic(STAT_USMSTATSDECRYPTIONERRORS);
  ------------------
  |  |  658|      0|#define   STAT_USMSTATSDECRYPTIONERRORS      8
  ------------------
 3274|      0|                usm_free_usmStateReference(*secStateRef);
 3275|      0|                *secStateRef = NULL;
 3276|      0|                error = SNMPERR_USM_DECRYPTIONERROR;
  ------------------
  |  |  267|      0|#define SNMPERR_USM_DECRYPTIONERROR		(-50)
  ------------------
 3277|      0|                goto err;
 3278|      0|            }
 3279|       |
 3280|       |            /*
 3281|       |             * XOR the salt with the last (iv_length) bytes
 3282|       |             * of the priv_key to obtain the IV.
 3283|       |             */
 3284|      0|            iv_length = BYTESIZE(USM_DES_SALT_LENGTH);
  ------------------
  |  |   55|      0|#define BYTESIZE(bitsize)       ((bitsize + 7) >> 3)
  ------------------
 3285|      0|            for (i = 0; i < (int) iv_length; i++)
  ------------------
  |  Branch (3285:25): [True: 0, False: 0]
  ------------------
 3286|      0|                iv[i] = salt[i] ^ user->privKey[iv_length + i];
 3287|      0|        }
 3288|      0|#endif
 3289|      0|#ifdef HAVE_AES
 3290|      0|        if (USM_CREATE_USER_PRIV_AES == (priv_type & USM_PRIV_MASK_ALG)) {
  ------------------
  |  |  176|      0|#define USM_CREATE_USER_PRIV_AES            0x02
  ------------------
                      if (USM_CREATE_USER_PRIV_AES == (priv_type & USM_PRIV_MASK_ALG)) {
  ------------------
  |  |  166|      0|#define USM_PRIV_MASK_ALG                   0x0000ff
  ------------------
  |  Branch (3290:13): [True: 0, False: 0]
  ------------------
 3291|      0|            iv_length = BYTESIZE(USM_AES_SALT_LENGTH);
  ------------------
  |  |   55|      0|#define BYTESIZE(bitsize)       ((bitsize + 7) >> 3)
  ------------------
 3292|      0|            net_boots = ntohl(boots_uint);
 3293|      0|            net_time = ntohl(time_uint);
 3294|      0|            memcpy(iv, &net_boots, 4);
 3295|      0|            memcpy(iv+4, &net_time, 4);
 3296|      0|            memcpy(iv+8, salt, salt_length);
 3297|      0|        }
 3298|      0|#endif
 3299|       |
 3300|       |#ifdef NETSNMP_ENABLE_TESTING_CODE
 3301|       |        if (debug_is_token_registered("usm/dump") == SNMPERR_SUCCESS) {
 3302|       |            dump_chunk("usm/dump", "Cypher Text", value_ptr, remaining);
 3303|       |            dump_chunk("usm/dump", "salt + Encrypted form:",
 3304|       |                       salt, salt_length);
 3305|       |            dump_chunk("usm/dump", "IV + Encrypted form:", iv, iv_length);
 3306|       |        }
 3307|       |#endif
 3308|      0|        if (sc_decrypt(user->privProtocol, user->privProtocolLen,
  ------------------
  |  Branch (3308:13): [True: 0, False: 0]
  ------------------
 3309|      0|                       user->privKey, user->privKeyLen,
 3310|      0|                       iv, iv_length,
 3311|      0|                       value_ptr, remaining, *scopedPdu, scopedPduLen)
 3312|      0|            != SNMP_ERR_NOERROR) {
  ------------------
  |  |  212|      0|#define SNMP_ERR_NOERROR                (0)     /* XXX  Used only for PDUs? */
  ------------------
 3313|      0|            DEBUGMSGTL(("usm", "%s\n", "Failed decryption."));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3314|      0|            snmp_increment_statistic(STAT_USMSTATSDECRYPTIONERRORS);
  ------------------
  |  |  658|      0|#define   STAT_USMSTATSDECRYPTIONERRORS      8
  ------------------
 3315|      0|            error = SNMPERR_USM_DECRYPTIONERROR;
  ------------------
  |  |  267|      0|#define SNMPERR_USM_DECRYPTIONERROR		(-50)
  ------------------
 3316|      0|            goto err;
 3317|      0|        }
 3318|       |#ifdef NETSNMP_ENABLE_TESTING_CODE
 3319|       |        if (debug_is_token_registered("usm/dump") == SNMPERR_SUCCESS) {
 3320|       |            dump_chunk("usm/dump", "Decrypted chunk:",
 3321|       |                       *scopedPdu, *scopedPduLen);
 3322|       |        }
 3323|       |#endif
 3324|      0|    }
 3325|       |    /*
 3326|       |     * sPDU is plaintext.
 3327|       |     */
 3328|      0|    else {
 3329|      0|        *scopedPdu = data_ptr;
 3330|      0|        *scopedPduLen = wholeMsgLen - (data_ptr - wholeMsg);
 3331|      0|        end_of_overhead = data_ptr;
 3332|       |
 3333|      0|    }                           /* endif -- PDU decryption */
 3334|       |
 3335|       |
 3336|       |    /*
 3337|       |     * Calculate the biggest sPDU for the response (i.e., whole - ovrhd).
 3338|       |     *
 3339|       |     * FIX  Correct? 
 3340|       |     */
 3341|      0|    *maxSizeResponse = maxMsgSize - (end_of_overhead - wholeMsg);
 3342|       |
 3343|       |
 3344|      0|    DEBUGMSGTL(("usm", "USM processing completed.\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3345|       |
 3346|      0|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 3347|       |
 3348|      4|err:
 3349|      4|    usm_free_usmStateReference(*secStateRef);
 3350|      4|    *secStateRef = NULL;
 3351|       |    netsnmp_assert(error != SNMPERR_SUCCESS);
  ------------------
  |  |   47|      4|#      define netsnmp_assert(x)  do { \
  |  |   48|      4|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 4, False: 0]
  |  |  ------------------
  |  |   49|      4|                 ; \
  |  |   50|      4|              else \
  |  |   51|      4|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      4|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 4]
  |  |  ------------------
  ------------------
 3352|      4|    return error;
 3353|      0|}                               /* end usm_process_in_msg() */
snmpusm.c:usm_malloc_usmStateReference:
  288|      4|{
  289|      4|    struct usmStateReference *retval;
  290|       |
  291|      4|    retval = calloc(1, sizeof(struct usmStateReference));
  292|      4|    if (retval)
  ------------------
  |  Branch (292:9): [True: 4, False: 0]
  ------------------
  293|      4|        retval->refcnt = 1;
  294|       |
  295|      4|    return retval;
  296|      4|}                               /* end usm_malloc_usmStateReference() */
snmpusm.c:usm_parse_security_parameters:
 2476|      4|{
 2477|      4|    u_char         *parse_ptr = secParams;
 2478|      4|    u_char         *value_ptr;
 2479|      4|    u_char         *next_ptr;
 2480|      4|    u_char          type_value;
 2481|       |
 2482|      4|    size_t          octet_string_length = remaining;
 2483|      4|    size_t          sequence_length;
 2484|      4|    size_t          remaining_bytes;
 2485|       |
 2486|      4|    long            boots_long;
 2487|      4|    long            time_long;
 2488|       |
 2489|      4|    u_int           origNameLen;
 2490|       |
 2491|       |
 2492|       |    /*
 2493|       |     * Eat the first octet header.
 2494|       |     */
 2495|      4|    if ((value_ptr = asn_parse_sequence(parse_ptr, &octet_string_length,
  ------------------
  |  Branch (2495:9): [True: 0, False: 4]
  ------------------
 2496|      4|                                        &type_value,
 2497|      4|                                        (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   90|      4|#define ASN_UNIVERSAL	    0x00U
  ------------------
                                                      (ASN_UNIVERSAL | ASN_PRIMITIVE |
  ------------------
  |  |   95|      4|#define ASN_PRIMITIVE	    0x00U
  ------------------
 2498|      4|                                         ASN_OCTET_STR),
  ------------------
  |  |   78|      4|#define ASN_OCTET_STR	    0x04U
  ------------------
 2499|      4|                                        "usm first octet")) == NULL) {
 2500|       |        /*
 2501|       |         * RETURN parse error 
 2502|      0|         */ return -1;
 2503|      0|    }
 2504|       |
 2505|       |
 2506|       |    /*
 2507|       |     * Eat the sequence header.
 2508|       |     */
 2509|      4|    parse_ptr = value_ptr;
 2510|      4|    sequence_length = octet_string_length;
 2511|       |
 2512|      4|    if ((value_ptr = asn_parse_sequence(parse_ptr, &sequence_length,
  ------------------
  |  Branch (2512:9): [True: 0, False: 4]
  ------------------
 2513|      4|                                        &type_value,
 2514|      4|                                        (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   84|      4|#define ASN_SEQUENCE	    0x10U
  ------------------
                                                      (ASN_SEQUENCE | ASN_CONSTRUCTOR),
  ------------------
  |  |   96|      4|#define ASN_CONSTRUCTOR	    0x20U
  ------------------
 2515|      4|                                        "usm sequence")) == NULL) {
 2516|       |        /*
 2517|       |         * RETURN parse error 
 2518|      0|         */ return -1;
 2519|      0|    }
 2520|       |
 2521|       |
 2522|       |    /*
 2523|       |     * Retrieve the engineID.
 2524|       |     */
 2525|      4|    parse_ptr = value_ptr;
 2526|      4|    remaining_bytes = sequence_length;
 2527|       |
 2528|      4|    DEBUGDUMPHEADER("recv", "msgAuthoritativeEngineID");
  ------------------
  |  |   79|      4|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2529|      4|    if ((next_ptr
  ------------------
  |  Branch (2529:9): [True: 0, False: 4]
  ------------------
 2530|      4|         = asn_parse_string(parse_ptr, &remaining_bytes, &type_value,
 2531|      4|                            secEngineID, secEngineIDLen)) == NULL) {
 2532|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2533|       |        /*
 2534|       |         * RETURN parse error 
 2535|      0|         */ return -1;
 2536|      0|    }
 2537|      4|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2538|       |
 2539|      4|    if (type_value !=
  ------------------
  |  Branch (2539:9): [True: 0, False: 4]
  ------------------
 2540|      4|        (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   90|      4|#define ASN_UNIVERSAL	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   95|      4|#define ASN_PRIMITIVE	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   78|      4|#define ASN_OCTET_STR	    0x04U
  ------------------
 2541|       |        /*
 2542|       |         * RETURN parse error 
 2543|      0|         */ return -1;
 2544|      0|    }
 2545|       |
 2546|       |
 2547|       |    /*
 2548|       |     * Retrieve the engine boots, notice switch in the way next_ptr and
 2549|       |     * remaining_bytes are used (to accommodate the asn code).
 2550|       |     */
 2551|      4|    DEBUGDUMPHEADER("recv", "msgAuthoritativeEngineBoots");
  ------------------
  |  |   79|      4|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2552|      4|    if ((next_ptr = asn_parse_int(next_ptr, &remaining_bytes, &type_value,
  ------------------
  |  Branch (2552:9): [True: 0, False: 4]
  ------------------
 2553|      4|                                  &boots_long, sizeof(long))) == NULL) {
 2554|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2555|       |        /*
 2556|       |         * RETURN parse error 
 2557|      0|         */ return -1;
 2558|      0|    }
 2559|      4|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2560|       |
 2561|      4|    if (type_value !=
  ------------------
  |  Branch (2561:9): [True: 0, False: 4]
  ------------------
 2562|      4|        (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER)) {
  ------------------
  |  |   90|      4|#define ASN_UNIVERSAL	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER)) {
  ------------------
  |  |   95|      4|#define ASN_PRIMITIVE	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER)) {
  ------------------
  |  |   75|      4|#define ASN_INTEGER	    0x02U
  ------------------
 2563|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2564|       |        /*
 2565|       |         * RETURN parse error 
 2566|      0|         */ return -1;
 2567|      0|    }
 2568|       |
 2569|      4|    *boots_uint = (u_int) boots_long;
 2570|       |
 2571|       |
 2572|       |    /*
 2573|       |     * Retrieve the time value.
 2574|       |     */
 2575|      4|    DEBUGDUMPHEADER("recv", "msgAuthoritativeEngineTime");
  ------------------
  |  |   79|      4|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2576|      4|    if ((next_ptr = asn_parse_int(next_ptr, &remaining_bytes, &type_value,
  ------------------
  |  Branch (2576:9): [True: 0, False: 4]
  ------------------
 2577|      4|                                  &time_long, sizeof(long))) == NULL) {
 2578|       |        /*
 2579|       |         * RETURN parse error 
 2580|      0|         */ return -1;
 2581|      0|    }
 2582|      4|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2583|       |
 2584|      4|    if (type_value !=
  ------------------
  |  Branch (2584:9): [True: 0, False: 4]
  ------------------
 2585|      4|        (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER)) {
  ------------------
  |  |   90|      4|#define ASN_UNIVERSAL	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER)) {
  ------------------
  |  |   95|      4|#define ASN_PRIMITIVE	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_INTEGER)) {
  ------------------
  |  |   75|      4|#define ASN_INTEGER	    0x02U
  ------------------
 2586|       |        /*
 2587|       |         * RETURN parse error 
 2588|      0|         */ return -1;
 2589|      0|    }
 2590|       |
 2591|      4|    *time_uint = (u_int) time_long;
 2592|       |
 2593|      4|    if (*boots_uint > ENGINEBOOT_MAX || *time_uint > ENGINETIME_MAX) {
  ------------------
  |  |  183|      8|#define ENGINEBOOT_MAX	2147483647      /* ((2^31)-1) */
  ------------------
                  if (*boots_uint > ENGINEBOOT_MAX || *time_uint > ENGINETIME_MAX) {
  ------------------
  |  |  182|      4|#define ENGINETIME_MAX	2147483647      /* ((2^31)-1) */
  ------------------
  |  Branch (2593:9): [True: 0, False: 4]
  |  Branch (2593:41): [True: 0, False: 4]
  ------------------
 2594|      0|        return -1;
 2595|      0|    }
 2596|       |
 2597|       |    /*
 2598|       |     * Retrieve the secName.
 2599|       |     */
 2600|      4|    origNameLen = *secNameLen;
 2601|       |
 2602|       |
 2603|      4|    DEBUGDUMPHEADER("recv", "msgUserName");
  ------------------
  |  |   79|      4|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2604|      4|    if ((next_ptr
  ------------------
  |  Branch (2604:9): [True: 0, False: 4]
  ------------------
 2605|      4|         = asn_parse_string(next_ptr, &remaining_bytes, &type_value,
 2606|      4|                            (u_char *) secName, secNameLen)) == NULL) {
 2607|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2608|       |        /*
 2609|       |         * RETURN parse error 
 2610|      0|         */ return -1;
 2611|      0|    }
 2612|      4|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2613|       |
 2614|       |    /*
 2615|       |     * FIX -- doesn't this also indicate a buffer overrun?
 2616|       |     */
 2617|      4|    if (origNameLen < *secNameLen + 1) {
  ------------------
  |  Branch (2617:9): [True: 0, False: 4]
  ------------------
 2618|       |        /*
 2619|       |         * RETURN parse error, but it's really a parameter error 
 2620|       |         */
 2621|      0|        return -1;
 2622|      0|    }
 2623|       |
 2624|      4|    if (*secNameLen > 32) {
  ------------------
  |  Branch (2624:9): [True: 0, False: 4]
  ------------------
 2625|       |        /*
 2626|       |         * This is a USM-specific limitation over and above the above
 2627|       |         * limitation (which will probably default to the length of an
 2628|       |         * SnmpAdminString, i.e. 255).  See RFC 2574, sec. 2.4.  
 2629|       |         */
 2630|      0|        return -1;
 2631|      0|    }
 2632|       |
 2633|      4|    secName[*secNameLen] = '\0';
 2634|       |
 2635|      4|    if (type_value !=
  ------------------
  |  Branch (2635:9): [True: 0, False: 4]
  ------------------
 2636|      4|        (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   90|      4|#define ASN_UNIVERSAL	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   95|      4|#define ASN_PRIMITIVE	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   78|      4|#define ASN_OCTET_STR	    0x04U
  ------------------
 2637|       |        /*
 2638|       |         * RETURN parse error 
 2639|      0|         */ return -1;
 2640|      0|    }
 2641|       |
 2642|       |
 2643|       |    /*
 2644|       |     * Retrieve the signature and blank it if there.
 2645|       |     */
 2646|      4|    DEBUGDUMPHEADER("recv", "msgAuthenticationParameters");
  ------------------
  |  |   79|      4|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2647|      4|    if ((next_ptr
  ------------------
  |  Branch (2647:9): [True: 0, False: 4]
  ------------------
 2648|      4|         = asn_parse_string(next_ptr, &remaining_bytes, &type_value,
 2649|      4|                            signature, signature_length)) == NULL) {
 2650|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2651|       |        /*
 2652|       |         * RETURN parse error 
 2653|      0|         */ return -1;
 2654|      0|    }
 2655|      4|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2656|       |
 2657|      4|    if (type_value !=
  ------------------
  |  Branch (2657:9): [True: 0, False: 4]
  ------------------
 2658|      4|        (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   90|      4|#define ASN_UNIVERSAL	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   95|      4|#define ASN_PRIMITIVE	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   78|      4|#define ASN_OCTET_STR	    0x04U
  ------------------
 2659|       |        /*
 2660|       |         * RETURN parse error 
 2661|      0|         */ return -1;
 2662|      0|    }
 2663|       |
 2664|      4|    if (*signature_length != 0) {       /* Blanking for authentication step later */
  ------------------
  |  Branch (2664:9): [True: 4, False: 0]
  ------------------
 2665|      4|        memset(next_ptr - (u_long) * signature_length,
 2666|      4|               0, *signature_length);
 2667|      4|    }
 2668|       |
 2669|       |
 2670|       |    /*
 2671|       |     * Retrieve the salt.
 2672|       |     *
 2673|       |     * Note that the next ptr is where the data section starts.
 2674|       |     */
 2675|      4|    DEBUGDUMPHEADER("recv", "msgPrivacyParameters");
  ------------------
  |  |   79|      4|	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               	do {if (_DBG_IF_) {__DBGDUMPHEADER(token,x);} }while(0)
  |  |  ------------------
  |  |  |  |  178|      0|        __DBGPRINTINDENT("dumph_" token); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|      0|#define __DBGPRINTINDENT(token) __DBGMSGTL((token, "%*s", __DBGINDENT(), ""))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  179|      0|        debugmsg("dumph_" token,x); \
  |  |  |  |  180|      0|        if (debug_is_token_registered("dumpx" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (180:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  181|      0|            debug_is_token_registered("dumpv" token) == SNMPERR_SUCCESS ||    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (181:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  182|      0|            (debug_is_token_registered("dumpx_" token) != SNMPERR_SUCCESS &&  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (182:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  183|      0|             debug_is_token_registered("dumpv_" token) != SNMPERR_SUCCESS)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (183:14): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  184|      0|            debugmsg("dumph_" token,"\n"); \
  |  |  |  |  185|      0|        } else { \
  |  |  |  |  186|      0|            debugmsg("dumph_" token,"  "); \
  |  |  |  |  187|      0|        } \
  |  |  |  |  188|      0|        __DBGINDENTMORE()
  |  |  |  |  ------------------
  |  |  |  |  |  |  173|      0|#define __DBGINDENTMORE()  debug_indent_add(2)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (79:55): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2676|      4|    if ((*data_ptr
  ------------------
  |  Branch (2676:9): [True: 0, False: 4]
  ------------------
 2677|      4|         = asn_parse_string(next_ptr, &remaining_bytes, &type_value,
 2678|      4|                            salt, salt_length)) == NULL) {
 2679|      0|        DEBUGINDENTLESS();
  ------------------
  |  |   75|      0|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2680|       |        /*
 2681|       |         * RETURN parse error 
 2682|      0|         */ return -2;
 2683|      0|    }
 2684|      4|    DEBUGINDENTLESS();
  ------------------
  |  |   75|      4|#define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGINDENTLESS()  do {if (_DBG_IF_) {__DBGINDENTLESS();} }while(0)
  |  |  ------------------
  |  |  |  |  174|      0|#define __DBGINDENTLESS()  debug_indent_add(-2)
  |  |  ------------------
  |  |  |  Branch (75:74): [Folded, False: 4]
  |  |  ------------------
  ------------------
 2685|       |
 2686|      4|    if (type_value !=
  ------------------
  |  Branch (2686:9): [True: 0, False: 4]
  ------------------
 2687|      4|        (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   90|      4|#define ASN_UNIVERSAL	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   95|      4|#define ASN_PRIMITIVE	    0x00U
  ------------------
                      (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE | ASN_OCTET_STR)) {
  ------------------
  |  |   78|      4|#define ASN_OCTET_STR	    0x04U
  ------------------
 2688|       |        /*
 2689|       |         * RETURN parse error 
 2690|      0|         */ return -2;
 2691|      0|    }
 2692|       |
 2693|      4|    return 0;
 2694|       |
 2695|      4|}                               /* end usm_parse_security_parameters() */
snmpusm.c:usm_set_usmStateReference_name:
  356|      4|{
  357|       |    MAKE_ENTRY(ref, char, name, name_len, usr_name, usr_name_length);
  ------------------
  |  |  248|      4|#define MAKE_ENTRY(ref, type, item, len, field, field_len)      \
  |  |  249|      4|do {                                                            \
  |  |  250|      4|	if (ref == NULL)                                        \
  |  |  ------------------
  |  |  |  Branch (250:6): [True: 0, False: 4]
  |  |  ------------------
  |  |  251|      4|		return -1;                                      \
  |  |  252|      4|	if (ref->field != NULL)	{                               \
  |  |  ------------------
  |  |  |  Branch (252:6): [True: 0, False: 4]
  |  |  ------------------
  |  |  253|      0|		SNMP_ZERO(ref->field, ref->field_len);          \
  |  |  ------------------
  |  |  |  |   77|      0|#define SNMP_ZERO(s,l)	do { if (s) memset(s, 0, l); } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:33): [True: 0, False: 0]
  |  |  |  |  |  Branch (77:61): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  254|      0|		SNMP_FREE(ref->field);                          \
  |  |  ------------------
  |  |  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  255|      0|	}                                                       \
  |  |  256|      4|	ref->field_len = 0;                                     \
  |  |  257|      4|        if (len == 0 || item == NULL)                           \
  |  |  ------------------
  |  |  |  Branch (257:13): [True: 0, False: 4]
  |  |  |  Branch (257:25): [True: 0, False: 4]
  |  |  ------------------
  |  |  258|      4|		return 0;                                       \
  |  |  259|      4|	ref->field = netsnmp_memdup(item, len * sizeof(type));  \
  |  |  260|      4|        if (ref->field == NULL)                                 \
  |  |  ------------------
  |  |  |  Branch (260:13): [True: 0, False: 4]
  |  |  ------------------
  |  |  261|      4|		return -1;                                      \
  |  |  262|      4|                                                                \
  |  |  263|      4|	ref->field_len = len;                                   \
  |  |  264|      4|	return 0;                                               \
  |  |  265|      4|} while (0)
  |  |  ------------------
  |  |  |  Branch (265:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
  358|      4|}
snmpusm.c:usm_set_usmStateReference_engine_id:
  364|      4|{
  365|       |    MAKE_ENTRY(ref, u_char, engine_id, engine_id_len,
  ------------------
  |  |  248|      4|#define MAKE_ENTRY(ref, type, item, len, field, field_len)      \
  |  |  249|      4|do {                                                            \
  |  |  250|      4|	if (ref == NULL)                                        \
  |  |  ------------------
  |  |  |  Branch (250:6): [True: 0, False: 4]
  |  |  ------------------
  |  |  251|      4|		return -1;                                      \
  |  |  252|      4|	if (ref->field != NULL)	{                               \
  |  |  ------------------
  |  |  |  Branch (252:6): [True: 0, False: 4]
  |  |  ------------------
  |  |  253|      0|		SNMP_ZERO(ref->field, ref->field_len);          \
  |  |  ------------------
  |  |  |  |   77|      0|#define SNMP_ZERO(s,l)	do { if (s) memset(s, 0, l); } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:33): [True: 0, False: 0]
  |  |  |  |  |  Branch (77:61): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  254|      0|		SNMP_FREE(ref->field);                          \
  |  |  ------------------
  |  |  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  255|      0|	}                                                       \
  |  |  256|      4|	ref->field_len = 0;                                     \
  |  |  257|      4|        if (len == 0 || item == NULL)                           \
  |  |  ------------------
  |  |  |  Branch (257:13): [True: 0, False: 4]
  |  |  |  Branch (257:25): [True: 0, False: 4]
  |  |  ------------------
  |  |  258|      4|		return 0;                                       \
  |  |  259|      4|	ref->field = netsnmp_memdup(item, len * sizeof(type));  \
  |  |  260|      4|        if (ref->field == NULL)                                 \
  |  |  ------------------
  |  |  |  Branch (260:13): [True: 0, False: 4]
  |  |  ------------------
  |  |  261|      4|		return -1;                                      \
  |  |  262|      4|                                                                \
  |  |  263|      4|	ref->field_len = len;                                   \
  |  |  264|      4|	return 0;                                               \
  |  |  265|      4|} while (0)
  |  |  ------------------
  |  |  |  Branch (265:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
  366|      4|               usr_engine_id, usr_engine_id_length);
  367|      4|}
snmpusm.c:usm_set_usmStateReference_sec_level:
  406|      4|{
  407|      4|    if (ref == NULL)
  ------------------
  |  Branch (407:9): [True: 0, False: 4]
  ------------------
  408|      0|        return -1;
  409|      4|    ref->usr_sec_level = sec_level;
  410|      4|    return 0;
  411|      4|}
snmpusm.c:usm_check_secLevel:
 2874|      1|{
 2875|       |
 2876|      1|    if (user->userStatus != RS_ACTIVE)
  ------------------
  |  |   35|      1|#define RS_ACTIVE	        1
  ------------------
  |  Branch (2876:9): [True: 0, False: 1]
  ------------------
 2877|      0|        return -1;
 2878|       |
 2879|      1|    DEBUGMSGTL(("comparex", "Comparing: %" NETSNMP_PRIo "u %" NETSNMP_PRIo "u ",
  ------------------
  |  |   66|      1|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 1]
  |  |  ------------------
  ------------------
 2880|      1|                usmNoPrivProtocol[0], usmNoPrivProtocol[1]));
 2881|      1|    DEBUGMSGOID(("comparex", usmNoPrivProtocol,
  ------------------
  |  |   67|      1|#define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  165|      0|#define __DBGMSGOID(x)     debugmsg_oid x
  |  |  ------------------
  |  |  |  Branch (67:71): [Folded, False: 1]
  |  |  ------------------
  ------------------
 2882|      1|                 OID_LENGTH(usmNoPrivProtocol)));
 2883|      1|    DEBUGMSG(("comparex", "\n"));
  ------------------
  |  |   61|      1|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 1]
  |  |  ------------------
  ------------------
 2884|      1|    if (level == SNMP_SEC_LEVEL_AUTHPRIV
  ------------------
  |  |  301|      2|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (2884:9): [True: 0, False: 1]
  ------------------
 2885|      0|        && (netsnmp_oid_equals(user->privProtocol, user->privProtocolLen,
  ------------------
  |  Branch (2885:12): [True: 0, False: 0]
  ------------------
 2886|      0|                             usmNoPrivProtocol,
 2887|      0|                             OID_LENGTH(usmNoPrivProtocol)) ==
  ------------------
  |  |   64|      0|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|      0|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
 2888|      0|            0)) {
 2889|      0|        DEBUGMSGTL(("usm", "Level: %d\n", level));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2890|      0|        DEBUGMSGTL(("usm", "User (%s) Auth Protocol: ", user->name));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2891|      0|        DEBUGMSGOID(("usm", user->authProtocol, user->authProtocolLen));
  ------------------
  |  |   67|      0|#define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  165|      0|#define __DBGMSGOID(x)     debugmsg_oid x
  |  |  ------------------
  |  |  |  Branch (67:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2892|      0|        DEBUGMSG(("usm", ", User Priv Protocol: "));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2893|      0|        DEBUGMSGOID(("usm", user->privProtocol, user->privProtocolLen));
  ------------------
  |  |   67|      0|#define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  165|      0|#define __DBGMSGOID(x)     debugmsg_oid x
  |  |  ------------------
  |  |  |  Branch (67:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2894|      0|        DEBUGMSG(("usm", "\n"));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2895|      0|        return 1;
 2896|      0|    }
 2897|      1|    if ((level == SNMP_SEC_LEVEL_AUTHPRIV
  ------------------
  |  |  301|      2|#define SNMP_SEC_LEVEL_AUTHPRIV		3
  ------------------
  |  Branch (2897:10): [True: 0, False: 1]
  ------------------
 2898|      1|         || level == SNMP_SEC_LEVEL_AUTHNOPRIV)
  ------------------
  |  |  300|      1|#define SNMP_SEC_LEVEL_AUTHNOPRIV	2
  ------------------
  |  Branch (2898:13): [True: 1, False: 0]
  ------------------
 2899|      1|        &&
 2900|      1|        (netsnmp_oid_equals
  ------------------
  |  Branch (2900:9): [True: 0, False: 1]
  ------------------
 2901|      1|         (user->authProtocol, user->authProtocolLen, usmNoAuthProtocol,
 2902|      1|          OID_LENGTH(usmNoAuthProtocol)) == 0)) {
  ------------------
  |  |   64|      1|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|      1|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
 2903|      0|        DEBUGMSGTL(("usm", "Level: %d\n", level));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2904|      0|        DEBUGMSGTL(("usm", "User (%s) Auth Protocol: ", user->name));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2905|      0|        DEBUGMSGOID(("usm", user->authProtocol, user->authProtocolLen));
  ------------------
  |  |   67|      0|#define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  165|      0|#define __DBGMSGOID(x)     debugmsg_oid x
  |  |  ------------------
  |  |  |  Branch (67:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2906|      0|        DEBUGMSG(("usm", ", User Priv Protocol: "));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2907|      0|        DEBUGMSGOID(("usm", user->privProtocol, user->privProtocolLen));
  ------------------
  |  |   67|      0|#define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGOID(x)     do {if (_DBG_IF_) {__DBGMSGOID(x);} }while(0)
  |  |  ------------------
  |  |  |  |  165|      0|#define __DBGMSGOID(x)     debugmsg_oid x
  |  |  ------------------
  |  |  |  Branch (67:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2908|      0|        DEBUGMSG(("usm", "\n"));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2909|      0|        return 1;
 2910|      0|    }
 2911|       |
 2912|      1|    return 0;
 2913|      1|}                               /* end usm_check_secLevel() */
snmpusm.c:usm_clone:
  300|      4|{
  301|      4|    struct usmStateReference *ref = pdu->securityStateRef;
  302|      4|    struct usmStateReference **new_ref =
  303|      4|        (struct usmStateReference **)&new_pdu->securityStateRef;
  304|      4|    int ret = 0;
  305|       |
  306|      4|    if (!ref)
  ------------------
  |  Branch (306:9): [True: 4, False: 0]
  ------------------
  307|      4|        return ret;
  308|       |
  309|      0|    if (pdu->command == SNMP_MSG_TRAP2) {
  ------------------
  |  |  142|      0|#define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   92|      0|#define ASN_CONTEXT	    0x80U
  |  |  ------------------
  |  |               #define SNMP_MSG_TRAP2      (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x7) /* a7=167 */
  |  |  ------------------
  |  |  |  |   96|      0|#define ASN_CONSTRUCTOR	    0x20U
  |  |  ------------------
  ------------------
  |  Branch (309:9): [True: 0, False: 0]
  ------------------
  310|      0|        ret = usm_clone_usmStateReference(ref, new_ref);
  311|      0|    } else {
  312|      0|        netsnmp_assert(ref == *new_ref);
  ------------------
  |  |   47|      0|#      define netsnmp_assert(x)  do { \
  |  |   48|      0|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 0, False: 0]
  |  |  ------------------
  |  |   49|      0|                 ; \
  |  |   50|      0|              else \
  |  |   51|      0|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|      0|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
  313|      0|        ref->refcnt++;
  314|      0|    }
  315|       |
  316|      0|    return ret;
  317|      4|}
snmpusm.c:usm_free_usmStateReference:
  321|     12|{
  322|     12|    struct usmStateReference *ref = old;
  323|       |
  324|     12|    if (!ref)
  ------------------
  |  Branch (324:9): [True: 8, False: 4]
  ------------------
  325|      8|        return;
  326|       |
  327|      4|    if (--ref->refcnt > 0)
  ------------------
  |  Branch (327:9): [True: 0, False: 4]
  ------------------
  328|      0|        return;
  329|       |
  330|      4|    SNMP_FREE(ref->usr_name);
  ------------------
  |  |   62|      4|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 4, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 4]
  |  |  ------------------
  ------------------
  331|      4|    SNMP_FREE(ref->usr_engine_id);
  ------------------
  |  |   62|      4|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 4, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 4]
  |  |  ------------------
  ------------------
  332|      4|    SNMP_FREE(ref->usr_auth_protocol);
  ------------------
  |  |   62|      4|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 4]
  |  |  |  Branch (62:66): [Folded, False: 4]
  |  |  ------------------
  ------------------
  333|      4|    SNMP_FREE(ref->usr_priv_protocol);
  ------------------
  |  |   62|      4|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 4]
  |  |  |  Branch (62:66): [Folded, False: 4]
  |  |  ------------------
  ------------------
  334|       |
  335|      4|    if (ref->usr_auth_key_length && ref->usr_auth_key) {
  ------------------
  |  Branch (335:9): [True: 0, False: 4]
  |  Branch (335:37): [True: 0, False: 0]
  ------------------
  336|      0|        SNMP_ZERO(ref->usr_auth_key, ref->usr_auth_key_length);
  ------------------
  |  |   77|      0|#define SNMP_ZERO(s,l)	do { if (s) memset(s, 0, l); } while(0)
  |  |  ------------------
  |  |  |  Branch (77:33): [True: 0, False: 0]
  |  |  |  Branch (77:61): [Folded, False: 0]
  |  |  ------------------
  ------------------
  337|      0|        SNMP_FREE(ref->usr_auth_key);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
  338|      0|    }
  339|      4|    if (ref->usr_priv_key_length && ref->usr_priv_key) {
  ------------------
  |  Branch (339:9): [True: 0, False: 4]
  |  Branch (339:37): [True: 0, False: 0]
  ------------------
  340|      0|        SNMP_ZERO(ref->usr_priv_key, ref->usr_priv_key_length);
  ------------------
  |  |   77|      0|#define SNMP_ZERO(s,l)	do { if (s) memset(s, 0, l); } while(0)
  |  |  ------------------
  |  |  |  Branch (77:33): [True: 0, False: 0]
  |  |  |  Branch (77:61): [Folded, False: 0]
  |  |  ------------------
  ------------------
  341|      0|        SNMP_FREE(ref->usr_priv_key);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
  342|      0|    }
  343|       |
  344|       |    SNMP_FREE(ref);
  ------------------
  |  |   62|      4|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 4, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 4]
  |  |  ------------------
  ------------------
  345|      4|}                               /* end usm_free_usmStateReference() */
snmpusm.c:usm_session_init:
 3460|     69|{
 3461|     69|    char *cp;
 3462|     69|    size_t i;
 3463|       |    
 3464|     69|    if (in_session->securityAuthProtoLen > 0) {
  ------------------
  |  Branch (3464:9): [True: 0, False: 69]
  ------------------
 3465|      0|        session->securityAuthProto =
 3466|      0|            snmp_duplicate_objid(in_session->securityAuthProto,
 3467|      0|                                 in_session->securityAuthProtoLen);
 3468|      0|        if (session->securityAuthProto == NULL) {
  ------------------
  |  Branch (3468:13): [True: 0, False: 0]
  ------------------
 3469|      0|            in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 3470|      0|            return SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 3471|      0|        }
 3472|     69|    } else if (get_default_authtype(&i) != NULL) {
  ------------------
  |  Branch (3472:16): [True: 69, False: 0]
  ------------------
 3473|     69|        session->securityAuthProto =
 3474|     69|            snmp_duplicate_objid(get_default_authtype(NULL), i);
 3475|     69|        session->securityAuthProtoLen = i;
 3476|     69|    }
 3477|       |
 3478|     69|    if (in_session->securityPrivProtoLen > 0) {
  ------------------
  |  Branch (3478:9): [True: 0, False: 69]
  ------------------
 3479|      0|        session->securityPrivProto =
 3480|      0|            snmp_duplicate_objid(in_session->securityPrivProto,
 3481|      0|                                 in_session->securityPrivProtoLen);
 3482|      0|        if (session->securityPrivProto == NULL) {
  ------------------
  |  Branch (3482:13): [True: 0, False: 0]
  ------------------
 3483|      0|            in_session->s_snmp_errno = SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 3484|      0|            return SNMPERR_MALLOC;
  ------------------
  |  |  279|      0|#define SNMPERR_MALLOC			(-62)
  ------------------
 3485|      0|        }
 3486|     69|    } else if (get_default_privtype(&i) != NULL) {
  ------------------
  |  Branch (3486:16): [True: 69, False: 0]
  ------------------
 3487|     69|        session->securityPrivProto =
 3488|     69|            snmp_duplicate_objid(get_default_privtype(NULL), i);
 3489|     69|        session->securityPrivProtoLen = i;
 3490|     69|    }
 3491|       |
 3492|     69|    if ((in_session->securityAuthKeyLen <= 0) &&
  ------------------
  |  Branch (3492:9): [True: 69, False: 0]
  ------------------
 3493|     69|        ((cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (3493:9): [True: 0, False: 69]
  ------------------
 3494|     69|				     NETSNMP_DS_LIB_AUTHMASTERKEY)))) {
  ------------------
  |  |  167|     69|#define NETSNMP_DS_LIB_AUTHMASTERKEY     16
  ------------------
 3495|      0|        size_t buflen = sizeof(session->securityAuthKey);
 3496|      0|        u_char *tmpp = session->securityAuthKey;
 3497|      0|        session->securityAuthKeyLen = 0;
 3498|       |        /* it will be a hex string */
 3499|      0|        if (!snmp_hex_to_binary(&tmpp, &buflen,
  ------------------
  |  Branch (3499:13): [True: 0, False: 0]
  ------------------
 3500|      0|                                &session->securityAuthKeyLen, 0, cp)) {
 3501|      0|            snmp_set_detail("error parsing authentication master key");
 3502|      0|            return SNMP_ERR_GENERR;
  ------------------
  |  |  217|      0|#define SNMP_ERR_GENERR	                (5)
  ------------------
 3503|      0|        }
 3504|     69|    } else if ((in_session->securityAuthKeyLen <= 0) &&
  ------------------
  |  Branch (3504:16): [True: 69, False: 0]
  ------------------
 3505|     69|               ((cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (3505:17): [True: 0, False: 69]
  ------------------
 3506|     69|                                            NETSNMP_DS_LIB_AUTHPASSPHRASE)) ||
  ------------------
  |  |  154|     69|#define NETSNMP_DS_LIB_AUTHPASSPHRASE    3
  ------------------
 3507|     69|                (cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (3507:17): [True: 0, False: 69]
  ------------------
 3508|     69|                                            NETSNMP_DS_LIB_PASSPHRASE)))) {
  ------------------
  |  |  153|     69|#define NETSNMP_DS_LIB_PASSPHRASE        2
  ------------------
 3509|      0|        session->securityAuthKeyLen = USM_AUTH_KU_LEN;
  ------------------
  |  |  257|      0|#define USM_AUTH_KU_LEN     64
  ------------------
 3510|      0|        if (generate_Ku(session->securityAuthProto,
  ------------------
  |  Branch (3510:13): [True: 0, False: 0]
  ------------------
 3511|      0|                        session->securityAuthProtoLen,
 3512|      0|                        (u_char *) cp, strlen(cp),
 3513|      0|                        session->securityAuthKey,
 3514|      0|                        &session->securityAuthKeyLen) != SNMPERR_SUCCESS) {
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 3515|      0|            snmp_set_detail
 3516|      0|                ("Error generating a key (Ku) from the supplied authentication pass phrase.");
 3517|      0|            return SNMP_ERR_GENERR;
  ------------------
  |  |  217|      0|#define SNMP_ERR_GENERR	                (5)
  ------------------
 3518|      0|        }
 3519|      0|    }
 3520|       |
 3521|       |    
 3522|     69|    if ((in_session->securityPrivKeyLen <= 0) &&
  ------------------
  |  Branch (3522:9): [True: 69, False: 0]
  ------------------
 3523|     69|        ((cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (3523:9): [True: 0, False: 69]
  ------------------
 3524|     69|				     NETSNMP_DS_LIB_PRIVMASTERKEY)))) {
  ------------------
  |  |  168|     69|#define NETSNMP_DS_LIB_PRIVMASTERKEY     17
  ------------------
 3525|      0|        size_t buflen = sizeof(session->securityPrivKey);
 3526|      0|        u_char *tmpp = session->securityPrivKey;
 3527|      0|        session->securityPrivKeyLen = 0;
 3528|       |        /* it will be a hex string */
 3529|      0|        if (!snmp_hex_to_binary(&tmpp, &buflen,
  ------------------
  |  Branch (3529:13): [True: 0, False: 0]
  ------------------
 3530|      0|                                &session->securityPrivKeyLen, 0, cp)) {
 3531|      0|            snmp_set_detail("error parsing encryption master key");
 3532|      0|            return SNMP_ERR_GENERR;
  ------------------
  |  |  217|      0|#define SNMP_ERR_GENERR	                (5)
  ------------------
 3533|      0|        }
 3534|     69|    } else if ((in_session->securityPrivKeyLen <= 0) &&
  ------------------
  |  Branch (3534:16): [True: 69, False: 0]
  ------------------
 3535|     69|               ((cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (3535:17): [True: 0, False: 69]
  ------------------
 3536|     69|                                            NETSNMP_DS_LIB_PRIVPASSPHRASE)) ||
  ------------------
  |  |  155|     69|#define NETSNMP_DS_LIB_PRIVPASSPHRASE    4
  ------------------
 3537|     69|                (cp = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (3537:17): [True: 0, False: 69]
  ------------------
 3538|     69|                                            NETSNMP_DS_LIB_PASSPHRASE)))) {
  ------------------
  |  |  153|     69|#define NETSNMP_DS_LIB_PASSPHRASE        2
  ------------------
 3539|      0|        session->securityPrivKeyLen = USM_PRIV_KU_LEN;
  ------------------
  |  |  258|      0|#define USM_PRIV_KU_LEN     64
  ------------------
 3540|      0|        if (generate_Ku(session->securityAuthProto,
  ------------------
  |  Branch (3540:13): [True: 0, False: 0]
  ------------------
 3541|      0|                        session->securityAuthProtoLen,
 3542|      0|                        (u_char *) cp, strlen(cp),
 3543|      0|                        session->securityPrivKey,
 3544|      0|                        &session->securityPrivKeyLen) != SNMPERR_SUCCESS) {
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 3545|      0|            snmp_set_detail
 3546|      0|                ("Error generating a key (Ku) from the supplied privacy pass phrase.");
 3547|      0|            return SNMP_ERR_GENERR;
  ------------------
  |  |  217|      0|#define SNMP_ERR_GENERR	                (5)
  ------------------
 3548|      0|        }
 3549|      0|    }
 3550|       |
 3551|     69|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|     69|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 3552|     69|}
snmpusm.c:usm_handle_report:
 3383|      4|{
 3384|       |    /*
 3385|       |     * handle reportable errors 
 3386|       |     */
 3387|       |
 3388|       |    /* this will get in our way */
 3389|      4|    usm_free_usmStateReference(pdu->securityStateRef);
 3390|      4|    pdu->securityStateRef = NULL;
 3391|       |
 3392|      4|    switch (result) {
  ------------------
  |  Branch (3392:13): [True: 4, False: 0]
  ------------------
 3393|      1|    case SNMPERR_USM_AUTHENTICATIONFAILURE:
  ------------------
  |  |  263|      1|#define SNMPERR_USM_AUTHENTICATIONFAILURE	(-46)
  ------------------
  |  Branch (3393:5): [True: 1, False: 3]
  ------------------
 3394|      1|    {
 3395|      1|        int res = session->s_snmp_errno;
 3396|      1|        session->s_snmp_errno = result;
 3397|      1|        if (session->callback) {
  ------------------
  |  Branch (3397:13): [True: 1, False: 0]
  ------------------
 3398|      1|            session->callback(NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE,
  ------------------
  |  |  352|      1|#define NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE	1
  ------------------
 3399|      1|                              session, pdu->reqid, pdu,
 3400|      1|                              session->callback_magic);
 3401|      1|        }
 3402|      1|        session->s_snmp_errno = res;
 3403|      1|    }  
 3404|      1|    NETSNMP_FALLTHROUGH;
  ------------------
  |  | 2408|      1|#    define NETSNMP_FALLTHROUGH __attribute__((__fallthrough__))
  ------------------
 3405|      3|    case SNMPERR_USM_UNKNOWNENGINEID:
  ------------------
  |  |  265|      3|#define SNMPERR_USM_UNKNOWNENGINEID		(-48)
  ------------------
  |  Branch (3405:5): [True: 2, False: 2]
  ------------------
 3406|      4|    case SNMPERR_USM_UNKNOWNSECURITYNAME:
  ------------------
  |  |  260|      4|#define SNMPERR_USM_UNKNOWNSECURITYNAME		(-43)
  ------------------
  |  Branch (3406:5): [True: 1, False: 3]
  ------------------
 3407|      4|    case SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL:
  ------------------
  |  |  261|      4|#define SNMPERR_USM_UNSUPPORTEDSECURITYLEVEL	(-44)
  ------------------
  |  Branch (3407:5): [True: 0, False: 4]
  ------------------
 3408|      4|    case SNMPERR_USM_NOTINTIMEWINDOW:
  ------------------
  |  |  266|      4|#define SNMPERR_USM_NOTINTIMEWINDOW		(-49)
  ------------------
  |  Branch (3408:5): [True: 0, False: 4]
  ------------------
 3409|      4|    case SNMPERR_USM_DECRYPTIONERROR:
  ------------------
  |  |  267|      4|#define SNMPERR_USM_DECRYPTIONERROR		(-50)
  ------------------
  |  Branch (3409:5): [True: 0, False: 4]
  ------------------
 3410|       |
 3411|      4|        if (SNMP_CMD_CONFIRMED(pdu->command) ||
  ------------------
  |  |  193|      8|#define SNMP_CMD_CONFIRMED(c) (c == SNMP_MSG_INFORM || c == SNMP_MSG_GETBULK ||\
  |  |  ------------------
  |  |  |  |  141|      8|#define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|      4|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_INFORM     (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x6) /* a6=166 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|      4|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define SNMP_CMD_CONFIRMED(c) (c == SNMP_MSG_INFORM || c == SNMP_MSG_GETBULK ||\
  |  |  ------------------
  |  |  |  |  140|      8|#define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|      4|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_GETBULK    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x5) /* a5=165 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|      4|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (193:32): [True: 0, False: 4]
  |  |  |  Branch (193:56): [True: 0, False: 4]
  |  |  ------------------
  |  |  194|      4|                               c == SNMP_MSG_GETNEXT || c == SNMP_MSG_GET || \
  |  |  ------------------
  |  |  |  |  126|      8|#define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|      4|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_GETNEXT    (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x1) /* a1=161 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|      4|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                              c == SNMP_MSG_GETNEXT || c == SNMP_MSG_GET || \
  |  |  ------------------
  |  |  |  |  125|      6|#define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|      2|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_GET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x0) /* a0=160 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|      2|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (194:32): [True: 2, False: 2]
  |  |  |  Branch (194:57): [True: 0, False: 2]
  |  |  ------------------
  |  |  195|      8|                               c == SNMP_MSG_SET )
  |  |  ------------------
  |  |  |  |  129|      6|#define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   92|      2|#define ASN_CONTEXT	    0x80U
  |  |  |  |  ------------------
  |  |  |  |               #define SNMP_MSG_SET        (ASN_CONTEXT | ASN_CONSTRUCTOR | 0x3) /* a3=163 */
  |  |  |  |  ------------------
  |  |  |  |  |  |   96|      2|#define ASN_CONSTRUCTOR	    0x20U
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (195:32): [True: 0, False: 2]
  |  |  ------------------
  ------------------
 3412|      2|            (pdu->command == 0
  ------------------
  |  Branch (3412:14): [True: 2, False: 0]
  ------------------
 3413|      4|             && (pdu->flags & SNMP_MSG_FLAG_RPRT_BIT))) {
  ------------------
  |  |  305|      2|#define SNMP_MSG_FLAG_RPRT_BIT          0x04
  ------------------
  |  Branch (3413:17): [True: 2, False: 0]
  ------------------
 3414|      4|            netsnmp_pdu    *pdu2;
 3415|      4|            int             flags = pdu->flags;
 3416|       |
 3417|      4|            pdu->flags |= UCD_MSG_FLAG_FORCE_PDU_COPY;
  ------------------
  |  |  313|      4|#define UCD_MSG_FLAG_FORCE_PDU_COPY          0x400
  ------------------
 3418|      4|            pdu2 = snmp_clone_pdu(pdu);
 3419|      4|            pdu->flags = pdu2->flags = flags;
 3420|      4|            snmpv3_make_report(pdu2, result);
 3421|      4|            if (0 == snmp_sess_send(slp, pdu2)) {
  ------------------
  |  Branch (3421:17): [True: 0, False: 4]
  ------------------
 3422|      0|                snmp_free_pdu(pdu2);
 3423|       |                /*
 3424|       |                 * TODO: indicate error 
 3425|       |                 */
 3426|      0|            }
 3427|      4|        }
 3428|      4|        break;
 3429|      4|    }       
 3430|      4|}
snmpusm.c:init_usm_post_config:
 5133|     69|{
 5134|     69|    size_t          salt_integer_len = sizeof(salt_integer);
 5135|     69|    uint64_t        current_time;
 5136|       |
 5137|     69|    if (sc_random((u_char *) & salt_integer, &salt_integer_len) !=
  ------------------
  |  Branch (5137:9): [True: 0, False: 69]
  ------------------
 5138|     69|        SNMPERR_SUCCESS) {
  ------------------
  |  |  217|     69|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 5139|      0|        DEBUGMSGTL(("usm", "sc_random() failed: using time() as salt.\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5140|      0|        current_time = time(NULL);
 5141|      0|        salt_integer = current_time;
 5142|      0|    }
 5143|       |
 5144|     69|#ifdef HAVE_AES
 5145|     69|    salt_integer_len = sizeof (salt_integer64_1);
 5146|     69|    if (sc_random((u_char *) & salt_integer64_1, &salt_integer_len) !=
  ------------------
  |  Branch (5146:9): [True: 0, False: 69]
  ------------------
 5147|     69|        SNMPERR_SUCCESS) {
  ------------------
  |  |  217|     69|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 5148|      0|        DEBUGMSGTL(("usm", "sc_random() failed: using time() as aes1 salt.\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5149|      0|        current_time = time(NULL);
 5150|      0|        salt_integer64_1 = current_time;
 5151|      0|    }
 5152|     69|    salt_integer_len = sizeof (salt_integer64_1);
 5153|     69|    if (sc_random((u_char *) & salt_integer64_2, &salt_integer_len) !=
  ------------------
  |  Branch (5153:9): [True: 0, False: 69]
  ------------------
 5154|     69|        SNMPERR_SUCCESS) {
  ------------------
  |  |  217|     69|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 5155|      0|        DEBUGMSGTL(("usm", "sc_random() failed: using time() as aes2 salt.\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 5156|      0|        current_time = time(NULL);
 5157|      0|        salt_integer64_2 = current_time;
 5158|      0|    }
 5159|     69|#endif
 5160|       |
 5161|       |    // Free noNameUser before it is assigned
 5162|     69|    usm_free_user(noNameUser);
 5163|       |
 5164|     69|#ifndef NETSNMP_DISABLE_MD5
 5165|     69|    noNameUser = usm_create_initial_user("", usmHMACMD5AuthProtocol,
 5166|     69|                                         OID_LENGTH(usmHMACMD5AuthProtocol),
  ------------------
  |  |   64|     69|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|     69|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
 5167|     69|                                         SNMP_DEFAULT_PRIV_PROTO,
  ------------------
  |  |  133|     69|#define SNMP_DEFAULT_PRIV_PROTO     usmDESPrivProtocol
  ------------------
 5168|     69|                                         SNMP_DEFAULT_PRIV_PROTOLEN);
  ------------------
  |  |  137|     69|#define SNMP_DEFAULT_PRIV_PROTOLEN  OID_LENGTH(SNMP_DEFAULT_PRIV_PROTO)
  |  |  ------------------
  |  |  |  |   64|     69|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |  |  |   65|     69|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  |  |  ------------------
  ------------------
 5169|       |#else
 5170|       |    noNameUser = usm_create_initial_user("", usmHMACSHA1AuthProtocol,
 5171|       |                                         OID_LENGTH(usmHMACSHA1AuthProtocol),
 5172|       |                                         SNMP_DEFAULT_PRIV_PROTO,
 5173|       |                                         SNMP_DEFAULT_PRIV_PROTOLEN);
 5174|       |#endif
 5175|       |
 5176|     69|    if ( noNameUser ) {
  ------------------
  |  Branch (5176:10): [True: 69, False: 0]
  ------------------
 5177|     69|        SNMP_FREE(noNameUser->engineID);
  ------------------
  |  |   62|     69|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 69, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 69]
  |  |  ------------------
  ------------------
 5178|     69|        noNameUser->engineIDLen = 0;
 5179|     69|    }
 5180|       |
 5181|     69|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|     69|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 5182|     69|}                               /* end init_usm_post_config() */
snmpusm.c:usm_create_initial_user:
 4141|     69|{
 4142|     69|    struct usmUser *newUser = usm_create_user();
 4143|     69|    if (newUser == NULL)
  ------------------
  |  Branch (4143:9): [True: 0, False: 69]
  ------------------
 4144|      0|        return NULL;
 4145|       |
 4146|     69|    if ((newUser->name = strdup(name)) == NULL)
  ------------------
  |  Branch (4146:9): [True: 0, False: 69]
  ------------------
 4147|      0|        return usm_free_user(newUser);
 4148|       |
 4149|     69|    if ((newUser->secName = strdup(name)) == NULL)
  ------------------
  |  Branch (4149:9): [True: 0, False: 69]
  ------------------
 4150|      0|        return usm_free_user(newUser);
 4151|       |
 4152|     69|    if ((newUser->engineID =
  ------------------
  |  Branch (4152:9): [True: 0, False: 69]
  ------------------
 4153|     69|         snmpv3_generate_engineID(&newUser->engineIDLen)) == NULL)
 4154|      0|        return usm_free_user(newUser);
 4155|       |
 4156|     69|    if ((newUser->cloneFrom = (oid *) malloc(sizeof(oid) * 2)) == NULL)
  ------------------
  |  Branch (4156:9): [True: 0, False: 69]
  ------------------
 4157|      0|        return usm_free_user(newUser);
 4158|     69|    newUser->cloneFrom[0] = 0;
 4159|     69|    newUser->cloneFrom[1] = 0;
 4160|     69|    newUser->cloneFromLen = 2;
 4161|       |
 4162|     69|    SNMP_FREE(newUser->privProtocol);
  ------------------
  |  |   62|     69|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 69, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 69]
  |  |  ------------------
  ------------------
 4163|     69|    if ((newUser->privProtocol = snmp_duplicate_objid(privProtocol,
  ------------------
  |  Branch (4163:9): [True: 0, False: 69]
  ------------------
 4164|     69|                                                      privProtocolLen)) ==
 4165|     69|        NULL) {
 4166|      0|        return usm_free_user(newUser);
 4167|      0|    }
 4168|     69|    newUser->privProtocolLen = privProtocolLen;
 4169|       |
 4170|     69|    SNMP_FREE(newUser->authProtocol);
  ------------------
  |  |   62|     69|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 69, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 69]
  |  |  ------------------
  ------------------
 4171|     69|    if ((newUser->authProtocol = snmp_duplicate_objid(authProtocol,
  ------------------
  |  Branch (4171:9): [True: 0, False: 69]
  ------------------
 4172|     69|                                                      authProtocolLen)) ==
 4173|     69|        NULL) {
 4174|      0|        return usm_free_user(newUser);
 4175|      0|    }
 4176|     69|    newUser->authProtocolLen = authProtocolLen;
 4177|       |
 4178|     69|    newUser->userStatus = RS_ACTIVE;
  ------------------
  |  |   35|     69|#define RS_ACTIVE	        1
  ------------------
 4179|     69|    newUser->userStorageType = ST_READONLY;
  ------------------
  |  |   54|     69|#define ST_READONLY	5
  ------------------
 4180|       |
 4181|     69|    return newUser;
 4182|     69|}
snmpusm.c:deinit_usm_post_config:
 5187|     69|{
 5188|     69|    usm_free_user(noNameUser);
 5189|     69|    noNameUser = NULL;
 5190|       |
 5191|     69|    DEBUGMSGTL(("deinit_usm_post_config", "initial user removed\n"));
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
 5192|     69|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|     69|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 5193|     69|}                               /* end deinit_usm_post_config() */
snmpusm.c:free_enginetime_on_shutdown:
  274|     69|{
  275|     69|    u_char engineID[SNMP_MAX_ENG_SIZE];
  276|     69|    size_t engineID_len = sizeof(engineID);
  277|       |
  278|     69|    DEBUGMSGTL(("snmpv3", "free enginetime callback called\n"));
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
  279|       |
  280|     69|    engineID_len = snmpv3_get_engineID(engineID, engineID_len);
  281|     69|    if (engineID_len > 0)
  ------------------
  |  Branch (281:9): [True: 0, False: 69]
  ------------------
  282|      0|	free_enginetime(engineID, engineID_len);
  283|     69|    return 0;
  284|     69|}
snmpusm.c:clear_user_list:
 3989|     69|{
 3990|     69|    struct usmUser *tmp = userList, *next = NULL;
 3991|       |
 3992|     69|    while (tmp != NULL) {
  ------------------
  |  Branch (3992:12): [True: 0, False: 69]
  ------------------
 3993|      0|	next = tmp->next;
 3994|      0|	usm_free_user(tmp);
 3995|      0|	tmp = next;
 3996|      0|    }
 3997|     69|    userList = NULL;
 3998|       |
 3999|     69|}

setup_engineID:
  471|     69|{
  472|     69|    int             enterpriseid = htonl(NETSNMP_ENTERPRISE_OID),
  473|     69|        netsnmpoid = htonl(NETSNMP_OID),
  474|     69|        localsetup = (eidp) ? 0 : 1;
  ------------------
  |  Branch (474:22): [True: 0, False: 69]
  ------------------
  475|       |
  476|       |    /*
  477|       |     * Use local engineID if *eidp == NULL.  
  478|       |     */
  479|     69|#ifdef HAVE_GETHOSTNAME
  480|     69|    u_char          buf[SNMP_MAXBUF_SMALL];
  481|     69|    struct hostent *hent = NULL;
  482|     69|#endif
  483|     69|    u_char         *bufp = NULL;
  484|     69|    size_t          len;
  485|     69|    int             localEngineIDType = engineIDType;
  486|     69|    int             tmpint;
  487|     69|    time_t          tmptime;
  488|       |
  489|     69|    engineIDIsSet = 1;
  490|       |
  491|     69|#ifdef HAVE_GETHOSTNAME
  492|     69|#ifdef AF_INET6
  493|       |    /*
  494|       |     * see if they selected IPV4 or IPV6 support 
  495|       |     */
  496|     69|    if ((ENGINEID_TYPE_IPV6 == localEngineIDType) ||
  ------------------
  |  |   20|     69|#define ENGINEID_TYPE_IPV6    2
  ------------------
  |  Branch (496:9): [True: 0, False: 69]
  ------------------
  497|     69|        (ENGINEID_TYPE_IPV4 == localEngineIDType)) {
  ------------------
  |  |   19|     69|#define ENGINEID_TYPE_IPV4    1
  ------------------
  |  Branch (497:9): [True: 0, False: 69]
  ------------------
  498|       |        /*
  499|       |         * get the host name and save the information 
  500|       |         */
  501|      0|        gethostname((char *) buf, sizeof(buf));
  502|      0|        hent = netsnmp_gethostbyname((char *) buf);
  503|      0|        if (hent && hent->h_addrtype == AF_INET6) {
  ------------------
  |  Branch (503:13): [True: 0, False: 0]
  |  Branch (503:21): [True: 0, False: 0]
  ------------------
  504|      0|            localEngineIDType = ENGINEID_TYPE_IPV6;
  ------------------
  |  |   20|      0|#define ENGINEID_TYPE_IPV6    2
  ------------------
  505|      0|        } else {
  506|       |            /*
  507|       |             * Not IPV6 so we go with default 
  508|       |             */
  509|      0|            localEngineIDType = ENGINEID_TYPE_IPV4;
  ------------------
  |  |   19|      0|#define ENGINEID_TYPE_IPV4    1
  ------------------
  510|      0|        }
  511|      0|    }
  512|       |#else
  513|       |    /*
  514|       |     * No IPV6 support.  Check if they selected IPV6 engineID type.
  515|       |     *  If so make it IPV4 instead 
  516|       |     */
  517|       |    if (ENGINEID_TYPE_IPV6 == localEngineIDType) {
  518|       |        localEngineIDType = ENGINEID_TYPE_IPV4;
  519|       |    }
  520|       |    if (ENGINEID_TYPE_IPV4 == localEngineIDType) {
  521|       |        /*
  522|       |         * get the host name and save the information 
  523|       |         */
  524|       |        gethostname((char *) buf, sizeof(buf));
  525|       |        hent = netsnmp_gethostbyname((char *) buf);
  526|       |    }
  527|       |#endif
  528|     69|#endif                          /* HAVE_GETHOSTNAME */
  529|       |
  530|       |    /*
  531|       |     * Determine if we have text and if so setup our localEngineIDType
  532|       |     * * appropriately.  
  533|       |     */
  534|     69|    if (NULL != text) {
  ------------------
  |  Branch (534:9): [True: 0, False: 69]
  ------------------
  535|      0|        engineIDType = localEngineIDType = ENGINEID_TYPE_TEXT;
  ------------------
  |  |   22|      0|#define ENGINEID_TYPE_TEXT    4
  ------------------
  536|      0|    }
  537|       |    /*
  538|       |     * Determine length of the engineID string. 
  539|       |     */
  540|     69|    len = 5;                    /* always have 5 leading bytes */
  541|     69|    switch (localEngineIDType) {
  542|      0|    case ENGINEID_TYPE_TEXT:
  ------------------
  |  |   22|      0|#define ENGINEID_TYPE_TEXT    4
  ------------------
  |  Branch (542:5): [True: 0, False: 69]
  ------------------
  543|      0|        if (NULL == text) {
  ------------------
  |  Branch (543:13): [True: 0, False: 0]
  ------------------
  544|      0|            snmp_log(LOG_ERR,
  545|      0|                     "Can't set up engineID of type text from an empty string.\n");
  546|      0|            return -1;
  547|      0|        }
  548|      0|        len += strlen(text);    /* 5 leading bytes+text. No NULL char */
  549|      0|        break;
  550|      0|#if defined(IFHWADDRLEN) && defined(SIOCGIFHWADDR)
  551|      0|    case ENGINEID_TYPE_MACADDR:        /* MAC address */
  ------------------
  |  |   21|      0|#define ENGINEID_TYPE_MACADDR 3
  ------------------
  |  Branch (551:5): [True: 0, False: 69]
  ------------------
  552|      0|        len += 6;               /* + 6 bytes for MAC address */
  553|      0|        break;
  554|      0|#endif
  555|      0|    case ENGINEID_TYPE_IPV4:   /* IPv4 */
  ------------------
  |  |   19|      0|#define ENGINEID_TYPE_IPV4    1
  ------------------
  |  Branch (555:5): [True: 0, False: 69]
  ------------------
  556|      0|        len += 4;               /* + 4 byte IPV4 address */
  557|      0|        break;
  558|      0|    case ENGINEID_TYPE_IPV6:   /* IPv6 */
  ------------------
  |  |   20|      0|#define ENGINEID_TYPE_IPV6    2
  ------------------
  |  Branch (558:5): [True: 0, False: 69]
  ------------------
  559|      0|        len += 16;              /* + 16 byte IPV6 address */
  560|      0|        break;
  561|     69|    case ENGINEID_TYPE_NETSNMP_RND:        /* Net-SNMP specific encoding */
  ------------------
  |  |   24|     69|#define ENGINEID_TYPE_NETSNMP_RND 128
  ------------------
  |  Branch (561:5): [True: 69, False: 0]
  ------------------
  562|     69|        if (engineID)           /* already setup, keep current value */
  ------------------
  |  Branch (562:13): [True: 0, False: 69]
  ------------------
  563|      0|            return engineIDLength;
  564|     69|        if (oldEngineID) {
  ------------------
  |  Branch (564:13): [True: 0, False: 69]
  ------------------
  565|      0|            len = oldEngineIDLength;
  566|     69|        } else {
  567|     69|            len += sizeof(int) + sizeof(time_t);
  568|     69|        }
  569|     69|        break;
  570|      0|    default:
  ------------------
  |  Branch (570:5): [True: 0, False: 69]
  ------------------
  571|      0|        snmp_log(LOG_ERR,
  572|      0|                 "Unknown EngineID type requested for setup (%d).  Using IPv4.\n",
  573|      0|                 localEngineIDType);
  574|      0|        localEngineIDType = ENGINEID_TYPE_IPV4; /* make into IPV4 */
  ------------------
  |  |   19|      0|#define ENGINEID_TYPE_IPV4    1
  ------------------
  575|      0|        len += 4;               /* + 4 byte IPv4 address */
  576|      0|        break;
  577|     69|    }                           /* switch */
  578|       |
  579|       |
  580|       |    /*
  581|       |     * Allocate memory and store enterprise ID.
  582|       |     */
  583|     69|    if (len == 0) {
  ------------------
  |  Branch (583:9): [True: 0, False: 69]
  ------------------
  584|      0|        snmp_log(LOG_ERR, "%s(): len == 0\n", __func__);
  585|      0|        return -1;
  586|      0|    }
  587|     69|    bufp = calloc(1, len);
  588|     69|    if (bufp == NULL) {
  ------------------
  |  Branch (588:9): [True: 0, False: 69]
  ------------------
  589|      0|        snmp_log_perror("setup_engineID() calloc()");
  590|      0|        return -1;
  591|      0|    }
  592|     69|    if (localEngineIDType == ENGINEID_TYPE_NETSNMP_RND)
  ------------------
  |  |   24|     69|#define ENGINEID_TYPE_NETSNMP_RND 128
  ------------------
  |  Branch (592:9): [True: 69, False: 0]
  ------------------
  593|       |        /*
  594|       |         * we must use the net-snmp enterprise id here, regardless 
  595|       |         */
  596|     69|        memcpy(bufp, &netsnmpoid, sizeof(netsnmpoid));    /* XXX Must be 4 bytes! */
  597|      0|    else
  598|      0|        memcpy(bufp, &enterpriseid, sizeof(enterpriseid));      /* XXX Must be 4 bytes! */
  599|       |
  600|     69|    bufp[0] |= 0x80;
  601|       |
  602|       |
  603|       |    /*
  604|       |     * Store the given text  -OR-   the first found IP address
  605|       |     *  -OR-  the MAC address  -OR-  random elements
  606|       |     * (the latter being the recommended default)
  607|       |     */
  608|     69|    switch (localEngineIDType) {
  609|     69|    case ENGINEID_TYPE_NETSNMP_RND:
  ------------------
  |  |   24|     69|#define ENGINEID_TYPE_NETSNMP_RND 128
  ------------------
  |  Branch (609:5): [True: 69, False: 0]
  ------------------
  610|     69|        if (oldEngineID) {
  ------------------
  |  Branch (610:13): [True: 0, False: 69]
  ------------------
  611|       |            /*
  612|       |             * keep our previous notion of the engineID 
  613|       |             */
  614|      0|            memcpy(bufp, oldEngineID, oldEngineIDLength);
  615|     69|        } else {
  616|       |            /*
  617|       |             * Here we've desigend our own ENGINEID that is not based on
  618|       |             * an address which may change and may even become conflicting
  619|       |             * in the future like most of the default v3 engineID types
  620|       |             * suffer from.
  621|       |             * 
  622|       |             * Ours is built from 2 fairly random elements: a random number and
  623|       |             * the current time in seconds.  This method suffers from boxes
  624|       |             * that may not have a correct clock setting and random number
  625|       |             * seed at startup, but few OSes should have that problem.
  626|       |             */
  627|     69|            bufp[4] = ENGINEID_TYPE_NETSNMP_RND;
  ------------------
  |  |   24|     69|#define ENGINEID_TYPE_NETSNMP_RND 128
  ------------------
  628|     69|            tmpint = netsnmp_random();
  629|     69|            memcpy(bufp + 5, &tmpint, sizeof(tmpint));
  630|     69|            tmptime = time(NULL);
  631|     69|            memcpy(bufp + 5 + sizeof(tmpint), &tmptime, sizeof(tmptime));
  632|     69|        }
  633|     69|        break;
  634|      0|    case ENGINEID_TYPE_TEXT:
  ------------------
  |  |   22|      0|#define ENGINEID_TYPE_TEXT    4
  ------------------
  |  Branch (634:5): [True: 0, False: 69]
  ------------------
  635|      0|        bufp[4] = ENGINEID_TYPE_TEXT;
  ------------------
  |  |   22|      0|#define ENGINEID_TYPE_TEXT    4
  ------------------
  636|      0|        memcpy((char *) bufp + 5, (text), strlen(text));
  637|      0|        break;
  638|      0|#ifdef HAVE_GETHOSTNAME
  639|      0|#ifdef AF_INET6
  640|      0|    case ENGINEID_TYPE_IPV6:
  ------------------
  |  |   20|      0|#define ENGINEID_TYPE_IPV6    2
  ------------------
  |  Branch (640:5): [True: 0, False: 69]
  ------------------
  641|      0|        bufp[4] = ENGINEID_TYPE_IPV6;
  ------------------
  |  |   20|      0|#define ENGINEID_TYPE_IPV6    2
  ------------------
  642|      0|        if (hent)
  ------------------
  |  Branch (642:13): [True: 0, False: 0]
  ------------------
  643|      0|            memcpy(bufp + 5, hent->h_addr_list[0], hent->h_length);
  644|      0|        break;
  645|      0|#endif
  646|      0|#endif
  647|      0|#if defined(IFHWADDRLEN) && defined(SIOCGIFHWADDR)
  648|      0|    case ENGINEID_TYPE_MACADDR:
  ------------------
  |  |   21|      0|#define ENGINEID_TYPE_MACADDR 3
  ------------------
  |  Branch (648:5): [True: 0, False: 69]
  ------------------
  649|      0|        {
  650|      0|            int             x;
  651|      0|            bufp[4] = ENGINEID_TYPE_MACADDR;
  ------------------
  |  |   21|      0|#define ENGINEID_TYPE_MACADDR 3
  ------------------
  652|       |            /*
  653|       |             * use default NIC if none provided 
  654|       |             */
  655|      0|            if (NULL == engineIDNic) {
  ------------------
  |  Branch (655:17): [True: 0, False: 0]
  ------------------
  656|      0|	      x = getHwAddress(DEFAULT_NIC, (char *)&bufp[5]);
  ------------------
  |  |   26|      0|#define	DEFAULT_NIC "eth0"
  ------------------
  657|      0|            } else {
  658|      0|	      x = getHwAddress((char *)engineIDNic, (char *)&bufp[5]);
  659|      0|            }
  660|      0|            if (0 != x)
  ------------------
  |  Branch (660:17): [True: 0, False: 0]
  ------------------
  661|       |                /*
  662|       |                 * function failed fill MAC address with zeros 
  663|       |                 */
  664|      0|            {
  665|      0|                memset(&bufp[5], 0, 6);
  666|      0|            }
  667|      0|        }
  668|      0|        break;
  669|      0|#endif
  670|      0|    case ENGINEID_TYPE_IPV4:
  ------------------
  |  |   19|      0|#define ENGINEID_TYPE_IPV4    1
  ------------------
  |  Branch (670:5): [True: 0, False: 69]
  ------------------
  671|      0|    default:
  ------------------
  |  Branch (671:5): [True: 0, False: 69]
  ------------------
  672|      0|        bufp[4] = ENGINEID_TYPE_IPV4;
  ------------------
  |  |   19|      0|#define ENGINEID_TYPE_IPV4    1
  ------------------
  673|      0|#ifdef HAVE_GETHOSTNAME
  674|      0|        if (hent && hent->h_addrtype == AF_INET) {
  ------------------
  |  Branch (674:13): [True: 0, False: 0]
  |  Branch (674:21): [True: 0, False: 0]
  ------------------
  675|      0|            memcpy(bufp + 5, hent->h_addr_list[0], hent->h_length);
  676|      0|        } else {                /* Unknown address type.  Default to 127.0.0.1. */
  677|       |
  678|      0|            bufp[5] = 127;
  679|      0|            bufp[6] = 0;
  680|      0|            bufp[7] = 0;
  681|      0|            bufp[8] = 1;
  682|      0|        }
  683|       |#else                           /* HAVE_GETHOSTNAME */
  684|       |        /*
  685|       |         * Unknown address type.  Default to 127.0.0.1. 
  686|       |         */
  687|       |        bufp[5] = 127;
  688|       |        bufp[6] = 0;
  689|       |        bufp[7] = 0;
  690|       |        bufp[8] = 1;
  691|       |#endif                          /* HAVE_GETHOSTNAME */
  692|      0|        break;
  693|     69|    }
  694|       |
  695|       |    /*
  696|       |     * Pass the string back to the calling environment, or use it for
  697|       |     * our local engineID.
  698|       |     */
  699|     69|    if (localsetup) {
  ------------------
  |  Branch (699:9): [True: 69, False: 0]
  ------------------
  700|     69|        SNMP_FREE(engineID);
  ------------------
  |  |   62|     69|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 69]
  |  |  |  Branch (62:66): [Folded, False: 69]
  |  |  ------------------
  ------------------
  701|     69|        engineID = bufp;
  702|     69|        engineIDLength = len;
  703|       |
  704|     69|    } else {
  705|      0|        *eidp = bufp;
  706|      0|    }
  707|       |
  708|       |
  709|     69|    return len;
  710|       |
  711|     69|}                               /* end setup_engineID() */
free_engineID:
  716|     69|{
  717|     69|    SNMP_FREE(engineID);
  ------------------
  |  |   62|     69|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 69, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 69]
  |  |  ------------------
  ------------------
  718|     69|    SNMP_FREE(engineIDNic);
  ------------------
  |  |   62|     69|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 69]
  |  |  |  Branch (62:66): [Folded, False: 69]
  |  |  ------------------
  ------------------
  719|       |    SNMP_FREE(oldEngineID);
  ------------------
  |  |   62|     69|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 69]
  |  |  |  Branch (62:66): [Folded, False: 69]
  |  |  ------------------
  ------------------
  720|     69|    engineIDIsSet = 0;
  721|     69|    return 0;
  722|     69|}
init_snmpv3:
  993|     69|{
  994|     69|    netsnmp_get_monotonic_clock(&snmpv3starttime);
  995|       |
  996|     69|    if (!type)
  ------------------
  |  Branch (996:9): [True: 0, False: 69]
  ------------------
  997|      0|        type = "__snmpapp__";
  998|       |
  999|       |    /*
 1000|       |     * we need to be called back later 
 1001|       |     */
 1002|     69|    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     69|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 1003|     69|                           SNMP_CALLBACK_POST_READ_CONFIG,
  ------------------
  |  |   24|     69|#define SNMP_CALLBACK_POST_READ_CONFIG	        0
  ------------------
 1004|     69|                           init_snmpv3_post_config, NULL);
 1005|       |
 1006|     69|    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     69|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
 1007|     69|                           SNMP_CALLBACK_POST_PREMIB_READ_CONFIG,
  ------------------
  |  |   27|     69|#define SNMP_CALLBACK_POST_PREMIB_READ_CONFIG	3
  ------------------
 1008|     69|                           init_snmpv3_post_premib_config, NULL);
 1009|       |    /*
 1010|       |     * we need to be called back later 
 1011|       |     */
 1012|     69|    snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
  ------------------
  |  |   18|     69|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
                  snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
  ------------------
  |  |   25|     69|#define SNMP_CALLBACK_STORE_DATA	        1
  ------------------
 1013|     69|                           snmpv3_store, (void *) strdup(type));
 1014|       |
 1015|       |    /*
 1016|       |     * initialize submodules 
 1017|       |     */
 1018|       |    /*
 1019|       |     * NOTE: this must be after the callbacks are registered above,
 1020|       |     * since they need to be called before the USM callbacks. 
 1021|       |     */
 1022|     69|    init_secmod();
 1023|       |
 1024|       |    /*
 1025|       |     * register all our configuration handlers (ack, there's a lot) 
 1026|       |     */
 1027|       |
 1028|       |    /*
 1029|       |     * handle engineID setup before everything else which may depend on it 
 1030|       |     */
 1031|     69|    register_prenetsnmp_mib_handler(type, "engineID", engineID_conf, NULL,
 1032|     69|                                    "string");
 1033|     69|    register_prenetsnmp_mib_handler(type, "oldEngineID", oldengineID_conf,
 1034|     69|                                    NULL, NULL);
 1035|     69|    register_prenetsnmp_mib_handler(type, "exactEngineID", exactEngineID_conf,
 1036|     69|                                    NULL, NULL);
 1037|     69|    register_prenetsnmp_mib_handler(type, "engineIDType",
 1038|     69|                                    engineIDType_conf, NULL, "num");
 1039|     69|    register_prenetsnmp_mib_handler(type, "engineIDNic", engineIDNic_conf,
 1040|     69|                                    NULL, "string");
 1041|     69|    register_config_handler(type, "engineBoots", engineBoots_conf, NULL,
 1042|     69|                            NULL);
 1043|       |
 1044|       |    /*
 1045|       |     * default store config entries 
 1046|       |     */
 1047|     69|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defSecurityName",
  ------------------
  |  |   78|     69|#define ASN_OCTET_STR	    0x04U
  ------------------
 1048|     69|			       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SECNAME);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              			       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_SECNAME);
  ------------------
  |  |  151|     69|#define NETSNMP_DS_LIB_SECNAME           0
  ------------------
 1049|     69|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defContext", 
  ------------------
  |  |   78|     69|#define ASN_OCTET_STR	    0x04U
  ------------------
 1050|     69|			       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CONTEXT);
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
              			       NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_CONTEXT);
  ------------------
  |  |  152|     69|#define NETSNMP_DS_LIB_CONTEXT           1
  ------------------
 1051|     69|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defPassphrase",
  ------------------
  |  |   78|     69|#define ASN_OCTET_STR	    0x04U
  ------------------
 1052|     69|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1053|     69|                               NETSNMP_DS_LIB_PASSPHRASE);
  ------------------
  |  |  153|     69|#define NETSNMP_DS_LIB_PASSPHRASE        2
  ------------------
 1054|     69|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defAuthPassphrase",
  ------------------
  |  |   78|     69|#define ASN_OCTET_STR	    0x04U
  ------------------
 1055|     69|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1056|     69|                               NETSNMP_DS_LIB_AUTHPASSPHRASE);
  ------------------
  |  |  154|     69|#define NETSNMP_DS_LIB_AUTHPASSPHRASE    3
  ------------------
 1057|     69|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defPrivPassphrase",
  ------------------
  |  |   78|     69|#define ASN_OCTET_STR	    0x04U
  ------------------
 1058|     69|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1059|     69|                               NETSNMP_DS_LIB_PRIVPASSPHRASE);
  ------------------
  |  |  155|     69|#define NETSNMP_DS_LIB_PRIVPASSPHRASE    4
  ------------------
 1060|     69|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defAuthMasterKey",
  ------------------
  |  |   78|     69|#define ASN_OCTET_STR	    0x04U
  ------------------
 1061|     69|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1062|     69|                               NETSNMP_DS_LIB_AUTHMASTERKEY);
  ------------------
  |  |  167|     69|#define NETSNMP_DS_LIB_AUTHMASTERKEY     16
  ------------------
 1063|     69|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defPrivMasterKey",
  ------------------
  |  |   78|     69|#define ASN_OCTET_STR	    0x04U
  ------------------
 1064|     69|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1065|     69|                               NETSNMP_DS_LIB_PRIVMASTERKEY);
  ------------------
  |  |  168|     69|#define NETSNMP_DS_LIB_PRIVMASTERKEY     17
  ------------------
 1066|     69|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defAuthLocalizedKey",
  ------------------
  |  |   78|     69|#define ASN_OCTET_STR	    0x04U
  ------------------
 1067|     69|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1068|     69|                               NETSNMP_DS_LIB_AUTHLOCALIZEDKEY);
  ------------------
  |  |  169|     69|#define NETSNMP_DS_LIB_AUTHLOCALIZEDKEY  18
  ------------------
 1069|     69|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "defPrivLocalizedKey",
  ------------------
  |  |   78|     69|#define ASN_OCTET_STR	    0x04U
  ------------------
 1070|     69|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 1071|     69|                               NETSNMP_DS_LIB_PRIVLOCALIZEDKEY);
  ------------------
  |  |  170|     69|#define NETSNMP_DS_LIB_PRIVLOCALIZEDKEY  19
  ------------------
 1072|     69|    register_config_handler("snmp", "defVersion", version_conf, NULL,
 1073|     69|                            "1|2c|3");
 1074|       |
 1075|     69|    register_config_handler("snmp", "defSecurityLevel",
 1076|       |                            snmpv3_secLevel_conf, NULL,
 1077|     69|                            "noAuthNoPriv|authNoPriv|authPriv");
 1078|     69|}
init_snmpv3_post_config:
 1088|     69|{
 1089|       |
 1090|     69|    size_t          engineIDLen;
 1091|     69|    u_char         *c_engineID;
 1092|     69|    u_long          localEngineTime;
 1093|     69|    u_long          localEngineBoots;
 1094|       |
 1095|     69|    c_engineID = snmpv3_generate_engineID(&engineIDLen);
 1096|       |
 1097|     69|    if (!c_engineID || engineIDLen == 0) {
  ------------------
  |  Branch (1097:9): [True: 0, False: 69]
  |  Branch (1097:24): [True: 0, False: 69]
  ------------------
 1098|       |        /*
 1099|       |         * Something went wrong - help! 
 1100|       |         */
 1101|      0|        SNMP_FREE(c_engineID);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1102|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 1103|      0|    }
 1104|       |
 1105|       |    /*
 1106|       |     * if our engineID has changed at all, the boots record must be set to 1 
 1107|       |     */
 1108|     69|    if (engineIDLen != oldEngineIDLength ||
  ------------------
  |  Branch (1108:9): [True: 69, False: 0]
  ------------------
 1109|      0|        oldEngineID == NULL || c_engineID == NULL ||
  ------------------
  |  Branch (1109:9): [True: 0, False: 0]
  |  Branch (1109:32): [True: 0, False: 0]
  ------------------
 1110|     69|        memcmp(oldEngineID, c_engineID, engineIDLen) != 0) {
  ------------------
  |  Branch (1110:9): [True: 0, False: 0]
  ------------------
 1111|     69|        engineBoots = 1;
 1112|     69|    }
 1113|       |
 1114|     69|#ifdef NETSNMP_SECMOD_USM
 1115|       |    /*
 1116|       |     * for USM set our local engineTime in the LCD timing cache 
 1117|       |     */
 1118|     69|    localEngineTime = snmpv3_local_snmpEngineTime();
 1119|     69|    localEngineBoots = snmpv3_local_snmpEngineBoots();
 1120|     69|    set_enginetime(c_engineID, engineIDLen,
 1121|     69|                   localEngineBoots,
 1122|     69|                   localEngineTime, TRUE);
  ------------------
  |  |  128|     69|#define TRUE  1
  ------------------
 1123|     69|#endif /* NETSNMP_SECMOD_USM */
 1124|       |
 1125|     69|    SNMP_FREE(c_engineID);
  ------------------
  |  |   62|     69|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 69, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 69]
  |  |  ------------------
  ------------------
 1126|     69|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|     69|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1127|     69|}
init_snmpv3_post_premib_config:
 1132|     69|{
 1133|     69|    if (!engineIDIsSet)
  ------------------
  |  Branch (1133:9): [True: 69, False: 0]
  ------------------
 1134|     69|        setup_engineID(NULL, NULL);
 1135|       |
 1136|     69|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|     69|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1137|     69|}
snmpv3_store:
 1147|     69|{
 1148|     69|    char            line[SNMP_MAXBUF_SMALL];
 1149|     69|    u_char          c_engineID[SNMP_MAXBUF_SMALL];
 1150|     69|    int             engineIDLen;
 1151|     69|    const char     *type = (const char *) clientarg;
 1152|       |
 1153|     69|    if (type == NULL)           /* should never happen, since the arg is ours */
  ------------------
  |  Branch (1153:9): [True: 0, False: 69]
  ------------------
 1154|      0|        type = "unknown";
 1155|       |
 1156|     69|    sprintf(line, "engineBoots %ld", engineBoots);
 1157|     69|    read_config_store(type, line);
 1158|       |
 1159|     69|    engineIDLen = snmpv3_get_engineID(c_engineID, SNMP_MAXBUF_SMALL);
  ------------------
  |  |   45|     69|#define SNMP_MAXBUF_SMALL	512
  ------------------
 1160|       |
 1161|     69|    if (engineIDLen) {
  ------------------
  |  Branch (1161:9): [True: 69, False: 0]
  ------------------
 1162|       |        /*
 1163|       |         * store the engineID used for this run 
 1164|       |         */
 1165|     69|        sprintf(line, "oldEngineID ");
 1166|     69|        read_config_save_octet_string(line + strlen(line), c_engineID,
 1167|     69|                                      engineIDLen);
 1168|     69|        read_config_store(type, line);
 1169|     69|    }
 1170|     69|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|     69|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1171|     69|}                               /* snmpv3_store() */
snmpv3_local_snmpEngineBoots:
 1175|     69|{
 1176|     69|    return engineBoots;
 1177|     69|}
snmpv3_get_engineID:
 1197|    284|{
 1198|       |    /*
 1199|       |     * Sanity check.
 1200|       |     */
 1201|    284|    if (!buf || (buflen < engineIDLength)) {
  ------------------
  |  Branch (1201:9): [True: 0, False: 284]
  |  Branch (1201:17): [True: 0, False: 284]
  ------------------
 1202|      0|        return 0;
 1203|      0|    }
 1204|    284|    if (!engineID) {
  ------------------
  |  Branch (1204:9): [True: 69, False: 215]
  ------------------
 1205|     69|        return 0;
 1206|     69|    }
 1207|       |
 1208|    215|    memcpy(buf, engineID, engineIDLength);
 1209|    215|    return engineIDLength;
 1210|       |
 1211|    284|}                               /* end snmpv3_get_engineID() */
snmpv3_generate_engineID:
 1267|    146|{
 1268|    146|    u_char         *newID;
 1269|    146|    newID = (u_char *) malloc(engineIDLength);
 1270|       |
 1271|    146|    if (newID) {
  ------------------
  |  Branch (1271:9): [True: 146, False: 0]
  ------------------
 1272|    146|        *length = snmpv3_get_engineID(newID, engineIDLength);
 1273|    146|        if (*length == 0) {
  ------------------
  |  Branch (1273:13): [True: 0, False: 146]
  ------------------
 1274|      0|            SNMP_FREE(newID);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1275|      0|            newID = NULL;
 1276|      0|        }
 1277|    146|    }
 1278|    146|    return newID;
 1279|       |
 1280|    146|}                               /* end snmpv3_generate_engineID() */
snmpv3_local_snmpEngineTime:
 1294|    144|{
 1295|       |#ifdef NETSNMP_FEATURE_CHECKING
 1296|       |    netsnmp_feature_require(calculate_sectime_diff)
 1297|       |#endif /* NETSNMP_FEATURE_CHECKING */
 1298|       |
 1299|    144|    static uint32_t last_engineTime;
 1300|    144|    struct timeval  now;
 1301|    144|    uint32_t engineTime;
 1302|       |
 1303|    144|    netsnmp_get_monotonic_clock(&now);
 1304|    144|    engineTime = calculate_sectime_diff(&now, &snmpv3starttime) & 0x7fffffffL;
 1305|    144|    if (engineTime < last_engineTime)
  ------------------
  |  Branch (1305:9): [True: 0, False: 144]
  ------------------
 1306|      0|        engineBoots++;
 1307|    144|    last_engineTime = engineTime;
 1308|    144|    return engineTime;
 1309|    144|}

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

netsnmp_gethostbyname_v4:
  773|     69|{
  774|     69|#ifdef HAVE_GETADDRINFO
  775|     69|    struct addrinfo *addrs = NULL;
  776|     69|    struct addrinfo hint;
  777|     69|    int             err;
  778|       |
  779|     69|    memset(&hint, 0, sizeof hint);
  780|     69|    hint.ai_flags = 0;
  781|     69|    hint.ai_family = PF_INET;
  782|     69|    hint.ai_socktype = SOCK_DGRAM;
  783|     69|    hint.ai_protocol = 0;
  784|       |
  785|     69|    err = netsnmp_getaddrinfo(name, NULL, &hint, &addrs);
  786|     69|    if (err != 0) {
  ------------------
  |  Branch (786:9): [True: 0, False: 69]
  ------------------
  787|      0|        return -1;
  788|      0|    }
  789|       |
  790|     69|    if (addrs != NULL) {
  ------------------
  |  Branch (790:9): [True: 69, False: 0]
  ------------------
  791|     69|        memcpy(addr_out,
  792|     69|               &((struct sockaddr_in *) addrs->ai_addr)->sin_addr,
  793|     69|               sizeof(in_addr_t));
  794|     69|        freeaddrinfo(addrs);
  795|     69|    } else {
  796|      0|        DEBUGMSGTL(("get_thisaddr",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  797|      0|                    "Failed to resolve IPv4 hostname\n"));
  798|      0|    }
  799|     69|    return 0;
  800|       |
  801|       |#elif defined(HAVE_GETHOSTBYNAME)
  802|       |    struct hostent *hp = NULL;
  803|       |
  804|       |    hp = netsnmp_gethostbyname(name);
  805|       |    if (hp == NULL) {
  806|       |        DEBUGMSGTL(("get_thisaddr",
  807|       |                    "hostname (couldn't resolve)\n"));
  808|       |        return -1;
  809|       |    } else if (hp->h_addrtype != AF_INET) {
  810|       |        DEBUGMSGTL(("get_thisaddr",
  811|       |                    "hostname (not AF_INET!)\n"));
  812|       |        return -1;
  813|       |    } else {
  814|       |        DEBUGMSGTL(("get_thisaddr",
  815|       |                    "hostname (resolved okay)\n"));
  816|       |        memcpy(addr_out, hp->h_addr, sizeof(in_addr_t));
  817|       |    }
  818|       |    return 0;
  819|       |
  820|       |#elif defined(HAVE_GETIPNODEBYNAME)
  821|       |    struct hostent *hp = NULL;
  822|       |    int             err;
  823|       |
  824|       |    hp = getipnodebyname(peername, AF_INET, 0, &err);
  825|       |    if (hp == NULL) {
  826|       |        DEBUGMSGTL(("get_thisaddr",
  827|       |                    "hostname (couldn't resolve = %d)\n", err));
  828|       |        return -1;
  829|       |    }
  830|       |    DEBUGMSGTL(("get_thisaddr",
  831|       |                "hostname (resolved okay)\n"));
  832|       |    memcpy(addr_out, hp->h_addr, sizeof(in_addr_t));
  833|       |    return 0;
  834|       |
  835|       |#else /* HAVE_GETIPNODEBYNAME */
  836|       |    return -1;
  837|       |#endif
  838|     69|}
netsnmp_getaddrinfo:
  843|     69|{
  844|     69|#ifdef HAVE_GETADDRINFO
  845|     69|    struct addrinfo *addrs = NULL;
  846|     69|    struct addrinfo hint;
  847|     69|    int             err;
  848|       |#ifdef DNSSEC_LOCAL_VALIDATION
  849|       |    val_status_t    val_status;
  850|       |#endif
  851|       |
  852|     69|    DEBUGMSGTL(("dns:getaddrinfo", "looking up "));
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
  853|     69|    if (name)
  ------------------
  |  Branch (853:9): [True: 69, False: 0]
  ------------------
  854|     69|        DEBUGMSG(("dns:getaddrinfo", "\"%s\"", name));
  ------------------
  |  |   61|     69|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 69]
  |  |  ------------------
  ------------------
  855|      0|    else
  856|      0|        DEBUGMSG(("dns:getaddrinfo", "<NULL>"));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
  857|       |
  858|     69|    if (service)
  ------------------
  |  Branch (858:9): [True: 0, False: 69]
  ------------------
  859|      0|	DEBUGMSG(("dns:getaddrinfo", ":\"%s\"", service));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
  860|       |
  861|     69|    if (hints)
  ------------------
  |  Branch (861:9): [True: 69, False: 0]
  ------------------
  862|     69|	DEBUGMSG(("dns:getaddrinfo",
  ------------------
  |  |   61|     69|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:56): [True: 0, False: 0]
  |  |  |  Branch (61:56): [True: 0, False: 0]
  |  |  |  Branch (61:56): [True: 0, False: 0]
  |  |  |  Branch (61:67): [Folded, False: 69]
  |  |  ------------------
  ------------------
  863|     69|                  " with hints ({.ai_flags = %#x, .ai_family = %s})",
  864|     69|                  hints->ai_flags, hints->ai_family == 0 ? "0" :
  865|     69|                  hints->ai_family == AF_INET ? "AF_INET" :
  866|     69|                  hints->ai_family == AF_INET6 ? "AF_INET6" : "?"));
  867|      0|    else
  868|      0|	DEBUGMSG(("dns:getaddrinfo", " with no hint"));
  ------------------
  |  |   61|      0|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 0]
  |  |  ------------------
  ------------------
  869|       |
  870|     69|    DEBUGMSG(("dns:getaddrinfo", "\n"));
  ------------------
  |  |   61|     69|#define DEBUGMSG(x)        do {if (_DBG_IF_) {debugmsg x;} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (61:67): [Folded, False: 69]
  |  |  ------------------
  ------------------
  871|       |
  872|     69|    if (NULL == hints) {
  ------------------
  |  Branch (872:9): [True: 0, False: 69]
  ------------------
  873|      0|        memset(&hint, 0, sizeof hint);
  874|      0|        hint.ai_flags = 0;
  875|      0|        hint.ai_family = PF_INET;
  876|      0|        hint.ai_socktype = SOCK_DGRAM;
  877|      0|        hint.ai_protocol = 0;
  878|      0|        hints = &hint;
  879|     69|    } else {
  880|     69|        memcpy(&hint, hints, sizeof hint);
  881|     69|    }
  882|       |
  883|     69|#ifndef DNSSEC_LOCAL_VALIDATION
  884|     69|    err = getaddrinfo(name, NULL, &hint, &addrs);
  885|       |#else /* DNSSEC_LOCAL_VALIDATION */
  886|       |    err = val_getaddrinfo(netsnmp_validator_context(), name, NULL, &hint,
  887|       |                          &addrs, &val_status);
  888|       |    DEBUGMSGTL(("dns:sec:val", "err %d, val_status %d / %s; trusted: %d\n",
  889|       |                err, val_status, p_val_status(val_status),
  890|       |                val_istrusted(val_status)));
  891|       |    if (! val_istrusted(val_status)) {
  892|       |        int rc;
  893|       |        if ((err != 0) && VAL_GETADDRINFO_HAS_STATUS(err)) {
  894|       |            snmp_log(LOG_WARNING,
  895|       |                     "WARNING: UNTRUSTED error in DNS resolution for %s!\n",
  896|       |                     name);
  897|       |            rc = EAI_FAIL;
  898|       |        } else {
  899|       |            snmp_log(LOG_WARNING,
  900|       |                     "The authenticity of DNS response is not trusted (%s)\n",
  901|       |                     p_val_status(val_status));
  902|       |            rc = EAI_NONAME;
  903|       |        }
  904|       |        /** continue anyways if DNSSEC_WARN_ONLY is set */
  905|       |        if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
  906|       |                                    NETSNMP_DS_LIB_DNSSEC_WARN_ONLY))
  907|       |            return rc;
  908|       |    }
  909|       |
  910|       |
  911|       |#endif /* DNSSEC_LOCAL_VALIDATION */
  912|     69|    *res = addrs;
  913|     69|    DEBUGIF("dns:getaddrinfo") {
  ------------------
  |  |  145|     69|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|    138|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (145:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  914|      0|        if (err == 0 && addrs && addrs->ai_addr) {
  ------------------
  |  Branch (914:13): [True: 0, False: 0]
  |  Branch (914:25): [True: 0, False: 0]
  |  Branch (914:34): [True: 0, False: 0]
  ------------------
  915|      0|            const char *fam = "?";
  916|      0|            char dst[64] = "?";
  917|      0|            uint16_t port = 0;
  918|       |
  919|      0|            switch (addrs->ai_addr->sa_family) {
  ------------------
  |  Branch (919:21): [True: 0, False: 0]
  ------------------
  920|      0|            case AF_INET: {
  ------------------
  |  Branch (920:13): [True: 0, False: 0]
  ------------------
  921|      0|                struct sockaddr_in *sin = (struct sockaddr_in *)addrs->ai_addr;
  922|       |
  923|      0|                fam = "AF_INET";
  924|      0|                inet_ntop(AF_INET, &sin->sin_addr, dst, sizeof(dst));
  925|      0|                port = ntohs(sin->sin_port);
  926|      0|                break;
  927|      0|            }
  928|      0|            case AF_INET6: {
  ------------------
  |  Branch (928:13): [True: 0, False: 0]
  ------------------
  929|      0|                struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)
  930|      0|                    addrs->ai_addr;
  931|       |
  932|      0|                fam = "AF_INET6";
  933|      0|                inet_ntop(AF_INET6, &sin6->sin6_addr, dst, sizeof(dst));
  934|      0|                port = ntohs(sin6->sin6_port);
  935|      0|                break;
  936|      0|            }
  937|      0|            }
  938|      0|            DEBUGMSGTL(("dns:getaddrinfo", "answer { %s, %s:%hu }\n", fam, dst,
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  939|      0|                        port));
  940|      0|        }
  941|      0|    }
  942|     69|    return err;
  943|       |#else
  944|       |    NETSNMP_LOGONCE((LOG_ERR, "getaddrinfo not available"));
  945|       |    return EAI_FAIL;
  946|       |#endif /* getaddrinfo */
  947|     69|}
calculate_sectime_diff:
 1176|    144|{
 1177|    144|    struct timeval  diff;
 1178|       |
 1179|    144|    NETSNMP_TIMERSUB(now, then, &diff);
  ------------------
  |  |  173|    144|#define NETSNMP_TIMERSUB(a, b, res) do {                        \
  |  |  174|    144|    (res)->tv_sec  = (a)->tv_sec  - (b)->tv_sec - 1;            \
  |  |  175|    144|    (res)->tv_usec = (a)->tv_usec - (b)->tv_usec + 1000000L;    \
  |  |  176|    144|    if ((res)->tv_usec >= 1000000L) {                           \
  |  |  ------------------
  |  |  |  Branch (176:9): [True: 144, False: 0]
  |  |  ------------------
  |  |  177|    144|        (res)->tv_usec -= 1000000L;                             \
  |  |  178|    144|        (res)->tv_sec++;                                        \
  |  |  179|    144|    }                                                           \
  |  |  180|    144|} while (0)
  |  |  ------------------
  |  |  |  Branch (180:10): [Folded, False: 144]
  |  |  ------------------
  ------------------
 1180|    144|    return (u_int)(diff.tv_sec + (diff.tv_usec >= 500000L));
 1181|    144|}
mkdirhier:
 1241|      1|{
 1242|      1|    struct stat     sbuf;
 1243|      1|    char           *ourcopy = strdup(pathname);
 1244|      1|    char           *entry;
 1245|      1|    char           *buf = NULL;
 1246|      1|    char           *st = NULL;
 1247|      1|    int             res;
 1248|       |
 1249|      1|    res = SNMPERR_GENERR;
  ------------------
  |  |  218|      1|#define SNMPERR_GENERR			(-1)
  ------------------
 1250|      1|    if (!ourcopy)
  ------------------
  |  Branch (1250:9): [True: 0, False: 1]
  ------------------
 1251|      0|        goto out;
 1252|       |
 1253|      1|    buf = malloc(strlen(pathname) + 2);
 1254|      1|    if (!buf)
  ------------------
  |  Branch (1254:9): [True: 0, False: 1]
  ------------------
 1255|      0|        goto out;
 1256|       |
 1257|       |#if defined (WIN32) || defined (cygwin)
 1258|       |    /* convert backslash to forward slash */
 1259|       |    for (entry = ourcopy; *entry; entry++)
 1260|       |        if (*entry == '\\')
 1261|       |            *entry = '/';
 1262|       |#endif
 1263|       |
 1264|      1|    entry = strtok_r(ourcopy, "/", &st);
 1265|       |
 1266|      1|    buf[0] = '\0';
 1267|       |
 1268|       |#if defined (WIN32) || defined (cygwin)
 1269|       |    /*
 1270|       |     * Check if first entry contains a drive-letter
 1271|       |     *   e.g  "c:/path"
 1272|       |     */
 1273|       |    if ((entry) && (':' == entry[1]) &&
 1274|       |        (('\0' == entry[2]) || ('/' == entry[2]))) {
 1275|       |        strcat(buf, entry);
 1276|       |        entry = strtok_r(NULL, "/", &st);
 1277|       |    }
 1278|       |#endif
 1279|       |
 1280|       |    /*
 1281|       |     * check to see if filename is a directory 
 1282|       |     */
 1283|      3|    while (entry) {
  ------------------
  |  Branch (1283:12): [True: 2, False: 1]
  ------------------
 1284|      2|        strcat(buf, "/");
 1285|      2|        strcat(buf, entry);
 1286|      2|        entry = strtok_r(NULL, "/", &st);
 1287|      2|        if (entry == NULL && skiplast)
  ------------------
  |  Branch (1287:13): [True: 1, False: 1]
  |  Branch (1287:30): [True: 0, False: 1]
  ------------------
 1288|      0|            break;
 1289|      2|        if (stat(buf, &sbuf) < 0) {
  ------------------
  |  Branch (1289:13): [True: 1, False: 1]
  ------------------
 1290|       |            /*
 1291|       |             * DNE, make it 
 1292|       |             */
 1293|       |#ifdef WIN32
 1294|       |            if (CreateDirectory(buf, NULL) == 0)
 1295|       |#else
 1296|      1|            if (mkdir(buf, mode) == -1)
  ------------------
  |  Branch (1296:17): [True: 0, False: 1]
  ------------------
 1297|      0|#endif
 1298|      0|                goto out;
 1299|      1|            else
 1300|      1|                snmp_log(LOG_INFO, "Created directory: %s\n", buf);
 1301|      1|        } else {
 1302|       |            /*
 1303|       |             * exists, is it a file? 
 1304|       |             */
 1305|      1|            if ((sbuf.st_mode & S_IFDIR) == 0) {
  ------------------
  |  Branch (1305:17): [True: 0, False: 1]
  ------------------
 1306|       |                /*
 1307|       |                 * ack! can't make a directory on top of a file 
 1308|       |                 */
 1309|      0|                goto out;
 1310|      0|            }
 1311|      1|        }
 1312|      2|    }
 1313|      1|    res = SNMPERR_SUCCESS;
  ------------------
  |  |  217|      1|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
 1314|      1|out:
 1315|      1|    free(buf);
 1316|      1|    free(ourcopy);
 1317|      1|    return res;
 1318|      1|}
netsnmp_os_prematch:
 1384|     69|{
 1385|     69|#ifdef HAVE_SYS_UTSNAME_H
 1386|     69|  static int printOSonce = 1;
 1387|     69|  struct utsname utsbuf;
 1388|     69|  if ( 0 > uname(&utsbuf))
  ------------------
  |  Branch (1388:8): [True: 0, False: 69]
  ------------------
 1389|      0|    return -1;
 1390|       |
 1391|     69|  if (printOSonce) {
  ------------------
  |  Branch (1391:7): [True: 1, False: 68]
  ------------------
 1392|      1|    printOSonce = 0;
 1393|       |    /* show the four elements that the kernel can be sure of */
 1394|      1|  DEBUGMSGT(("daemonize","sysname '%s',\nrelease '%s',\nversion '%s',\nmachine '%s'\n",
  ------------------
  |  |   62|      1|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 1]
  |  |  ------------------
  ------------------
 1395|      1|      utsbuf.sysname, utsbuf.release, utsbuf.version, utsbuf.machine));
 1396|      1|  }
 1397|     69|  if (0 != strcasecmp(utsbuf.sysname, ospmname)) return -1;
  ------------------
  |  Branch (1397:7): [True: 0, False: 69]
  ------------------
 1398|       |
 1399|       |  /* Required to match only the leading characters */
 1400|     69|  return strncasecmp(utsbuf.release, ospmrelprefix, strlen(ospmrelprefix));
 1401|       |
 1402|       |#else
 1403|       |
 1404|       |  return -1;
 1405|       |
 1406|       |#endif /* HAVE_SYS_UTSNAME_H */
 1407|     69|}

netsnmp_memdup:
  279|    152|{
  280|    152|    void *to = NULL;
  281|       |
  282|    152|    if (from) {
  ------------------
  |  Branch (282:9): [True: 152, False: 0]
  ------------------
  283|    152|        to = malloc(size);
  284|    152|        if (to)
  ------------------
  |  Branch (284:13): [True: 152, False: 0]
  ------------------
  285|    152|            memcpy(to, from, size);
  286|    152|    }
  287|    152|    return to;
  288|    152|}                               /* end netsnmp_memdup() */
netsnmp_get_monotonic_clock:
  948|    350|{
  949|    350|#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
  950|    350|    struct timespec ts;
  951|    350|    int res;
  952|       |
  953|    350|    res = clock_gettime(CLOCK_MONOTONIC, &ts);
  954|    350|    if (res >= 0) {
  ------------------
  |  Branch (954:9): [True: 350, False: 0]
  ------------------
  955|    350|        tv->tv_sec = ts.tv_sec;
  956|    350|        tv->tv_usec = ts.tv_nsec / 1000;
  957|    350|    } else {
  958|      0|        gettimeofday(tv, NULL);
  959|      0|    }
  960|       |#elif defined(WIN32)
  961|       |    /*
  962|       |     * Windows: return tick count. Note: the rate at which the tick count
  963|       |     * increases is not adjusted by the time synchronization algorithm, so
  964|       |     * expect an error of <= 100 ppm for the rate at which this clock
  965|       |     * increases.
  966|       |     */
  967|       |    typedef ULONGLONG (WINAPI * pfGetTickCount64)(void);
  968|       |    static int s_initialized;
  969|       |    static pfGetTickCount64 s_pfGetTickCount64;
  970|       |    uint64_t now64;
  971|       |
  972|       |    if (!s_initialized) {
  973|       |        HMODULE hKernel32 = GetModuleHandle("kernel32");
  974|       |        s_pfGetTickCount64 =
  975|       |            (pfGetTickCount64) GetProcAddress(hKernel32, "GetTickCount64");
  976|       |        s_initialized = TRUE;
  977|       |    }
  978|       |
  979|       |    if (s_pfGetTickCount64) {
  980|       |        /* Windows Vista, Windows 2008 or any later Windows version */
  981|       |        now64 = (*s_pfGetTickCount64)();
  982|       |    } else {
  983|       |        /* Windows XP, Windows 2003 or any earlier Windows version */
  984|       |        static uint32_t s_wraps, s_last;
  985|       |        uint32_t now;
  986|       |
  987|       |        now = GetTickCount();
  988|       |        if (now < s_last)
  989|       |            s_wraps++;
  990|       |        s_last = now;
  991|       |        now64 = ((uint64_t)s_wraps << 32) | now;
  992|       |    }
  993|       |    tv->tv_sec = now64 / 1000;
  994|       |    tv->tv_usec = (now64 % 1000) * 1000;
  995|       |#else
  996|       |    /* At least FreeBSD 4 doesn't provide monotonic clock support. */
  997|       |#warning Not sure how to query a monotonically increasing clock on your system. \
  998|       |Timers will not work correctly if the system clock is adjusted by e.g. ntpd.
  999|       |    gettimeofday(tv, NULL);
 1000|       |#endif
 1001|    350|}
netsnmp_getenv:
 1187|    347|{
 1188|    347|#if !defined (WIN32) && !defined (cygwin)
 1189|    347|  return (getenv(name));
 1190|       |#else
 1191|       |  char *temp = NULL;  
 1192|       |  HKEY hKey;
 1193|       |  unsigned char * key_value = NULL;
 1194|       |  DWORD key_value_size = 0;
 1195|       |  DWORD key_value_type = 0;
 1196|       |  DWORD getenv_worked = 0;
 1197|       |
 1198|       |  DEBUGMSGTL(("read_config", "netsnmp_getenv called with name: %s\n",name));
 1199|       |
 1200|       |  if (!(name))
 1201|       |    return NULL;
 1202|       |  
 1203|       |  /* Try environment variable first */ 
 1204|       |  temp = getenv(name);
 1205|       |  if (temp) {
 1206|       |    getenv_worked = 1;
 1207|       |    DEBUGMSGTL(("read_config", "netsnmp_getenv will return from ENV: %s\n",temp));
 1208|       |  }
 1209|       |  
 1210|       |  /* Next try HKCU */
 1211|       |  if (temp == NULL)
 1212|       |  {
 1213|       |    if (getenv("SNMP_IGNORE_WINDOWS_REGISTRY"))
 1214|       |      return NULL;
 1215|       |
 1216|       |    if (RegOpenKeyExA(
 1217|       |          HKEY_CURRENT_USER, 
 1218|       |          "SOFTWARE\\Net-SNMP", 
 1219|       |          0, 
 1220|       |          KEY_QUERY_VALUE, 
 1221|       |          &hKey) == ERROR_SUCCESS) {   
 1222|       |      
 1223|       |      if (RegQueryValueExA(
 1224|       |            hKey, 
 1225|       |            name, 
 1226|       |            NULL, 
 1227|       |            &key_value_type, 
 1228|       |            NULL,               /* Just get the size */
 1229|       |            &key_value_size) == ERROR_SUCCESS) {
 1230|       |
 1231|       |        SNMP_FREE(key_value);
 1232|       |
 1233|       |        /* Allocate memory needed +1 to allow RegQueryValueExA to NULL terminate the
 1234|       |         * string data in registry is missing one (which is unlikely).
 1235|       |         */
 1236|       |        key_value = malloc((sizeof(char) * key_value_size)+sizeof(char));
 1237|       |        
 1238|       |        if (RegQueryValueExA(
 1239|       |              hKey, 
 1240|       |              name, 
 1241|       |              NULL, 
 1242|       |              &key_value_type, 
 1243|       |              key_value, 
 1244|       |              &key_value_size) == ERROR_SUCCESS) {
 1245|       |        }
 1246|       |        temp = (char *) key_value;
 1247|       |      }
 1248|       |      RegCloseKey(hKey);
 1249|       |      if (temp)
 1250|       |        DEBUGMSGTL(("read_config", "netsnmp_getenv will return from HKCU: %s\n",temp));
 1251|       |    }
 1252|       |  }
 1253|       |
 1254|       |  /* Next try HKLM */
 1255|       |  if (temp == NULL)
 1256|       |  {
 1257|       |    if (RegOpenKeyExA(
 1258|       |          HKEY_LOCAL_MACHINE, 
 1259|       |          "SOFTWARE\\Net-SNMP", 
 1260|       |          0, 
 1261|       |          KEY_QUERY_VALUE, 
 1262|       |          &hKey) == ERROR_SUCCESS) {   
 1263|       |      
 1264|       |      if (RegQueryValueExA(
 1265|       |            hKey, 
 1266|       |            name, 
 1267|       |            NULL, 
 1268|       |            &key_value_type, 
 1269|       |            NULL,               /* Just get the size */
 1270|       |            &key_value_size) == ERROR_SUCCESS) {
 1271|       |
 1272|       |        SNMP_FREE(key_value);
 1273|       |
 1274|       |        /* Allocate memory needed +1 to allow RegQueryValueExA to NULL terminate the
 1275|       |         * string data in registry is missing one (which is unlikely).
 1276|       |         */
 1277|       |        key_value = malloc((sizeof(char) * key_value_size)+sizeof(char));
 1278|       |        
 1279|       |        if (RegQueryValueExA(
 1280|       |              hKey, 
 1281|       |              name, 
 1282|       |              NULL, 
 1283|       |              &key_value_type, 
 1284|       |              key_value, 
 1285|       |              &key_value_size) == ERROR_SUCCESS) {
 1286|       |        }
 1287|       |        temp = (char *) key_value;
 1288|       |
 1289|       |      }
 1290|       |      RegCloseKey(hKey);
 1291|       |      if (temp)
 1292|       |        DEBUGMSGTL(("read_config", "netsnmp_getenv will return from HKLM: %s\n",temp));
 1293|       |    }
 1294|       |  }
 1295|       |  
 1296|       |  if (temp && !getenv_worked) {
 1297|       |    setenv(name, temp, 1);
 1298|       |    SNMP_FREE(temp);
 1299|       |  }
 1300|       |
 1301|       |  DEBUGMSGTL(("read_config", "netsnmp_getenv returning: %s\n",getenv(name)));
 1302|       |
 1303|       |  return(getenv(name));
 1304|       |#endif
 1305|    347|}
netsnmp_gethomedir:
 1417|     70|const char *netsnmp_gethomedir(void) {
 1418|     70|    const char *homepath = netsnmp_getenv("HOME");
 1419|       |#ifdef _WIN32
 1420|       |    if (!homepath)
 1421|       |        homepath = netsnmp_getenv("USERPROFILE");
 1422|       |#endif
 1423|     70|    return homepath;
 1424|     70|}

netsnmp_aal5pvc_ctor:
  371|     69|{
  372|     69|    aal5pvcDomain.name = netsnmp_AAL5PVCDomain;
  373|     69|    aal5pvcDomain.name_length = OID_LENGTH(netsnmp_AAL5PVCDomain);
  ------------------
  |  |   64|     69|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|     69|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
  374|     69|    aal5pvcDomain.prefix = calloc(3, sizeof(char *));
  375|     69|    if (!aal5pvcDomain.prefix) {
  ------------------
  |  Branch (375:9): [True: 0, False: 69]
  ------------------
  376|      0|        snmp_log(LOG_ERR, "calloc() failed - out of memory\n");
  377|      0|        return;
  378|      0|    }
  379|     69|    aal5pvcDomain.prefix[0] = "aal5pvc";
  380|     69|    aal5pvcDomain.prefix[1] = "pvc";
  381|       |
  382|     69|    aal5pvcDomain.f_create_from_tstring_new = netsnmp_aal5pvc_create_tstring;
  383|     69|    aal5pvcDomain.f_create_from_ostring     = netsnmp_aal5pvc_create_ostring;
  384|       |
  385|     69|    netsnmp_tdomain_register(&aal5pvcDomain);
  386|     69|}

free_alias_config:
   61|    138|free_alias_config(void) {
   62|    138|    netsnmp_free_all_list_data(alias_memory);
   63|       |    alias_memory = NULL;
   64|    138|}
netsnmp_alias_ctor:
   98|     69|{
   99|     69|    aliasDomain.name = netsnmp_snmpALIASDomain;
  100|     69|    aliasDomain.name_length = OID_LENGTH(netsnmp_snmpALIASDomain);
  ------------------
  |  |   64|     69|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|     69|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
  101|     69|    aliasDomain.prefix = calloc(2, sizeof(char *));
  102|     69|    if (!aliasDomain.prefix) {
  ------------------
  |  Branch (102:9): [True: 0, False: 69]
  ------------------
  103|      0|        snmp_log(LOG_ERR, "calloc() failed - out of memory\n");
  104|      0|        return;
  105|      0|    }
  106|     69|    aliasDomain.prefix[0] = "alias";
  107|       |
  108|     69|    aliasDomain.f_create_from_tstring_new = netsnmp_alias_create_tstring;
  109|     69|    aliasDomain.f_create_from_ostring     = netsnmp_alias_create_ostring;
  110|       |
  111|     69|    netsnmp_tdomain_register(&aliasDomain);
  112|       |
  113|     69|    register_config_handler("snmp", "alias", parse_alias_config,
  114|     69|                            free_alias_config, "NAME TRANSPORT_DEFINITION");
  115|     69|}

netsnmp_dtlsudp_ctor:
 1652|     69|{
 1653|     69|    static const char indexname[] = "_netsnmp_addr_info";
 1654|     69|    static const char *prefixes[] = { "dtlsudp", "dtls"
 1655|     69|#ifdef NETSNMP_TRANSPORT_UDPIPV6_DOMAIN
 1656|     69|                                      , "dtlsudp6", "dtls6"
 1657|     69|#endif
 1658|     69|    };
 1659|     69|    int i, num_prefixes = sizeof(prefixes) / sizeof(char *);
 1660|     69|#ifdef NETSNMP_TRANSPORT_UDPIPV6_DOMAIN
 1661|     69|    static const char indexname6[] = "_netsnmp_addr_info6";
 1662|     69|#endif
 1663|       |
 1664|     69|    DEBUGMSGTL(("dtlsudp", "registering DTLS constructor\n"));
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
 1665|       |
 1666|       |    /* config settings */
 1667|       |
 1668|     69|#ifdef NETSNMP_TRANSPORT_UDPIPV6_DOMAIN
 1669|     69|    if (!openssl_addr_index6)
  ------------------
  |  Branch (1669:9): [True: 1, False: 68]
  ------------------
 1670|      1|        openssl_addr_index6 =
 1671|      1|            SSL_get_ex_new_index(0, NETSNMP_REMOVE_CONST(void *, indexname6),
 1672|     69|                                 NULL, NULL, NULL);
 1673|     69|#endif
 1674|       |
 1675|     69|    dtlsudpDomain.name = netsnmpDTLSUDPDomain;
 1676|     69|    dtlsudpDomain.name_length = netsnmpDTLSUDPDomain_len;
 1677|     69|    dtlsudpDomain.prefix = calloc(num_prefixes + 1, sizeof(char *));
 1678|     69|    if (!dtlsudpDomain.prefix) {
  ------------------
  |  Branch (1678:9): [True: 0, False: 69]
  ------------------
 1679|      0|        snmp_log(LOG_ERR, "calloc() failed - out of memory\n");
 1680|      0|        return;
 1681|      0|    }
 1682|    345|    for (i = 0; i < num_prefixes; ++ i)
  ------------------
  |  Branch (1682:17): [True: 276, False: 69]
  ------------------
 1683|    276|        dtlsudpDomain.prefix[i] = prefixes[i];
 1684|       |
 1685|     69|    dtlsudpDomain.f_create_from_tstring_new = netsnmp_dtlsudp_create_tstring;
 1686|     69|    dtlsudpDomain.f_create_from_ostring     = netsnmp_dtlsudp_create_ostring;
 1687|       |
 1688|     69|    if (!openssl_addr_index)
  ------------------
  |  Branch (1688:9): [True: 1, False: 68]
  ------------------
 1689|      1|        openssl_addr_index =
 1690|      1|            SSL_get_ex_new_index(0, NETSNMP_REMOVE_CONST(void *, indexname),
 1691|     69|                                 NULL, NULL, NULL);
 1692|       |
 1693|     69|    netsnmp_tdomain_register(&dtlsudpDomain);
 1694|     69|}

netsnmp_parse_ep_str:
   31|     69|{
   32|     69|    char *dup, *cp, *addrstr = NULL, *iface = NULL, *portstr = NULL;
   33|     69|    unsigned port;
   34|       |
   35|     69|    if (!endpoint)
  ------------------
  |  Branch (35:9): [True: 0, False: 69]
  ------------------
   36|      0|        return 0;
   37|       |
   38|     69|    dup = strdup(endpoint);
   39|     69|    if (!dup)
  ------------------
  |  Branch (39:9): [True: 0, False: 69]
  ------------------
   40|      0|        return 0;
   41|       |
   42|     69|    cp = dup;
   43|     69|    if (netsnmp_isnumber(cp)) {
  ------------------
  |  Branch (43:9): [True: 0, False: 69]
  ------------------
   44|      0|        portstr = cp;
   45|     69|    } else {
   46|     69|        if (*cp == '[') {
  ------------------
  |  Branch (46:13): [True: 0, False: 69]
  ------------------
   47|      0|            addrstr = cp + 1;
   48|      0|            cp = strchr(cp, ']');
   49|      0|            if (cp) {
  ------------------
  |  Branch (49:17): [True: 0, False: 0]
  ------------------
   50|      0|                cp[0] = '\0';
   51|      0|                cp++;
   52|      0|            } else {
   53|      0|                goto err;
   54|      0|            }
   55|     69|        } else if (*cp != '@' && (*cp != ':' || cp[1] == ':')) {
  ------------------
  |  Branch (55:20): [True: 69, False: 0]
  |  Branch (55:35): [True: 69, False: 0]
  |  Branch (55:49): [True: 0, False: 0]
  ------------------
   56|     69|            addrstr = cp;
   57|     69|            cp = strchr(addrstr, '@');
   58|     69|            if (!cp) {
  ------------------
  |  Branch (58:17): [True: 69, False: 0]
  ------------------
   59|     69|                cp = strrchr(addrstr, ':');
   60|     69|                if (cp && strchr(dup, ':') < cp)
  ------------------
  |  Branch (60:21): [True: 69, False: 0]
  |  Branch (60:27): [True: 0, False: 69]
  ------------------
   61|      0|                    cp = NULL;
   62|     69|            }
   63|     69|        }
   64|     69|        if (cp && *cp == '@') {
  ------------------
  |  Branch (64:13): [True: 69, False: 0]
  |  Branch (64:19): [True: 0, False: 69]
  ------------------
   65|      0|            *cp = '\0';
   66|      0|            iface = cp + 1;
   67|      0|            cp = strchr(cp + 1, ':');
   68|      0|        }
   69|     69|        if (cp && *cp == ':') {
  ------------------
  |  Branch (69:13): [True: 69, False: 0]
  |  Branch (69:19): [True: 69, False: 0]
  ------------------
   70|     69|            *cp++ = '\0';
   71|     69|            portstr = cp;
   72|     69|            if (!netsnmp_isnumber(cp))
  ------------------
  |  Branch (72:17): [True: 0, False: 69]
  ------------------
   73|      0|                goto err;
   74|     69|        } else if (cp && *cp) {
  ------------------
  |  Branch (74:20): [True: 0, False: 0]
  |  Branch (74:26): [True: 0, False: 0]
  ------------------
   75|      0|            goto err;
   76|      0|        }
   77|     69|    }
   78|       |
   79|     69|    if (addrstr) {
  ------------------
  |  Branch (79:9): [True: 69, False: 0]
  ------------------
   80|     69|        ep_str->addr = strdup(addrstr);
   81|     69|        if (!ep_str->addr)
  ------------------
  |  Branch (81:13): [True: 0, False: 69]
  ------------------
   82|      0|            goto err;
   83|     69|    }
   84|     69|    if (iface)
  ------------------
  |  Branch (84:9): [True: 0, False: 69]
  ------------------
   85|      0|        strlcpy(ep_str->iface, iface, sizeof(ep_str->iface));
   86|     69|    if (portstr) {
  ------------------
  |  Branch (86:9): [True: 69, False: 0]
  ------------------
   87|     69|        port = atoi(portstr);
   88|     69|        if (port <= 0xffff)
  ------------------
  |  Branch (88:13): [True: 69, False: 0]
  ------------------
   89|     69|            strlcpy(ep_str->port, portstr, sizeof(ep_str->port));
   90|      0|        else
   91|      0|            goto err;
   92|     69|    }
   93|       |
   94|     69|    free(dup);
   95|     69|    return 1;
   96|       |
   97|      0|err:
   98|      0|    free(ep_str->addr);
   99|       |    ep_str->addr = NULL;
  100|      0|    free(dup);
  101|      0|    return 0;
  102|     69|}
netsnmp_bindtodevice:
  105|     69|{
  106|       |    /* If no interface name has been specified, report success. */
  107|     69|    if (!iface || iface[0] == '\0')
  ------------------
  |  Branch (107:9): [True: 0, False: 69]
  |  Branch (107:19): [True: 69, False: 0]
  ------------------
  108|     69|        return 0;
  109|       |
  110|      0|#ifdef HAVE_SO_BINDTODEVICE
  111|      0|    {
  112|       |        /*
  113|       |         * +1 to work around the Linux kernel bug that the passed in name is not
  114|       |         * '\0'-terminated.
  115|       |         */
  116|      0|        int ifacelen = strlen(iface) + 1;
  117|      0|        int ret;
  118|       |
  119|      0|        ret = setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, iface, ifacelen);
  120|      0|        if (ret < 0)
  ------------------
  |  Branch (120:13): [True: 0, False: 0]
  ------------------
  121|      0|            snmp_log(LOG_ERR, "Binding socket to interface %s failed: %s\n",
  122|      0|                     iface, strerror(errno));
  123|      0|        return ret;
  124|     69|    }
  125|       |#else
  126|       |    errno = EINVAL;
  127|       |    return -1;
  128|       |#endif
  129|     69|}
netsnmp_ipbase_session_init:
  132|     69|                            struct snmp_session *sess) {
  133|     69|    union {
  134|     69|        struct sockaddr     sa;
  135|     69|        struct sockaddr_in  sin;
  136|     69|        struct sockaddr_in6 sin6;
  137|     69|    } ss;
  138|     69|    socklen_t len = sizeof(ss);
  139|       |
  140|     69|    if (!sess) {
  ------------------
  |  Branch (140:9): [True: 0, False: 69]
  ------------------
  141|      0|        DEBUGMSGTL(("netsnmp_ipbase", "session pointer is NULL\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  142|      0|        return SNMPERR_SUCCESS;
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  143|      0|    }
  144|       |
  145|     69|    if (getsockname(transport->sock, (struct sockaddr *)&ss, &len) == -1) {
  ------------------
  |  Branch (145:9): [True: 0, False: 69]
  ------------------
  146|      0|        DEBUGMSGTL(("netsnmp_ipbase", "getsockname error %s\n", strerror(errno)));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  147|      0|        return SNMPERR_SUCCESS;
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  148|      0|    }
  149|     69|    switch (ss.sa.sa_family) {
  150|     69|    case AF_INET:
  ------------------
  |  Branch (150:5): [True: 69, False: 0]
  ------------------
  151|     69|        sess->local_port = ntohs(ss.sin.sin_port);
  152|     69|        break;
  153|      0|    case AF_INET6:
  ------------------
  |  Branch (153:5): [True: 0, False: 69]
  ------------------
  154|      0|        sess->local_port = ntohs(ss.sin6.sin6_port);
  155|      0|        break;
  156|      0|    default:
  ------------------
  |  Branch (156:5): [True: 0, False: 69]
  ------------------
  157|      0|        DEBUGMSGTL(("netsnmp_ipbase", "unsupported address family %d\n",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  158|      0|                    ss.sa.sa_family));
  159|      0|        return SNMPERR_SUCCESS;
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  160|     69|    }
  161|       |
  162|     69|    DEBUGMSGTL(("netsnmp_ipbase", "local port number %d\n", sess->local_port));
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
  163|       |
  164|     69|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|     69|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  165|     69|}
snmpIPBaseDomain.c:netsnmp_isnumber:
   12|    138|{
   13|    138|    if (!*cp)
  ------------------
  |  Branch (13:9): [True: 0, False: 138]
  ------------------
   14|      0|        return 0;
   15|       |
   16|    138|    while (isdigit((unsigned char)*cp))
  ------------------
  |  Branch (16:12): [True: 483, False: 138]
  ------------------
   17|    483|        cp++;
   18|    138|    return *cp == '\0';
   19|    138|}

netsnmp_ipx_ctor:
  476|     69|{
  477|     69|    ipxDomain.name = netsnmpIPXDomain;
  478|     69|    ipxDomain.name_length = netsnmpIPXDomain_len;
  479|     69|    ipxDomain.prefix = calloc(2, sizeof(char *));
  480|     69|    if (!ipxDomain.prefix) {
  ------------------
  |  Branch (480:9): [True: 0, False: 69]
  ------------------
  481|      0|        snmp_log(LOG_ERR, "calloc() failed - out of memory\n");
  482|      0|        return;
  483|      0|    }
  484|     69|    ipxDomain.prefix[0] = "ipx";
  485|       |
  486|     69|    ipxDomain.f_create_from_tstring_new = netsnmp_ipx_create_tstring;
  487|     69|    ipxDomain.f_create_from_ostring     = netsnmp_ipx_create_ostring;
  488|       |
  489|     69|    netsnmp_tdomain_register(&ipxDomain);
  490|     69|}

netsnmp_sockaddr_in3:
   87|     69|{
   88|     69|    struct sockaddr_in *addr = &ep->a.sin;
   89|     69|    struct netsnmp_ep_str ep_str;
   90|     69|    int port, ret;
   91|       |
   92|     69|    if (!ep)
  ------------------
  |  Branch (92:9): [True: 0, False: 69]
  ------------------
   93|      0|        return 0;
   94|       |
   95|     69|    DEBUGMSGTL(("netsnmp_sockaddr_in",
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
   96|     69|                "addr %p, inpeername \"%s\", default_target \"%s\"\n",
   97|     69|                ep, inpeername ? inpeername : "[NIL]",
   98|     69|                default_target ? default_target : "[NIL]"));
   99|       |
  100|     69|    memset(ep, 0, sizeof(*ep));
  101|     69|    addr->sin_addr.s_addr = htonl(INADDR_ANY);
  102|     69|    addr->sin_family = AF_INET;
  103|     69|    addr->sin_port = htons((u_short)SNMP_PORT);
  104|       |
  105|     69|    memset(&ep_str, 0, sizeof(ep_str));
  106|     69|    port = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  107|     69|                              NETSNMP_DS_LIB_DEFAULT_PORT);
  ------------------
  |  |  117|     69|#define NETSNMP_DS_LIB_DEFAULT_PORT         3
  ------------------
  108|     69|    if (port != 0)
  ------------------
  |  Branch (108:9): [True: 0, False: 69]
  ------------------
  109|      0|        snprintf(ep_str.port, sizeof(ep_str.port), "%d", port);
  110|     69|    else if (default_target &&
  ------------------
  |  Branch (110:14): [True: 0, False: 69]
  ------------------
  111|      0|             !netsnmp_parse_ep_str(&ep_str, default_target))
  ------------------
  |  Branch (111:14): [True: 0, False: 0]
  ------------------
  112|      0|            snmp_log(LOG_ERR, "Invalid default target %s\n",
  113|      0|                     default_target);
  114|     69|    if (inpeername && *inpeername != '\0') {
  ------------------
  |  Branch (114:9): [True: 69, False: 0]
  |  Branch (114:23): [True: 69, False: 0]
  ------------------
  115|     69|	if (ep_str.addr) {
  ------------------
  |  Branch (115:6): [True: 0, False: 69]
  ------------------
  116|      0|	    free(ep_str.addr);  /* free default target */
  117|      0|	    ep_str.addr = NULL;
  118|      0|	}
  119|     69|	if (!netsnmp_parse_ep_str(&ep_str, inpeername))
  ------------------
  |  Branch (119:6): [True: 0, False: 69]
  ------------------
  120|      0|            return 0;
  121|     69|    }
  122|       |
  123|     69|    if (ep_str.port[0])
  ------------------
  |  Branch (123:9): [True: 69, False: 0]
  ------------------
  124|     69|        addr->sin_port = htons(atoi(ep_str.port));
  125|     69|    if (ep_str.iface[0])
  ------------------
  |  Branch (125:9): [True: 0, False: 69]
  ------------------
  126|      0|        strlcpy(ep->iface, ep_str.iface, sizeof(ep->iface));
  127|     69|    if (ep_str.addr && strcmp(ep_str.addr, "255.255.255.255") == 0) {
  ------------------
  |  Branch (127:9): [True: 69, False: 0]
  |  Branch (127:24): [True: 0, False: 69]
  ------------------
  128|       |        /*
  129|       |         * The explicit broadcast address hack
  130|       |         */
  131|      0|        DEBUGMSGTL(("netsnmp_sockaddr_in", "Explicit UDP broadcast\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  132|      0|        addr->sin_addr.s_addr = INADDR_NONE;
  133|     69|    } else if (ep_str.addr && strcmp(ep_str.addr, "") != 0) {
  ------------------
  |  Branch (133:16): [True: 69, False: 0]
  |  Branch (133:31): [True: 69, False: 0]
  ------------------
  134|     69|        ret = netsnmp_gethostbyname_v4(ep_str.addr, &addr->sin_addr.s_addr);
  135|     69|        if (ret < 0) {
  ------------------
  |  Branch (135:13): [True: 0, False: 69]
  ------------------
  136|      0|            DEBUGMSGTL(("netsnmp_sockaddr_in",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  137|      0|                        "couldn't resolve hostname \"%s\"\n", ep_str.addr));
  138|      0|            free(ep_str.addr);
  139|      0|            return 0;
  140|      0|        }
  141|     69|        DEBUGMSGTL(("netsnmp_sockaddr_in",
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
  142|     69|                    "hostname (resolved okay)\n"));
  143|     69|    }
  144|       |
  145|       |    /*
  146|       |     * Finished
  147|       |     */
  148|       |
  149|     69|    DEBUGMSGTL(("netsnmp_sockaddr_in", "return { AF_INET, %s:%hu }\n",
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
  150|     69|                inet_ntoa(addr->sin_addr), ntohs(addr->sin_port)));
  151|     69|    free(ep_str.addr);
  152|     69|    return 1;
  153|     69|}

netsnmp_std_ctor:
  268|     69|{
  269|     69|    stdDomain.name = netsnmp_snmpSTDDomain;
  270|     69|    stdDomain.name_length = OID_LENGTH(netsnmp_snmpSTDDomain);
  ------------------
  |  |   64|     69|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|     69|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
  271|     69|    stdDomain.prefix = calloc(2, sizeof(char *));
  272|     69|    if (!stdDomain.prefix) {
  ------------------
  |  Branch (272:9): [True: 0, False: 69]
  ------------------
  273|      0|        snmp_log(LOG_ERR, "calloc() failed - out of memory\n");
  274|      0|        return;
  275|      0|    }
  276|     69|    stdDomain.prefix[0] = "std";
  277|       |
  278|     69|    stdDomain.f_create_from_tstring_new = netsnmp_std_create_tstring;
  279|     69|    stdDomain.f_create_from_ostring     = netsnmp_std_create_ostring;
  280|       |
  281|     69|    netsnmp_tdomain_register(&stdDomain);
  282|     69|}

netsnmp_socketbase_close:
   43|     69|int netsnmp_socketbase_close(netsnmp_transport *t) {
   44|     69|    int rc = -1;
   45|     69|    if (t->sock >= 0) {
  ------------------
  |  Branch (45:9): [True: 69, False: 0]
  ------------------
   46|     69|#ifndef HAVE_CLOSESOCKET
   47|     69|        rc = close(t->sock);
   48|       |#else
   49|       |        rc = closesocket(t->sock);
   50|       |#endif
   51|     69|        t->sock = -1;
   52|     69|    }
   53|     69|    return rc;
   54|     69|}
netsnmp_sock_buffer_set:
  220|    138|{
  221|       |#if ! defined(SO_SNDBUF) && ! defined(SO_RCVBUF)
  222|       |    DEBUGMSGTL(("socket:buffer", "Changing socket buffer is not supported\n"));
  223|       |    return -1;
  224|       |#else
  225|    138|    const char     *buftype;
  226|    138|    int            curbuf = 0;
  227|    138|    socklen_t      curbuflen = sizeof(int);
  228|       |
  229|       |#   ifndef  SO_SNDBUF
  230|       |    if (SO_SNDBUF == optname) {
  231|       |        DEBUGMSGTL(("socket:buffer",
  232|       |                    "Changing socket send buffer is not supported\n"));
  233|       |        return -1;
  234|       |    }
  235|       |#   endif                          /*SO_SNDBUF */
  236|       |#   ifndef  SO_RCVBUF
  237|       |    if (SO_RCVBUF == optname) {
  238|       |        DEBUGMSGTL(("socket:buffer",
  239|       |                    "Changing socket receive buffer is not supported\n"));
  240|       |        return -1;
  241|       |    }
  242|       |#   endif                          /*SO_RCVBUF */
  243|       |
  244|       |    /*
  245|       |     * What is the requested buffer size ?
  246|       |     */
  247|    138|    if (0 == size)
  ------------------
  |  Branch (247:9): [True: 138, False: 0]
  ------------------
  248|    138|        size = _sock_buffer_size_get(optname, local, &buftype);
  249|      0|    else {
  250|      0|        buftype = _sock_buf_type_get(optname, local);
  251|      0|        DEBUGMSGT(("verbose:socket:buffer", "Requested %s is %d\n",
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
  252|      0|                   buftype, size));
  253|      0|    }
  254|       |
  255|    138|    if ((getsockopt(s, SOL_SOCKET, optname, (void *) &curbuf,
  ------------------
  |  Branch (255:9): [True: 138, False: 0]
  ------------------
  256|    138|                    &curbuflen) == 0) 
  257|    138|        && (curbuflen == sizeof(int))) {
  ------------------
  |  Branch (257:12): [True: 138, False: 0]
  ------------------
  258|       |        
  259|    138|        DEBUGMSGT(("verbose:socket:buffer", "Original %s is %d\n",
  ------------------
  |  |   62|    138|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    138|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 138]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 138]
  |  |  ------------------
  ------------------
  260|    138|                   buftype, curbuf));
  261|    138|        if (curbuf >= size) {
  ------------------
  |  Branch (261:13): [True: 138, False: 0]
  ------------------
  262|    138|            DEBUGMSGT(("verbose:socket:buffer",
  ------------------
  |  |   62|    138|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    138|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 138]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 138]
  |  |  ------------------
  ------------------
  263|    138|                      "New %s size is smaller than original!\n", buftype));
  264|    138|        }
  265|    138|    }
  266|       |
  267|       |    /*
  268|       |     * If the buffersize was not specified or it was a negative value
  269|       |     * then don't change the OS buffers at all
  270|       |     */
  271|    138|    if (size <= 0) {
  ------------------
  |  Branch (271:9): [True: 138, False: 0]
  ------------------
  272|    138|       DEBUGMSGT(("socket:buffer",
  ------------------
  |  |   62|    138|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    138|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 138]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 138]
  |  |  ------------------
  ------------------
  273|    138|                    "%s not valid or not specified; using OS default(%d)\n",
  274|    138|                    buftype,curbuf));
  275|    138|       return curbuf;
  276|    138|    }
  277|       |
  278|       |    /*
  279|       |     * Try to set the requested send buffer
  280|       |     */
  281|      0|    if (setsockopt(s, SOL_SOCKET, optname, (void *) &size, sizeof(int)) == 0) {
  ------------------
  |  Branch (281:9): [True: 0, False: 0]
  ------------------
  282|       |        /*
  283|       |         * Because some platforms lie about the actual buffer that has been 
  284|       |         * set (Linux will always say it worked ...), we print some 
  285|       |         * diagnostic output for debugging
  286|       |         */
  287|      0|        DEBUGIF("socket:buffer") {
  ------------------
  |  |  145|      0|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (145:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  288|      0|            DEBUGMSGT(("socket:buffer", "Set %s to %d\n",
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
  289|      0|                       buftype, size));
  290|      0|            if ((getsockopt(s, SOL_SOCKET, optname, (void *) &curbuf,
  ------------------
  |  Branch (290:17): [True: 0, False: 0]
  ------------------
  291|      0|                            &curbuflen) == 0) 
  292|      0|                    && (curbuflen == sizeof(int))) {
  ------------------
  |  Branch (292:24): [True: 0, False: 0]
  ------------------
  293|       |
  294|      0|                DEBUGMSGT(("verbose:socket:buffer",
  ------------------
  |  |   62|      0|#define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGT(x)       do {if (_DBG_IF_) {__DBGMSGT(x);} }while(0)
  |  |  ------------------
  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  ------------------
  |  |  |  Branch (62:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
  295|      0|                           "Now %s is %d\n", buftype, curbuf));
  296|      0|            }
  297|      0|        }
  298|       |        /*
  299|       |         * If the new buffer is smaller than the size we requested, we will
  300|       |         * try to increment the new buffer with 1k increments 
  301|       |         * (this will sometime allow us to reach a more optimal buffer.)
  302|       |         *   For example : On Solaris, if the max OS buffer is 100k and you
  303|       |         *   request 110k, you end up with the default 8k :-(
  304|       |         */
  305|      0|        if (curbuf < size) {
  ------------------
  |  Branch (305:13): [True: 0, False: 0]
  ------------------
  306|      0|            curbuf = _sock_buffer_maximize(s, optname, buftype, size);
  307|      0|            if(-1 != curbuf)
  ------------------
  |  Branch (307:16): [True: 0, False: 0]
  ------------------
  308|      0|                size = curbuf;
  309|      0|        }
  310|       |
  311|      0|    } else {
  312|       |        /*
  313|       |         * Obviously changing the buffer failed, most like like because we 
  314|       |         * requested a buffer greater than the OS limit.
  315|       |         * Therefore we need to search for an optimal buffer that is close
  316|       |         * enough to the point of failure.
  317|       |         * This will allow us to reach a more optimal buffer.
  318|       |         *   For example : On Solaris, if the max OS buffer is 100k and you 
  319|       |         *   request 110k, you end up with the default 8k :-(
  320|       |         *   After this quick seach we would get 1k close to 100k (the max)
  321|       |         */
  322|      0|        DEBUGMSGTL(("socket:buffer", "couldn't set %s to %d\n",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  323|      0|                    buftype, size));
  324|       |
  325|      0|        curbuf = _sock_buffer_maximize(s, optname, buftype, size);
  326|      0|        if(-1 != curbuf)
  ------------------
  |  Branch (326:12): [True: 0, False: 0]
  ------------------
  327|      0|            size = curbuf;
  328|      0|    }
  329|       |
  330|      0|    return size;
  331|    138|#endif
  332|    138|}
snmpSocketBaseDomain.c:_sock_buffer_size_get:
  159|    138|{
  160|    138|    int size;
  161|       |
  162|    138|    if (NULL != buftype)
  ------------------
  |  Branch (162:9): [True: 138, False: 0]
  ------------------
  163|    138|        *buftype = _sock_buf_type_get(optname, local);
  164|       |
  165|    138|    if (optname == SO_SNDBUF) {
  ------------------
  |  Branch (165:9): [True: 69, False: 69]
  ------------------
  166|     69|        if (local) {
  ------------------
  |  Branch (166:13): [True: 69, False: 0]
  ------------------
  167|     69|            size = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  168|     69|                    NETSNMP_DS_LIB_SERVERSENDBUF);
  ------------------
  |  |  122|     69|#define NETSNMP_DS_LIB_SERVERSENDBUF        7 /* send buffer (server) */
  ------------------
  169|       |#ifdef NETSNMP_DEFAULT_SERVER_SEND_BUF
  170|       |            if (size <= 0)
  171|       |               size = NETSNMP_DEFAULT_SERVER_SEND_BUF;
  172|       |#endif
  173|     69|        } else {
  174|      0|            size = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  175|      0|                    NETSNMP_DS_LIB_CLIENTSENDBUF);
  ------------------
  |  |  124|      0|#define NETSNMP_DS_LIB_CLIENTSENDBUF        9 /* send buffer (client) */
  ------------------
  176|       |#ifdef NETSNMP_DEFAULT_CLIENT_SEND_BUF
  177|       |            if (size <= 0)
  178|       |               size = NETSNMP_DEFAULT_CLIENT_SEND_BUF;
  179|       |#endif
  180|      0|        }
  181|     69|    } else if (optname == SO_RCVBUF) {
  ------------------
  |  Branch (181:16): [True: 69, False: 0]
  ------------------
  182|     69|        if (local) {
  ------------------
  |  Branch (182:13): [True: 69, False: 0]
  ------------------
  183|     69|            size = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  184|     69|                    NETSNMP_DS_LIB_SERVERRECVBUF);
  ------------------
  |  |  123|     69|#define NETSNMP_DS_LIB_SERVERRECVBUF        8 /* receive buffer (server) */
  ------------------
  185|       |#ifdef NETSNMP_DEFAULT_SERVER_RECV_BUF
  186|       |            if (size <= 0)
  187|       |               size = NETSNMP_DEFAULT_SERVER_RECV_BUF;
  188|       |#endif
  189|     69|        } else {
  190|      0|            size = netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  191|      0|                    NETSNMP_DS_LIB_CLIENTRECVBUF);
  ------------------
  |  |  125|      0|#define NETSNMP_DS_LIB_CLIENTRECVBUF       10 /* receive buffer (client) */
  ------------------
  192|       |#ifdef NETSNMP_DEFAULT_CLIENT_RECV_BUF
  193|       |            if (size <= 0)
  194|       |               size = NETSNMP_DEFAULT_CLIENT_RECV_BUF;
  195|       |#endif
  196|      0|        }
  197|     69|    } else {
  198|      0|        size = 0;
  199|      0|    }
  200|       |
  201|    138|    DEBUGMSGTL(("socket:buffer", "Requested %s is %d\n",
  ------------------
  |  |   66|    138|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    138|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 138]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 138]
  |  |  ------------------
  ------------------
  202|    138|                (buftype) ? *buftype : "unknown buffer", size));
  203|       |
  204|    138|    return(size);
  205|    138|}
snmpSocketBaseDomain.c:_sock_buf_type_get:
  132|    138|{
  133|    138|    if (optname == SO_SNDBUF) {
  ------------------
  |  Branch (133:9): [True: 69, False: 69]
  ------------------
  134|     69|        if (local)
  ------------------
  |  Branch (134:13): [True: 69, False: 0]
  ------------------
  135|     69|            return "server send buffer";
  136|      0|        else
  137|      0|            return "client send buffer";
  138|     69|    } else if (optname == SO_RCVBUF) {
  ------------------
  |  Branch (138:16): [True: 69, False: 0]
  ------------------
  139|     69|        if (local)
  ------------------
  |  Branch (139:13): [True: 69, False: 0]
  ------------------
  140|     69|            return "server receive buffer";
  141|      0|        else
  142|      0|            return "client receive buffer";
  143|     69|    }
  144|       |
  145|      0|    return "unknown buffer";
  146|    138|}

netsnmp_tcp_ctor:
  347|     69|{
  348|     69|    tcpDomain.name = netsnmp_snmpTCPDomain;
  349|     69|    tcpDomain.name_length = OID_LENGTH(netsnmp_snmpTCPDomain);
  ------------------
  |  |   64|     69|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|     69|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
  350|     69|    tcpDomain.prefix = calloc(2, sizeof(char *));
  351|     69|    if (!tcpDomain.prefix) {
  ------------------
  |  Branch (351:9): [True: 0, False: 69]
  ------------------
  352|      0|        snmp_log(LOG_ERR, "calloc() failed - out of memory\n");
  353|      0|        return;
  354|      0|    }
  355|     69|    tcpDomain.prefix[0] = "tcp";
  356|       |
  357|     69|    tcpDomain.f_create_from_tstring_new = netsnmp_tcp_create_tstring;
  358|     69|    tcpDomain.f_create_from_ostring     = netsnmp_tcp_create_ostring;
  359|       |
  360|     69|    netsnmp_tdomain_register(&tcpDomain);
  361|     69|}

netsnmp_tcpipv6_ctor:
  365|     69|{
  366|     69|    tcp6Domain.name = netsnmp_TCPIPv6Domain;
  367|     69|    tcp6Domain.name_length = OID_LENGTH(netsnmp_TCPIPv6Domain);
  ------------------
  |  |   64|     69|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|     69|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
  368|     69|    tcp6Domain.f_create_from_tstring_new = netsnmp_tcp6_create_tstring;
  369|     69|    tcp6Domain.f_create_from_ostring     = netsnmp_tcp6_create_ostring;
  370|     69|    tcp6Domain.prefix = calloc(4, sizeof(char *));
  371|     69|    if (!tcp6Domain.prefix) {
  ------------------
  |  Branch (371:9): [True: 0, False: 69]
  ------------------
  372|      0|        snmp_log(LOG_ERR, "calloc() failed - out of memory\n");
  373|      0|        return;
  374|      0|    }
  375|     69|    tcp6Domain.prefix[0] = "tcp6";
  376|     69|    tcp6Domain.prefix[1] = "tcpv6";
  377|     69|    tcp6Domain.prefix[2] = "tcpipv6";
  378|       |
  379|     69|    netsnmp_tdomain_register(&tcp6Domain);
  380|     69|}

netsnmp_tlsbase_ctor:
  896|     69|netsnmp_tlsbase_ctor(void) {
  897|       |
  898|       |    /* bootstrap ssl since we'll need it */
  899|     69|    netsnmp_init_openssl();
  900|       |
  901|       |    /* the private client cert to authenticate with */
  902|     69|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "extraX509SubDir",
  ------------------
  |  |   78|     69|#define ASN_OCTET_STR	    0x04U
  ------------------
  903|     69|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  904|     69|                               NETSNMP_DS_LIB_CERT_EXTRA_SUBDIR);
  ------------------
  |  |  177|     69|#define NETSNMP_DS_LIB_CERT_EXTRA_SUBDIR 26
  ------------------
  905|       |
  906|       |    /* Do we have a CRL list? */
  907|     69|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "x509CRLFile",
  ------------------
  |  |   78|     69|#define ASN_OCTET_STR	    0x04U
  ------------------
  908|     69|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  909|     69|                               NETSNMP_DS_LIB_X509_CRL_FILE);
  ------------------
  |  |  179|     69|#define NETSNMP_DS_LIB_X509_CRL_FILE     28
  ------------------
  910|       |
  911|       |    /* What TLS algorithms should be use */
  912|     69|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "tlsAlgorithms",
  ------------------
  |  |   78|     69|#define ASN_OCTET_STR	    0x04U
  ------------------
  913|     69|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  914|     69|                               NETSNMP_DS_LIB_TLS_ALGORITMS);
  ------------------
  |  |  180|     69|#define NETSNMP_DS_LIB_TLS_ALGORITMS     29
  ------------------
  915|       |
  916|       |    /* What TLS version should be used at least */
  917|     69|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "tlsMinVersion",
  ------------------
  |  |   78|     69|#define ASN_OCTET_STR	    0x04U
  ------------------
  918|     69|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  919|     69|                               NETSNMP_DS_LIB_TLS_MIN_VERSION);
  ------------------
  |  |  187|     69|#define NETSNMP_DS_LIB_TLS_MIN_VERSION   36
  ------------------
  920|       |
  921|       |    /* What TLS version should be used at max */
  922|     69|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "tlsMaxVersion",
  ------------------
  |  |   78|     69|#define ASN_OCTET_STR	    0x04U
  ------------------
  923|     69|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  924|     69|                               NETSNMP_DS_LIB_TLS_MAX_VERSION);
  ------------------
  |  |  188|     69|#define NETSNMP_DS_LIB_TLS_MAX_VERSION   37
  ------------------
  925|       |
  926|       |    /*
  927|       |     * for the client
  928|       |     */
  929|       |
  930|       |    /* the public client cert to authenticate with */
  931|     69|    register_config_handler("snmp", "clientCert", _parse_client_cert, NULL,
  932|     69|                            NULL);
  933|       |
  934|       |    /*
  935|       |     * for the server
  936|       |     */
  937|       |
  938|       |    /* The X509 server key to use */
  939|     69|    register_config_handler("snmp", "serverCert", _parse_server_cert, NULL,
  940|     69|                            NULL);
  941|       |    /*
  942|       |     * remove cert config ambiguity: localCert, peerCert
  943|       |     */
  944|     69|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "localCert",
  ------------------
  |  |   78|     69|#define ASN_OCTET_STR	    0x04U
  ------------------
  945|     69|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  946|     69|                               NETSNMP_DS_LIB_TLS_LOCAL_CERT);
  ------------------
  |  |  181|     69|#define NETSNMP_DS_LIB_TLS_LOCAL_CERT    30
  ------------------
  947|     69|    netsnmp_ds_register_config(ASN_OCTET_STR, "snmp", "peerCert",
  ------------------
  |  |   78|     69|#define ASN_OCTET_STR	    0x04U
  ------------------
  948|     69|                               NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  949|     69|                               NETSNMP_DS_LIB_TLS_PEER_CERT);
  ------------------
  |  |  182|     69|#define NETSNMP_DS_LIB_TLS_PEER_CERT     31
  ------------------
  950|       |
  951|       |    /*
  952|       |     * register our boot-strapping needs
  953|       |     */
  954|     69|    snmp_register_callback(SNMP_CALLBACK_LIBRARY,
  ------------------
  |  |   18|     69|#define SNMP_CALLBACK_LIBRARY     0
  ------------------
  955|     69|			   SNMP_CALLBACK_POST_PREMIB_READ_CONFIG,
  ------------------
  |  |   27|     69|#define SNMP_CALLBACK_POST_PREMIB_READ_CONFIG	3
  ------------------
  956|     69|			   tls_bootstrap, NULL);
  957|       |
  958|     69|}
snmpTLSBaseDomain.c:tls_bootstrap:
  848|     69|tls_bootstrap(int majorid, int minorid, void *serverarg, void *clientarg) {
  849|     69|    char indexname[] = "_netsnmp_verify_info";
  850|       |
  851|       |    /* don't do this more than once */
  852|     69|    if (have_done_bootstrap)
  ------------------
  |  Branch (852:9): [True: 68, False: 1]
  ------------------
  853|     68|        return 0;
  854|      1|    have_done_bootstrap = 1;
  855|       |
  856|      1|    netsnmp_certs_load();
  857|       |
  858|      1|    openssl_local_index =
  859|      1|        SSL_get_ex_new_index(0, indexname, NULL, NULL, NULL);
  860|       |
  861|      1|    return 0;
  862|     69|}

netsnmp_tlstcp_ctor:
 1074|     69|{
 1075|     69|    DEBUGMSGTL(("tlstcp", "registering TLS constructor\n"));
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
 1076|       |
 1077|       |    /* config settings */
 1078|       |
 1079|     69|    tlstcpDomain.name = netsnmpTLSTCPDomain;
 1080|     69|    tlstcpDomain.name_length = netsnmpTLSTCPDomain_len;
 1081|     69|    tlstcpDomain.prefix = calloc(3, sizeof(char *));
 1082|     69|    if (!tlstcpDomain.prefix) {
  ------------------
  |  Branch (1082:9): [True: 0, False: 69]
  ------------------
 1083|      0|        snmp_log(LOG_ERR, "calloc() failed - out of memory\n");
 1084|      0|        return;
 1085|      0|    }
 1086|     69|    tlstcpDomain.prefix[0] = "tlstcp";
 1087|     69|    tlstcpDomain.prefix[1] = "tls";
 1088|       |
 1089|     69|    tlstcpDomain.f_create_from_tstring_new = netsnmp_tlstcp_create_tstring;
 1090|     69|    tlstcpDomain.f_create_from_ostring     = netsnmp_tlstcp_create_ostring;
 1091|       |
 1092|     69|    netsnmp_tdomain_register(&tlstcpDomain);
 1093|     69|}

_netsnmp_udp_sockopt_set:
   69|     69|{
   70|     69|#ifdef  SO_BSDCOMPAT
   71|       |    /*
   72|       |     * Patch for Linux.  Without this, UDP packets that fail get an ICMP
   73|       |     * response.  Linux turns the failed ICMP response into an error message
   74|       |     * and return value, unlike all other OS's.  
   75|       |     */
   76|     69|    if (0 == netsnmp_os_prematch("Linux","2.4"))
  ------------------
  |  Branch (76:9): [True: 0, False: 69]
  ------------------
   77|      0|    {
   78|      0|        int             one = 1;
   79|      0|        DEBUGMSGTL(("socket:option", "setting socket option SO_BSDCOMPAT\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
   80|      0|        setsockopt(fd, SOL_SOCKET, SO_BSDCOMPAT, (void *) &one,
   81|      0|                   sizeof(one));
   82|      0|    }
   83|     69|#endif                          /*SO_BSDCOMPAT */
   84|       |    /*
   85|       |     * SO_REUSEADDR will allow multiple apps to open the same port at
   86|       |     * the same time. Only the last one to open the socket will get
   87|       |     * data. Obviously, for an agent, this is a bad thing. There should
   88|       |     * only be one listener.
   89|       |     */
   90|       |#ifdef ALLOW_PORT_HIJACKING
   91|       |#ifdef  SO_REUSEADDR
   92|       |    /*
   93|       |     * Allow the same port to be specified multiple times without failing.
   94|       |     *    (useful for a listener)
   95|       |     */
   96|       |    {
   97|       |        int             one = 1;
   98|       |        DEBUGMSGTL(("socket:option", "setting socket option SO_REUSEADDR\n"));
   99|       |        setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void *) &one,
  100|       |                   sizeof(one));
  101|       |    }
  102|       |#endif                          /*SO_REUSEADDR */
  103|       |#endif
  104|       |
  105|       |    /*
  106|       |     * Try to set the send and receive buffers to a reasonably large value, so
  107|       |     * that we can send and receive big PDUs (defaults to 8192 bytes (!) on
  108|       |     * Solaris, for instance).  Don't worry too much about errors -- just
  109|       |     * plough on regardless.  
  110|       |     */
  111|     69|    netsnmp_sock_buffer_set(fd, SO_SNDBUF, local, 0);
  112|       |    netsnmp_sock_buffer_set(fd, SO_RCVBUF, local, 0);
  113|     69|}
netsnmp_udpbase_recvfrom:
  144|     68|{
  145|     68|    int r;
  146|     68|#if !defined(WIN32)
  147|     68|    struct iovec iov;
  148|     68|    char cmsg[CMSG_SPACE(cmsg_data_size)];
  149|     68|    struct cmsghdr *cm;
  150|     68|    struct msghdr msg;
  151|       |
  152|     68|    iov.iov_base = buf;
  153|     68|    iov.iov_len = len;
  154|       |
  155|     68|    memset(&msg, 0, sizeof msg);
  156|     68|    msg.msg_name = from;
  157|     68|    msg.msg_namelen = *fromlen;
  158|     68|    msg.msg_iov = &iov;
  159|     68|    msg.msg_iovlen = 1;
  160|     68|    msg.msg_control = &cmsg;
  161|     68|    msg.msg_controllen = sizeof(cmsg);
  162|       |
  163|     68|    r = recvmsg(s, &msg, MSG_DONTWAIT);
  164|       |#else /* !defined(WIN32) */
  165|       |    WSABUF wsabuf;
  166|       |    char cmsg[WSA_CMSG_SPACE(sizeof(struct in_pktinfo))];
  167|       |    WSACMSGHDR *cm;
  168|       |    WSAMSG msg;
  169|       |    DWORD bytes_received;
  170|       |
  171|       |    wsabuf.buf = buf;
  172|       |    wsabuf.len = len;
  173|       |
  174|       |    msg.name = from;
  175|       |    msg.namelen = *fromlen;
  176|       |    msg.lpBuffers = &wsabuf;
  177|       |    msg.dwBufferCount = 1;
  178|       |    msg.Control.len = sizeof(cmsg);
  179|       |    msg.Control.buf = cmsg;
  180|       |    msg.dwFlags = 0;
  181|       |
  182|       |    if (pfWSARecvMsg) {
  183|       |        r = pfWSARecvMsg(s, &msg, &bytes_received, NULL, NULL) == 0 ?
  184|       |            bytes_received : -1;
  185|       |        *fromlen = msg.namelen;
  186|       |    } else {
  187|       |        r = recvfrom(s, buf, len, MSG_DONTWAIT, from, fromlen);
  188|       |    }
  189|       |#endif /* !defined(WIN32) */
  190|       |
  191|     68|    if (r == -1) {
  ------------------
  |  Branch (191:9): [True: 0, False: 68]
  ------------------
  192|      0|        return -1;
  193|      0|    }
  194|       |
  195|     68|    DEBUGMSGTL(("udpbase:recv", "got source addr: %s\n",
  ------------------
  |  |   66|     68|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     68|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 68]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 68]
  |  |  ------------------
  ------------------
  196|     68|                inet_ntoa(((struct sockaddr_in *)from)->sin_addr)));
  197|       |
  198|     68|    {
  199|       |        /* Get the local port number for use in diagnostic messages */
  200|     68|        int r2 = getsockname(s, dstip, dstlen);
  201|     68|        netsnmp_assert(r2 == 0);
  ------------------
  |  |   47|     68|#      define netsnmp_assert(x)  do { \
  |  |   48|     68|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 68, False: 0]
  |  |  ------------------
  |  |   49|     68|                 ; \
  |  |   50|     68|              else \
  |  |   51|     68|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|     68|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 68]
  |  |  ------------------
  ------------------
  202|     68|    }
  203|       |
  204|     68|#if !defined(WIN32)
  205|    136|    for (cm = CMSG_FIRSTHDR(&msg); cm != NULL; cm = CMSG_NXTHDR(&msg, cm)) {
  ------------------
  |  Branch (205:15): [True: 68, False: 0]
  |  Branch (205:36): [True: 68, False: 68]
  ------------------
  206|     68|#if defined(HAVE_IP_PKTINFO)
  207|     68|        if (cm->cmsg_level == SOL_IP && cm->cmsg_type == IP_PKTINFO) {
  ------------------
  |  Branch (207:13): [True: 68, False: 0]
  |  Branch (207:41): [True: 68, False: 0]
  ------------------
  208|     68|            struct in_pktinfo* src = (struct in_pktinfo *)CMSG_DATA(cm);
  209|     68|            netsnmp_assert(dstip->sa_family == AF_INET);
  ------------------
  |  |   47|     68|#      define netsnmp_assert(x)  do { \
  |  |   48|     68|              if ( x ) \
  |  |  ------------------
  |  |  |  Branch (48:20): [True: 68, False: 0]
  |  |  ------------------
  |  |   49|     68|                 ; \
  |  |   50|     68|              else \
  |  |   51|     68|                 snmp_log(LOG_ERR, \
  |  |   52|      0|                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
  |  |  ------------------
  |  |  |  |   40|      0|#          define NETSNMP_FUNC_FMT " %s()\n"
  |  |  ------------------
  |  |   53|      0|                          __STRING(x),__FILE__,__LINE__, \
  |  |   54|      0|                          NETSNMP_FUNC_PARAM); \
  |  |  ------------------
  |  |  |  |   41|      0|#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
  |  |  |  |  ------------------
  |  |  |  |  |  | 1699|      0|#define NETSNMP_FUNCTION __func__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   55|     68|           }while(0)
  |  |  ------------------
  |  |  |  Branch (55:19): [Folded, False: 68]
  |  |  ------------------
  ------------------
  210|     68|            ((struct sockaddr_in*)dstip)->sin_addr = src->ipi_addr;
  211|     68|            *if_index = src->ipi_ifindex;
  212|     68|            DEBUGMSGTL(("udpbase:recv",
  ------------------
  |  |   66|     68|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     68|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 68]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 68]
  |  |  ------------------
  ------------------
  213|     68|                        "got destination (local) addr %s, iface %d\n",
  214|     68|                        inet_ntoa(src->ipi_addr), *if_index));
  215|     68|        }
  216|       |#elif defined(HAVE_IP_RECVDSTADDR)
  217|       |        if (cm->cmsg_level == IPPROTO_IP && cm->cmsg_type == IP_RECVDSTADDR) {
  218|       |            struct in_addr* src = (struct in_addr *)CMSG_DATA(cm);
  219|       |            ((struct sockaddr_in*)dstip)->sin_addr = *src;
  220|       |            DEBUGMSGTL(("netsnmp_udp", "got destination (local) addr %s\n",
  221|       |                        inet_ntoa(*src)));
  222|       |        }
  223|       |#endif
  224|     68|    }
  225|       |#else /* !defined(WIN32) */
  226|       |    for (cm = WSA_CMSG_FIRSTHDR(&msg); cm; cm = WSA_CMSG_NXTHDR(&msg, cm)) {
  227|       |        if (cm->cmsg_level == IPPROTO_IP && cm->cmsg_type == IP_PKTINFO) {
  228|       |            struct in_pktinfo* src = (struct in_pktinfo *)WSA_CMSG_DATA(cm);
  229|       |            netsnmp_assert(dstip->sa_family == AF_INET);
  230|       |            ((struct sockaddr_in*)dstip)->sin_addr = src->ipi_addr;
  231|       |            *if_index = src->ipi_ifindex;
  232|       |            DEBUGMSGTL(("udpbase:recv",
  233|       |                        "got destination (local) addr %s, iface %d\n",
  234|       |                        inet_ntoa(src->ipi_addr), *if_index));
  235|       |        }
  236|       |    }
  237|       |#endif /* !defined(WIN32) */
  238|     68|    return r;
  239|     68|}
netsnmp_udpbase_sendto_unix:
  245|      4|{
  246|      4|    struct iovec iov;
  247|      4|    struct msghdr m = { NULL };
  248|      4|    char          cmsg[CMSG_SPACE(cmsg_data_size)];
  249|      4|    int           rc;
  250|      4|    char          iface[IFNAMSIZ];
  251|      4|    socklen_t     ifacelen = IFNAMSIZ;
  252|       |
  253|      4|    iov.iov_base = NETSNMP_REMOVE_CONST(void *, data);
  ------------------
  |  |   91|      4|    (__extension__ ({ const t tmp = (e); (t)(size_t)tmp; }))
  ------------------
  254|      4|    iov.iov_len  = len;
  255|       |
  256|      4|    m.msg_name		= NETSNMP_REMOVE_CONST(void *, remote);
  ------------------
  |  |   91|      4|    (__extension__ ({ const t tmp = (e); (t)(size_t)tmp; }))
  ------------------
  257|      4|    m.msg_namelen	= sizeof(struct sockaddr_in);
  258|      4|    m.msg_iov		= &iov;
  259|      4|    m.msg_iovlen	= 1;
  260|      4|    m.msg_flags		= 0;
  261|       |
  262|      4|    if (srcip && srcip->s_addr != INADDR_ANY) {
  ------------------
  |  Branch (262:9): [True: 4, False: 0]
  |  Branch (262:18): [True: 4, False: 0]
  ------------------
  263|      4|        struct cmsghdr *cm;
  264|      4|        struct in_pktinfo ipi;
  265|      4|        int use_sendto = FALSE;
  ------------------
  |  |  125|      4|#define FALSE 0
  ------------------
  266|       |
  267|      4|        memset(cmsg, 0, sizeof(cmsg));
  268|       |
  269|      4|        m.msg_control    = &cmsg;
  270|      4|        m.msg_controllen = sizeof(cmsg);
  271|       |
  272|      4|        cm = CMSG_FIRSTHDR(&m);
  ------------------
  |  Branch (272:14): [True: 4, False: 0]
  ------------------
  273|      4|        cm->cmsg_len = CMSG_LEN(cmsg_data_size);
  274|       |
  275|      4|#if defined(HAVE_IP_PKTINFO)
  276|      4|        cm->cmsg_level = SOL_IP;
  277|      4|        cm->cmsg_type = IP_PKTINFO;
  278|       |
  279|      4|        memset(&ipi, 0, sizeof(ipi));
  280|      4|#ifdef HAVE_SO_BINDTODEVICE
  281|       |        /*
  282|       |         * For asymmetric multihomed users, we only set ifindex to 0 to
  283|       |         * let kernel handle return if there was no iface bound to the
  284|       |         * socket.
  285|       |         */
  286|      4|        if (getsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, iface,
  ------------------
  |  Branch (286:13): [True: 0, False: 4]
  ------------------
  287|      4|                       &ifacelen) != 0)  {
  288|      0|            DEBUGMSGTL(("udpbase:sendto",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  289|      0|                        "getsockopt SO_BINDTODEVICE failed: %s\n",
  290|      0|                        strerror(errno)));
  291|      4|        } else if (ifacelen == 0) {
  ------------------
  |  Branch (291:20): [True: 4, False: 0]
  ------------------
  292|      4|            DEBUGMSGTL(("udpbase:sendto",
  ------------------
  |  |   66|      4|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 4]
  |  |  ------------------
  ------------------
  293|      4|                        "sendto: SO_BINDTODEVICE not set\n"));
  294|      4|        } else {
  295|      0|            DEBUGMSGTL(("udpbase:sendto",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  296|      0|                        "sendto: SO_BINDTODEVICE dev=%s using ifindex=%d\n",
  297|      0|                        iface, if_index));
  298|      0|            use_sendto = TRUE;
  ------------------
  |  |  128|      0|#define TRUE  1
  ------------------
  299|      0|        }
  300|      4|#endif /* HAVE_SO_BINDTODEVICE */
  301|       |
  302|      4|#ifdef HAVE_STRUCT_IN_PKTINFO_IPI_SPEC_DST
  303|      4|        DEBUGMSGTL(("udpbase:sendto", "sending from %s\n",
  ------------------
  |  |   66|      4|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      4|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 4]
  |  |  ------------------
  ------------------
  304|      4|                    inet_ntoa(*srcip)));
  305|      4|        ipi.ipi_spec_dst.s_addr = srcip->s_addr;
  306|       |#else
  307|       |        DEBUGMSGTL(("udpbase:sendto", "ignoring from address %s\n",
  308|       |                    inet_ntoa(*srcip)));
  309|       |#endif
  310|      4|        memcpy(CMSG_DATA(cm), &ipi, sizeof(ipi));
  311|       |
  312|       |        /*
  313|       |         * For Linux and VRF, use sendto() instead of sendmsg(). Do not pass a
  314|       |         * cmsg with IP_PKTINFO set because that would override the bind to
  315|       |         * VRF which is set by 'vrf exec' command. That would break VRF.
  316|       |         */
  317|      4|        if (use_sendto)
  ------------------
  |  Branch (317:13): [True: 0, False: 4]
  ------------------
  318|      0|            rc = sendto(fd, data, len, MSG_DONTWAIT, remote,
  319|      0|                        sizeof(struct sockaddr));
  320|      4|        else
  321|      4|            rc = sendmsg(fd, &m, MSG_DONTWAIT);
  322|      4|        if (rc >= 0 || (errno != EINVAL && errno != ENETUNREACH))
  ------------------
  |  Branch (322:13): [True: 4, False: 0]
  |  Branch (322:25): [True: 0, False: 0]
  |  Branch (322:44): [True: 0, False: 0]
  ------------------
  323|      4|            return rc;
  324|       |
  325|       |        /*
  326|       |         * The error might be caused by broadcast srcip (i.e. we're responding
  327|       |         * to a broadcast request) - sendmsg does not like it. Try to resend it
  328|       |         * using the interface on which it was received
  329|       |         */
  330|       |
  331|      0|        DEBUGMSGTL(("udpbase:sendto", "re-sending on iface %d\n", if_index));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  332|       |
  333|      0|        {
  334|      0|            struct in_pktinfo ipi;
  335|       |
  336|      0|            memset(&ipi, 0, sizeof(ipi));
  337|      0|            ipi.ipi_ifindex = if_index;
  338|      0|#ifdef HAVE_STRUCT_IN_PKTINFO_IPI_SPEC_DST
  339|      0|            ipi.ipi_spec_dst.s_addr = INADDR_ANY;
  340|      0|#endif
  341|      0|            memcpy(CMSG_DATA(cm), &ipi, sizeof(ipi));
  342|      0|        }
  343|       |#elif defined(HAVE_IP_SENDSRCADDR)
  344|       |        cm->cmsg_level = IPPROTO_IP;
  345|       |        cm->cmsg_type = IP_SENDSRCADDR;
  346|       |        memcpy((struct in_addr *)CMSG_DATA(cm), srcip, sizeof(struct in_addr));
  347|       |#endif
  348|      0|        rc = sendmsg(fd, &m, MSG_DONTWAIT);
  349|      0|        if (rc >= 0 || errno != EINVAL)
  ------------------
  |  Branch (349:13): [True: 0, False: 0]
  |  Branch (349:24): [True: 0, False: 0]
  ------------------
  350|      0|            return rc;
  351|       |
  352|      0|        DEBUGMSGTL(("udpbase:sendto", "re-sending without source address\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  353|      0|        m.msg_control = NULL;
  354|      0|        m.msg_controllen = 0;
  355|      0|    }
  356|       |
  357|      0|    return sendmsg(fd, &m, MSG_DONTWAIT);
  358|      4|}
netsnmp_udpbase_sendto:
  416|      4|{
  417|      4|#if !defined(WIN32)
  418|      4|    return netsnmp_udpbase_sendto_unix(fd, srcip, if_index, remote, data, len);
  419|       |#else /* !defined(WIN32) */
  420|       |    return netsnmp_udpbase_sendto_win32(fd, srcip, if_index, remote, data, len);
  421|       |#endif /* !defined(WIN32) */
  422|      4|}
netsnmp_udpbase_recv:
  434|     68|{
  435|     68|    int             rc = -1;
  436|     68|    socklen_t       fromlen = sizeof(netsnmp_sockaddr_storage);
  437|     68|    netsnmp_indexed_addr_pair *addr_pair = NULL;
  438|     68|    struct sockaddr *from;
  439|       |
  440|     68|    if (t != NULL && t->sock >= 0) {
  ------------------
  |  Branch (440:9): [True: 68, False: 0]
  |  Branch (440:22): [True: 68, False: 0]
  ------------------
  441|     68|        addr_pair = SNMP_MALLOC_TYPEDEF(netsnmp_indexed_addr_pair);
  ------------------
  |  |   73|     68|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
  442|     68|        if (addr_pair == NULL) {
  ------------------
  |  Branch (442:13): [True: 0, False: 68]
  ------------------
  443|      0|            *opaque = NULL;
  444|      0|            *olength = 0;
  445|      0|            return -1;
  446|      0|        } else
  447|     68|            from = &addr_pair->remote_addr.sa;
  448|       |
  449|    136|	while (rc < 0) {
  ------------------
  |  Branch (449:9): [True: 68, False: 68]
  ------------------
  450|     68|#ifdef netsnmp_udpbase_recvfrom_sendto_defined
  451|     68|            socklen_t local_addr_len = sizeof(addr_pair->local_addr);
  452|     68|            rc = netsnmp_udp_recvfrom(t->sock, buf, size, from, &fromlen,
  453|     68|                                      &addr_pair->local_addr.sa,
  454|     68|                                      &local_addr_len, &(addr_pair->if_index));
  455|       |#else
  456|       |            rc = recvfrom(t->sock, buf, size, MSG_DONTWAIT, from, &fromlen);
  457|       |#endif /* netsnmp_udpbase_recvfrom_sendto_defined */
  458|     68|	    if (rc < 0 && errno != EINTR) {
  ------------------
  |  Branch (458:10): [True: 0, False: 68]
  |  Branch (458:20): [True: 0, False: 0]
  ------------------
  459|      0|		break;
  460|      0|	    }
  461|     68|	}
  462|       |
  463|     68|        if (rc >= 0) {
  ------------------
  |  Branch (463:13): [True: 68, False: 0]
  ------------------
  464|     68|            DEBUGIF("netsnmp_udp") {
  ------------------
  |  |  145|     68|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|    136|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 68]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (145:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  465|      0|                char *str = netsnmp_udp_fmtaddr(
  466|      0|                    NULL, addr_pair, sizeof(netsnmp_indexed_addr_pair));
  467|      0|                DEBUGMSGTL(("netsnmp_udp",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  468|      0|                            "recvfrom fd %d got %d bytes (from %s)\n",
  469|      0|                            t->sock, rc, str));
  470|      0|                free(str);
  471|      0|            }
  472|     68|        } else {
  473|      0|            DEBUGMSGTL(("netsnmp_udp", "recvfrom fd %d err %d (\"%s\")\n",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  474|      0|                        t->sock, errno, strerror(errno)));
  475|      0|        }
  476|     68|        *opaque = (void *)addr_pair;
  477|     68|        *olength = sizeof(netsnmp_indexed_addr_pair);
  478|     68|    }
  479|     68|    return rc;
  480|     68|}
netsnmp_udpbase_send:
  487|      4|{
  488|      4|    int rc = -1;
  489|      4|    const netsnmp_indexed_addr_pair *addr_pair = NULL;
  490|      4|    const struct sockaddr *to = NULL;
  491|       |
  492|      4|    if (opaque != NULL && *opaque != NULL && NULL != olength &&
  ------------------
  |  Branch (492:9): [True: 4, False: 0]
  |  Branch (492:27): [True: 4, False: 0]
  |  Branch (492:46): [True: 4, False: 0]
  ------------------
  493|      4|        ((*olength == sizeof(netsnmp_indexed_addr_pair) ||
  ------------------
  |  Branch (493:11): [True: 4, False: 0]
  ------------------
  494|      4|          (*olength == sizeof(struct sockaddr_in))))) {
  ------------------
  |  Branch (494:11): [True: 0, False: 0]
  ------------------
  495|      4|        addr_pair = (const netsnmp_indexed_addr_pair *) (*opaque);
  496|      4|    } else if (t != NULL && t->data != NULL &&
  ------------------
  |  Branch (496:16): [True: 0, False: 0]
  |  Branch (496:29): [True: 0, False: 0]
  ------------------
  497|      0|                t->data_length == sizeof(netsnmp_indexed_addr_pair)) {
  ------------------
  |  Branch (497:17): [True: 0, False: 0]
  ------------------
  498|      0|        addr_pair = (netsnmp_indexed_addr_pair *) (t->data);
  499|      0|    } else {
  500|      0|        int len = -1;
  501|      0|        if (opaque != NULL && *opaque != NULL && NULL != olength)
  ------------------
  |  Branch (501:13): [True: 0, False: 0]
  |  Branch (501:31): [True: 0, False: 0]
  |  Branch (501:50): [True: 0, False: 0]
  ------------------
  502|      0|            len = *olength;
  503|      0|        else if (t != NULL && t->data != NULL)
  ------------------
  |  Branch (503:18): [True: 0, False: 0]
  |  Branch (503:31): [True: 0, False: 0]
  ------------------
  504|      0|            len = t->data_length;
  505|      0|        snmp_log(LOG_ERR, "unknown addr type of size %d\n", len);
  506|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  507|      0|    }
  508|       |
  509|      4|    to = &addr_pair->remote_addr.sa;
  510|       |
  511|      4|    if (to != NULL && t != NULL && t->sock >= 0) {
  ------------------
  |  Branch (511:9): [True: 4, False: 0]
  |  Branch (511:23): [True: 4, False: 0]
  |  Branch (511:36): [True: 4, False: 0]
  ------------------
  512|      4|        DEBUGIF("netsnmp_udp") {
  ------------------
  |  |  145|      4|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|      8|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (145:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  513|      0|            char *str = netsnmp_udp_fmtaddr(NULL, addr_pair,
  514|      0|                                            sizeof(netsnmp_indexed_addr_pair));
  515|      0|            DEBUGMSGTL(("netsnmp_udp", "send %d bytes from %p to %s on fd %d\n",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  516|      0|                        size, buf, str, t->sock));
  517|      0|            free(str);
  518|      0|        }
  519|      8|	while (rc < 0) {
  ------------------
  |  Branch (519:9): [True: 4, False: 4]
  ------------------
  520|      4|#ifdef netsnmp_udpbase_recvfrom_sendto_defined
  521|      4|            rc = netsnmp_udp_sendto(t->sock,
  522|      4|                    addr_pair ? &(addr_pair->local_addr.sin.sin_addr) : NULL,
  ------------------
  |  Branch (522:21): [True: 4, False: 0]
  ------------------
  523|      4|                    addr_pair ? addr_pair->if_index : 0, to, buf, size);
  ------------------
  |  Branch (523:21): [True: 4, False: 0]
  ------------------
  524|       |#else
  525|       |            rc = sendto(t->sock, buf, size, 0, to, sizeof(struct sockaddr));
  526|       |#endif /* netsnmp_udpbase_recvfrom_sendto_defined */
  527|      4|	    if (rc < 0 && errno != EINTR) {
  ------------------
  |  Branch (527:10): [True: 0, False: 4]
  |  Branch (527:20): [True: 0, False: 0]
  ------------------
  528|      0|                DEBUGMSGTL(("netsnmp_udp", "sendto error, rc %d (errno %d)\n",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  529|      0|                            rc, errno));
  530|      0|		break;
  531|      0|	    }
  532|      4|	}
  533|      4|    }
  534|      4|    return rc;
  535|      4|}

netsnmp_udp_recvfrom:
  156|     68|{
  157|       |    /** udpipv4 just calls udpbase. should we skip directly to there? */
  158|     68|    return netsnmp_udpipv4_recvfrom(s, buf, len, from, fromlen, dstip, dstlen,
  159|     68|                                    if_index);
  160|     68|}
netsnmp_udp_sendto:
  164|      4|{
  165|       |    /** udpipv4 just calls udpbase. should we skip directly to there? */
  166|      4|    return netsnmp_udpipv4_sendto(fd, srcip, if_index, remote, data, len);
  167|      4|}
netsnmp_udp_create_tspec:
  683|     69|{
  684|     69|    netsnmp_transport *t = netsnmp_udpipv4base_tspec_transport(tspec);
  685|     69|    if (NULL != t) {
  ------------------
  |  Branch (685:9): [True: 69, False: 0]
  ------------------
  686|     69|        netsnmp_udp_transport_base(t);
  687|     69|    }
  688|     69|    return t;
  689|       |
  690|     69|}
netsnmp_udp_ctor:
  706|     69|{
  707|     69|    udpDomain.name = netsnmpUDPDomain;
  708|     69|    udpDomain.name_length = netsnmpUDPDomain_len;
  709|     69|    udpDomain.prefix = calloc(2, sizeof(char *));
  710|     69|    if (!udpDomain.prefix) {
  ------------------
  |  Branch (710:9): [True: 0, False: 69]
  ------------------
  711|      0|        snmp_log(LOG_ERR, "calloc() failed - out of memory\n");
  712|      0|        return;
  713|      0|    }
  714|     69|    udpDomain.prefix[0] = "udp";
  715|       |
  716|     69|    udpDomain.f_create_from_tstring_new = netsnmp_udp_create_tstring;
  717|     69|    udpDomain.f_create_from_tspec       = netsnmp_udp_create_tspec;
  718|     69|    udpDomain.f_create_from_ostring     = netsnmp_udp_create_ostring;
  719|       |
  720|     69|    netsnmp_tdomain_register(&udpDomain);
  721|     69|}
snmpUDPDomain.c:netsnmp_udp_transport_base:
  176|     69|{
  177|     69|    if (NULL == t) {
  ------------------
  |  Branch (177:9): [True: 0, False: 69]
  ------------------
  178|      0|        return NULL;
  179|      0|    }
  180|       |
  181|       |    /*
  182|       |     * Set Domain
  183|       |     */
  184|       |
  185|     69|    t->domain = netsnmpUDPDomain;
  186|     69|    t->domain_length = netsnmpUDPDomain_len;
  187|       |
  188|       |    /*
  189|       |     * 16-bit length field, 8 byte UDP header, 20 byte IPv4 header  
  190|       |     */
  191|       |
  192|     69|    t->msgMaxSize = 0xffff - 8 - 20;
  193|     69|    t->f_recv     = netsnmp_udpbase_recv;
  194|     69|    t->f_send     = netsnmp_udpbase_send;
  195|     69|    t->f_close    = netsnmp_socketbase_close;
  196|     69|    t->f_accept   = NULL;
  197|     69|    t->f_setup_session = netsnmp_ipbase_session_init;
  198|     69|    t->f_fmtaddr  = netsnmp_udp_fmtaddr;
  199|     69|    t->f_get_taddr = netsnmp_ipv4_get_taddr;
  200|       |
  201|     69|    return t;
  202|     69|}

netsnmp_udpipv4_recvfrom:
   62|     68|{
   63|     68|    return netsnmp_udpbase_recvfrom(s, buf, len, from, fromlen, dstip, dstlen,
   64|     68|                                    if_index);
   65|     68|}
netsnmp_udpipv4_sendto:
   70|      4|{
   71|      4|    return netsnmp_udpbase_sendto(fd, srcip, if_index, remote, data, len);
   72|      4|}
netsnmp_udpipv4base_transport_init:
   77|     69|{
   78|     69|    netsnmp_transport *t;
   79|     69|    const struct sockaddr_in *addr = &ep->a.sin;
   80|     69|    u_char *addr_ptr;
   81|       |
   82|     69|    if (addr == NULL || addr->sin_family != AF_INET) {
  ------------------
  |  Branch (82:9): [True: 0, False: 69]
  |  Branch (82:25): [True: 0, False: 69]
  ------------------
   83|      0|        return NULL;
   84|      0|    }
   85|       |
   86|     69|    t = SNMP_MALLOC_TYPEDEF(netsnmp_transport);
  ------------------
  |  |   73|     69|#define SNMP_MALLOC_TYPEDEF(td)  (td *) calloc(1, sizeof(td))
  ------------------
   87|     69|    if (NULL == t)
  ------------------
  |  Branch (87:9): [True: 0, False: 69]
  ------------------
   88|      0|        return NULL;
   89|       |
   90|     69|    t->sock = -1;
   91|       |
   92|     69|    addr_ptr = netsnmp_memdup(addr, sizeof(*addr));
   93|     69|    if (NULL == addr_ptr) {
  ------------------
  |  Branch (93:9): [True: 0, False: 69]
  ------------------
   94|      0|        free(t);
   95|      0|        return NULL;
   96|      0|    }
   97|       |
   98|     69|    if (local) {
  ------------------
  |  Branch (98:9): [True: 69, False: 0]
  ------------------
   99|       |        /** This is a server session. */
  100|     69|        t->local_length = sizeof(*addr);
  101|     69|        t->local = addr_ptr;
  102|     69|    } else {
  103|       |        /** This is a client session. */
  104|      0|        t->remote = addr_ptr;
  105|      0|        t->remote_length = sizeof(*addr);
  106|      0|    }
  107|       |
  108|     69|    DEBUGIF("netsnmp_udpbase") {
  ------------------
  |  |  145|     69|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|    138|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (145:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  109|      0|        netsnmp_indexed_addr_pair addr_pair;
  110|      0|        char                      *str;
  111|      0|        memset(&addr_pair, 0, sizeof(netsnmp_indexed_addr_pair));
  112|      0|        memcpy(&(addr_pair.remote_addr), addr, sizeof(*addr));
  113|      0|        str = netsnmp_udp_fmtaddr(NULL, (void *)&addr_pair,
  114|      0|                                  sizeof(netsnmp_indexed_addr_pair));
  115|      0|        DEBUGMSGTL(("netsnmp_udpbase", "open %s %s\n",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (164:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (164:64): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  116|      0|                    local ? "local" : "remote", str));
  117|      0|        free(str);
  118|      0|    }
  119|       |
  120|     69|    if (!local) {
  ------------------
  |  Branch (120:9): [True: 0, False: 69]
  ------------------
  121|      0|        netsnmp_indexed_addr_pair *addr_pair;
  122|       |
  123|       |        /*
  124|       |         * allocate space to save the (remote) address in the
  125|       |         * transport-specific data pointer for later use by netsnmp_udp_send.
  126|       |         */
  127|      0|        t->data = calloc(1, sizeof(netsnmp_indexed_addr_pair));
  128|      0|        if (NULL == t->data) {
  ------------------
  |  Branch (128:13): [True: 0, False: 0]
  ------------------
  129|      0|            netsnmp_transport_free(t);
  130|      0|            return NULL;
  131|      0|        }
  132|      0|        t->data_length = sizeof(netsnmp_indexed_addr_pair);
  133|       |
  134|      0|        addr_pair = (netsnmp_indexed_addr_pair *)t->data;
  135|      0|        memcpy(&addr_pair->remote_addr, addr, sizeof(*addr));
  136|      0|    }
  137|     69|    return t;
  138|     69|}
netsnmp_udpipv4base_transport_socket:
  142|     69|{
  143|     69|    int local = flags & NETSNMP_TSPEC_LOCAL;
  ------------------
  |  |  117|     69|#define NETSNMP_TSPEC_LOCAL                     0x01 /* 1=server, 0=client */
  ------------------
  144|     69|    int sock = socket(PF_INET, SOCK_DGRAM, 0);
  145|       |
  146|     69|    DEBUGMSGTL(("UDPBase", "opened socket %d as local=%d\n", sock, local));
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
  147|     69|    if (sock < 0)
  ------------------
  |  Branch (147:9): [True: 0, False: 69]
  ------------------
  148|      0|        return -1;
  149|       |
  150|     69|    _netsnmp_udp_sockopt_set(sock, local);
  151|       |
  152|     69|    return sock;
  153|     69|}
netsnmp_udpipv4base_transport_bind:
  158|     69|{
  159|     69|    const struct sockaddr_in *addr = &ep->a.sin;
  160|     69|#if defined(HAVE_IP_PKTINFO) || defined(HAVE_IP_RECVDSTADDR) || defined(WIN32)
  161|     69|    int                sockopt = 1;
  162|     69|#endif
  163|     69|    int                rc;
  164|       |
  165|     69|    if (flags & NETSNMP_TSPEC_LOCAL) {
  ------------------
  |  |  117|     69|#define NETSNMP_TSPEC_LOCAL                     0x01 /* 1=server, 0=client */
  ------------------
  |  Branch (165:9): [True: 69, False: 0]
  ------------------
  166|       |#ifdef NETSNMP_NO_LISTEN_SUPPORT
  167|       |        return NULL;
  168|       |#endif /* NETSNMP_NO_LISTEN_SUPPORT */
  169|     69|#if defined(HAVE_IP_PKTINFO) && !defined(WIN32)
  170|     69|        if (setsockopt(t->sock, SOL_IP, IP_PKTINFO, &sockopt, sizeof sockopt) == -1) {
  ------------------
  |  Branch (170:13): [True: 0, False: 69]
  ------------------
  171|      0|            DEBUGMSGTL(("netsnmp_udpbase", "couldn't set IP_PKTINFO: %s\n",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  172|      0|                        strerror(errno)));
  173|      0|            return 1;
  174|      0|        }
  175|     69|        DEBUGMSGTL(("netsnmp_udpbase", "set IP_PKTINFO\n"));
  ------------------
  |  |   66|     69|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|     69|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 69]
  |  |  ------------------
  ------------------
  176|       |#elif defined(HAVE_IP_RECVDSTADDR)
  177|       |        if (setsockopt(t->sock, IPPROTO_IP, IP_RECVDSTADDR, &sockopt, sizeof sockopt) == -1) {
  178|       |            DEBUGMSGTL(("netsnmp_udp", "couldn't set IP_RECVDSTADDR: %s\n",
  179|       |                        strerror(errno)));
  180|       |            return 1;
  181|       |        }
  182|       |        DEBUGMSGTL(("netsnmp_udp", "set IP_RECVDSTADDR\n"));
  183|       |#elif defined(WIN32)
  184|       |        if (setsockopt(t->sock, IPPROTO_IP, IP_PKTINFO, (void *)&sockopt,
  185|       |                       sizeof(sockopt)) == -1) {
  186|       |            DEBUGMSGTL(("netsnmp_udpbase", "couldn't set IP_PKTINFO: %d\n",
  187|       |                        WSAGetLastError()));
  188|       |        } else {
  189|       |            DEBUGMSGTL(("netsnmp_udpbase", "set IP_PKTINFO\n"));
  190|       |        }
  191|       |#endif
  192|     69|    }
  193|       |
  194|     69|    DEBUGIF("netsnmp_udpbase") {
  ------------------
  |  |  145|     69|#define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  144|    138|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGIF(x)         if (_DBG_IF_ && debug_is_token_registered(x) == SNMPERR_SUCCESS)
  |  |  ------------------
  |  |  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  |  |  ------------------
  |  |  |  Branch (145:44): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  195|      0|        netsnmp_indexed_addr_pair addr_pair;
  196|      0|        char *str;
  197|      0|        memset(&addr_pair, 0x0, sizeof(addr_pair));
  198|      0|        memcpy(&(addr_pair.local_addr), addr, sizeof(*addr));
  199|      0|        str = netsnmp_udp_fmtaddr(NULL, (void *)&addr_pair,
  200|      0|                                  sizeof(netsnmp_indexed_addr_pair));
  201|      0|        DEBUGMSGTL(("netsnmp_udpbase", "binding socket: %d to %s\n",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  202|      0|                    t->sock, str));
  203|      0|        free(str);
  204|      0|    }
  205|     69|    if (flags & NETSNMP_TSPEC_PREBOUND) {
  ------------------
  |  |  118|     69|#define NETSNMP_TSPEC_PREBOUND                  0x02 /* 1=bound by systemd, 0=needs bind in the library */
  ------------------
  |  Branch (205:9): [True: 0, False: 69]
  ------------------
  206|      0|        DEBUGMSGTL(("netsnmp_udpbase", "socket %d is prebound, nothing to do\n",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  207|      0|                    t->sock));
  208|      0|        return 0;
  209|      0|    }
  210|     69|    rc = netsnmp_bindtodevice(t->sock, ep->iface);
  211|     69|    if (rc != 0) {
  ------------------
  |  Branch (211:9): [True: 0, False: 69]
  ------------------
  212|      0|        DEBUGMSGTL(("netsnmp_udpbase", "failed to bind to iface %s: %s\n",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  213|      0|                    ep->iface, strerror(errno)));
  214|      0|        goto err;
  215|      0|    }
  216|     69|    rc = bind(t->sock, (const struct sockaddr *)addr, sizeof(*addr));
  217|     69|    if ( rc != 0 ) {
  ------------------
  |  Branch (217:10): [True: 0, False: 69]
  ------------------
  218|      0|        DEBUGMSGTL(("netsnmp_udpbase",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  219|      0|                    "failed to bind for clientaddr: %d %s\n",
  220|      0|                    errno, strerror(errno)));
  221|      0|        goto err;
  222|      0|    }
  223|       |
  224|     69|    return 0;
  225|       |
  226|      0|err:
  227|      0|    netsnmp_socketbase_close(t);
  228|      0|    return 1;
  229|     69|}
netsnmp_udpipv4base_transport_with_source:
  265|     69|{
  266|     69|    netsnmp_transport         *t = NULL;
  267|     69|    const struct netsnmp_ep   *bind_addr;
  268|     69|    int                        rc, flags = 0;
  269|       |
  270|     69|    t = netsnmp_udpipv4base_transport_init(ep, local);
  271|     69|    if (NULL == t)
  ------------------
  |  Branch (271:9): [True: 0, False: 69]
  ------------------
  272|      0|         return NULL;
  273|       |
  274|     69|    if (local) {
  ------------------
  |  Branch (274:9): [True: 69, False: 0]
  ------------------
  275|     69|        bind_addr = ep;
  276|     69|        flags |= NETSNMP_TSPEC_LOCAL;
  ------------------
  |  |  117|     69|#define NETSNMP_TSPEC_LOCAL                     0x01 /* 1=server, 0=client */
  ------------------
  277|       |
  278|     69|#ifndef NETSNMP_NO_SYSTEMD
  279|       |        /*
  280|       |         * Maybe the socket was already provided by systemd...
  281|       |         */
  282|     69|        t->sock = netsnmp_sd_find_inet_socket(PF_INET, SOCK_DGRAM, -1,
  283|     69|                                              ntohs(ep->a.sin.sin_port));
  284|     69|        if (t->sock >= 0)
  ------------------
  |  Branch (284:13): [True: 0, False: 69]
  ------------------
  285|      0|            flags |= NETSNMP_TSPEC_PREBOUND;
  ------------------
  |  |  118|      0|#define NETSNMP_TSPEC_PREBOUND                  0x02 /* 1=bound by systemd, 0=needs bind in the library */
  ------------------
  286|     69|#endif
  287|     69|    }
  288|      0|    else
  289|      0|        bind_addr = src_addr;
  290|       |
  291|     69|    if (-1 == t->sock)
  ------------------
  |  Branch (291:9): [True: 69, False: 0]
  ------------------
  292|     69|        t->sock = netsnmp_udpipv4base_transport_socket(flags);
  293|     69|    if (t->sock < 0) {
  ------------------
  |  Branch (293:9): [True: 0, False: 69]
  ------------------
  294|      0|        netsnmp_transport_free(t);
  295|      0|        return NULL;
  296|      0|    }
  297|       |
  298|       |    /*
  299|       |     * If we've been given an address to bind to, then bind to it.
  300|       |     * Otherwise the OS will use "something sensible".
  301|       |     */
  302|     69|    if (NULL == bind_addr)
  ------------------
  |  Branch (302:9): [True: 0, False: 69]
  ------------------
  303|      0|        return t;
  304|       |
  305|       |    /* for Linux VRF Traps we try to bind the iface if clientaddr is not set */
  306|     69|    if (ep && ep->iface[0]) {
  ------------------
  |  Branch (306:9): [True: 69, False: 0]
  |  Branch (306:15): [True: 0, False: 69]
  ------------------
  307|      0|        rc = netsnmp_bindtodevice(t->sock, ep->iface);
  308|      0|        if (rc)
  ------------------
  |  Branch (308:13): [True: 0, False: 0]
  ------------------
  309|      0|            DEBUGMSGTL(("netsnmp_udpbase", "VRF: Could not bind socket %d to %s\n",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  310|      0|                        t->sock, ep->iface));
  311|      0|        else
  312|      0|            DEBUGMSGTL(("netsnmp_udpbase", "VRF: Bound socket %d to %s\n",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  313|      0|                        t->sock, ep->iface));
  314|      0|    }
  315|       |
  316|     69|    rc = netsnmp_udpipv4base_transport_bind(t, bind_addr, flags);
  317|     69|    if (rc) {
  ------------------
  |  Branch (317:9): [True: 0, False: 69]
  ------------------
  318|      0|        netsnmp_transport_free(t);
  319|      0|        t = NULL;
  320|      0|    }
  321|     69|    else if (!local)
  ------------------
  |  Branch (321:14): [True: 0, False: 69]
  ------------------
  322|      0|        netsnmp_udpipv4base_transport_get_bound_addr(t);
  323|       |
  324|     69|    return t;
  325|     69|}
netsnmp_udpipv4base_tspec_transport:
  329|     69|{
  330|     69|    struct netsnmp_ep addr;
  331|     69|    int local;
  332|       |
  333|     69|    if (NULL == tspec)
  ------------------
  |  Branch (333:9): [True: 0, False: 69]
  ------------------
  334|      0|        return NULL;
  335|       |
  336|     69|    local = tspec->flags & NETSNMP_TSPEC_LOCAL;
  ------------------
  |  |  117|     69|#define NETSNMP_TSPEC_LOCAL                     0x01 /* 1=server, 0=client */
  ------------------
  337|       |
  338|       |    /** get address from target */
  339|     69|    if (!netsnmp_sockaddr_in3(&addr, tspec->target, tspec->default_target))
  ------------------
  |  Branch (339:9): [True: 0, False: 69]
  ------------------
  340|      0|        return NULL;
  341|       |
  342|     69|    if (NULL != tspec->source) {
  ------------------
  |  Branch (342:9): [True: 0, False: 69]
  ------------------
  343|      0|        struct netsnmp_ep src_addr;
  344|       |
  345|       |        /** get sockaddr from source */
  346|      0|        if (!netsnmp_sockaddr_in3(&src_addr, tspec->source, ":0"))
  ------------------
  |  Branch (346:13): [True: 0, False: 0]
  ------------------
  347|      0|            return NULL;
  348|      0|        return netsnmp_udpipv4base_transport_with_source(&addr, local,
  349|      0|                                                         &src_addr);
  350|      0|    }
  351|       |
  352|       |    /** no source and default client address ok */
  353|     69|    return netsnmp_udpipv4base_transport(&addr, local);
  354|     69|}
netsnmp_udpipv4base_transport:
  358|     69|{
  359|     69|    struct netsnmp_ep client_ep;
  360|     69|    const char *client_addr;
  361|     69|    int uses_port;
  362|       |
  363|     69|    memset(&client_ep, 0, sizeof(client_ep));
  364|     69|    client_ep.a.sin.sin_family = AF_INET;
  365|       |
  366|     69|    if (local)
  ------------------
  |  Branch (366:9): [True: 69, False: 0]
  ------------------
  367|     69|        goto out;
  368|       |
  369|      0|    client_addr = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  370|      0|                                        NETSNMP_DS_LIB_CLIENT_ADDR);
  ------------------
  |  |  165|      0|#define NETSNMP_DS_LIB_CLIENT_ADDR       14
  ------------------
  371|      0|    if (!client_addr)
  ------------------
  |  Branch (371:9): [True: 0, False: 0]
  ------------------
  372|      0|        goto out;
  373|       |
  374|      0|    if (netsnmp_sockaddr_in3(&client_ep, client_addr, ":0") < 0) {
  ------------------
  |  Branch (374:9): [True: 0, False: 0]
  ------------------
  375|      0|        snmp_log(LOG_ERR, "Parsing clientaddr %s failed\n", client_addr);
  376|      0|        goto out;
  377|      0|    }
  378|       |
  379|      0|    uses_port = netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  380|      0|                                       NETSNMP_DS_LIB_CLIENT_ADDR_USES_PORT);
  ------------------
  |  |  102|      0|#define NETSNMP_DS_LIB_CLIENT_ADDR_USES_PORT 42 /* NETSNMP_DS_LIB_CLIENT_ADDR includes address and also port */
  ------------------
  381|      0|    if (!uses_port)
  ------------------
  |  Branch (381:9): [True: 0, False: 0]
  ------------------
  382|      0|        client_ep.a.sin.sin_port = 0;
  383|       |
  384|     69|out:
  385|     69|    return netsnmp_udpipv4base_transport_with_source(ep, local, &client_ep);
  386|      0|}

netsnmp_udpipv6_ctor:
  997|     69|{
  998|     69|    udp6Domain.name = netsnmp_UDPIPv6Domain;
  999|     69|    udp6Domain.name_length = OID_LENGTH(netsnmp_UDPIPv6Domain);
  ------------------
  |  |   64|     69|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|     69|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
 1000|     69|    udp6Domain.f_create_from_tstring_new = netsnmp_udp6_create_tstring;
 1001|     69|    udp6Domain.f_create_from_tspec       = netsnmp_udp6_create_tspec;
 1002|     69|    udp6Domain.f_create_from_ostring     = netsnmp_udp6_create_ostring;
 1003|     69|    udp6Domain.prefix = calloc(5, sizeof(char *));
 1004|     69|    if (!udp6Domain.prefix) {
  ------------------
  |  Branch (1004:9): [True: 0, False: 69]
  ------------------
 1005|      0|        snmp_log(LOG_ERR, "calloc() failed - out of memory\n");
 1006|      0|        return;
 1007|      0|    }
 1008|     69|    udp6Domain.prefix[0] = "udp6";
 1009|     69|    udp6Domain.prefix[1] = "ipv6";
 1010|     69|    udp6Domain.prefix[2] = "udpv6";
 1011|     69|    udp6Domain.prefix[3] = "udpipv6";
 1012|       |
 1013|     69|    netsnmp_tdomain_register(&udp6Domain);
 1014|     69|}

netsnmp_udpshared_ctor:
  453|     69|{
  454|     69|    static netsnmp_tdomain domain;
  455|     69|    static int done = 0;
  456|       |
  457|     69|    if (done)
  ------------------
  |  Branch (457:9): [True: 68, False: 1]
  ------------------
  458|     68|        return;
  459|      1|    done = 1;
  460|       |
  461|      1|    domain.name = netsnmpUDPsharedDomain;
  462|      1|    domain.name_length = netsnmpUDPsharedDomain_len;
  463|       |
  464|      1|    domain.prefix = calloc(2, sizeof(char *));
  465|      1|    if (!domain.prefix) {
  ------------------
  |  Branch (465:9): [True: 0, False: 1]
  ------------------
  466|      0|        snmp_log(LOG_ERR, "calloc() failed - out of memory\n");
  467|      0|        return;
  468|      0|    }
  469|      1|    domain.prefix[0] = "udpshared";
  470|       |
  471|      1|    domain.f_create_from_tstring_new = netsnmp_udpshared_create_tstring;
  472|      1|    domain.f_create_from_tspec       = netsnmp_udpshared_create_tspec;
  473|      1|    domain.f_create_from_ostring     = netsnmp_udpshared_create_ostring;
  474|       |
  475|      1|    netsnmp_tdomain_register(&domain);
  476|      1|}

netsnmp_unix_ctor:
  520|     69|{
  521|     69|    unixDomain.name = netsnmp_UnixDomain;
  522|     69|    unixDomain.name_length = OID_LENGTH(netsnmp_UnixDomain);
  ------------------
  |  |   64|     69|    (sizeof(x) / sizeof((x)[0]) +                                       \
  |  |   65|     69|     sizeof(int[-__builtin_types_compatible_p(typeof(x), typeof(&(x)[0]))]))
  ------------------
  523|     69|    unixDomain.prefix = calloc(2, sizeof(char *));
  524|     69|    if (!unixDomain.prefix) {
  ------------------
  |  Branch (524:9): [True: 0, False: 69]
  ------------------
  525|      0|        snmp_log(LOG_ERR, "calloc() failed - out of memory\n");
  526|      0|        return;
  527|      0|    }
  528|     69|    unixDomain.prefix[0] = "unix";
  529|       |
  530|     69|    unixDomain.f_create_from_tstring_new = netsnmp_unix_create_tstring;
  531|     69|    unixDomain.f_create_from_ostring     = netsnmp_unix_create_ostring;
  532|       |
  533|     69|    netsnmp_tdomain_register(&unixDomain);
  534|     69|}

init_vacm:
   85|     69|{
   86|       |    /* views for access via get/set/send-notifications */
   87|     69|    se_add_pair_to_slist(VACM_VIEW_ENUM_NAME, strdup("read"),
  ------------------
  |  |  103|     69|#define VACM_VIEW_ENUM_NAME "vacmviews"
  ------------------
   88|     69|                         VACM_VIEW_READ);
  ------------------
  |  |   77|     69|#define VACM_VIEW_READ     0
  ------------------
   89|     69|    se_add_pair_to_slist(VACM_VIEW_ENUM_NAME, strdup("write"),
  ------------------
  |  |  103|     69|#define VACM_VIEW_ENUM_NAME "vacmviews"
  ------------------
   90|     69|                         VACM_VIEW_WRITE);
  ------------------
  |  |   78|     69|#define VACM_VIEW_WRITE    1
  ------------------
   91|     69|    se_add_pair_to_slist(VACM_VIEW_ENUM_NAME, strdup("notify"),
  ------------------
  |  |  103|     69|#define VACM_VIEW_ENUM_NAME "vacmviews"
  ------------------
   92|     69|                         VACM_VIEW_NOTIFY);
  ------------------
  |  |   79|     69|#define VACM_VIEW_NOTIFY   2
  ------------------
   93|       |
   94|       |    /* views for permissions when receiving notifications */
   95|     69|    se_add_pair_to_slist(VACM_VIEW_ENUM_NAME, strdup("log"),
  ------------------
  |  |  103|     69|#define VACM_VIEW_ENUM_NAME "vacmviews"
  ------------------
   96|     69|                         VACM_VIEW_LOG);
  ------------------
  |  |   82|     69|#define VACM_VIEW_LOG      3
  ------------------
   97|     69|    se_add_pair_to_slist(VACM_VIEW_ENUM_NAME, strdup("execute"),
  ------------------
  |  |  103|     69|#define VACM_VIEW_ENUM_NAME "vacmviews"
  ------------------
   98|     69|                         VACM_VIEW_EXECUTE);
  ------------------
  |  |   83|     69|#define VACM_VIEW_EXECUTE  4
  ------------------
   99|     69|    se_add_pair_to_slist(VACM_VIEW_ENUM_NAME, strdup("net"),
  ------------------
  |  |  103|     69|#define VACM_VIEW_ENUM_NAME "vacmviews"
  ------------------
  100|     69|                         VACM_VIEW_NET);
  ------------------
  |  |   84|     69|#define VACM_VIEW_NET      5
  ------------------
  101|     69|}

LLVMFuzzerInitialize:
   54|      2|int LLVMFuzzerInitialize(int *argc, char ***argv) {
   55|      2|    if (getenv("NETSNMP_DEBUGGING") != NULL) {
  ------------------
  |  Branch (55:9): [True: 0, False: 2]
  ------------------
   56|      0|        snmp_enable_stderrlog();
   57|      0|        snmp_set_do_debugging(1);
   58|      0|        debug_register_tokens("sess_process_packet");
   59|      0|    }
   60|       |
   61|      2|    return 0;
   62|      2|}
LLVMFuzzerTestOneInput:
   64|     70|int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
   65|     70|    netsnmp_transport *transport = NULL;
   66|     70|    netsnmp_session *session = NULL;
   67|     70|    const unsigned short pkt_len = size;
   68|     70|    const void *const pkt = data;
   69|     70|    int skt = -1;
   70|     70|    int ret = 1;
   71|       |
   72|     70|    if (pkt_len == 0)
  ------------------
  |  Branch (72:9): [True: 1, False: 69]
  ------------------
   73|      1|        goto cleanup;
   74|       |
   75|     69|    netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS, "mibs");
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS, "mibs");
  ------------------
  |  |  162|     69|#define NETSNMP_DS_LIB_MIBDIRS           11
  ------------------
   76|     69|    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
   77|     69|                           NETSNMP_DS_LIB_DONT_PERSIST_STATE, 1);
  ------------------
  |  |   92|     69|#define NETSNMP_DS_LIB_DONT_PERSIST_STATE  32	/* don't load config and don't load/save persistent file */
  ------------------
   78|     69|    netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PERSISTENT_DIR,
  ------------------
  |  |   48|     69|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PERSISTENT_DIR,
  ------------------
  |  |  159|     69|#define NETSNMP_DS_LIB_PERSISTENT_DIR    8
  ------------------
   79|     69|                          "/tmp");
   80|       |
   81|     69|    init_snmp("snmptrapd");
   82|       |
   83|     69|    transport = netsnmp_transport_open_server("trap_fuzzer", "127.0.0.1:7365");
   84|     69|    if (!transport) {
  ------------------
  |  Branch (84:9): [True: 0, False: 69]
  ------------------
   85|      0|        fprintf(stderr, "Error: failed to open Net-SNMP transport.\n");
   86|      0|        goto cleanup;
   87|      0|    }
   88|     69|    session = add_session(transport);
   89|     69|    if (!session) {
  ------------------
  |  Branch (89:9): [True: 0, False: 69]
  ------------------
   90|      0|        fprintf(stderr, "Error: failed to add Net-SNMP session.\n");
   91|      0|        goto cleanup;
   92|      0|    }
   93|       |
   94|     69|    skt = socket(AF_INET, SOCK_DGRAM, 0);
   95|     69|    if (skt < 0) {
  ------------------
  |  Branch (95:9): [True: 0, False: 69]
  ------------------
   96|      0|        perror("socket()");
   97|      0|        goto shutdown;
   98|      0|    }
   99|     69|    struct sockaddr_in addr = {
  100|     69|        .sin_family = AF_INET,
  101|     69|        .sin_port = htons(7365),
  102|     69|        .sin_addr = { htonl(INADDR_LOOPBACK) }
  103|     69|    };
  104|     69|    if (connect(skt, &addr, sizeof(addr)) < 0) {
  ------------------
  |  Branch (104:9): [True: 0, False: 69]
  ------------------
  105|      0|        perror("connect()");
  106|      0|        goto shutdown;
  107|      0|    }
  108|     69|    if (send(skt, pkt, pkt_len, 0) < 0) {
  ------------------
  |  Branch (108:9): [True: 1, False: 68]
  ------------------
  109|      1|        perror("send()");
  110|      1|        goto shutdown;
  111|      1|    }
  112|     68|    {
  113|     68|        fd_set readfds,writefds,exceptfds;
  114|     68|        int numfds = 0, block = 0;
  115|     68|        struct timeval timeout;
  116|       |
  117|     68|        FD_ZERO(&readfds);
  ------------------
  |  Branch (117:9): [Folded, False: 68]
  ------------------
  118|     68|        FD_ZERO(&writefds);
  ------------------
  |  Branch (118:9): [Folded, False: 68]
  ------------------
  119|     68|        FD_ZERO(&exceptfds);
  ------------------
  |  Branch (119:9): [Folded, False: 68]
  ------------------
  120|     68|        timerclear(&timeout);
  121|     68|        timeout.tv_sec = 5;
  122|     68|        snmp_select_info(&numfds, &readfds, &timeout, &block);
  123|     68|        if (select(numfds, &readfds, &writefds, &exceptfds, &timeout) > 0)
  ------------------
  |  Branch (123:13): [True: 68, False: 0]
  ------------------
  124|     68|            snmp_read(&readfds);
  125|     68|    }
  126|     68|    ret = 0;
  127|       |
  128|     69|shutdown:
  129|     69|    snmp_shutdown("snmptrapd");
  130|       |
  131|     70|cleanup:
  132|     70|    if (skt >= 0)
  ------------------
  |  Branch (132:9): [True: 69, False: 1]
  ------------------
  133|     69|        close(skt);
  134|     70|    if (session)
  ------------------
  |  Branch (134:9): [True: 69, False: 1]
  ------------------
  135|     69|        snmp_close(session);
  136|       |
  137|     70|    return ret;
  138|     69|}
snmp_parse_trap2_fuzzer.c:add_session:
   37|     69|{
   38|     69|    netsnmp_session session;
   39|       |
   40|     69|    snmp_sess_init(&session);
   41|     69|    session.peername = SNMP_DEFAULT_PEERNAME;
  ------------------
  |  |  120|     69|#define SNMP_DEFAULT_PEERNAME	    NULL
  ------------------
   42|     69|    session.version = SNMP_DEFAULT_VERSION;
  ------------------
  |  |  123|     69|#define SNMP_DEFAULT_VERSION	    -1
  ------------------
   43|     69|    session.community_len = SNMP_DEFAULT_COMMUNITY_LEN;
  ------------------
  |  |  111|     69|#define SNMP_DEFAULT_COMMUNITY_LEN  0   /* to get a default community name */
  ------------------
   44|     69|    session.retries = SNMP_DEFAULT_RETRIES;
  ------------------
  |  |  112|     69|#define SNMP_DEFAULT_RETRIES	    -1
  ------------------
   45|     69|    session.timeout = SNMP_DEFAULT_TIMEOUT;
  ------------------
  |  |  113|     69|#define SNMP_DEFAULT_TIMEOUT	    -1
  ------------------
   46|     69|    session.callback = snmp_input;
   47|     69|    session.callback_magic = t;
   48|     69|    session.authenticator = NULL;
   49|     69|    session.isAuthoritative = SNMP_SESS_UNKNOWNAUTH;
  ------------------
  |  |  159|     69|#define SNMP_SESS_UNKNOWNAUTH      2    /* sometimes (like NRs) */
  ------------------
   50|       |
   51|     69|    return snmp_add(&session, t, NULL, NULL);
   52|     69|}

