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

📄 snmp1472.c

📁 这是全套的PPP协议的源码
💻 C
📖 第 1 页 / 共 5 页
字号:
                {                           getproc_got_object_id(pktp,                                       vbp,                                       11,                                      pppSecurityChapMD5Protocol_OID,                                      0);                 }            else                {                getproc_error(pktp, vbp, INCONSISTENT_VALUE);                }            return;        case LEAF_pppSecuritySecretsIdentity:        /* if the data being returned is in dynamic storage and needs         * to be free'd, change the 0 argument to a 1.          */            length = min(strlen(pData->identity), 255);            pChar = (char *)snmpdMemoryAlloc(length);            strncpy(pChar, pData->identity, length);            getproc_got_string(pktp,                                vbp,                                length,                               pChar,                               1,                               VT_STRING);            return;        case LEAF_pppSecuritySecretsSecret:        /* if the data being returned is in dynamic storage and needs         * to be free'd, change the 0 argument to a 1.          */            length = min(strlen(pData->secret), 255);            pChar = (char *)snmpdMemoryAlloc(length);            strncpy(pChar, pData->secret, length);            getproc_got_string(pktp,                                vbp,                                length,                               pChar,                               1,                               VT_STRING);            return;        case LEAF_pppSecuritySecretsStatus:            /* Values:             *  invalid(1) = VAL_pppSecurityConfigStatus_invalid             *  valid(2)   = VAL_pppSecurityConfigStatus_valid             */            getproc_got_int32(pktp,                               vbp,                               pData->status);                   return;        default:            getproc_error(pktp, vbp, GEN_ERR);            return;        }    }/**************************************************************************** pppSecuritySecretsEntryGet - Get routine for pppSecuritySecretsTable** A columnar object instance is identified by an instance identifier.* An instance identifier consists of the object identifier and the sequence of* index values. The object identifier consists of the object identifier* of the tabular entry (in this case the OID for pppSecuritySecretsEntry) and * the leaf subindentifier. In our case the table pppSecuritySecretsTable* is indexed by pppSecuritySecretsLink and pppSecuritySecretsIdIndex.* OIDC stands for Object Identifier Component. Compc stands for component* count and it counts the number of components that comprise the index* values part of the instance identifier. Compl stands for components left * and it is the index values array.** RETURNS N/A*/void pppSecuritySecretsEntryGet    (    OIDC_T          lastmatch,  /* leaf subindentifier                 */    int             compc,      /* number of instance OID_T components */    OIDC_T *        compl,      /* pointer to OID_T variable array     */    SNMP_PKT_T *    pktp,       /* packet pointer                      */    VB_T *          vbp         /* varbind list head                   */    )    {    PPP_SECURITY_SECRETS_ENTRY_DATA data;    /* find all the varbinds that share the same getproc and instance */    snmpdGroupByGetprocAndInstance(pktp, vbp, compc, compl);    if  ((compc < 1) || (compc > 2) || (NULL == compl))        {        for ( ; vbp; vbp = vbp->vb_link)            {            getproc_nosuchins(pktp, vbp);            }        return;        }    data.link =    (UINT32)(compl[0]);                   /* from unsigned long * to UINT32 since OIDC_T                     * is bits32_t which is unsigned long                    */    data.idIndex = (UINT32)(compl[1]);    if  (m2pppSecretsEntryAgentLookup(data.link,                                      data.idIndex,                                      &(data.direction),                                      &(data.protocol),                                      data.identity,                                      data.secret,                                      &(data.status))         != OK)         {        for ( ; vbp; vbp = vbp->vb_link)            {            getproc_nosuchins(pktp, vbp);            }        }    else         {        /* retrieve all the values from the same data structure */        for ( ; vbp; vbp = vbp->vb_link)             {            pppSecuritySecretsEntryInfoGet(vbp->vb_ml.ml_last_match,                                           pktp,                                           vbp,                                           &data);            }        }    return;    }/**************************************************************************** pppSecuritySecretsEntryNext - GetNext routine for pppSecuritySecretsTable** A columnar object instance is identified by an instance identifier.* An instance identifier consists of the object identifier and the sequence of* index values. The object identifier consists of the object identifier* of the tabular entry (in this case the OID for pppSecuritySecretsEntry) and  * the leaf subindentifier.  In our case the table pppSecuritySecretsTable* is indexed by pppSecuritySecretsLink and pppSecuritySecretsIdIndex.* OIDC stands for Object Identifier Component. Compc stands for component* count and it counts the number of components that comprise the index* values part of the instance identifier. Compl stands for components left * and it is the index values array.** RETURNS N/A*/void pppSecuritySecretsEntryNext    (    OIDC_T          lastmatch,  /* leaf subindentifier                 */    int             compc,      /* number of instance OID_T components */    OIDC_T *        compl,      /* pointer to OID_T variable array     */    SNMP_PKT_T *    pktp,       /* packet pointer                      */    VB_T *          vbp         /* varbind list head                   */    )    {    PPP_SECURITY_SECRETS_ENTRY_DATA data;    OIDC_T nextInstance[2];    /* find all the varbinds that share the same getproc and instance */    snmpdGroupByGetprocAndInstance(pktp, vbp, compc, compl);    if  (compc > 0)        data.link =(UINT32)(compl[0]);                   /* from unsigned long * to UINT32 since OIDC_T                     * is bits32_t which is unsigned long                    */    if  (compc > 1)        data.idIndex = (UINT32)(compl[1]);    if  (m2pppNextSecretsEntryAgentLookup(compc,                                          &(data.link),                                          &(data.idIndex),                                          &(data.direction),                                          &(data.protocol),                                          data.identity,                                          data.secret,                                          &(data.status))         != OK)         {        for ( ; vbp; vbp = vbp->vb_link)            {            nextproc_no_next(pktp, vbp);            }        }    else         {        /* retrieve all the values from the same data structure */        for ( ; vbp; vbp = vbp->vb_link)             {            pppSecuritySecretsEntryInfoGet(vbp->vb_ml.ml_last_match,                                            pktp,                                            vbp,                                            &data);            nextInstance[0] = (OIDC_T)data.link;            nextInstance[1] = (OIDC_T)data.idIndex;            nextproc_next_instance(pktp,                                    vbp,                                    pppSecuritySecretsEntry_INSTANCE_LEN,                                    nextInstance);            nextproc_good(pktp, vbp);            }        }    return;    }/**************************************************************************** pppSecuritySecurityEntryTest - Test routine for pppSecuritySecretsEntry** RETURNS: N/A*/void pppSecuritySecretsEntryTest    (    OIDC_T          lastmatch,  /* leaf subindentifier                 */    int             compc,      /* number of instance OID_T components */    OIDC_T *        compl,      /* pointer to OID_T variable array     */    SNMP_PKT_T *    pktp,       /* packet pointer                      */    VB_T *          vbp         /* varbind list head                   */    )    {    VB_T * group_vbp;                       /* introduced by mibcomp    */    VB_T * pGroupRepVarBind;                /* introduced by programmer */    PPP_SECURITY_SECRETS_ENTRY_PRESET_DATA * pPresetData;    INT_32_T value;    OIDC_T * pOID;    int length;    pGroupRepVarBind = vbp;    /* find all the varbinds that share the same getproc and instance */    snmpdGroupByGetprocAndInstance(pktp, vbp, compc, compl);    pPresetData = (PPP_SECURITY_SECRETS_ENTRY_PRESET_DATA *)                  snmpdMemoryAlloc                  (sizeof(PPP_SECURITY_SECRETS_ENTRY_PRESET_DATA));    pPresetData->entryPreExisted = FALSE;    pPresetData->pGroupHead = pGroupRepVarBind = vbp;    if  ((compc < 1) || (compc > 2) || (NULL == compl))        {        for (group_vbp = pGroupRepVarBind;              group_vbp != NULL;              group_vbp = group_vbp->vb_link)             {            testproc_error(pktp, group_vbp, NO_SUCH_NAME);;            }        return;        }    pPresetData->previousPppSecuritySecretsLink = (UINT32)(compl[0]);                                                  /* from unsigned long *                                                    * to UINT32 since OIDC_T                                                    * is bits32_t which is                                                    * unsigned long                                                   */    pPresetData->previousPppSecuritySecretsIdIndex = (UINT32)(compl[1]);    if  (m2pppSecretsEntryAgentLookup(pPresetData->                                      previousPppSecuritySecretsLink,                                      pPresetData->                                      previousPppSecuritySecretsIdIndex,                                      &(pPresetData->                                        previousPppSecuritySecretsDirection),                                      &(pPresetData->                                        previousPppSecuritySecretsProtocol),                                      pPresetData->                                       previousPppSecuritySecretsIdentity,                                      pPresetData->                                       previousPppSecuritySecretsSecret,                                      &(pPresetData->                                        previousPppSecuritySecretsStatus))         != OK)         {        pPresetData->entryPreExisted = FALSE;                pPresetData->pPreviousTransferDirection = NULL;        pPresetData->pPreviousTransferProtocol = NULL;        pPresetData->pPreviousTransferIdentity = NULL;        pPresetData->pPreviousTransferSecret = NULL;        }    else         {        pPresetData->entryPreExisted = TRUE;        pPresetData->pPreviousTransferDirection =        &(pPresetData->previousPppSecuritySecretsDirection);        pPresetData->pPreviousTransferProtocol =        &(pPresetData->previousPppSecuritySecretsProtocol);        pPresetData->pPreviousTransferIdentity =        pPresetData->previousPppSecuritySecretsIdentity;        pPresetData->pPreviousTransferSecret =        pPresetData->previousPppSecuritySecretsSecret;        }    pPresetData->newPppSecuritySecretsLink =     pPresetData->previousPppSecuritySecretsLink;    pPresetData->newPppSecuritySecretsIdIndex =    pPresetData->previousPppSecuritySecretsIdIndex;    pPresetData->newPppSecuritySecretsDirection =    PPP_SECURITY_SECRETS_DIRECTION_UNDEFINED;    pPresetData->newPppSecuritySecretsProtocol =    PPP_SECURITY_UNDEFINED_PROTOCOL;    strcpy(pPresetData->newPppSecuritySecretsIdentity, "");    strcpy(pPresetData->newPppSecuritySecretsSecret, "");    pPresetData->pNewTransferDirection = NULL;    pPresetData->pNewTransferProtocol = NULL;     pPresetData->pNewTransferIdentity = NULL;    pPresetData->pNewTransferSecret = NULL;    pPresetData->newPppSecuritySecretsStatus =     PPP_SECURITY_SECRETS_STATUS_VALID;    /* assign to all relative varbinds the same private data */    for (group_vbp = pGroupRepVarBind;          group_vbp != NULL;          group_vbp = group_vbp->vb_link)        {        group_vbp->vb_priv = (PTR_T) pPresetData;        }    /* but only to one assign memory management */    pGroupRepVarBind->vb_free_priv = (VBPRIVPROC_T *) snmpVbPrivFree;        /* now check validity of the value fields of each varbind */    for (group_vbp = pGroupRepVarBind;          group_vbp != NULL;          group_vbp = group_vbp->vb_link)         {        switch (group_vbp->vb_ml.ml_last_match) 

⌨️ 快捷键说明

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