OverView Index Help                                                                WebNMS Agent Toolkit C Edition 6 

snmpauth.c
Implementing the ACL table in AGENT-SNMP-CONFIG-MIB. In the case of SNMP v1 and v2c, after receiving a request from the manager, agent will do authentication using the routines available in this file based on the request type. This file also contains set of routines to add and delete entries to the authentication list.
Return Type Method Summary
U_CHAR* AgentAuthTableProcessReadReq(U_CHAR pduType, OID *reqOid, INT32 *reqOidLen, INT32 *varValLen, U_CHAR *status)
             It will process the GET & GET-NEXT requests and send back the appropriate result.
U_CHAR* AgentAuthTableProcessWriteReq(INT32 pduVersion, OID *reqOid, INT32 reqOidLen, U_CHAR *varVal, INT32 *varValLen, U_CHAR *status)
             It will process the SET requests and send back the modified result.
U_CHAR CheckAccessForManager(CHAR *aclManagers, TransportDomainInfo *tdInfo)
             If the given manager matches any one of the managers of the gv_authVector, then it returns TRUE otherwise FALSE.
CHAR CreateAndAddAuthenticationEntry(OID *instance, INT32 instanceLen, CHAR *aclCommunity, INT32 aclAccess, CHAR *aclManagers, INT32 aclStatus)
             It will take all columns value and its instance value as input and add create an Entry then add it to the Vector.
void* CreateAuthTableRowWithDefaultValues(U_CHAR **indexList, INT32 *indexListLen, INT32 len)
             It will create a new row and assign default value for each table column.
CHAR CreateAuthenticationEntry(CHAR *aclCommunity, INT32 aclAccess, CHAR *aclManagers, INT32 aclStatus)
             It will take all columns value as input and create an instance then add it to the Vector.
void CreateAuthenticationList()
             Creates an authentication list.
CHAR DeleteAuthenticationEntry(CHAR *aclCommunity, U_INT16 aclAccess, CHAR *aclManagers)
             Delete an object from the authentication list.
void FreeAgentAuthTableEntryMemory(Entry *entryPtr)
             It will free the reserved memeory for an Entry of manager table.
CHAR IsValidAuthentication(CHAR *aclCommunity, U_CHAR pduType, TransportDomainInfo *tdInfo)
             If the given community is matches with any one of the community of the gv_authVector, then it check for access.
void MapAccessToInteger(CHAR *aclAcc, INT32 *aclAccess)
             After reading from text file corresponding macro will be mapped.
void MapAccessToString(INT32 aclAcc, CHAR *aclAccess)
             Before writing to the text file corresponding string will be mapped.
U_CHAR* ReadAclAccess(void *tableEntryPtr, INT32 *varValLen, U_CHAR *status)
             Read method for (table) column aclAccess.
U_CHAR* ReadAclCommunity(void *tableEntryPtr, INT32 *varValLen, U_CHAR *status)
             Read method for (table) column aclCommunity.
U_CHAR* ReadAclManagers(void *tableEntryPtr, INT32 *varValLen, U_CHAR *status)
             Read method for (table) column aclManagers.
U_CHAR* ReadAclStatus(void *tableEntryPtr, INT32 *varValLen, U_CHAR *status)
             Read method for (table) column aclStatus.
U_CHAR ReadAclTableEntry(U_CHAR ***cols, INT32 index)
            
Vector* ReadAuthTableInfo(INT32 startIdx, INT32 numOfRows, INT32 *flag)
             It will return the table Vector reference, before that it will verify the total size of the table and set flag value.
CHAR ReadFromAgentAuthTableFile()
             Reads from the text file and updates the authentication Vector.
CHAR UpdateAgentAuthTableFile(U_CHAR command)
             Update the changes of UpdateAgentAuthTableFile.
U_CHAR* WriteAclAccess(void *tableEntryPtr, U_CHAR *varVal, INT32 *varValLen, U_CHAR *status)
             Write method for (table) column access.
U_CHAR* WriteAclManagers(void *tableEntryPtr, U_CHAR *varVal, INT32 *varValLen, U_CHAR *status)
             Write method for (table) column aclManagers.
U_CHAR* WriteAclStatus(void *tableEntryPtr, U_CHAR *varVal, INT32 *varValLen, U_CHAR *status)
             Write method for (table) column aclStatus.
CHAR WriteToAgentAuthTableFile()
             It will write the table enteries from the Vector into the file.
   
Method Details

AgentAuthTableProcessReadReq()

U_CHAR* AgentAuthTableProcessReadReq(U_CHAR pduType, OID *reqOid, INT32 *reqOidLen, INT32 *varValLen, U_CHAR *status)

It will process the GET & GET-NEXT requests and send back the appropriate result.

Arguments:
1. PduType (GET/GET-NEXT) (IN).
2. Requested Oid (IN).
3. Requested Oid Length (IN).
4. Variable value length (IN).
5. GET for rollback or not (IN/OUT).
Return type:
Pointer to the return variable value.
Bugs:
null
See Also:
AgentAuthTableProcessWriteReq()

