⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 snmptcp.c

📁 wm PNE 3.3 source code, running at more than vxworks6.x version.
💻 C
📖 第 1 页 / 共 2 页
字号:
    tcpConnEntry.tcpConnState = vbp->value_u.v_number;    if (m2TcpConnEntrySet (&tcpConnEntry) != OK)        {        setproc_error (pktp, vbp, COMMIT_FAILED);        return;        }    setproc_good (pktp, vbp);    }            /*******************************************************************************  tcpConnEntryGet**  Get method routine for tcpConnEntryGet***  Parameters to this routine are *  *  <lastmatch> - the last oid component that was matched to get to this leaf.*  <compc>     - count of components remaining in the unmatched portion i.e.*                the length of the instance portion.*  <compl>     - ptr to the oid sequence remaining, i.e. the instance portion.*  <pktp>      - ptr to internal representation of the snmp pkt.*  <vbp>       - ptr to var bind being processed.** RETURNS : N/A*/    void tcpConnEntryGet    (    OIDC_T              lastmatch,    int	                compc,    OIDC_T*             compl,    SNMP_PKT_T*	        pktp,    VB_T*               vbp    )    {    M2_TCPCONNTBL       tcpConnEntry;    /* Group together all varbinds which have the same getproc and instance */    snmpdGroupByGetprocAndInstance (pktp, vbp, compc, compl);     /* check for valid instance */    if ((compc != TCP_TBL_INDEX_LEN) ||         snmpOidToIpHostOrder (IP_ADDR_LEN, compl,                               &tcpConnEntry.tcpConnLocalAddress) ||         ((tcpConnEntry.tcpConnLocalPort = *(compl + IP_ADDR_LEN))         > MAX_TCP_PORT) ||         snmpOidToIpHostOrder (IP_ADDR_LEN, compl + TCP_REMOTE_ADDR_OFFSET,                                &tcpConnEntry.tcpConnRemAddress) ||         ((tcpConnEntry.tcpConnRemPort = *(compl + TCP_REMOTE_PORT_OFFSET)) >          MAX_TCP_PORT) ||         (m2TcpConnEntryGet (M2_EXACT_VALUE, &tcpConnEntry) != OK) )        {        for ( ; vbp != NULL; vbp = vbp->vb_link)            {            getproc_nosuchins (pktp, vbp);            }        return;        }    for (  ; vbp; vbp = vbp->vb_link)        {         tcpConnEntryInfoGet (vbp->vb_ml.ml_last_match, pktp, vbp,                              &tcpConnEntry);        }    }            /*******************************************************************************  tcpConnEntryNext**  next method routine for tcp connection table.*  Parameters to this routine are *  *  <lastmatch> - the last oid component that was matched to get to this leaf.*  <compc>     - count of components remaining in the unmatched portion i.e.*                the length of the instance portion.*  <compl>     - ptr to the oid sequence remaining, i.e. the instance portion.*  <pktp>      - ptr to internal representation of the snmp pkt.*  <vbp>       - ptr to var bind being processed.**  RETURNS: N/A*/    void tcpConnEntryNext    (    OIDC_T              lastmatch,    int	                compc,    OIDC_T*             compl,    SNMP_PKT_T*	        pktp,    VB_T*               vbp    )    {    M2_TCPCONNTBL       tcpConnEntry;    OIDC_T              tcpIndex [TCP_TBL_INDEX_LEN];        snmpdGroupByGetprocAndInstance (pktp, vbp, compc, compl);         if (snmpNextIndex (compc, compl, tcpIndex, maxTcpConnIndex, TCP_TBL_INDEX_LEN))        {        for ( ; vbp != NULL; vbp = vbp->vb_link)            {            nextproc_no_next (pktp, vbp);            }        return;        }    snmpOidToIpHostOrder (IP_ADDR_LEN, tcpIndex,                          & tcpConnEntry.tcpConnLocalAddress);    tcpConnEntry.tcpConnLocalPort = *(tcpIndex + IP_ADDR_LEN);    snmpOidToIpHostOrder (IP_ADDR_LEN, tcpIndex + TCP_REMOTE_ADDR_OFFSET,                           &tcpConnEntry.tcpConnRemAddress);    tcpConnEntry.tcpConnRemPort = *(tcpIndex + TCP_REMOTE_PORT_OFFSET);    if (m2TcpConnEntryGet (M2_NEXT_VALUE, & tcpConnEntry) != OK)        {        for ( ; vbp != NULL; vbp = vbp->vb_link)            {            snmpNextError (pktp, vbp);            }        return;        }    (void) ip_to_rlist (htonl (tcpConnEntry.tcpConnLocalAddress), tcpIndex);    (void) ip_to_rlist (htonl (tcpConnEntry.tcpConnRemAddress),                         tcpIndex + TCP_REMOTE_ADDR_OFFSET) ;    *(tcpIndex + IP_ADDR_LEN) = tcpConnEntry.tcpConnLocalPort;    *(tcpIndex + TCP_REMOTE_PORT_OFFSET) = tcpConnEntry.tcpConnRemPort;    for (  ; vbp; vbp = vbp->vb_link)        {            nextproc_next_instance (pktp, vbp, TCP_TBL_INDEX_LEN, tcpIndex);        tcpConnEntryInfoGet (vbp->vb_ml.ml_last_match, pktp, vbp,                              &tcpConnEntry);        }    }            /*******************************************************************************  tcpGet**  Get method routine for tcp group scalars.**  Parameters to this routine are *  *  <lastmatch> - the last oid component that was matched to get to this leaf.*  <compc>     - count of components remaining in the unmatched portion i.e.*                the length of the instance portion.*  <compl>     - ptr to the oid sequence remaining, i.e. the instance portion.*  <pktp>      - ptr to internal representation of the snmp pkt.*  <vbp>       - ptr to var bind being processed.***/void tcpGet    (    OIDC_T              lastmatch,    int	                compc,    OIDC_T*             compl,    SNMP_PKT_T*	        pktp,    VB_T*               vbp    )    {    M2_TCPINFO          tcpVars;    snmpdGroupByGetprocAndInstance (pktp, vbp, compc, compl);    if ((compc != 1) || (*compl != 0))        {        for ( ; vbp != NULL; vbp = vbp->vb_link)            {            getproc_nosuchins (pktp, vbp);            }        return;        }    if (m2TcpGroupInfoGet (&tcpVars) != OK)        {        for ( ; vbp != NULL; vbp = vbp->vb_link)             {             getproc_error (pktp, vbp, GEN_ERR);             }        return;        }    for (    ; vbp; vbp = vbp->vb_link)        {        switch (vbp->vb_ml.ml_last_match)            {            case LEAF_tcpRtoAlgorithm:                getproc_got_int32 (pktp, vbp,                                    (INT_32_T)tcpVars.tcpRtoAlgorithm);                break;            case LEAF_tcpRtoMin:                getproc_got_int32 (pktp, vbp, (INT_32_T)tcpVars.tcpRtoMin);                break;            case LEAF_tcpRtoMax:                getproc_got_int32 (pktp, vbp, (INT_32_T)tcpVars.tcpRtoMax);                break;            case LEAF_tcpMaxConn:                getproc_got_int32 (pktp, vbp, (INT_32_T)tcpVars.tcpMaxConn);                break;            case LEAF_tcpActiveOpens:                getproc_got_uint32 (pktp, vbp, tcpVars.tcpActiveOpens,                                     VT_COUNTER);                break;            case LEAF_tcpPassiveOpens:                getproc_got_uint32 (pktp, vbp, tcpVars.tcpPassiveOpens,                                     VT_COUNTER);                break;            case LEAF_tcpAttemptFails:                getproc_got_uint32 (pktp, vbp, tcpVars.tcpAttemptFails,                                     VT_COUNTER);                break;            case LEAF_tcpEstabResets:                getproc_got_uint32 (pktp, vbp, tcpVars.tcpEstabResets,                                     VT_COUNTER);                break;            case LEAF_tcpCurrEstab:                getproc_got_uint32 (pktp, vbp, tcpVars.tcpCurrEstab, VT_GAUGE);                break;            case LEAF_tcpInSegs:                getproc_got_uint32 (pktp, vbp, tcpVars.tcpInSegs, VT_COUNTER);                break;            case LEAF_tcpOutSegs:                getproc_got_uint32 (pktp, vbp, tcpVars.tcpOutSegs, VT_COUNTER);                break;            case LEAF_tcpRetransSegs:                getproc_got_uint32 (pktp, vbp, tcpVars.tcpRetransSegs,                                     VT_COUNTER);                break;            case LEAF_tcpInErrs:                getproc_got_uint32 (pktp, vbp, tcpVars.tcpInErrs, VT_COUNTER);                break;            case LEAF_tcpOutRsts:                getproc_got_uint32 (pktp, vbp, tcpVars.tcpOutRsts, VT_COUNTER);                break;            default:                getproc_error (pktp, vbp, GEN_ERR);                 break;             }        }    }        

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -