2324 lines
75 KiB
C
2324 lines
75 KiB
C
/* snmpDot1x.c - IEEE 802.1X SNMP method routines */
|
|
|
|
/*
|
|
* Copyright (c) 2005 - 2006 Wind River Systems, Inc.
|
|
*
|
|
* The right to copy, distribute, modify, or otherwise make use
|
|
* of this software may be licensed only pursuant to the terms
|
|
* of an applicable Wind River license agreement.
|
|
*/
|
|
|
|
/*
|
|
modification history
|
|
-------------------
|
|
01p,13apr06,rb Fix to SPR 120177 - Missing files in
|
|
wrs.platforms_ve-3_3-spin13
|
|
01o,16mar06,rjh Add NOMANUAL
|
|
01n,05jul05,eja Add supplicant support
|
|
01m,13may05,eja Fix minor taskLib() warning
|
|
01l,27apr05,eja Add NOMANUAL flag to dot1xMibAdd()
|
|
01k,26apr05,eja Add DEBUG hooks
|
|
01j,06apr05,eja Fix gnu build warning on base6
|
|
01i,03feb05,alm Edited comments
|
|
01h,28oct04,rjh NOMANUAL doc fixes
|
|
01g,05may03,ggg Update documentation
|
|
01f,23apr03,ggg Move dynamic MIB code
|
|
01e,22apr03,ggg Remove warning
|
|
01d,21apr03,ggg File name, location change
|
|
01c,21feb03,ggg Update copyright dates
|
|
01b,19feb03,ggg Correct SNMP include path
|
|
01a,15Jan02,myz written
|
|
*/
|
|
|
|
/*
|
|
DESCRIPTION
|
|
|
|
This library provides the SNMP method routines for IEEE 802.1X MIB. Most
|
|
routines are first automatically generated by the MIB compiler and
|
|
then augmented and modified. In general, the SNMP agent works closely with a MIB
|
|
node tree and the method routines to process the SNMP requests. When a request
|
|
arrives, the agent uses the Object Identifier contained in the request to
|
|
locate the node in the MIB tree, and then calls the method routines associated
|
|
with the node to perform the requested operation. The MIB node tree, a list of
|
|
C data structures, is also generated by the MIB compiler, with the MIB files
|
|
as its input.
|
|
|
|
The method routines generally have four functions (get, next, test, and set)
|
|
associated with each leaf node. They all have the same five arguments:
|
|
|
|
<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 packet.
|
|
<vbp> - ptr to var bind being processed.
|
|
|
|
The 802.1X MIB has three main components: dot1xPaeSystem, dot1xPaeAuthenticator,
|
|
and dot1xPaeSupplicant. This library provides support for all components. To
|
|
include or exclude a component simply modify the MIB file itself and
|
|
regenerate the MIB tree again. This file need not be recompiled.
|
|
|
|
*/
|
|
|
|
#include <wrn/wm/snmp/engine/asn1conf.h>
|
|
#include <wrn/wm/snmp/engine/asn1.h>
|
|
#include <wrn/wm/snmp/engine/buffer.h>
|
|
#include <wrn/wm/snmp/engine/mib.h>
|
|
#include <wrn/wm/snmp/engine/localio.h>
|
|
#include <wrn/wm/snmp/engine/snmpdefs.h>
|
|
#include <wrn/wm/snmp/engine/snmp.h>
|
|
#include <wrn/wm/snmp/engine/auxfuncs.h>
|
|
#include <wrn/wm/snmp/engine/view.h>
|
|
#include <taskLib.h>
|
|
#include <dot1xMibLib.h>
|
|
#include "snmpDot1x.h"
|
|
#include "dot1xMibLeaf.h"
|
|
#include "dot1xMib.c"
|
|
|
|
IMPORT int sysClkRateGet(void);
|
|
|
|
#define PORT_NUM_LEN 1
|
|
|
|
IMPORT OBJ_ID_T objid_paeMIBObjects;
|
|
IMPORT MIBNODE_T n_paeMIBObjects;
|
|
|
|
LOCAL DOT1X_MIB_HANDLER *pMibTable = NULL;
|
|
|
|
LOCAL void * dot1xMibHandlerBind(int);
|
|
|
|
/****************************************************************************
|
|
*
|
|
* dot1xMibAdd - Adds the 802.1X MIB to the standard MIB tree.
|
|
*
|
|
* This is the initialization routine for the 802.1X MIB. This is refered to
|
|
* as "dynamic MIB initialization" since it is performed at run-time, typically
|
|
* during system initialization. It creates a view (necessary due to the
|
|
* 'unique' placement in the SNMP hierarchy of the ieee802dot11 MIB.) and then
|
|
* calls <Add_Node_From_Root> to add the tree. Once this call successfully
|
|
* returns, the ieee802dot1x MIB can be accessed.
|
|
*
|
|
* <dot1xMibAdd> only needs to be called once, regardless of the number of
|
|
* interfaces. Calling it again will produce an SNMP error.
|
|
*
|
|
* RETURNS: OK or ERROR if tree not successfully started.
|
|
*
|
|
*/
|
|
STATUS dot1xMibAdd(void)
|
|
{
|
|
MIBNODE_T * rnode;
|
|
int status;
|
|
VIEWLEAF_T * view;
|
|
/* OID of the unique branch we're on, {1,0} */
|
|
OIDC_T twob_obj[] = {1,0};
|
|
|
|
/* Add a small delay to allow WM SNMP to finish any delayed initialization
|
|
that may be present */
|
|
taskDelay(sysClkRateGet()/20); /* 50 ms */
|
|
|
|
/* Create a new view with the branch that the IEEE 802.1X MIB is specified
|
|
on */
|
|
view = SNMP_View_Create(twob_obj, 2);
|
|
if (view == 0)
|
|
{
|
|
printf("Error creating view for 802.1X MIB\n");
|
|
return(ERROR);
|
|
}
|
|
|
|
SNMP_View_Set_Status(view, RS_ACTIVE);
|
|
SNMP_View_Set_Type(view, VIEW_INCLUDED);
|
|
if (SNMP_View_2275_Install(view, (bits8_t *) "two", 3))
|
|
{
|
|
printf("Error installing view for 802.1X MIB\n");
|
|
return(ERROR);
|
|
}
|
|
|
|
|
|
/* Actually add the tree to the view we just created. This has to be done
|
|
under an SNMP agent "coarse lock" to prevent the MIB from being accesses
|
|
as we add a tree */
|
|
ENVOY_SNMP_GET_WRITE_LOCK(SNMP_CoarseLock);
|
|
status = Add_Node_From_Root(&mib_root_node, &objid_paeMIBObjects,
|
|
&n_paeMIBObjects, &rnode);
|
|
ENVOY_SNMP_RELEASE_WRITE_LOCK(SNMP_CoarseLock);
|
|
|
|
if (status != 0)
|
|
{
|
|
printf("Error creating view for IEEE 802.1X MIB %d\n", status);
|
|
return(ERROR);
|
|
}
|
|
else
|
|
{
|
|
printf("Creating view for IEEE 802.1X MIB %d\n", status);
|
|
return(OK);
|
|
}
|
|
}
|
|
|
|
/****************************************************************************
|
|
* dot1xMibHandlerInstall -
|
|
*
|
|
* This routine
|
|
*
|
|
* RETURNS: OK or ERROR.
|
|
*
|
|
* NOMANUAL
|
|
*/
|
|
STATUS dot1xMibHandlerInstall
|
|
(
|
|
void * pHandlerTable, /* function table */
|
|
int type /* authenticator - 0 or supplicant - 1 */
|
|
)
|
|
{
|
|
/* sanity check */
|
|
if(pHandlerTable == NULL)
|
|
{
|
|
return(ERROR);
|
|
}
|
|
|
|
/* Allocate the MIB handler table */
|
|
if(pMibTable == NULL)
|
|
{
|
|
pMibTable = calloc(1, sizeof(DOT1X_MIB_HANDLER));
|
|
if(pMibTable == NULL)
|
|
{
|
|
return(ERROR);
|
|
}
|
|
}
|
|
|
|
switch(type)
|
|
{
|
|
case DOT1X_SUPP_BINDING:
|
|
if(pMibTable != NULL)
|
|
{
|
|
pMibTable->suppHandler = pHandlerTable;
|
|
}
|
|
break;
|
|
case DOT1X_AUTH_BINDING:
|
|
if(pMibTable != NULL)
|
|
{
|
|
pMibTable->authHandler = pHandlerTable;
|
|
}
|
|
break;
|
|
default:
|
|
return(ERROR);
|
|
}
|
|
|
|
/* Handler table installed */
|
|
return(OK);
|
|
}
|
|
|
|
/****************************************************************************
|
|
* dot1xMibHandlerRemove -
|
|
*
|
|
* This routine
|
|
*
|
|
* RETURNS: OK or ERROR.
|
|
*
|
|
* NOMANUAL
|
|
*/
|
|
STATUS dot1xMibHandlerRemove
|
|
(
|
|
void * pHandlerTable, /* function table */
|
|
int type /* authenticator - 0 or supplicant - 1 */
|
|
)
|
|
{
|
|
/* Sanity check */
|
|
if(pHandlerTable == NULL)
|
|
{
|
|
return(ERROR);
|
|
}
|
|
|
|
switch(type)
|
|
{
|
|
case DOT1X_SUPP_BINDING:
|
|
if(pMibTable != NULL && pMibTable->suppHandler != NULL)
|
|
{
|
|
pMibTable->suppHandler = NULL;
|
|
}
|
|
break;
|
|
case DOT1X_AUTH_BINDING:
|
|
if(pMibTable != NULL && pMibTable->authHandler != NULL)
|
|
{
|
|
pMibTable->authHandler = NULL;
|
|
}
|
|
break;
|
|
default:
|
|
return(ERROR);
|
|
}
|
|
|
|
/* Handler table removed */
|
|
return(OK);
|
|
}
|
|
|
|
/****************************************************************************
|
|
* dot1xMibHandlerBind -
|
|
*
|
|
* This routine
|
|
*
|
|
* RETURNS: pointer to handler or NULL on error.
|
|
*/
|
|
LOCAL void * dot1xMibHandlerBind
|
|
(
|
|
int type /* handler type to bind to */
|
|
)
|
|
{
|
|
void * pHandler = NULL;
|
|
|
|
switch(type)
|
|
{
|
|
case DOT1X_AUTH_BINDING:
|
|
pHandler = pMibTable->authHandler;
|
|
break;
|
|
case DOT1X_SUPP_BINDING:
|
|
pHandler = pMibTable->suppHandler;
|
|
break;
|
|
default:
|
|
return(NULL);
|
|
}
|
|
|
|
/* return the handler */
|
|
return(pHandler);
|
|
}
|
|
|
|
/*****************************************************************************
|
|
* entryGenericGet - Retrieve a specified entry from the MIB data base
|
|
*
|
|
* This routine is a common retrieving function, expect to be called by most
|
|
* get method routines.
|
|
*
|
|
* RETURNS: NONE
|
|
*/
|
|
LOCAL void entryGenericGet
|
|
(
|
|
OIDC_T lastmatch, /* last OID matched to get to this leaf */
|
|
int compc, /* length of the instance portion */
|
|
OIDC_T * compl, /* ptr to the instance portion */
|
|
SNMP_PKT_T * pktp, /* ptr to internal representation of snmp pkt*/
|
|
VB_T * vbp, /* ptr to var bind being processed */
|
|
UINT32 entryId, /* which MIB entry */
|
|
void * pEntry, /* buffer for retrieved data */
|
|
UINT32 len, /* length of buffer */
|
|
FUNCPTR entryValueGet, /* SNMP agent specified value get function */
|
|
int type /* 0 - authenticator , 1 - supplicant */
|
|
)
|
|
{
|
|
int error;
|
|
OIDC_T portNum;
|
|
DOT1X_MIB_FUNC_TABLE *pSnmpHandler;
|
|
|
|
/* Bind to handler method */
|
|
pSnmpHandler = dot1xMibHandlerBind(type);
|
|
if(pSnmpHandler == NULL || pSnmpHandler->next == NULL)
|
|
{
|
|
getproc_nosuchins(pktp, vbp);
|
|
return;
|
|
}
|
|
|
|
/* find all the varbinds that share the same getproc and instance */
|
|
snmpdGroupByGetprocAndInstance(pktp, vbp, compc, compl);
|
|
|
|
/* should have one component, which is the index */
|
|
if(compc != 1)
|
|
{
|
|
for(; vbp != NULL; vbp = vbp->vb_link)
|
|
{
|
|
getproc_nosuchins(pktp, vbp);
|
|
}
|
|
return;
|
|
}
|
|
|
|
/* retrieve the index which is the port number */
|
|
portNum = *compl;
|
|
|
|
if(pSnmpHandler->get(portNum, entryId, pEntry, len) != 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)
|
|
{
|
|
if((error = entryValueGet(vbp->vb_ml.ml_last_match, pktp,
|
|
vbp, pEntry)) != NO_ERROR)
|
|
{
|
|
getproc_error(pktp, vbp, error);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/****************************************************************************
|
|
* entryGenericNext - Retrieve a specified next entry from the MIB data base
|
|
*
|
|
* This routine is a common next function, expect to be called by most
|
|
* next method routines.
|
|
*
|
|
* RETURNS: NONE
|
|
*/
|
|
LOCAL void entryGenericNext
|
|
(
|
|
OIDC_T lastmatch, /* last OID matched to get to this leaf */
|
|
int compc, /* length of the instance portion */
|
|
OIDC_T * compl, /* ptr to the instance portion */
|
|
SNMP_PKT_T * pktp, /* ptr to internal representation of snmp pkt*/
|
|
VB_T * vbp, /* ptr to var bind being processed */
|
|
UINT32 entryId, /* which MIB entry */
|
|
void * pEntry, /* buffer for retrieved data */
|
|
UINT32 len, /* length of buffer */
|
|
FUNCPTR entryValueGet, /* SNMP agent specified value get function */
|
|
int type /* 0 - authenticator , 1 - supplicant */
|
|
)
|
|
{
|
|
OIDC_T portNum; /* Oid sequence for port number */
|
|
int error;
|
|
DOT1X_MIB_FUNC_TABLE *pSnmpHandler;
|
|
|
|
/* Bind to handler method */
|
|
pSnmpHandler = dot1xMibHandlerBind(type);
|
|
if(pSnmpHandler == NULL || pSnmpHandler->next == NULL)
|
|
{
|
|
getproc_nosuchins(pktp, vbp);
|
|
return;
|
|
}
|
|
|
|
/* find all the varbinds that share the same getproc and instance */
|
|
snmpdGroupByGetprocAndInstance(pktp, vbp, compc, compl);
|
|
|
|
/* Set the compl to 0 on a NULL binding */
|
|
portNum = (compl != NULL) ? *compl : 0;
|
|
|
|
if(pSnmpHandler->next(&portNum, entryId, pEntry, len) == OK)
|
|
{
|
|
for(; vbp; vbp = vbp->vb_link)
|
|
{
|
|
nextproc_next_instance(pktp, vbp, PORT_NUM_LEN, &portNum);
|
|
if((error = entryValueGet(vbp->vb_ml.ml_last_match, pktp, vbp,
|
|
pEntry)) != NO_ERROR)
|
|
{
|
|
getproc_error(pktp, vbp, error);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
/* there's no more in this table, try next object */
|
|
for(; vbp != NULL; vbp = vbp->vb_link)
|
|
{
|
|
nextproc_no_next(pktp, vbp);
|
|
}
|
|
}
|
|
}
|
|
|
|
/**************************************************************************
|
|
* dot1xPaePortEntry_get_value - Bind the variables of the PaePortEntry
|
|
* group
|
|
*
|
|
* This function is an internal routine to retrieve the values of the
|
|
* variables, used by the method routines dot1xPaePortEntry_get and
|
|
* dot1xPaePortEntry_next.
|
|
*
|
|
* RETURNS: error status, NO_ERROR or GEN_ERR if there is an error.
|
|
*/
|
|
LOCAL int dot1xPaePortEntry_get_value
|
|
(
|
|
OIDC_T lastmatch, /* the last OID matched to get to this leaf */
|
|
SNMP_PKT_T * pktp, /* ptr to internal representation of snmp pkt */
|
|
VB_T * vbp, /* ptr to var bind being processed */
|
|
void * pData /* PAE_PORT_ENTRY values */
|
|
)
|
|
{
|
|
D1XM_PAE_PORT_ENTRY *data = (D1XM_PAE_PORT_ENTRY*)pData;
|
|
OCTET_T * pBuf;
|
|
|
|
/* Sanity check */
|
|
if(data == NULL)
|
|
{
|
|
return(GEN_ERR);
|
|
}
|
|
|
|
switch(lastmatch)
|
|
{
|
|
case LEAF_dot1xPaePortProtocolVersion:
|
|
getproc_got_uint32(pktp, vbp, data->paePortProtocolVersion,
|
|
VT_GAUGE);
|
|
break;
|
|
|
|
case LEAF_dot1xPaePortCapabilities:
|
|
/* The buffer for getproc_got_string should be kept even after the
|
|
the corresponding method routine exits */
|
|
pBuf = SNMP_memory_alloc(4);
|
|
if(pBuf == NULL)
|
|
{
|
|
getproc_error(pktp, vbp, GEN_ERR);
|
|
return(GEN_ERR);
|
|
}
|
|
|
|
MEMCPY(pBuf, data->paePortCapabilities, 1);
|
|
getproc_got_string(pktp, vbp, 1, pBuf, BFL_IS_DYNAMIC, VT_STRING );
|
|
break;
|
|
|
|
case LEAF_dot1xPaePortInitialize:
|
|
/* Values:
|
|
* true(1) = VAL_dot1xPaePortInitialize_true
|
|
* false(2) = VAL_dot1xPaePortInitialize_false
|
|
*/
|
|
getproc_got_int32(pktp, vbp, data->paePortInitialize);
|
|
break;
|
|
|
|
case LEAF_dot1xPaePortReauthenticate:
|
|
/* Values:
|
|
* true(1) = VAL_dot1xPaePortReauthenticate_true
|
|
* false(2) = VAL_dot1xPaePortReauthenticate_false
|
|
*/
|
|
getproc_got_int32(pktp, vbp, data->paePortReauthenticate);
|
|
break;
|
|
|
|
default:
|
|
return(GEN_ERR);
|
|
}
|
|
|
|
return(NO_ERROR);
|
|
}
|
|
|
|
/*****************************************************************************
|
|
* dot1xPaePortEntry_get - Get the PaePortTable entry.
|
|
*
|
|
* This is the get method routine for PaePortTable
|
|
*
|
|
* RETURNS: NONE.
|
|
*
|
|
* NOMANUAL
|
|
*/
|
|
void dot1xPaePortEntry_get
|
|
(
|
|
OIDC_T lastmatch, /* the last OID matched to get to this leaf */
|
|
int compc, /* the length of the instance portion */
|
|
OIDC_T * compl, /* ptr to the instance portion */
|
|
SNMP_PKT_T * pktp, /* ptr to internal representation of snmp pkt*/
|
|
VB_T * vbp /* ptr to var bind being processed */
|
|
)
|
|
{
|
|
D1XM_PAE_PORT_ENTRY entry;
|
|
|
|
entryGenericGet(lastmatch, compc, compl, pktp, vbp, D1XM_VAR_PORT_ENTRY,
|
|
&entry, sizeof(D1XM_PAE_PORT_ENTRY),
|
|
dot1xPaePortEntry_get_value, DOT1X_AUTH_BINDING);
|
|
}
|
|
|
|
/***************************************************************************
|
|
* dot1xPaePortEntry_next - Get the next PaePortTable entry.
|
|
*
|
|
* This is the next method routine for PaePortTable entry.
|
|
*
|
|
* RETURNS: NONE.
|
|
*
|
|
* NOMANUAL
|
|
*/
|
|
void dot1xPaePortEntry_next
|
|
(
|
|
OIDC_T lastmatch, /* the last OID matched to get to this leaf */
|
|
int compc, /* the length of the instance portion */
|
|
OIDC_T * compl, /* ptr to the instance portion */
|
|
SNMP_PKT_T * pktp, /* ptr to internal representation of snmp pkt */
|
|
VB_T * vbp /* ptr to var bind being processed */
|
|
)
|
|
{
|
|
D1XM_PAE_PORT_ENTRY entry;
|
|
|
|
entryGenericNext(lastmatch, compc, compl, pktp, vbp, D1XM_VAR_PORT_ENTRY,
|
|
&entry, sizeof(D1XM_PAE_PORT_ENTRY),
|
|
dot1xPaePortEntry_get_value, DOT1X_AUTH_BINDING);
|
|
}
|
|
|
|
/****************************************************************************
|
|
* dot1xPaePortEntry_test - Validate the set values.
|
|
*
|
|
* This routine validates the set values for PaePortEntry. It should be
|
|
* called before the corresponding set method function is called.
|
|
*
|
|
* RETURNS: NONE.
|
|
*
|
|
* NOMANUAL
|
|
*/
|
|
void dot1xPaePortEntry_test
|
|
(
|
|
OIDC_T lastmatch, /* the last OID matched to get to this leaf */
|
|
int compc, /* the length of the instance portion */
|
|
OIDC_T * compl, /* ptr to the instance portion */
|
|
SNMP_PKT_T * pktp, /* ptr to internal representation of snmp pkt */
|
|
VB_T * vbp /* ptr to var bind being processed */
|
|
)
|
|
{
|
|
D1XM_PAE_PORT_ENTRY data;
|
|
VB_T * group_vbp;
|
|
OIDC_T portNum;
|
|
int errorStatus;
|
|
DOT1X_MIB_FUNC_TABLE *pSnmpHandler;
|
|
|
|
/* Bind to handler method */
|
|
pSnmpHandler = dot1xMibHandlerBind(DOT1X_AUTH_BINDING);
|
|
if(pSnmpHandler == NULL || pSnmpHandler->get == NULL)
|
|
{
|
|
getproc_nosuchins(pktp, vbp);
|
|
return;
|
|
}
|
|
|
|
if(compc != 1)
|
|
{
|
|
errorStatus = NO_SUCH_NAME;
|
|
goto errorReturn;
|
|
}
|
|
|
|
portNum = *compl;
|
|
|
|
if(pSnmpHandler->get(portNum,D1XM_VAR_PORT_ENTRY, &data,
|
|
sizeof(D1XM_PAE_PORT_ENTRY)) != OK)
|
|
{
|
|
errorStatus = NO_SUCH_NAME;
|
|
goto errorReturn;
|
|
}
|
|
|
|
/* find all the varbinds that share the same getproc and instance and
|
|
group them together. */
|
|
snmpdGroupByGetprocAndInstance(pktp, vbp, compc, compl);
|
|
|
|
/* now check each varbind */
|
|
for(group_vbp = vbp; group_vbp; group_vbp = group_vbp->vb_link)
|
|
{
|
|
switch(group_vbp->vb_ml.ml_last_match)
|
|
{
|
|
case LEAF_dot1xPaePortInitialize:
|
|
switch(VB_GET_INT32(group_vbp))
|
|
{
|
|
case VAL_dot1xPaePortInitialize_true:
|
|
case VAL_dot1xPaePortInitialize_false:
|
|
break;
|
|
default:
|
|
errorStatus = WRONG_VALUE;
|
|
goto errorReturn;
|
|
}
|
|
break;
|
|
|
|
case LEAF_dot1xPaePortReauthenticate:
|
|
switch (VB_GET_INT32(group_vbp))
|
|
{
|
|
case VAL_dot1xPaePortReauthenticate_true:
|
|
case VAL_dot1xPaePortReauthenticate_false:
|
|
break;
|
|
default:
|
|
errorStatus = WRONG_VALUE;
|
|
goto errorReturn;
|
|
}
|
|
break;
|
|
|
|
default:
|
|
errorStatus = GEN_ERR;
|
|
goto errorReturn;
|
|
}
|
|
|
|
testproc_good(pktp, group_vbp);
|
|
} /* end for loop */
|
|
return;
|
|
|
|
errorReturn:
|
|
testproc_error(pktp, vbp, errorStatus);
|
|
}
|
|
|
|
/****************************************************************************
|
|
* dot1xPaePortEntry_set - Set the variables in PaePortEntry.
|
|
*
|
|
* This routine is the set method function for PaePortEntry.
|
|
*
|
|
* RETURNS: NONE.
|
|
*
|
|
* NOMANUAL
|
|
*/
|
|
void dot1xPaePortEntry_set
|
|
(
|
|
OIDC_T lastmatch, /* the last OID matched to get to this leaf */
|
|
int compc, /* the length of the instance portion */
|
|
OIDC_T * compl, /* ptr to the instance portion */
|
|
SNMP_PKT_T * pktp, /* ptr to internal representation of snmp pkt*/
|
|
VB_T * vbp /* ptr to var bind being processed */
|
|
)
|
|
{
|
|
VB_T * pSavedVbp;
|
|
UINT32 varFields = 0;
|
|
OIDC_T portNum;
|
|
DOT1X_MIB_FUNC_TABLE *pSnmpHandler;
|
|
|
|
/* Bind to handler method */
|
|
pSnmpHandler = dot1xMibHandlerBind(DOT1X_AUTH_BINDING);
|
|
if(pSnmpHandler == NULL || pSnmpHandler->set == NULL)
|
|
{
|
|
getproc_nosuchins(pktp, vbp);
|
|
return;
|
|
}
|
|
|
|
pSavedVbp = vbp;
|
|
portNum = *compl;
|
|
|
|
for( ; vbp; vbp = vbp->vb_link)
|
|
{
|
|
switch(vbp->vb_ml.ml_last_match)
|
|
{
|
|
case LEAF_dot1xPaePortInitialize:
|
|
varFields = D1XM_VAR_PaePortInitialize;
|
|
break;
|
|
|
|
case LEAF_dot1xPaePortReauthenticate:
|
|
varFields = D1XM_VAR_PaePortReauthenticate;
|
|
break;
|
|
|
|
default:
|
|
setproc_error(pktp, pSavedVbp, COMMIT_FAILED);
|
|
return;
|
|
}
|
|
|
|
if(pSnmpHandler->set(portNum, varFields, VB_GET_INT32(vbp))== OK)
|
|
{
|
|
setproc_good(pktp, vbp);
|
|
}
|
|
else
|
|
{
|
|
setproc_error(pktp,pSavedVbp,COMMIT_FAILED);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
/****************************************************************************
|
|
*
|
|
* dot1xPaeSystem_get_value - Bind the PaeSystem variable
|
|
*
|
|
* this is an internal routine to retrieve the values of the variables, used
|
|
* by the method routines dot1xPaeSystem_get and dot1xPaeSystem_next.
|
|
*
|
|
* RETURNS: error status, NO_ERROR or GEN_ERR if there is an error.
|
|
*/
|
|
LOCAL int dot1xPaeSystem_get_value
|
|
(
|
|
OIDC_T lastmatch, /* the last OID matched */
|
|
SNMP_PKT_T * pktp, /* ptr to snmp pkt */
|
|
VB_T * vbp, /* ptr to var bind being processed */
|
|
D1XM_SYSTEM_AUTH_CONTROL * data /* SYSTEM_AUTH_CONTROL value */
|
|
)
|
|
{
|
|
switch(lastmatch)
|
|
{
|
|
case LEAF_dot1xPaeSystemAuthControl:
|
|
/* Values:
|
|
* enabled(1) = VAL_dot1xPaeSystemAuthControl_enabled
|
|
* disabled(2) = VAL_dot1xPaeSystemAuthControl_disabled
|
|
*/
|
|
getproc_got_int32(pktp, vbp, *data);
|
|
break;
|
|
|
|
default:
|
|
return GEN_ERR;
|
|
}
|
|
|
|
return(NO_ERROR);
|
|
}
|
|
|
|
/*****************************************************************************
|
|
*
|
|
* dot1xPaeSystem_get - Get the PaeSystem variable.
|
|
*
|
|
* This is the get method routine of the PaeSystem variable.
|
|
*
|
|
* RETURNS: NONE.
|
|
*
|
|
* NOMANUAL
|
|
*/
|
|
|
|
void dot1xPaeSystem_get
|
|
(
|
|
OIDC_T lastmatch, /* the last OID matched to get to this leaf */
|
|
int compc, /* the length of the instance portion */
|
|
OIDC_T * compl, /* ptr to the instance portion */
|
|
SNMP_PKT_T * pktp, /* ptr to internal representation of snmp pkt */
|
|
VB_T * vbp /* ptr to var bind being processed */
|
|
)
|
|
{
|
|
D1XM_SYSTEM_AUTH_CONTROL data;
|
|
int error;
|
|
VB_T * pSaveVbp;
|
|
DOT1X_MIB_FUNC_TABLE *pSnmpHandler;
|
|
|
|
/* Bind to handler method */
|
|
pSnmpHandler = dot1xMibHandlerBind(DOT1X_AUTH_BINDING);
|
|
if(pSnmpHandler == NULL || pSnmpHandler->get == NULL)
|
|
{
|
|
getproc_nosuchins(pktp, vbp);
|
|
return;
|
|
}
|
|
|
|
pSaveVbp = vbp;
|
|
|
|
/* find all the varbinds that share the same getproc and instance */
|
|
snmpdGroupByGetprocAndInstance(pktp, vbp, compc, compl);
|
|
|
|
/* check that the instance is exactly .0 */
|
|
if(!((compc == 1) && (*compl == 0)))
|
|
{
|
|
for( ; vbp; vbp = vbp->vb_link)
|
|
{
|
|
getproc_nosuchins(pktp, vbp);
|
|
}
|
|
}
|
|
/* grab the actual data for this variable. */
|
|
else if(pSnmpHandler->get(0, D1XM_VAR_PaeSystemAuth, &data,
|
|
sizeof(D1XM_SYSTEM_AUTH_CONTROL)) != OK)
|
|
{
|
|
for( ; vbp; vbp = vbp->vb_link)
|
|
{
|
|
getproc_error(pktp, vbp, GEN_ERR);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
/* retrieve all the values from the same data structure */
|
|
for( ; vbp; vbp = vbp->vb_link)
|
|
{
|
|
if ((error = dot1xPaeSystem_get_value(vbp->vb_ml.ml_last_match,
|
|
pktp, vbp, &data))
|
|
!= NO_ERROR)
|
|
{
|
|
getproc_error(pktp, pSaveVbp, error);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/*****************************************************************************
|
|
*
|
|
* dot1xPaeSystem_next - Get the next PaeSystem
|
|
*
|
|
* This is the next method function for PaeSystem variable. Since the PaeSystem
|
|
* is the scalar variable, there is only one instance.
|
|
*
|
|
* RETURNS: NONE.
|
|
*
|
|
* NOMANUAL
|
|
*/
|
|
|
|
void dot1xPaeSystem_next
|
|
(
|
|
OIDC_T lastmatch, /* the last OID matched to get to this leaf */
|
|
int compc, /* the length of the instance portion */
|
|
OIDC_T * compl, /* ptr to the instance portion */
|
|
SNMP_PKT_T * pktp, /* ptr to internal representation of snmp pkt*/
|
|
VB_T * vbp /* ptr to var bind being processed */
|
|
)
|
|
{
|
|
D1XM_SYSTEM_AUTH_CONTROL data;
|
|
OIDC_T instance = 0;
|
|
DOT1X_MIB_FUNC_TABLE *pSnmpHandler;
|
|
|
|
/* Bind to handler method */
|
|
pSnmpHandler = dot1xMibHandlerBind(DOT1X_AUTH_BINDING);
|
|
if(pSnmpHandler == NULL || pSnmpHandler->get == NULL)
|
|
{
|
|
getproc_nosuchins(pktp, vbp);
|
|
return;
|
|
}
|
|
|
|
/* the only time there's a next for a scalar is if we're given
|
|
no instance at all. */
|
|
if(compc != 0)
|
|
{
|
|
nextproc_no_next(pktp, vbp);
|
|
}
|
|
/* grab the data for these variables. */
|
|
else if(pSnmpHandler->get(0, D1XM_VAR_PaeSystemAuth, &data,
|
|
sizeof(D1XM_SYSTEM_AUTH_CONTROL)) != OK)
|
|
{
|
|
getproc_error(pktp, vbp, GEN_ERR);
|
|
}
|
|
else
|
|
{
|
|
/* find all the varbinds in this group and retrieve their
|
|
values from the same data structure */
|
|
for(snmpdGroupByGetprocAndInstance(pktp, vbp, compc, compl);
|
|
vbp; vbp = vbp->vb_link)
|
|
{
|
|
nextproc_next_instance(pktp, vbp, 1, &instance);
|
|
dot1xPaeSystem_get_value(vbp->vb_ml.ml_last_match, pktp, vbp,
|
|
&data);
|
|
}
|
|
}
|
|
}
|
|
|
|
/*****************************************************************************
|
|
* dot1xPaeSystem_test - Validate the PaeSystem set value.
|
|
*
|
|
* This is the test method function for PaeSystem.
|
|
*
|
|
* RETURNS: NONE.
|
|
*
|
|
* NOMANUAL
|
|
*/
|
|
void dot1xPaeSystem_test
|
|
(
|
|
OIDC_T lastmatch, /* the last OID matched to get to this leaf */
|
|
int compc, /* the length of the instance portion */
|
|
OIDC_T * compl, /* ptr to the instance portion */
|
|
SNMP_PKT_T * pktp, /* ptr to internal representation of snmp pkt*/
|
|
VB_T * vbp /* ptr to var bind being processed */
|
|
)
|
|
{
|
|
VB_T *group_vbp;
|
|
|
|
/* Only scalar variables here, check for .0 */
|
|
if(!((compc == 1) && (*compl == 0)))
|
|
{
|
|
testproc_error(pktp, vbp, NO_SUCH_NAME);
|
|
return;
|
|
}
|
|
|
|
/* find all the varbinds that share the same getproc and instance and
|
|
group them together. */
|
|
|
|
snmpdGroupByGetprocAndInstance(pktp, vbp, compc, compl);
|
|
|
|
/* now check each varbind */
|
|
for(group_vbp = vbp; group_vbp; group_vbp = group_vbp->vb_link)
|
|
{
|
|
switch(group_vbp->vb_ml.ml_last_match)
|
|
{
|
|
case LEAF_dot1xPaeSystemAuthControl:
|
|
switch (VB_GET_INT32(group_vbp))
|
|
{
|
|
case VAL_dot1xPaeSystemAuthControl_enabled:
|
|
case VAL_dot1xPaeSystemAuthControl_disabled:
|
|
break;
|
|
default:
|
|
testproc_error(pktp, group_vbp, WRONG_VALUE);
|
|
continue;
|
|
}
|
|
testproc_good(pktp, group_vbp);
|
|
break;
|
|
|
|
default:
|
|
testproc_error(pktp, group_vbp, GEN_ERR);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
/*****************************************************************************
|
|
* dot1xPaeSystem_set - Set PaeSystem variable.
|
|
*
|
|
* This is the set method function for PaeSystem variable.
|
|
*
|
|
* RETURNS: NONE.
|
|
*
|
|
* NOMANUAL
|
|
*/
|
|
void dot1xPaeSystem_set
|
|
(
|
|
OIDC_T lastmatch, /* the last OID matched to get to this leaf */
|
|
int compc, /* the length of the instance portion */
|
|
OIDC_T * compl, /* ptr to the instance portion */
|
|
SNMP_PKT_T * pktp, /* ptr to internal representation of snmp pkt*/
|
|
VB_T * vbp /* ptr to var bind being processed */
|
|
)
|
|
{
|
|
DOT1X_MIB_FUNC_TABLE *pSnmpHandler;
|
|
|
|
/* Bind to handler method */
|
|
pSnmpHandler = dot1xMibHandlerBind(DOT1X_AUTH_BINDING);
|
|
if(pSnmpHandler == NULL || pSnmpHandler->set == NULL)
|
|
{
|
|
getproc_nosuchins(pktp, vbp);
|
|
return;
|
|
}
|
|
|
|
for( ; vbp; vbp = vbp->vb_link)
|
|
{
|
|
switch(vbp->vb_ml.ml_last_match)
|
|
{
|
|
case LEAF_dot1xPaeSystemAuthControl:
|
|
if(pSnmpHandler->set(0, D1XM_VAR_PaeSystemAuth,
|
|
VB_GET_INT32(vbp)) == OK)
|
|
{
|
|
setproc_good(pktp, vbp);
|
|
}
|
|
else
|
|
{
|
|
setproc_error(pktp, vbp, COMMIT_FAILED);
|
|
}
|
|
break;
|
|
|
|
default:
|
|
setproc_error(pktp, vbp, COMMIT_FAILED);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
/**************************************************************************
|
|
* dot1xAuthConfigEntry_get_value - Bind the variables of the AuthConfigEntry
|
|
*
|
|
* This is an internal routine to retrieve the values of the variables, used
|
|
* by the method routines dot1xAuthConfigEntry_get and dot1xAuthConfigEntry_next
|
|
*
|
|
* RETURNS: error status, NO_ERROR or GEN_ERR if there is an error.
|
|
*/
|
|
LOCAL int dot1xAuthConfigEntry_get_value
|
|
(
|
|
OIDC_T lastmatch, /* the last OID matched to get to this leaf */
|
|
SNMP_PKT_T * pktp, /* ptr to internal representation of snmp pkt*/
|
|
VB_T * vbp, /* ptr to var bind being processed */
|
|
void * pData /* AUTH_CONFIG_ENTRY values */
|
|
)
|
|
{
|
|
D1XM_AUTH_CONFIG_ENTRY *data = (D1XM_AUTH_CONFIG_ENTRY*)pData;
|
|
|
|
/* Sanity check */
|
|
if(data == NULL)
|
|
{
|
|
return(GEN_ERR);
|
|
}
|
|
|
|
switch(lastmatch)
|
|
{
|
|
case LEAF_dot1xAuthPaeState:
|
|
/* Values:
|
|
* initialize(1) = VAL_dot1xAuthPaeState_initialize
|
|
* disconnected(2) = VAL_dot1xAuthPaeState_disconnected
|
|
* connecting(3) = VAL_dot1xAuthPaeState_connecting
|
|
* authenticating(4) = VAL_dot1xAuthPaeState_authenticating
|
|
* authenticated(5) = VAL_dot1xAuthPaeState_authenticated
|
|
* aborting(6) = VAL_dot1xAuthPaeState_aborting
|
|
* held(7) = VAL_dot1xAuthPaeState_held
|
|
* forceAuth(8) = VAL_dot1xAuthPaeState_forceAuth
|
|
* forceUnauth(9) = VAL_dot1xAuthPaeState_forceUnauth
|
|
*/
|
|
getproc_got_int32(pktp, vbp, data->authPaeState);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthBackendAuthState:
|
|
/* Values:
|
|
* request(1) = VAL_dot1xAuthBackendAuthState_request
|
|
* response(2) = VAL_dot1xAuthBackendAuthState_response
|
|
* success(3) = VAL_dot1xAuthBackendAuthState_success
|
|
* fail(4) = VAL_dot1xAuthBackendAuthState_fail
|
|
* timeout(5) = VAL_dot1xAuthBackendAuthState_timeout
|
|
* idle(6) = VAL_dot1xAuthBackendAuthState_idle
|
|
* initialize(7) = VAL_dot1xAuthBackendAuthState_initialize
|
|
*/
|
|
getproc_got_int32(pktp, vbp, data->authBackendAuthState);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthAdminControlledDirections:
|
|
/* Values:
|
|
* both(0) = VAL_dot1xAuthAdminControlledDirections_both
|
|
* in(1) = VAL_dot1xAuthAdminControlledDirections_in
|
|
*/
|
|
getproc_got_int32(pktp, vbp, data->authAdminControlledDirections);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthOperControlledDirections:
|
|
/* Values:
|
|
* both(0) = VAL_dot1xAuthOperControlledDirections_both
|
|
* in(1) = VAL_dot1xAuthOperControlledDirections_in
|
|
*/
|
|
getproc_got_int32(pktp, vbp, data->authOperControlledDirections);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthAuthControlledPortStatus:
|
|
/* Values:
|
|
*authorized(1) = VAL_dot1xAuthAuthControlledPortStatus_authorized
|
|
*unauthorized(2)=VAL_dot1xAuthAuthControlledPortStatus_unauthorized
|
|
*/
|
|
getproc_got_int32(pktp, vbp, data->authAuthControlledPortStatus);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthAuthControlledPortControl:
|
|
/* Values:
|
|
* forceUnauthorized(1) =
|
|
* VAL_dot1xAuthAuthControlledPortControl_forceUnauthorized
|
|
* auto(2) = VAL_dot1xAuthAuthControlledPortControl_auto
|
|
* forceAuthorized(3) =
|
|
* VAL_dot1xAuthAuthControlledPortControl_forceAuthorized
|
|
*/
|
|
getproc_got_int32(pktp, vbp, data->authAuthControlledPortControl);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthQuietPeriod:
|
|
getproc_got_uint32(pktp, vbp, data->authQuietPeriod, VT_GAUGE);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthTxPeriod:
|
|
getproc_got_uint32(pktp, vbp, data->authTxPeriod, VT_GAUGE);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthSuppTimeout:
|
|
getproc_got_uint32(pktp, vbp, data->authSuppTimeout, VT_GAUGE);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthServerTimeout:
|
|
getproc_got_uint32(pktp, vbp, data->authServerTimeout, VT_GAUGE);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthMaxReq:
|
|
getproc_got_uint32(pktp, vbp, data->authMaxReq, VT_GAUGE);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthReAuthPeriod:
|
|
getproc_got_uint32(pktp, vbp, data->authReAuthPeriod, VT_GAUGE);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthReAuthEnabled:
|
|
/* Values:
|
|
* true(1) = VAL_dot1xAuthReAuthEnabled_true
|
|
* false(2) = VAL_dot1xAuthReAuthEnabled_false
|
|
*/
|
|
getproc_got_int32(pktp, vbp, data->authReAuthEnabled);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthKeyTxEnabled:
|
|
/* Values:
|
|
* true(1) = VAL_dot1xAuthKeyTxEnabled_true
|
|
* false(2) = VAL_dot1xAuthKeyTxEnabled_false
|
|
*/
|
|
getproc_got_int32(pktp, vbp, data->authKeyTxEnabled);
|
|
break;
|
|
default:
|
|
return(GEN_ERR);
|
|
}
|
|
|
|
return(NO_ERROR);
|
|
}
|
|
|
|
/*****************************************************************************
|
|
* dot1xAuthConfigEntry_get - Get the AuthConfigEntry
|
|
*
|
|
* This is the get method routine for AuthConfigEntry
|
|
*
|
|
* RETURNS: NONE.
|
|
*
|
|
* NOMANUAL
|
|
*/
|
|
void dot1xAuthConfigEntry_get
|
|
(
|
|
OIDC_T lastmatch, /* the last OID matched to get to this leaf */
|
|
int compc, /* the length of the instance portion */
|
|
OIDC_T * compl, /* ptr to the instance portion */
|
|
SNMP_PKT_T * pktp, /* ptr to internal representation of snmp pkt*/
|
|
VB_T * vbp /* ptr to var bind being processed */
|
|
)
|
|
{
|
|
D1XM_AUTH_CONFIG_ENTRY entry;
|
|
|
|
entryGenericGet(lastmatch, compc, compl, pktp, vbp,
|
|
D1XM_VAR_AUTH_CFG_ENTRY, &entry,
|
|
sizeof(D1XM_AUTH_CONFIG_ENTRY),
|
|
dot1xAuthConfigEntry_get_value, DOT1X_AUTH_BINDING);
|
|
}
|
|
|
|
/***************************************************************************
|
|
* dot1xAuthConfigEntry_next - Get the next AuthConfigEntry
|
|
*
|
|
* This is the next method routine for AuthConfigEntry
|
|
*
|
|
* RETURNS: NONE
|
|
*
|
|
* NOMANUAL
|
|
*/
|
|
void dot1xAuthConfigEntry_next
|
|
(
|
|
OIDC_T lastmatch, /* the last OID matched to get to this leaf */
|
|
int compc, /* the length of the instance portion */
|
|
OIDC_T * compl, /* ptr to the instance portion */
|
|
SNMP_PKT_T * pktp, /* ptr to internal representation of snmp pkt */
|
|
VB_T * vbp /* ptr to var bind being processed */
|
|
)
|
|
{
|
|
D1XM_AUTH_CONFIG_ENTRY entry;
|
|
|
|
entryGenericNext(lastmatch, compc, compl, pktp, vbp,
|
|
D1XM_VAR_AUTH_CFG_ENTRY,
|
|
&entry, sizeof(D1XM_AUTH_CONFIG_ENTRY),
|
|
dot1xAuthConfigEntry_get_value, DOT1X_AUTH_BINDING);
|
|
}
|
|
|
|
/****************************************************************************
|
|
* dot1xAuthConfigEntry_test - Validate the set values
|
|
*
|
|
* This routine validates the set values for AuthConfigEntry. It should be
|
|
* called
|
|
* before the corresponding set method function is called.
|
|
*
|
|
* RETURNS: NONE.
|
|
*
|
|
* NOMANUAL
|
|
*/
|
|
void dot1xAuthConfigEntry_test
|
|
(
|
|
OIDC_T lastmatch, /* the last OID matched to get to this leaf */
|
|
int compc, /* the length of the instance portion */
|
|
OIDC_T * compl, /* ptr to the instance portion */
|
|
SNMP_PKT_T * pktp, /* ptr to internal representation of snmp pkt */
|
|
VB_T * vbp /* ptr to var bind being processed */
|
|
)
|
|
{
|
|
D1XM_AUTH_CONFIG_ENTRY data;
|
|
VB_T * group_vbp;
|
|
int errorStatus;
|
|
OIDC_T portNum;
|
|
DOT1X_MIB_FUNC_TABLE *pSnmpHandler;
|
|
|
|
/* Bind to handler method */
|
|
pSnmpHandler = dot1xMibHandlerBind(DOT1X_AUTH_BINDING);
|
|
if(pSnmpHandler == NULL || pSnmpHandler->get == NULL)
|
|
{
|
|
getproc_nosuchins(pktp, vbp);
|
|
return;
|
|
}
|
|
|
|
if(compc != 1)
|
|
{
|
|
errorStatus = NO_SUCH_NAME;
|
|
goto errorReturn;
|
|
}
|
|
|
|
portNum = *compl;
|
|
|
|
if(pSnmpHandler->get(portNum,D1XM_VAR_AUTH_CFG_ENTRY,&data,
|
|
sizeof(D1XM_AUTH_CONFIG_ENTRY)) != OK)
|
|
{
|
|
errorStatus = NO_SUCH_NAME;
|
|
goto errorReturn;
|
|
}
|
|
|
|
/* find all the varbinds that share the same getproc and instance and
|
|
group them together. */
|
|
snmpdGroupByGetprocAndInstance(pktp, vbp, compc, compl);
|
|
|
|
/* now check each varbind */
|
|
for(group_vbp = vbp; group_vbp; group_vbp = group_vbp->vb_link)
|
|
{
|
|
switch (group_vbp->vb_ml.ml_last_match)
|
|
{
|
|
case LEAF_dot1xAuthAdminControlledDirections:
|
|
switch (VB_GET_INT32(group_vbp))
|
|
{
|
|
case VAL_dot1xAuthAdminControlledDirections_both:
|
|
case VAL_dot1xAuthAdminControlledDirections_in:
|
|
break;
|
|
default:
|
|
errorStatus = WRONG_VALUE;
|
|
goto errorReturn;
|
|
} /* end switch (VB_GET_INT32(group_vbp)) */
|
|
|
|
break;
|
|
|
|
case LEAF_dot1xAuthAuthControlledPortControl:
|
|
|
|
switch (VB_GET_INT32(group_vbp)){
|
|
case VAL_dot1xAuthAuthControlledPortControl_forceUnauthorized:
|
|
case VAL_dot1xAuthAuthControlledPortControl_auto:
|
|
case VAL_dot1xAuthAuthControlledPortControl_forceAuthorized:
|
|
break;
|
|
default:
|
|
errorStatus = WRONG_VALUE;
|
|
goto errorReturn;
|
|
}
|
|
break;
|
|
|
|
case LEAF_dot1xAuthQuietPeriod:
|
|
case LEAF_dot1xAuthTxPeriod:
|
|
case LEAF_dot1xAuthSuppTimeout:
|
|
case LEAF_dot1xAuthServerTimeout:
|
|
case LEAF_dot1xAuthMaxReq:
|
|
case LEAF_dot1xAuthReAuthPeriod:
|
|
break;
|
|
case LEAF_dot1xAuthReAuthEnabled:
|
|
switch (VB_GET_INT32(group_vbp))
|
|
{
|
|
case VAL_dot1xAuthReAuthEnabled_true:
|
|
case VAL_dot1xAuthReAuthEnabled_false:
|
|
break;
|
|
default:
|
|
errorStatus = WRONG_VALUE;
|
|
goto errorReturn;
|
|
|
|
}
|
|
break;
|
|
|
|
case LEAF_dot1xAuthKeyTxEnabled:
|
|
switch (VB_GET_INT32(group_vbp))
|
|
{
|
|
case VAL_dot1xAuthKeyTxEnabled_true:
|
|
case VAL_dot1xAuthKeyTxEnabled_false:
|
|
break;
|
|
default:
|
|
errorStatus = WRONG_VALUE;
|
|
goto errorReturn;
|
|
}
|
|
break;
|
|
default:
|
|
errorStatus = WRONG_VALUE;
|
|
goto errorReturn;
|
|
|
|
}
|
|
testproc_good(pktp, group_vbp);
|
|
|
|
} /* end the for loop */
|
|
|
|
return;
|
|
|
|
errorReturn:
|
|
testproc_error (pktp, vbp, errorStatus);
|
|
}
|
|
|
|
/****************************************************************************
|
|
* dot1xAuthConfigEntry_set - Set the variables in AuthConfigEntry.
|
|
*
|
|
* This is the set method function for AuthConfigEntry.
|
|
*
|
|
* RETURNS: NONE.
|
|
*
|
|
* NOMANUAL
|
|
*/
|
|
void dot1xAuthConfigEntry_set
|
|
(
|
|
OIDC_T lastmatch, /* the last OID matched to get to this leaf */
|
|
int compc, /* the length of the instance portion */
|
|
OIDC_T * compl, /* ptr to the instance portion */
|
|
SNMP_PKT_T * pktp, /* ptr to internal representation of snmp pkt */
|
|
VB_T * vbp /* ptr to var bind being processed */
|
|
)
|
|
{
|
|
VB_T * pSavedVbp;
|
|
UINT32 varFields = 0;
|
|
OIDC_T portNum;
|
|
DOT1X_MIB_FUNC_TABLE *pSnmpHandler;
|
|
|
|
/* Bind to handler method */
|
|
pSnmpHandler = dot1xMibHandlerBind(DOT1X_AUTH_BINDING);
|
|
if(pSnmpHandler == NULL || pSnmpHandler->set == NULL)
|
|
{
|
|
getproc_nosuchins(pktp, vbp);
|
|
return;
|
|
}
|
|
|
|
pSavedVbp = vbp;
|
|
portNum = *compl;
|
|
|
|
for( ; vbp; vbp = vbp->vb_link)
|
|
{
|
|
switch(vbp->vb_ml.ml_last_match)
|
|
{
|
|
case LEAF_dot1xAuthAdminControlledDirections:
|
|
varFields = D1XM_VAR_AuthAdminControlledDirections;
|
|
break;
|
|
|
|
case LEAF_dot1xAuthAuthControlledPortControl:
|
|
varFields = D1XM_VAR_AuthControlledPortControl;
|
|
break;
|
|
|
|
case LEAF_dot1xAuthQuietPeriod:
|
|
varFields = D1XM_VAR_AuthQuietPeriod;
|
|
break;
|
|
|
|
case LEAF_dot1xAuthTxPeriod:
|
|
varFields = D1XM_VAR_AuthTxPeriod;
|
|
break;
|
|
|
|
case LEAF_dot1xAuthSuppTimeout:
|
|
varFields = D1XM_VAR_AuthSuppTimeout;
|
|
break;
|
|
|
|
case LEAF_dot1xAuthServerTimeout:
|
|
varFields = D1XM_VAR_AuthServerTimeout;
|
|
break;
|
|
|
|
case LEAF_dot1xAuthMaxReq:
|
|
varFields = D1XM_VAR_AuthMaxReq;
|
|
break;
|
|
|
|
case LEAF_dot1xAuthReAuthPeriod:
|
|
varFields = D1XM_VAR_AuthReauthPeriod;
|
|
break;
|
|
|
|
case LEAF_dot1xAuthReAuthEnabled:
|
|
varFields = D1XM_VAR_AuthReauthEnabled;
|
|
break;
|
|
|
|
case LEAF_dot1xAuthKeyTxEnabled:
|
|
varFields = D1XM_VAR_AuthKeyTxEnabled;
|
|
break;
|
|
default:
|
|
setproc_error(pktp, pSavedVbp, COMMIT_FAILED);
|
|
return;
|
|
}
|
|
if(pSnmpHandler->set(portNum, varFields, VB_GET_INT32(vbp))== OK)
|
|
{
|
|
setproc_good(pktp, vbp);
|
|
}
|
|
else
|
|
{
|
|
setproc_error(pktp,pSavedVbp,COMMIT_FAILED);
|
|
return;
|
|
}
|
|
|
|
} /* end for loop */
|
|
}
|
|
|
|
/****************************************************************************
|
|
* dot1xAuthStatsEntry_get_value - Bind the AuthStatsEntry variables.
|
|
*
|
|
* This routine binds the variables in AuthStatsEntry with the values
|
|
* retrieved from the MIB data base for the purpose of forming a reponse for
|
|
* get and next commands.
|
|
* It is called by the method routines dot1xAuthStatsEntry_get and
|
|
* dot1xAuthStatsEntry_next.
|
|
*
|
|
* RETURNS: error status, NO_ERROR or GEN_ERR if there is an error.
|
|
*/
|
|
LOCAL int dot1xAuthStatsEntry_get_value
|
|
(
|
|
OIDC_T lastmatch, /* the last OID matched to get to this leaf */
|
|
SNMP_PKT_T * pktp, /* ptr to internal representation of snmp pkt*/
|
|
VB_T * vbp, /* ptr to var bind being processed */
|
|
void * pData /* AUTH_STATS_ENTRY values */
|
|
)
|
|
{
|
|
OCTET_T * pBuf;
|
|
D1XM_AUTH_STATS_ENTRY *data = (D1XM_AUTH_STATS_ENTRY*)pData;
|
|
|
|
/* sanity check */
|
|
if(data == NULL)
|
|
{
|
|
return(GEN_ERR);
|
|
}
|
|
|
|
switch(lastmatch)
|
|
{
|
|
case LEAF_dot1xAuthEapolFramesRx:
|
|
getproc_got_uint32(pktp, vbp, data->authEapolFramesRx,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthEapolFramesTx:
|
|
getproc_got_uint32(pktp, vbp, data->authEapolFramesTx,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthEapolStartFramesRx:
|
|
getproc_got_uint32(pktp, vbp, data->authEapolStartFramesRx,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthEapolLogoffFramesRx:
|
|
getproc_got_uint32(pktp, vbp, data->authEapolLogoffFramesRx,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthEapolRespIdFramesRx:
|
|
getproc_got_uint32(pktp, vbp, data->authEapolRespIdFramesRx,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthEapolRespFramesRx:
|
|
getproc_got_uint32(pktp, vbp, data->authEapolRespFramesRx,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthEapolReqIdFramesTx:
|
|
getproc_got_uint32(pktp, vbp, data->authEapolReqIdFramesTx,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthEapolReqFramesTx:
|
|
getproc_got_uint32(pktp, vbp, data->authEapolReqFramesTx,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthInvalidEapolFramesRx:
|
|
getproc_got_uint32(pktp, vbp, data->authInvalidEapolFramesRx,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthEapLengthErrorFramesRx:
|
|
getproc_got_uint32(pktp, vbp,data->authEapLengthErrorFramesRx,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthLastEapolFrameVersion:
|
|
getproc_got_uint32(pktp, vbp, data->authLastEapolFrameVersion,
|
|
VT_GAUGE);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthLastEapolFrameSource:
|
|
pBuf = SNMP_memory_alloc(6);
|
|
if(pBuf == NULL)
|
|
{
|
|
getproc_error (pktp, vbp, GEN_ERR);
|
|
return(GEN_ERR);
|
|
}
|
|
MEMCPY(pBuf, data->authLastEapolFrameSource, 6);
|
|
getproc_got_string(pktp, vbp, 6, pBuf, BFL_IS_DYNAMIC, VT_STRING );
|
|
break;
|
|
default:
|
|
return GEN_ERR;
|
|
}
|
|
|
|
return(NO_ERROR);
|
|
}
|
|
|
|
/*****************************************************************************
|
|
* dot1xAuthStatsEntry_get - Get the AuthStatsEntry
|
|
*
|
|
* This is the get method routine for AuthStatsEntry.
|
|
*
|
|
* RETURNS: NONE.
|
|
*
|
|
* NOMANUAL
|
|
*/
|
|
void dot1xAuthStatsEntry_get
|
|
(
|
|
OIDC_T lastmatch, /* the last OID matched to get to this leaf */
|
|
int compc, /* the length of the instance portion */
|
|
OIDC_T * compl, /* ptr to the instance portion */
|
|
SNMP_PKT_T * pktp, /* ptr to internal representation of snmp pkt*/
|
|
VB_T * vbp /* ptr to var bind being processed */
|
|
)
|
|
{
|
|
D1XM_AUTH_STATS_ENTRY entry;
|
|
|
|
entryGenericGet(lastmatch, compc, compl, pktp, vbp,
|
|
D1XM_VAR_AUTH_STATS_ENTRY, &entry,
|
|
sizeof(D1XM_AUTH_STATS_ENTRY),
|
|
dot1xAuthStatsEntry_get_value, DOT1X_AUTH_BINDING);
|
|
}
|
|
|
|
/****************************************************************************
|
|
* dot1xAuthStatsEntry_next - Get the next AuthStatsEntry.
|
|
*
|
|
* This is the next method routine for AuthStatsEntry
|
|
*
|
|
* RETURNS: NONE.
|
|
*
|
|
* NOMANUAL
|
|
*/
|
|
void dot1xAuthStatsEntry_next
|
|
(
|
|
OIDC_T lastmatch, /* the last OID matched to get to this leaf */
|
|
int compc, /* the length of the instance portion */
|
|
OIDC_T * compl, /* ptr to the instance portion */
|
|
SNMP_PKT_T * pktp, /* ptr to internal representation of snmp pkt */
|
|
VB_T * vbp /* ptr to var bind being processed */
|
|
)
|
|
{
|
|
D1XM_AUTH_STATS_ENTRY entry;
|
|
|
|
entryGenericNext(lastmatch, compc, compl, pktp, vbp,
|
|
D1XM_VAR_AUTH_STATS_ENTRY, &entry,
|
|
sizeof(D1XM_AUTH_STATS_ENTRY),
|
|
dot1xAuthStatsEntry_get_value, DOT1X_AUTH_BINDING);
|
|
}
|
|
|
|
/****************************************************************************
|
|
*
|
|
* dot1xAuthDiagEntry_get_value - Bind the variables in AuthDiagEntry.
|
|
*
|
|
* This routine binds the variables in AuthDiagEntry with the values retrieved
|
|
* from the MIB data base for the purpose of forming the response to the SNMP
|
|
* get and next commands. It is called by the method routines
|
|
* dot1xAuthDiagEntry_get and dot1xAuthDiagEntry_next.
|
|
*
|
|
* RETURNS: error status, NO_ERROR or GEN_ERR if there is an error.
|
|
*/
|
|
LOCAL int dot1xAuthDiagEntry_get_value
|
|
(
|
|
OIDC_T lastmatch, /* the last OID matched to get to this leaf */
|
|
SNMP_PKT_T * pktp, /* ptr to internal representation of snmp pkt */
|
|
VB_T * vbp, /* ptr to var bind being processed */
|
|
void * pData /* AUTH_DIAG_ENTRY values */
|
|
)
|
|
{
|
|
D1XM_AUTH_DIAG_ENTRY *data = (D1XM_AUTH_DIAG_ENTRY*)pData;
|
|
|
|
/* sanity check */
|
|
if(data == NULL)
|
|
{
|
|
return(GEN_ERR);
|
|
}
|
|
|
|
switch(lastmatch)
|
|
{
|
|
case LEAF_dot1xAuthEntersConnecting:
|
|
getproc_got_uint32(pktp, vbp, data->authEntersConnecting,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthEapLogoffsWhileConnecting:
|
|
getproc_got_uint32(pktp, vbp, data->authEapLogoffsWhileConnecting,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthEntersAuthenticating:
|
|
getproc_got_uint32(pktp, vbp, data->authEntersAuthenticating,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthAuthSuccessWhileAuthenticating:
|
|
getproc_got_uint32(pktp, vbp,
|
|
data->authAuthSuccessWhileAuthenticating,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthAuthTimeoutsWhileAuthenticating:
|
|
getproc_got_uint32(pktp, vbp,
|
|
data->authAuthTimeoutsWhileAuthenticating,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthAuthFailWhileAuthenticating:
|
|
getproc_got_uint32(pktp, vbp,
|
|
data->authAuthFailWhileAuthenticating,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthAuthReauthsWhileAuthenticating:
|
|
getproc_got_uint32(pktp, vbp,
|
|
data->authAuthReauthsWhileAuthenticating,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthAuthEapStartsWhileAuthenticating:
|
|
getproc_got_uint32(pktp, vbp,
|
|
data->authAuthEapStartsWhileAuthenticating,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthAuthEapLogoffWhileAuthenticating:
|
|
getproc_got_uint32(pktp, vbp,
|
|
data->authAuthEapLogoffWhileAuthenticating,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthAuthReauthsWhileAuthenticated:
|
|
getproc_got_uint32(pktp, vbp,
|
|
data->authAuthReauthsWhileAuthenticated,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthAuthEapStartsWhileAuthenticated:
|
|
getproc_got_uint32(pktp, vbp,
|
|
data->authAuthEapStartsWhileAuthenticated,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthAuthEapLogoffWhileAuthenticated:
|
|
getproc_got_uint32(pktp, vbp,
|
|
data->authAuthEapLogoffWhileAuthenticated,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthBackendResponses:
|
|
getproc_got_uint32(pktp, vbp, data->authBackendResponses,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthBackendAccessChallenges:
|
|
getproc_got_uint32(pktp, vbp, data->authBackendAccessChallenges,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthBackendOtherRequestsToSupplicant:
|
|
getproc_got_uint32(pktp, vbp,
|
|
data->authBackendOtherRequestsToSupplicant,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthBackendNonNakResponsesFromSupplicant:
|
|
getproc_got_uint32(pktp, vbp,
|
|
data->authBackendNonNakResponsesFromSupplicant,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthBackendAuthSuccesses:
|
|
getproc_got_uint32(pktp, vbp, data->authBackendAuthSuccesses,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthBackendAuthFails:
|
|
getproc_got_uint32(pktp, vbp, data->authBackendAuthFails,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
default:
|
|
return(GEN_ERR);
|
|
}
|
|
|
|
return(NO_ERROR);
|
|
}
|
|
|
|
/***************************************************************************
|
|
* dot1xAuthDiagEntry_get - Get the AuthDiagEntry
|
|
*
|
|
* This is the get method routine for AuthDiagEntry.
|
|
*
|
|
* RETURNS: NONE.
|
|
*
|
|
* NOMANUAL
|
|
*/
|
|
void dot1xAuthDiagEntry_get
|
|
(
|
|
OIDC_T lastmatch, /* the last OID matched to get to this leaf */
|
|
int compc, /* the length of the instance portion */
|
|
OIDC_T * compl, /* ptr to the instance portion */
|
|
SNMP_PKT_T * pktp, /* ptr to internal representation of snmp pkt */
|
|
VB_T * vbp /* ptr to var bind being processed */
|
|
)
|
|
{
|
|
D1XM_AUTH_DIAG_ENTRY entry;
|
|
|
|
entryGenericGet(lastmatch, compc, compl, pktp, vbp,
|
|
D1XM_VAR_AUTH_DIAG_ENTRY, &entry,
|
|
sizeof(D1XM_AUTH_DIAG_ENTRY),
|
|
dot1xAuthDiagEntry_get_value,
|
|
DOT1X_AUTH_BINDING);
|
|
}
|
|
|
|
/****************************************************************************
|
|
* dot1xAuthDiagEntry_next - Get the next AuthDiagEntry
|
|
*
|
|
* This is the next method routine for AuthDiagEntry.
|
|
*
|
|
* RETURNS: NONE.
|
|
*
|
|
* NOMANUAL
|
|
*/
|
|
void dot1xAuthDiagEntry_next
|
|
(
|
|
OIDC_T lastmatch, /* the last OID matched to get to this leaf */
|
|
int compc, /* the length of the instance portion */
|
|
OIDC_T *compl, /* ptr to the instance portion */
|
|
SNMP_PKT_T *pktp, /* ptr to internal representation of the snmp pkt*/
|
|
VB_T *vbp /* ptr to var bind being processed */
|
|
)
|
|
{
|
|
D1XM_AUTH_DIAG_ENTRY entry;
|
|
|
|
entryGenericNext(lastmatch, compc, compl, pktp, vbp,
|
|
D1XM_VAR_AUTH_DIAG_ENTRY, &entry,
|
|
sizeof(D1XM_AUTH_DIAG_ENTRY),
|
|
dot1xAuthDiagEntry_get_value, DOT1X_AUTH_BINDING);
|
|
}
|
|
|
|
/*****************************************************************************
|
|
* dot1xAuthSessionStatsEntry_get_value - Bind AuthSessionStatsEntry variables.
|
|
*
|
|
* This routine binds the variables in AuthSessionStatsEntry with the values
|
|
* retrieved from the MIB data base for the purpose of forming the response
|
|
* to the SNMP get and next commands. It is called by the method routines
|
|
* dot1xAuthSessionStatsEntry_get and dot1xAuthSessionStatsEntry_next.
|
|
*
|
|
* RETURNS: error status, NO_ERROR or GEN_ERR if there is an error.
|
|
*/
|
|
LOCAL int dot1xAuthSessionStatsEntry_get_value
|
|
(
|
|
OIDC_T lastmatch, /* the last OID matched to get to this leaf */
|
|
SNMP_PKT_T * pktp, /* ptr to internal representation of snmp pkt */
|
|
VB_T * vbp, /* ptr to var bind being processed */
|
|
void * pData /* AUTH_SESSION_STATS_ENTRY values */
|
|
)
|
|
{
|
|
OCTET_T *pBuf;
|
|
D1XM_AUTH_SESSION_STATS_ENTRY *data =
|
|
(D1XM_AUTH_SESSION_STATS_ENTRY*)pData;
|
|
|
|
/* sanity check */
|
|
if(data == NULL)
|
|
{
|
|
return(GEN_ERR);
|
|
}
|
|
|
|
switch(lastmatch)
|
|
{
|
|
case LEAF_dot1xAuthSessionOctetsRx:
|
|
{
|
|
/* convert to SNMP defined 64 bit type */
|
|
UINT_64_T value;
|
|
|
|
value.high = data->authSessionOctetsRx.high;
|
|
value.low = data->authSessionOctetsRx.low;
|
|
|
|
getproc_got_uint64(pktp, vbp,&value);
|
|
}
|
|
break;
|
|
|
|
case LEAF_dot1xAuthSessionOctetsTx:
|
|
{
|
|
/* convert to SNMP defined 64 bit type */
|
|
UINT_64_T value;
|
|
|
|
value.high = data->authSessionOctetsTx.high;
|
|
value.low = data->authSessionOctetsTx.low;
|
|
|
|
getproc_got_uint64(pktp, vbp,&value);
|
|
}
|
|
break;
|
|
|
|
case LEAF_dot1xAuthSessionFramesRx:
|
|
getproc_got_uint32(pktp, vbp, data->authSessionFramesRx,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthSessionFramesTx:
|
|
getproc_got_uint32(pktp, vbp, data->authSessionFramesTx,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthSessionId:
|
|
pBuf = SNMP_memory_alloc(strlen(data->authSessionId));
|
|
if(pBuf == NULL)
|
|
{
|
|
getproc_error(pktp, vbp, GEN_ERR);
|
|
return(GEN_ERR);
|
|
}
|
|
MEMCPY(pBuf, data->authSessionId, strlen(data->authSessionId));
|
|
getproc_got_string(pktp, vbp, strlen(data->authSessionId),
|
|
pBuf, BFL_IS_DYNAMIC, VT_STRING );
|
|
break;
|
|
|
|
case LEAF_dot1xAuthSessionAuthenticMethod:
|
|
/* Values:
|
|
* remoteAuthServer(1) =
|
|
* VAL_dot1xAuthSessionAuthenticMethod_remoteAuthServer
|
|
* localAuthServer(2) =
|
|
* VAL_dot1xAuthSessionAuthenticMethod_localAuthServer
|
|
*/
|
|
getproc_got_int32(pktp, vbp, data->authSessionAuthenticMethod);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthSessionTime:
|
|
getproc_got_uint32(pktp, vbp, data->authSessionTime, VT_TIMETICKS);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthSessionTerminateCause:
|
|
/* Values:
|
|
* supplicantLogoff(1) =
|
|
* VAL_dot1xAuthSessionTerminateCause_supplicantLogoff
|
|
* portFailure(2) = VAL_dot1xAuthSessionTerminateCause_portFailure
|
|
* supplicantRestart(3) =
|
|
* VAL_dot1xAuthSessionTerminateCause_supplicantRestart
|
|
* reauthFailed(4)= VAL_dot1xAuthSessionTerminateCause_reauthFailed
|
|
* authControlForceUnauth(5) =
|
|
* VAL_dot1xAuthSessionTerminateCause_authControlForceUnauth
|
|
* portReInit(6) = VAL_dot1xAuthSessionTerminateCause_portReInit
|
|
* portAdminDisabled(7) =
|
|
* VAL_dot1xAuthSessionTerminateCause_portAdminDisabled
|
|
* notTerminatedYet(999) =
|
|
* VAL_dot1xAuthSessionTerminateCause_notTerminatedYet
|
|
*/
|
|
|
|
getproc_got_int32(pktp, vbp, data->authSessionTerminateCause);
|
|
break;
|
|
|
|
case LEAF_dot1xAuthSessionUserName:
|
|
pBuf = SNMP_memory_alloc(strlen(data->authSessionUserName));
|
|
if(pBuf == NULL)
|
|
{
|
|
getproc_error (pktp, vbp, GEN_ERR);
|
|
return(GEN_ERR);
|
|
}
|
|
MEMCPY(pBuf, data->authSessionUserName,
|
|
strlen(data->authSessionUserName));
|
|
getproc_got_string(pktp, vbp, strlen(data->authSessionUserName),
|
|
pBuf, BFL_IS_DYNAMIC, VT_STRING );
|
|
break;
|
|
default:
|
|
return(GEN_ERR);
|
|
}
|
|
|
|
return(NO_ERROR);
|
|
}
|
|
|
|
/***************************************************************************
|
|
* dot1xAuthSessionStatsEntry_get - Get the AuthSessionStatsEntry.
|
|
*
|
|
* This is the get method routine for AuthSessionStatsEntry.
|
|
*
|
|
* RETURNS: NONE.
|
|
*
|
|
* NOMANUAL
|
|
*/
|
|
void dot1xAuthSessionStatsEntry_get
|
|
(
|
|
OIDC_T lastmatch, /* the last OID matched to get to this leaf */
|
|
int compc, /* the length of the instance portion */
|
|
OIDC_T * compl, /* ptr to the instance portion */
|
|
SNMP_PKT_T * pktp, /* ptr to internal representation of snmp pkt */
|
|
VB_T * vbp /* ptr to var bind being processed */
|
|
)
|
|
{
|
|
D1XM_AUTH_SESSION_STATS_ENTRY entry;
|
|
|
|
entryGenericGet(lastmatch, compc, compl, pktp, vbp,
|
|
D1XM_VAR_AUTH_SESSION_ENTRY, &entry,
|
|
sizeof(D1XM_AUTH_SESSION_STATS_ENTRY),
|
|
dot1xAuthSessionStatsEntry_get_value,
|
|
DOT1X_AUTH_BINDING);
|
|
}
|
|
|
|
/****************************************************************************
|
|
* dot1xAuthSessionStatsEntry_next - Get the next AuthSessionStatsEntry.
|
|
*
|
|
* This is the next method routine for AuthSessionStatsEntry.
|
|
*
|
|
* RETURNS: NONE.
|
|
*
|
|
* NOMANUAL
|
|
*/
|
|
void dot1xAuthSessionStatsEntry_next
|
|
(
|
|
OIDC_T lastmatch, /* the last OID matched to get to this leaf */
|
|
int compc, /* the length of the instance portion */
|
|
OIDC_T * compl, /* ptr to the instance portion */
|
|
SNMP_PKT_T * pktp, /* ptr to internal representation of snmp pkt */
|
|
VB_T * vbp /* ptr to var bind being processed */
|
|
)
|
|
{
|
|
D1XM_AUTH_SESSION_STATS_ENTRY entry;
|
|
|
|
entryGenericNext(lastmatch, compc, compl, pktp, vbp,
|
|
D1XM_VAR_AUTH_SESSION_ENTRY,
|
|
&entry, sizeof(D1XM_AUTH_SESSION_STATS_ENTRY),
|
|
dot1xAuthSessionStatsEntry_get_value,
|
|
DOT1X_AUTH_BINDING);
|
|
}
|
|
|
|
/****************************************************************************
|
|
* dot1xSuppConfigEntry_get_value - Bind the variables in SuppConfigEntry
|
|
*
|
|
* This routine binds the variables in SuppConfigEntry with the values
|
|
* retrieved from the MIB data base for the purpose of forming the response
|
|
* to the SNMP get and next commands. It is called by the method routines
|
|
* dot1xSuppConfigEntry_get and dot1xSuppConfigEntry_next.
|
|
*
|
|
* RETURNS: error status, NO_ERROR or GEN_ERR if there is an error.
|
|
*/
|
|
LOCAL int dot1xSuppConfigEntry_get_value
|
|
(
|
|
OIDC_T lastmatch, /* the last OID matched to get to this leaf */
|
|
SNMP_PKT_T * pktp, /* ptr to internal representation of snmp pkt */
|
|
VB_T * vbp, /* ptr to var bind being processed */
|
|
void * pData /* SUPP_CONFIG_ENTRY values */
|
|
)
|
|
{
|
|
D1XM_SUPP_CONFIG_ENTRY *data = (D1XM_SUPP_CONFIG_ENTRY*)pData;
|
|
|
|
/* sanity check */
|
|
if(data == NULL)
|
|
{
|
|
return(GEN_ERR);
|
|
}
|
|
|
|
switch(lastmatch)
|
|
{
|
|
case LEAF_dot1xSuppPaeState:
|
|
/* Values:
|
|
* disconnected(1) = VAL_dot1xSuppPaeState_disconnected
|
|
* logoff(2) = VAL_dot1xSuppPaeState_logoff
|
|
* connecting(3) = VAL_dot1xSuppPaeState_connecting
|
|
* authenticating(4) = VAL_dot1xSuppPaeState_authenticating
|
|
* authenticated(5) = VAL_dot1xSuppPaeState_authenticated
|
|
* acquired(6) = VAL_dot1xSuppPaeState_acquired
|
|
* held(7) = VAL_dot1xSuppPaeState_held
|
|
*/
|
|
getproc_got_int32(pktp, vbp, data->suppPaeState);
|
|
break;
|
|
|
|
case LEAF_dot1xSuppHeldPeriod:
|
|
getproc_got_uint32(pktp, vbp, data->suppHeldPeriod, VT_GAUGE);
|
|
break;
|
|
|
|
case LEAF_dot1xSuppAuthPeriod:
|
|
getproc_got_uint32(pktp, vbp, data->suppAuthPeriod, VT_GAUGE);
|
|
break;
|
|
|
|
case LEAF_dot1xSuppStartPeriod:
|
|
getproc_got_uint32(pktp, vbp, data->suppStartPeriod, VT_GAUGE);
|
|
break;
|
|
|
|
case LEAF_dot1xSuppMaxStart:
|
|
getproc_got_uint32(pktp, vbp, data->suppMaxStart, VT_GAUGE);
|
|
break;
|
|
default:
|
|
return GEN_ERR;
|
|
}
|
|
return NO_ERROR;
|
|
}
|
|
|
|
/***************************************************************************
|
|
* dot1xSuppConfigEntry_get - Get the SuppConfigEntry
|
|
*
|
|
* This is the get method routine for the SuppConfigEntry.
|
|
*
|
|
* RETURNS: NONE.
|
|
*
|
|
* NOMANUAL
|
|
*/
|
|
void dot1xSuppConfigEntry_get
|
|
(
|
|
OIDC_T lastmatch, /* the last OID matched to get to this leaf */
|
|
int compc, /* the length of the instance portion */
|
|
OIDC_T * compl, /* ptr to the instance portion */
|
|
SNMP_PKT_T * pktp, /* ptr to internal representation of snmp pkt */
|
|
VB_T * vbp /* ptr to var bind being processed */
|
|
)
|
|
{
|
|
D1XM_SUPP_CONFIG_ENTRY entry;
|
|
|
|
entryGenericGet(lastmatch, compc, compl, pktp, vbp,
|
|
D1XM_VAR_SUPP_CFG_ENTRY, &entry,
|
|
sizeof(D1XM_SUPP_CONFIG_ENTRY),
|
|
dot1xSuppConfigEntry_get_value,
|
|
DOT1X_SUPP_BINDING);
|
|
}
|
|
|
|
/****************************************************************************
|
|
* dot1xSuppConfigEntry_next - Get the next SuppConfigEntry
|
|
*
|
|
* This is the next method routine for the SuppConfigEntry
|
|
*
|
|
* RETURNS: NONE.
|
|
*
|
|
* NOMANUAL
|
|
*/
|
|
void dot1xSuppConfigEntry_next
|
|
(
|
|
OIDC_T lastmatch, /* the last OID matched to get to this leaf */
|
|
int compc, /* the length of the instance portion */
|
|
OIDC_T * compl, /* ptr to the instance portion */
|
|
SNMP_PKT_T * pktp, /* ptr to internal representation of snmp pkt */
|
|
VB_T * vbp /* ptr to var bind being processed */
|
|
)
|
|
{
|
|
D1XM_SUPP_CONFIG_ENTRY entry;
|
|
|
|
entryGenericNext(lastmatch, compc, compl, pktp, vbp,
|
|
D1XM_VAR_SUPP_CFG_ENTRY,
|
|
&entry, sizeof(D1XM_SUPP_CONFIG_ENTRY),
|
|
dot1xSuppConfigEntry_get_value,
|
|
DOT1X_SUPP_BINDING);
|
|
}
|
|
|
|
/****************************************************************************
|
|
* dot1xSuppConfigEntry_test - Validate the set values for SuppConfigEntry
|
|
*
|
|
* This routine validates the set values for SuppConfigEntry. It should be
|
|
* called before the corresponding set method function is called.
|
|
*
|
|
* RETURNS: NONE.
|
|
*
|
|
* NOMANUAL
|
|
*/
|
|
void dot1xSuppConfigEntry_test
|
|
(
|
|
OIDC_T lastmatch, /* the last OID matched to get to this leaf */
|
|
int compc, /* the length of the instance portion */
|
|
OIDC_T * compl, /* ptr to the instance portion */
|
|
SNMP_PKT_T * pktp, /* ptr to internal representation of snmp pkt */
|
|
VB_T * vbp /* ptr to var bind being processed */
|
|
)
|
|
{
|
|
D1XM_SUPP_CONFIG_ENTRY data;
|
|
VB_T * group_vbp;
|
|
int errorStatus;
|
|
OIDC_T portNum;
|
|
DOT1X_MIB_FUNC_TABLE *pSnmpHandler;
|
|
|
|
/* Bind to handler method */
|
|
pSnmpHandler = dot1xMibHandlerBind(DOT1X_SUPP_BINDING);
|
|
if(pSnmpHandler == NULL || pSnmpHandler->get == NULL)
|
|
{
|
|
getproc_nosuchins(pktp, vbp);
|
|
return;
|
|
}
|
|
|
|
if (compc != 1)
|
|
{
|
|
errorStatus = NO_SUCH_NAME;
|
|
goto errorReturn;
|
|
}
|
|
|
|
portNum = *compl;
|
|
|
|
if(pSnmpHandler->get(portNum, D1XM_VAR_SUPP_CFG_ENTRY, &data,
|
|
sizeof(D1XM_SUPP_CONFIG_ENTRY)) != OK)
|
|
{
|
|
errorStatus = NO_SUCH_NAME;
|
|
goto errorReturn;
|
|
}
|
|
|
|
/* find all the varbinds that share the same getproc and instance and
|
|
group them together.*/
|
|
snmpdGroupByGetprocAndInstance(pktp, vbp, compc, compl);
|
|
|
|
/* now check each varbind */
|
|
for(group_vbp = vbp; group_vbp; group_vbp = group_vbp->vb_link)
|
|
{
|
|
switch(group_vbp->vb_ml.ml_last_match)
|
|
{
|
|
case LEAF_dot1xSuppHeldPeriod:
|
|
testproc_good(pktp, group_vbp);
|
|
break;
|
|
|
|
case LEAF_dot1xSuppAuthPeriod:
|
|
testproc_good(pktp, group_vbp);
|
|
break;
|
|
|
|
case LEAF_dot1xSuppStartPeriod:
|
|
testproc_good(pktp, group_vbp);
|
|
break;
|
|
|
|
case LEAF_dot1xSuppMaxStart:
|
|
testproc_good(pktp, group_vbp);
|
|
break;
|
|
|
|
default:
|
|
errorStatus = GEN_ERR;
|
|
goto errorReturn;
|
|
}
|
|
}
|
|
return;
|
|
|
|
errorReturn:
|
|
testproc_error(pktp, vbp, errorStatus);
|
|
}
|
|
|
|
/****************************************************************************
|
|
* dot1xSuppConfigEntry_set - Set the variables in SuppConfigEntry.
|
|
*
|
|
* This is the set method routine for SuppConfigEntry.
|
|
*
|
|
* RETURNS: NONE.
|
|
*
|
|
* NOMANUAL
|
|
*/
|
|
void dot1xSuppConfigEntry_set
|
|
(
|
|
OIDC_T lastmatch, /* the last OID matched to get to this leaf */
|
|
int compc, /* the length of the instance portion */
|
|
OIDC_T * compl, /* ptr to the instance portion */
|
|
SNMP_PKT_T * pktp, /* ptr to internal representation of snmp pkt*/
|
|
VB_T * vbp /* ptr to var bind being processed */
|
|
)
|
|
{
|
|
UINT32 varField;
|
|
OIDC_T portNum;
|
|
VB_T * pSavedVbp;
|
|
DOT1X_MIB_FUNC_TABLE *pSnmpHandler;
|
|
|
|
/* Bind to handler method */
|
|
pSnmpHandler = dot1xMibHandlerBind(DOT1X_SUPP_BINDING);
|
|
if(pSnmpHandler == NULL || pSnmpHandler->set == NULL)
|
|
{
|
|
getproc_nosuchins(pktp, vbp);
|
|
return;
|
|
}
|
|
|
|
/* save local variables */
|
|
portNum = *compl;
|
|
pSavedVbp = vbp;
|
|
|
|
for (; vbp; vbp = vbp->vb_link)
|
|
{
|
|
switch(vbp->vb_ml.ml_last_match)
|
|
{
|
|
case LEAF_dot1xSuppHeldPeriod:
|
|
varField = D1XM_VAR_SuppHeldPeriod;
|
|
break;
|
|
|
|
case LEAF_dot1xSuppAuthPeriod:
|
|
varField = D1XM_VAR_SuppAuthPeriod;
|
|
break;
|
|
|
|
case LEAF_dot1xSuppStartPeriod:
|
|
varField = D1XM_VAR_SuppStartPeriod;
|
|
break;
|
|
|
|
case LEAF_dot1xSuppMaxStart:
|
|
varField = D1XM_VAR_SuppMaxStart;
|
|
break;
|
|
|
|
default:
|
|
setproc_error(pktp, pSavedVbp, COMMIT_FAILED);
|
|
return;
|
|
}
|
|
|
|
/* Update the config data */
|
|
if(pSnmpHandler->set(portNum, varField, VB_GET_UINT32(vbp)) == OK)
|
|
{
|
|
setproc_good(pktp, vbp);
|
|
}
|
|
else
|
|
{
|
|
setproc_error(pktp, pSavedVbp,COMMIT_FAILED);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
/****************************************************************************
|
|
* dot1xSuppStatsEntry_get_value - Bind the variables in SuppStatsEntry
|
|
*
|
|
* This routine binds the variables in SuppStatsEntry with the values
|
|
* retrieved from the MIB data base for the purpose of forming the response
|
|
* to the SNMP get and next commands. It is called by the method routines
|
|
* dot1xSuppStatsEntry_get and dot1xSuppStatsEntry_next.
|
|
*
|
|
* RETURNS: error status, NO_ERROR or GEN_ERR if there is an error.
|
|
*/
|
|
LOCAL int dot1xSuppStatsEntry_get_value
|
|
(
|
|
OIDC_T lastmatch, /* the last OID matched to get to this leaf */
|
|
SNMP_PKT_T * pktp, /* ptr to internal representation of the snmp pkt*/
|
|
VB_T * vbp, /* ptr to var bind being processed */
|
|
void * pData /* SUPP_STATS_ENTRY values */
|
|
)
|
|
{
|
|
D1XM_SUPP_STATS_ENTRY *data = (D1XM_SUPP_STATS_ENTRY*)pData;
|
|
OCTET_T * pBuf;
|
|
|
|
switch(lastmatch)
|
|
{
|
|
case LEAF_dot1xSuppEapolFramesRx:
|
|
getproc_got_uint32(pktp, vbp, data->suppEapolFramesRx,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xSuppEapolFramesTx:
|
|
getproc_got_uint32(pktp, vbp, data->suppEapolFramesTx,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xSuppEapolStartFramesTx:
|
|
getproc_got_uint32(pktp, vbp, data->suppEapolStartFramesTx,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xSuppEapolLogoffFramesTx:
|
|
getproc_got_uint32(pktp, vbp, data->suppEapolLogoffFramesTx,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xSuppEapolRespIdFramesTx:
|
|
getproc_got_uint32(pktp, vbp, data->suppEapolRespIdFramesTx,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xSuppEapolRespFramesTx:
|
|
getproc_got_uint32(pktp, vbp, data->suppEapolRespFramesTx,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xSuppEapolReqIdFramesRx:
|
|
getproc_got_uint32(pktp, vbp, data->suppEapolReqIdFramesRx,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xSuppEapolReqFramesRx:
|
|
getproc_got_uint32(pktp, vbp, data->suppEapolReqFramesRx,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xSuppInvalidEapolFramesRx:
|
|
getproc_got_uint32(pktp, vbp, data->suppInvalidEapolFramesRx,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xSuppEapLengthErrorFramesRx:
|
|
getproc_got_uint32(pktp, vbp, data->suppEapLengthErrorFramesRx,
|
|
VT_COUNTER);
|
|
break;
|
|
|
|
case LEAF_dot1xSuppLastEapolFrameVersion:
|
|
getproc_got_uint32(pktp, vbp, data->suppLastEapolFrameVersion,
|
|
VT_GAUGE);
|
|
break;
|
|
|
|
case LEAF_dot1xSuppLastEapolFrameSource:
|
|
pBuf = SNMP_memory_alloc(6);
|
|
if(pBuf == NULL)
|
|
{
|
|
getproc_error(pktp, vbp, GEN_ERR);
|
|
return(GEN_ERR);
|
|
}
|
|
MEMCPY(pBuf, data->suppLastEapolFrameSource, 6);
|
|
getproc_got_string(pktp, vbp, 6, pBuf, BFL_IS_DYNAMIC, VT_STRING );
|
|
break;
|
|
|
|
default:
|
|
return(GEN_ERR);
|
|
}
|
|
|
|
return(NO_ERROR);
|
|
}
|
|
|
|
/***************************************************************************
|
|
* dot1xSuppStatsEntry_get - Get the SuppStatsEntry
|
|
*
|
|
* This is the get method routine for SuppStatsEntry.
|
|
*
|
|
* RETURNS: NONE.
|
|
*
|
|
* NOMANUAL
|
|
*/
|
|
void dot1xSuppStatsEntry_get
|
|
(
|
|
OIDC_T lastmatch, /* the last OID matched to get to this leaf */
|
|
int compc, /* the length of the instance portion */
|
|
OIDC_T * compl, /* ptr to the instance portion */
|
|
SNMP_PKT_T * pktp, /* ptr to internal representation of snmp pkt*/
|
|
VB_T * vbp /* ptr to var bind being processed */
|
|
)
|
|
{
|
|
D1XM_SUPP_STATS_ENTRY entry;
|
|
|
|
entryGenericGet(lastmatch, compc, compl, pktp, vbp,
|
|
D1XM_VAR_SUPP_STATS_ENTRY,
|
|
&entry, sizeof(D1XM_SUPP_STATS_ENTRY),
|
|
dot1xSuppStatsEntry_get_value, DOT1X_SUPP_BINDING);
|
|
}
|
|
|
|
/****************************************************************************
|
|
* dot1xSuppStatsEntry_next - Get the next SuppStatsEntry
|
|
*
|
|
* This is the next method routine for SuppStatsEntry
|
|
*
|
|
* RETURNS: NONE.
|
|
*
|
|
* NOMANUAL
|
|
*/
|
|
void dot1xSuppStatsEntry_next
|
|
(
|
|
OIDC_T lastmatch, /* the last OID matched to get to this leaf */
|
|
int compc, /* the length of the instance portion */
|
|
OIDC_T * compl, /* ptr to the instance portion */
|
|
SNMP_PKT_T * pktp, /* ptr to internal representation of snmp pkt*/
|
|
VB_T * vbp /* ptr to var bind being processed */
|
|
)
|
|
{
|
|
D1XM_SUPP_STATS_ENTRY entry;
|
|
|
|
entryGenericNext(lastmatch, compc, compl, pktp, vbp,
|
|
D1XM_VAR_SUPP_STATS_ENTRY, &entry,
|
|
sizeof(D1XM_SUPP_STATS_ENTRY),
|
|
dot1xSuppStatsEntry_get_value, DOT1X_SUPP_BINDING);
|
|
}
|
|
|