AgentAuthTableProcessWriteReq()

U_CHAR* AgentAuthTableProcessWriteReq(INT32 pduVersion, OID *reqOid, INT32 reqOidLen, U_CHAR *varVal, INT32 *varValLen, U_CHAR *status)

It will process the SET requests and send back the modified result.

Arguments:
1. Pdu version(IN)
2. Requested Oid (IN).
3. Requested Oid Length (IN).
4. Variable value (IN).
5. Variable value length (IN).
6. Status of the operation (IN/OUT).
Return type:
Pointer to the return variable value.
Bugs:
null
See Also:
AgentAuthTableProcessReadReq()

CheckAccessForManager()

U_CHAR CheckAccessForManager(CHAR *aclManagers, TransportDomainInfo *tdInfo)

If the given manager matches any one of the managers of the gv_authVector, then it returns TRUE otherwise FALSE.

Arguments:
1. aclManagers (IN).
2. Reference of the TransportDomainInfo (IN).
Return type:
TRUE if the request comes from the manager have the access, otherwise FAILURE.
Bugs:
null

CreateAndAddAuthenticationEntry()

CHAR CreateAndAddAuthenticationEntry(OID *instance, INT32 instanceLen, CHAR *aclCommunity, INT32 aclAccess, CHAR *aclManagers, INT32 aclStatus)

It will take all columns value and its instance value as input and add create an Entry then add it to the Vector.

Arguments:
1. Instance Oid (IN).
2. Instance Oid Length (IN).
3. Table column aclCommunity (IN).
4. Table column aclAccess (IN).
5. Table column aclManagers (IN).
6. Table column aclStatus (IN).
Return type:
SUCCESS or FAILURE.
Bugs:
null

CreateAuthTableRowWithDefaultValues()

void* CreateAuthTableRowWithDefaultValues(U_CHAR **indexList, INT32 *indexListLen, INT32 len)

It will create a new row and assign default value for each table column. For index column it will assign the value from input argument (index).

Arguments:
1. List of index values (IN).
2. Length of each index value (IN).
3. Length of the index list (IN).
Return type:
Created aaplicationTable row pointer.
Bugs:
null

CreateAuthenticationEntry()

CHAR CreateAuthenticationEntry(CHAR *aclCommunity, INT32 aclAccess, CHAR *aclManagers, INT32 aclStatus)

It will take all columns value as input and create an instance then add it to the Vector.

Arguments:
1. Table column aclCommunity (IN).
2. Table column aclAccess (IN).
3. Table column aclManagers (IN).
4. Table column aclStatus (IN).
Return type:
SUCCESS or FAILURE.
Bugs:
null

CreateAuthenticationList()

void CreateAuthenticationList()

Creates an authentication list.

Arguments:
Nothing.
Return type:
Nothing.
Bugs:
null

DeleteAuthenticationEntry()

CHAR DeleteAuthenticationEntry(CHAR *aclCommunity, U_INT16 aclAccess, CHAR *aclManagers)

Delete an object from the authentication list.

Arguments:
1. aclCommunity(IN).
2. aclAccess(IN).
3. aclManagers(IN).
Return type:
SUCCESS on successful deletion otherwise FALSE.
Bugs:
null

FreeAgentAuthTableEntryMemory()

void FreeAgentAuthTableEntryMemory(Entry *entryPtr)

It will free the reserved memeory for an Entry of manager table.

Arguments:
1. Reference of the table Entry (IN).
Return type:
Nothing.
Bugs:
null

IsValidAuthentication()

CHAR IsValidAuthentication(CHAR *aclCommunity, U_CHAR pduType, TransportDomainInfo *tdInfo)

If the given community is matches with any one of the community of the gv_authVector, then it check for access. If access also satisfied then it returns SUCCESS otherwise FAILURE.

Arguments:
1. aclCommunity (IN).
2. Command or PDU Type (IN).
3. Reference of the TransportDomainInfo (IN).
Return type:
SUCCESS if both community and access are matched, otherwise FAILURE.
Bugs:
null

MapAccessToInteger()

void MapAccessToInteger(CHAR *aclAcc, INT32 *aclAccess)

After reading from text file corresponding macro will be mapped.

Arguments:
1. Access value as String (IN).
2. Access value as Integer (IN/OUT).
Return type:
Nothing.
Bugs:
null

MapAccessToString()

void MapAccessToString(INT32 aclAcc, CHAR *aclAccess)

Before writing to the text file corresponding string will be mapped.

Arguments:
1.Access value as Integer (IN).
2.Access value as String (IN/OUT).
Return type:
Nothing.
Bugs:
null

ReadAclAccess()

U_CHAR* ReadAclAccess(void *tableEntryPtr, INT32 *varValLen, U_CHAR *status)

Read method for (table) column aclAccess.

Arguments:
1. Pointer of the Entry (IN).
2. Pointer of the variable value length (IN/OUT).
3. status (IN/OUT).
Return type:
Pointer of the return variable value.
Bugs:
null
See Also:
WriteAclAccess()

