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

📄 m2pppipcpgrouptest.c

📁 这是全套的PPP协议的源码
💻 C
字号:
/* m2pppIpcpGroupTest.c *//* Copyright (C) 2003 Wind River Systems, Inc. */#include "vxWorks.h"#include "stdio.h"#include "stdlib.h"#include "string.h"#include "logLib.h"#include "tickLib.h"#include "pfw/pfw.h"#include "pfw/pfwStack.h"#include "pfw/pfwTable.h"#include "pfw/pfwMemory.h"#include "ppp/m2pppLib.h"#include "ppp/m2pppIpcpGroup.h"#include "ppp/interfaces/ipcpInterfaces.h"LOCAL PPP_IPCP_ENTRY_DATA  data;/* internally we have defined only one structure for both supported SNMP  * IPCP tables. In addition instead of using pppIp* we use ipcp* names. *//***********************************************************************/STATUS pppIpEntryLeafValueShow    (    UINT32 ifIndex,    UINT32 leafSubIdentifier    )    {    UINT32                  oidLen;    M2_PPP_ENTRY_MATCH_TYPE XON;                /* eXactOrNext  */    M2_PPP_ENTRY_MATCH_TYPE X;                  /* eXact        */    M2_PPP_ENTRY_MATCH_TYPE N;                  /* Next         */    UINT32  value;    oidLen = 1;    X = M2_PPP_ENTRY_EXACT_MATCH;    N = M2_PPP_ENTRY_NEXT_MATCH;    XON = X;    if  (m2pppIpcpEntryLookup(oidLen, &ifIndex, &data, XON)         != OK)        {        printf("m2pppIpcpEntryLookup returned ERROR: ");        printf("ifIndex = %3d, leafSubIdentifier = %2d\n",               ifIndex, leafSubIdentifier);        return ERROR;        }    switch(leafSubIdentifier)        {        case 1:            value = (*((data.interface)->                       ipcpOperStatusGet))                    (data.state);            printf("link = %3d, lsid = %2d, %-40.40s %5d\n",                   ifIndex, leafSubIdentifier,                    "pppIpOperStatus = ", value);            break;        case 2:            value = (*((data.interface)->                       ipcpLocalToRemoteCompressionProtocolGet))                    (data.state);            printf("link = %3d, lsid = %2d, %-40.40s %5d\n",                   ifIndex, leafSubIdentifier,                    "pppIpLocalToRemoteCompressionProtocolGet = ", value);            break;        case 3:            value = (*((data.interface)->                       ipcpRemoteToLocalCompressionProtocolGet))                    (data.state);            printf("link = %3d, lsid = %2d, %-40.40s %5d\n",                   ifIndex, leafSubIdentifier,                    "pppIpRemoteToLocalCompressionProtocolGet = ", value);            break;        case 4:            value = (*((data.interface)->                       ipcpRemoteMaxSlotIdGet))                    (data.state);            printf("link = %3d, lsid = %2d, %-40.40s %5d\n",                   ifIndex, leafSubIdentifier,                    "pppIpRemoteMaxSlotIdGet = ", value);            break;        case 5:            value = (*((data.interface)->                       ipcpLocalMaxSlotIdGet))                    (data.state);            printf("link = %3d, lsid = %2d, %-40.40s %5d\n",                   ifIndex, leafSubIdentifier,                    "pppIpLocalMaxSlotIdGet = ", value);            break;        default:            printf("invalid leafSubIdentifier: ");            printf("ifIndex = %3d, leafSubIdentifier = %2d\n",                   ifIndex, leafSubIdentifier);            return ERROR;        }    return OK;    }       /***********************************************************************/    STATUS pppIpEntryValuesShow    (    UINT32 ifIndex    )    {    int i;    STATUS auxStatus = OK;    for (i=1; i<6; i++)        {        if  (pppIpEntryLeafValueShow(ifIndex,i) != OK)            {            auxStatus = ERROR;            }        }    return auxStatus;    }/***********************************************************************/STATUS pppIpConfigEntryLeafValueShow    (    UINT32 ifIndex,    UINT32 leafSubIdentifier    )    {    UINT32                  oidLen;    M2_PPP_ENTRY_MATCH_TYPE XON;                /* eXactOrNext  */    M2_PPP_ENTRY_MATCH_TYPE X;                  /* eXact        */    M2_PPP_ENTRY_MATCH_TYPE N;                  /* Next         */    UINT32  value;    oidLen = 1;    X = M2_PPP_ENTRY_EXACT_MATCH;    N = M2_PPP_ENTRY_NEXT_MATCH;    XON = X;    if  (m2pppIpcpEntryLookup(oidLen, &ifIndex, &data, XON)         != OK)        {        printf("m2pppIpcpEntryLookup returned ERROR: ");        printf("ifIndex = %3d, leafSubIdentifier = %2d\n",               ifIndex, leafSubIdentifier);        return ERROR;        }    switch(leafSubIdentifier)        {        case 1:            value = (*((data.interface)->                       ipcpConfigAdminStatusGet))                    (data.state);            printf("link = %3d, lsid = %2d, %-24.24s %5d\n",                   ifIndex, leafSubIdentifier,                    "pppIpConfigAdminStatus = ", value);            break;        case 2:            value = (*((data.interface)->                       ipcpConfigCompressionGet))                    (data.state);            printf("link = %3d, lsid = %2d, %-24.24s %5d\n",                   ifIndex, leafSubIdentifier,                    "pppIpConfigCompression = ", value);            break;        default:            printf("invalid leafSubIdentifier: ");            printf("ifIndex = %3d, leafSubIdentifier = %2d\n",                   ifIndex, leafSubIdentifier);            return ERROR;        }    return OK;    }       /***********************************************************************/    STATUS pppIpConfigEntryValuesShow    (    UINT32 ifIndex    )    {    int i;    STATUS auxStatus = OK;    for (i=1; i<3; i++)        {        if  (pppIpConfigEntryLeafValueShow(ifIndex,i) != OK)            {            auxStatus = ERROR;            }        }    return auxStatus;    }/***********************************************************************/STATUS pppIpConfigEntryLeafValueSet    (    UINT32 ifIndex,    UINT32 leafSubIdentifier,    UINT32 inputValue    )    {    UINT32                  oidLen;    M2_PPP_ENTRY_MATCH_TYPE XON;                /* eXactOrNext  */    M2_PPP_ENTRY_MATCH_TYPE X;                  /* eXact        */    M2_PPP_ENTRY_MATCH_TYPE N;                  /* Next         */    oidLen = 1;    X = M2_PPP_ENTRY_EXACT_MATCH;    N = M2_PPP_ENTRY_NEXT_MATCH;    XON = X;    printf("pppLinkConfigEntryLeafValueSet does not validate input datum\n");    if  (m2pppIpcpEntryLookup(oidLen, &ifIndex, &data, XON)         != OK)        {        printf("m2pppIpcpEntryLookup returned ERROR: ");        printf("ifIndex = %3d, leafSubIdentifier = %2d\n",               ifIndex, leafSubIdentifier);        return ERROR;        }    switch(leafSubIdentifier)        {        case 1:            if  ((*((data.interface)->ipcpConfigAdminStatusSet))                    (data.state, inputValue) != OK)                {                              printf("SET FAILED: link = %3d, lsid = %2d, %-29.29s %5d\n",                       ifIndex, leafSubIdentifier,                        "pppIpConfigAdminStatusSet = ", inputValue);                return ERROR;                }            else                {                printf("SUCCESSFUL SET: link = %3d, lsid = %2d, %-29.29s %5d\n",                       ifIndex, leafSubIdentifier,                        "pppIpConfigAdminStatusSet = ", inputValue);                return OK;                }            break;        case 2:            if  ((*((data.interface)->ipcpConfigCompressionSet))                    (data.state, inputValue) != OK)                {                              printf("SET FAILED: link = %3d, lsid = %2d, %-29.29s %5d\n",                       ifIndex, leafSubIdentifier,                        "pppIpConfigCompression = ", inputValue);                return ERROR;                }            else                {                printf("SUCCESSFUL SET: link = %3d, lsid = %2d, %-29.29s %5d\n",                       ifIndex, leafSubIdentifier,                        "pppIpConfigCompression = ", inputValue);                return OK;                }            break;        default:            printf("invalid leafSubIdentifier: ");            printf("ifIndex = %3d, leafSubIdentifier = %2d\n",                   ifIndex, leafSubIdentifier);            return ERROR;        }    }       

⌨️ 快捷键说明

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