ReadAclCommunity()

U_CHAR* ReadAclCommunity(void *tableEntryPtr, INT32 *varValLen, U_CHAR *status)

Read method for (table) column aclCommunity.

Arguments:
1. Pointer of the Entry (IN).
2. Pointer of the variable value length (IN/OUT).
3. status (IN/OUT).
Return type:
Pointer of the return variable value.
Bugs:
null

ReadAclManagers()

U_CHAR* ReadAclManagers(void *tableEntryPtr, INT32 *varValLen, U_CHAR *status)

Read method for (table) column aclManagers. "This variable has the managers list allowed for specified access with specified community. The format of the string is 'managerName1;managerName2.....' with a list of manager IpAddress/name corresponding to each additional information separated via ';' as the delimiter between any two managers. The default value is '0:0:0:0' which states access for all managers for the corresponding community."

Arguments:
1. Pointer of the entry (IN).
2. Pointer of the variable value length (OUT).
3. Status which is used to return SNMP Error (OUT).
Return type:
The Current value of "aclManagers".
Bugs:
null
See Also:
WriteAclManagers()

ReadAclStatus()

U_CHAR* ReadAclStatus(void *tableEntryPtr, INT32 *varValLen, U_CHAR *status)

Read method for (table) column aclStatus.

Arguments:
1. Pointer of the Entry (IN).
2. Pointer of the variable value length (IN/OUT).
3. status (IN/OUT).
Return type:
Pointer of the return variable value.
Bugs:
null
See Also:
WriteAclStatus()

ReadAclTableEntry()

U_CHAR ReadAclTableEntry(U_CHAR ***cols,INT32**colsLen,INT32 index)

It will get an entry from table

Arguments:
1.Table columns (IN).
2. Columns length (IN).
3. Index of the vector (IN).
Return type:
SUCCESS/FAILURE.
Bugs:
null

ReadAuthTableInfo()

Vector* ReadAuthTableInfo(INT32 startIdx, INT32 numOfRows, INT32 *flag)

It will return the table Vector reference, before that it will verify the total size of the table and set flag value.

Arguments:
1. Starting Row index (IN).
2. Number of rows (IN).
3. Flag about remaining number of rows (OUT).
Return type:
Reference to Acl table vector.
Bugs:
null

ReadFromAgentAuthTableFile()

CHAR ReadFromAgentAuthTableFile()

Reads from the text file and updates the authentication Vector. It is used when check for authentication after receiving a request from the manager.

Arguments:
Nothing.
Return type:
SUCCESS or FAILURE.
Bugs:
null

UpdateAgentAuthTableFile()

CHAR UpdateAgentAuthTableFile(U_CHAR command)

Update the changes of UpdateAgentAuthTableFile.

Arguments:
command type.
Return type:
SUCCESS or FAILURE.
Bugs:
null

WriteAclAccess()

U_CHAR* WriteAclAccess(void *tableEntryPtr, U_CHAR *varVal, INT32 *varValLen, U_CHAR *status)

Write method for (table) column access.

Arguments:
1. Pointer of the Entry (IN/OUT).
2. Pointer of the variable to set (IN).
3. Pointer of the variable value length (IN/OUT).
4. Status which is used to return SNMP Error (IN/OUT).
Return type:
Pointer of the return variable value.
Bugs:
null
See Also:
ReadAclAccess()

WriteAclManagers()

U_CHAR* WriteAclManagers(void *tableEntryPtr, U_CHAR *varVal, INT32 *varValLen, U_CHAR *status)

Write method for (table) column aclManagers. "This variable has the managers list allowed for specified access with specified community. The format of the string is 'managerName1;managerName2.....' with a list of manager IpAddress/name corresponding to each additional information separated via ';' as the delimiter between any two managers. The default value is '0:0:0:0' which states access for all managers for the corresponding community."

Arguments:
1. Pointer of the entry (IN/OUT).
2. Pointer of the variable to set (IN).
3. Pointer of the variable value length (IN/OUT).
4. Status which is used to return SNMP Error (IN/OUT).
Return type:
The Current value of "aclManagers".
Bugs:
null
See Also:
ReadAclManagers()

WriteAclStatus()

U_CHAR* WriteAclStatus(void *tableEntryPtr, U_CHAR *varVal, INT32 *varValLen, U_CHAR *status)

Write method for (table) column aclStatus.

Arguments:
1. Pointer of the Entry (IN/OUT).
2. Pointer of the variable to set (IN).
3. Pointer of the variable value length (IN/OUT).
4. Status which is used to return SNMP Error (IN/OUT).
Return type:
Pointer of the return variable value.
Bugs:
null
See Also:
ReadAclStatus()

WriteToAgentAuthTableFile()

CHAR WriteToAgentAuthTableFile()

It will write the table enteries from the Vector into the file.

Arguments:
Nothing.
Return type:
SUCCESS or FAILURE.
Bugs:
null


OverView Index Help                                                                WebNMS Agent Toolkit C Edition 6 

Copyright (c) 2009 ZOHO Corp. All Rights Reserved.