OverView Index Help                                                                WebNMS Agent Toolkit C Edition 6 

snmputils.c
This file contains utility methods related to SNMP operation.
Return Type Method Summary
CHAR AddEntryToLCDTable(Vector *vect, void *ptr)
             Add an Entry to LCD table.
SnmpPdu* AllocateAndInitSnmpPdu()
             Allocates an instance to SnmpPdu and initialize all fields as NULL.
CHAR CheckAndInvokeRegisteredSnmpListener()
             This method will check the request queue size, wait for threads to become idle, invoke registered listener and start receiving the request.
CHAR CheckOidAccess(U_CHAR command, U_CHAR access, U_CHAR version)
             Check the corresponding access type of the given oid for its given command type.
SnmpPdu* CloneSnmpPdu(SnmpPdu *pdu)
             This function create a new pdu reference and all the info of the received pdu pointer to the newly create one.
CHAR CloneTdInfo(TransportDomainInfo **destTdInfo, TransportDomainInfo *srcTdInfo)
            
CHAR CompareDigest(U_CHAR *str1, INT32 len1, U_CHAR *str2, INT32 len2)
             Compare each element of the str1 with corresponding element of the str2.
INT32 ConvertToIpAddFromString(U_CHAR **dest, CHAR *src, INT32 srcLen)
             Converts the given string into ipAddress.
CHAR CreateRcvdInfo(ReceivedInfo **rcvdInfoPtr, TransportDomainInfo *tdInfo, U_CHAR *inPacket, INT32 inPacketLength)
             It will make a copy of all the received information.
CHAR CreateSnmpMsgForPdu(U_CHAR *outPkt, INT32 *outPktLen, SnmpPdu *pdu, UsmSecParamsReference *usmSecParams) or CHAR CreateSnmpMsgForPdu(U_CHAR *outPkt, INT32 *outPktLen, SnmpPdu *pdu)
             It will create a snmp message for the given pdu.
SnmpPdu* CreateSnmpPdu(LONG version, CHAR *community, U_CHAR command, LONG reqId, LONG errStatus, LONG errIndex, Vector *varBindVect)
             This function will create the SnmpPdu with the values such as version, community, command, reqId, error status, error index as arguments.
U_CHAR* DecodeAsnSyntaxValue(U_CHAR varValType, U_CHAR *varVal, INT32 *varValLen)
             Decodes the give varbind value according to BER standard.
OID* DecodeOID(CHAR *data, INT32 dataLen, INT32 *oidLen)
             Convert the character stream of oid representation to OID array using BER decoding rule.
void DeleteLCDVector(Vector *vect, void *lcdEntryPtr, CHAR status)
             It will delete the element from lcdVector.
CHAR FindNextSubId(TreeCell *tempCell, OID *varName, INT32 *varNameLen, INT16 columnIdx)
             It will find out the next subid of the given listener if it is available.
void FreeHolderVector(Vector *vect)
             Free the allocated resource of the holder Vector.
void FreeInformVector()
             It will free the inform Vector.
void FreeProxyVector(Vector *vect)
             Free the allocated resource of the proxy Vector.
void FreeSNMPResources()
             It will free the memory allocated by the run time agent for SNMP adapter.
void FreeSnmpPdu(SnmpPdu *pdu)
             Free the allocated resource of SnmpPdu.
void FreeSnmpPduResources(SnmpPdu *pdu)
             Free all the allocated resources of SnmpPdu.
void FreeSnmpThreadResource()
             It will free the resources related snmp thread.
void FreeSnmpTransportDominInfo()
             It will free the snmp transport domain information.
INT16 GetAttributeIndex(TreeCell *cell, OID *rcvdOid)
             It will find out the exact position/order of the column/scalar from the subId list.
INT16 GetColumnIndex(OID column, OID *subIdList, U_INT16 subIdListLen)
             Search the given column in the subid list, if it is there return corresponding index in the subid list.
void GetNOid(OID *destOid, OID *srcOid, INT32 startIndex, INT32 len)
             Get each oid from the srcOid and copy to destOid from startIndex to startIndex + len.
CHAR GetNextOid(TreeCell *tempCell, OID *oid, INT32 *len)
             Compares the received oid from the varbind with oid (oid of tree cell + each Entry of subid list) then return the next greater oid.
void IncrementSnmpInMessageCntrs(U_CHAR pduType, U_CHAR afterProcess, SnmpPdu *pdu)
             Depending upon the incoming message type the corresponding counter will be incremented.
void IncrementSnmpOutErrMessageCntrs(LONG errorStatus)
             Depending upon the error status of the outgoing message the corresponding counter will be incremented.
void MapFamilyTypeToInteger(CHAR *familyTypeAsString, INT32 *familyTypeAsInt)
            
void MapFamilyTypeToString(INT32 familyTypeAsInt, CHAR *familyTypeAsString)
            
void MapSecLevelToInteger(CHAR *secLevelAsString, INT32 *secLevelAsInt)
            
void MapSecLevelToString(INT32 secLevelAsInt, CHAR *secLevelAsString)
            
void MapSecModelToInteger(CHAR *secModelAsString, INT32 *secModelAsInt)
            
void MapSecModelToString(INT32 secModelAsInt, CHAR *secModelAsString)
            
void MapSnmpVersionToInteger(CHAR *snmpVersionAsString, INT32 *snmpVersionAsInt)
             After reading from text file corresponding errStatus macro will be mapped.
void MapSnmpVersionToString(U_INT32 snmpVersionAsInt, CHAR *snmpVersionAsString)
            
void MapStorageTypeToIneger(CHAR *storageTypeAsString, INT32 *storageTypeAsInt)
            
void MapStorageTypeToString(INT32 storageTypeAsInt, CHAR *storageTypeAsString)
            
LONG MapToSNMPv1Error(LONG errStatus)
             It will convert the given snmp error into SNMPv1 Error if needed.
void MapTrapTypeToInteger(CHAR *typeAsString, INT32 *typeAsInt)
             After reading from the text file corresponding value will be mapped.
void MapTrapTypeToString(INT32 typeAsInt, CHAR *typeAsString)
             Before writing in the text file corresponding macro will be mapped.
U_CHAR* ParseSnmpMsgLen(U_CHAR *pkt, U_LONG *length)
            
CHAR RegisterListenerBeforeRestartSnmpService(void *funPtr)
             This method will register a method which will be excecuted before restarting the snmp service.
U_CHAR* RemoveSnmpPktHeaderLength(U_CHAR *pkt)
             It will skip the header length and return the pointer on which original data starts.
CHAR RestartSnmpAgentService(LONG port, CHAR *host)
             This method will stop the already running service and restart the service for specified port.
SnmpPdu* SendAndReceiveSnmpPdu(SnmpPdu *pdu, CHAR *remoteHost, INT32 remotePort, CHAR *status, UsmSecParamsReference *usmSecParams) or SnmpPdu *SendAndReceiveSnmpPdu(SnmpPdu *pdu, CHAR *remoteHost, INT32 remotePort, CHAR *status)
             This function will first creates a tdInfo with the remote host and remote port values and then open an Snmp session.
U_CHAR SendPduAndWaitForTdInfoResp(TransportDomainInfo *tdInfo, SnmpPdu *trapPdu, UsmSecParamsReference *usmSecParams) or U_CHAR SendPduAndWaitForTdInfoResp(TransportDomainInfo *tdInfo, SnmpPdu *trapPdu)
             This function will send the created pdu to the master agent and waits for the response and returns SUCCESS or FAILURE depends on the response received from the master agent.
CHAR SendSnmpPdu(TransportDomainInfo *tdInfo, SnmpPdu *trapPdu, UsmSecParamsReference *usmSecParams) or CHAR SendSnmpPdu(TransportDomainInfo *tdInfo, SnmpPdu *trapPdu)
             It will first create the Snmp message for the specified pdu and the transport domain values and finally send the Snmp message to the manager.
CHAR SplitIndexValue(U_CHAR *indexDataTypes, INT32 indexDataTypeLen, CHAR impliedIndexFlag, OID *inst, INT32 instLen, U_CHAR **indexes, INT32 *indexesLen, INT32 *indexLen, U_CHAR *errorStatus)
             It will split the given instance value into number of index and store then in "indexes" variable, the corresponding length of each index will be inindexesLen variable.
CHAR StartReceivingSnmpRequest()
             This method will set the flag true which will start receiving the request by the snmp service.
CHAR StartSnmpAgentService(LONG port, CHAR *host)
             This method will start the snmp service at the specified port.
CHAR StopReceivingSnmpRequest()
             This method will set the flag false which will stop receiving the request by the snmp service.
CHAR StopSnmpAgentService()
             This method will stop the snmp service.
CHAR ValidateOid(OID * src, INT32 len)
             Check the received Oid for Validation.
CHAR WaitForSnmpThreadsToIdle(ThreadInfo *threadPool, U_INT16 poolSize)
             This method will wait till all threads become wating state.
   
Method Details

AddEntryToLCDTable()

CHAR AddEntryToLCDTable(Vector *vect, void *ptr)

Add an Entry to LCD table. The Entry is the same as added in its corresponding Vector.

Arguments:
1. LCD Vector to add given Entry (IN).
2. Table Entry (row) pointer (IN).
Return type:
SUCCESS or FAILURE.
Bugs:
null

AllocateAndInitSnmpPdu()

SnmpPdu* AllocateAndInitSnmpPdu()

Allocates an instance to SnmpPdu and initialize all fields as NULL.

Arguments:
Nothing.
Return type:
pdu.
Bugs:
null
See Also:
FreeSnmpPdu()

CheckAndInvokeRegisteredSnmpListener()

CHAR CheckAndInvokeRegisteredSnmpListener()

This method will check the request queue size, wait for threads to become idle, invoke registered listener and start receiving the request.

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

CheckOidAccess()

CHAR CheckOidAccess(U_CHAR command, U_CHAR access, U_CHAR version)

Check the corresponding access type of the given oid for its given command type.

Arguments:
1. Command type (IN).
2. Access type of the oid (IN).
3. Version (IN).
Return type:
If the given oid having proper access w.r.to its command then it returns SUCCESS otherwise FAILURE.
Bugs:
null

CloneSnmpPdu()

SnmpPdu* CloneSnmpPdu(SnmpPdu *pdu)

This function create a new pdu reference and all the info of the received pdu pointer to the newly create one.

Arguments:
1. Reference of the pdu (IN).
Return type:
The cloned pdu reference
Bugs:
null

CloneTdInfo()

CHAR CloneTdInfo(TransportDomainInfo **destTdInfo, TransportDomainInfo *srcTdInfo)

It will copy all the srcTdInfo to destTdInfo

Arguments:
1. Reference of the destination TransportDomainInfo.
2. Reference of the source TransportDomainInfo.
Return type:
SUCCESS or MEMORY ALLOCATION FAILURE..
Bugs:
null

CompareDigest()

CHAR CompareDigest(U_CHAR *str1, INT32 len1, U_CHAR *str2, INT32 len2)

Compare each element of the str1 with corresponding element of the str2. It will return result as specified above (Returns).

Arguments:
1. String contains digest1 (IN).
2. String1 length (IN).
3. String contains digest1 (IN).
4. String2 length (IN).
Return type:
Return SUCCESS if str1 == str2 otherwise FAILURE.
Bugs:
null

ConvertToIpAddFromString()

INT32 ConvertToIpAddFromString(U_CHAR **dest, CHAR *src, INT32 srcLen)

Converts the given string into ipAddress. The resultant ipAddress will be stored in dest after allocating sufficient memory.

Arguments:
1. Address of the character pointer to which the src
string is to be copied as ipAddress (OUT).
2. The string representation of ipAddress (IN).
3. Length of string representation of ipAddress (IN).
Return type:
The length of the oid.
Bugs:
null

CreateRcvdInfo()

CHAR CreateRcvdInfo(ReceivedInfo **rcvdInfoPtr, TransportDomainInfo *tdInfo, U_CHAR *inPacket, INT32 inPacketLength)

It will make a copy of all the received information.

Arguments:
1. Reference of the received information.
2. Reference of the TransportDomainInfo.
3. Reference of the inpacket.
4. Inpacket length.
Return type:
SUCCESS or MEMORY ALLOCATION FAILURE.
Bugs:
null

CreateSnmpMsgForPdu()

CHAR CreateSnmpMsgForPdu(U_CHAR *outPkt, INT32 *outPktLen, SnmpPdu *pdu, UsmSecParamsReference *usmSecParams) or CHAR CreateSnmpMsgForPdu(U_CHAR *outPkt, INT32 *outPktLen, SnmpPdu *pdu)

It will create a snmp message for the given pdu.

Arguments:
1. Reference to the outPkt(OUT).
2. Reference of outPktLen (OUT).
3. Reference of Pdu (INT).
Return type:
SUCCESS or FAILURE.
Bugs:
null

CreateSnmpPdu()

SnmpPdu* CreateSnmpPdu(LONG version, CHAR *community, U_CHAR command, LONG reqId, LONG errStatus, LONG errIndex, Vector *varBindVect)

This function will create the SnmpPdu with the values such as version, community, command, reqId, error status, error index as arguments.

Arguments:
1. SNMP version (IN).
2. SNMP community (IN).
3. SNMP command (IN).
4. SNMP request ID (IN).
5. SNMP error status (IN).
6. SNMP error Index (IN).
4. Varbind vector as reference (IN).
Return type:
Reference to the created Snmp Pdu.
Bugs:
null

DecodeAsnSyntaxValue()

U_CHAR* DecodeAsnSyntaxValue(U_CHAR varValType, U_CHAR *varVal, INT32 *varValLen)

Decodes the give varbind value according to BER standard.

Arguments:
1. VarBind type (IN).
2. VarBind value (IN).
3. VarBind value length (IN/OUT).
Return type:
The decoded value of the given varbind.
Bugs:
null

DecodeOID()

OID* DecodeOID(CHAR *data, INT32 dataLen, INT32 *oidLen)

Convert the character stream of oid representation to OID array using BER decoding rule.

Arguments:
1. Oid representation of the character stream (IN).
2. Character stream length (IN).
3. Oid length after decoding (OUT).
Return type:
Pointer to the created oid.
Bugs:
null

DeleteLCDVector()

void DeleteLCDVector(Vector *vect, void *lcdEntryPtr, CHAR status)

It will delete the element from lcdVector.

Arguments:
1.Reference of the Vector (IN/OUT).
2.Reference of the gptr (IN).
3.status (IN).
Return type:
Nothing.
Bugs:
null

FindNextSubId()

CHAR FindNextSubId(TreeCell *tempCell, OID *varName, INT32 *varNameLen, INT16 columnIdx)

It will find out the next subid of the given listener if it is available. otherwise it will goto next TreeCell (listener) if present.

Arguments:
1. Tree cell reference (IN).
2. Rcvd OID (IN/OUT).
3. Rcvd OID length (IN/OUT).
4. Column index (IN).
Return type:
ACCESS_DENIED or NEXT_LISTENER.
Bugs:
null

FreeHolderVector()

void FreeHolderVector(Vector *vect)

Free the allocated resource of the holder Vector.

Arguments:
1. The holder Vector (IN/OUT).
Return type:
Nothing.
Bugs:
null

FreeInformVector()

void FreeInformVector()

It will free the inform Vector.

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

FreeProxyVector()

void FreeProxyVector(Vector *vect)

Free the allocated resource of the proxy Vector.

Arguments:
1. The proxy Vector (IN/OUT).
Return type:
Nothing.
Bugs:
null

FreeSNMPResources()

void FreeSNMPResources()

It will free the memory allocated by the run time agent for SNMP adapter.

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

FreeSnmpPdu()

void FreeSnmpPdu(SnmpPdu *pdu)

Free the allocated resource of SnmpPdu.

Arguments:
Reference to the Pdu (IN/OUT).
Return type:
Nothing.
Bugs:
null
See Also:
AllocateAndInitSnmpPdu()

FreeSnmpPduResources()

void FreeSnmpPduResources(SnmpPdu *pdu)

Free all the allocated resources of SnmpPdu.

Arguments:
Reference to the Pdu (IN/OUT).
Return type:
Nothing.
Bugs:
null

FreeSnmpThreadResource()

void FreeSnmpThreadResource()

It will free the resources related snmp thread.

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

FreeSnmpTransportDominInfo()

void FreeSnmpTransportDominInfo()

It will free the snmp transport domain information.

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

GetAttributeIndex()

INT16 GetAttributeIndex(TreeCell *cell, OID *rcvdOid)

It will find out the exact position/order of the column/scalar from the subId list.

Arguments:
1. Tree cell (IN).
2. Received oid from the manger (IN).
Return type:
The index of the column/scalar in the subId List.
Bugs:
null

GetColumnIndex()

INT16 GetColumnIndex(OID column, OID *subIdList, U_INT16 subIdListLen)

Search the given column in the subid list, if it is there return corresponding index in the subid list.

Arguments:
1. Column number (IN).
2. Subid list of the registered oid (IN).
3. Subid list length of the registered oid (IN).
Return type:
Index of the given column in the subid list.
Bugs:
null

GetNOid()

void GetNOid(OID *destOid, OID *srcOid, INT32 startIndex, INT32 len)

Get each oid from the srcOid and copy to destOid from startIndex to startIndex + len.

Arguments:
1. Destination to where the oid is to be copied (OUT).
2. Source oid from where the oid is copied (IN).
3. Starting index of the src oid to copy to dest (IN).
4. Number of oid have to copy from source oid (IN).
Return type:
Nothing.
Bugs:
null

GetNextOid()

CHAR GetNextOid(TreeCell *tempCell, OID *oid, INT32 *len)

Compares the received oid from the varbind with oid (oid of tree cell + each Entry of subid list) then return the next greater oid.

Arguments:
1. Tree cell (IN).
2. Oid to compare (OUT).
3. Oid length (OUT).
Return type:
Returns SUCCESS if next OID is available in the same table or group, otherwise FAILURE.
Bugs:
null

IncrementSnmpInMessageCntrs()

void IncrementSnmpInMessageCntrs(U_CHAR pduType, U_CHAR afterProcess, SnmpPdu *pdu)

Depending upon the incoming message type the corresponding counter will be incremented.

Arguments:
1. Incoming message type (IN).
2. Counter will be incremented after successful
processing (IN).
3. Reference to the pdu.
Return type:
Nothing.
Bugs:
null

IncrementSnmpOutErrMessageCntrs()

void IncrementSnmpOutErrMessageCntrs(LONG errorStatus)

Depending upon the error status of the outgoing message the corresponding counter will be incremented.

Arguments:
1. Outgoing error status (IN).
Return type:
Nothing.
Bugs:
null

MapFamilyTypeToInteger()

void MapFamilyTypeToInteger(CHAR *familyTypeAsString, INT32 *familyTypeAsInt)

After reading from the text file corresponding macro will be mapped

Arguments:
1. Row status value as String(IN).
2. Row status value as Integer(IN/OUT);
Return type:
Nothing.
Bugs:
null
See Also:
MapFamilyTypeToString()

MapFamilyTypeToString()

void MapFamilyTypeToString(INT32 familyTypeAsInt, CHAR *familyTypeAsString)

Before writing to the text file corresponding string will be mapped

Arguments:
1. Row status value as Integer(IN).
2. Row status value as String(IN/OUT);
Return type:
Nothing.
Bugs:
null
See Also:
MapFamilyTypeToInteger()

MapSecLevelToInteger()

void MapSecLevelToInteger(CHAR *secLevelAsString, INT32 *secLevelAsInt)

After reading from the text file corresponding macro will be mapped

Arguments:
1. Row status value as String(IN).
2. Row status value as Integer(IN/OUT);
Return type:
Nothing.
Bugs:
null
See Also:
MapSecLevelToString()

MapSecLevelToString()

void MapSecLevelToString(INT32 secLevelAsInt, CHAR *secLevelAsString)

Before writing in the text file corresponding string will be mapped

Arguments:
1. Row status value as Integer(IN).
2. Row status value as String(IN/OUT);
Return type:
Nothing.
Bugs:
null
See Also:
MapSecLevelToInteger()

MapSecModelToInteger()

void MapSecModelToInteger(CHAR *secModelAsString, INT32 *secModelAsInt)

After reading from the text file corresponding macro will be mapped

Arguments:
1. Security model value as String(IN).
2. Security model value as Integer(IN/OUT);
Return type:
Nothing.
Bugs:
null
See Also:
MapSecModelToString()

MapSecModelToString()

void MapSecModelToString(INT32 secModelAsInt, CHAR *secModelAsString)

Before writing in the text file corresponding string will be mapped

Arguments:
1. Security model value as Integer(IN).
2. Security model value as String(IN/OUT);
Return type:
Nothing.
Bugs:
null
See Also:
MapSecModelToInteger()

MapSnmpVersionToInteger()

void MapSnmpVersionToInteger(CHAR *snmpVersionAsString, INT32 *snmpVersionAsInt)

After reading from text file corresponding errStatus macro will be mapped.

Arguments:
1. Snmp version value as String(IN).
2. Snmp Version value as Integer(IN/OUT);
Return type:
Nothing.
Bugs:
null
See Also:
MapSnmpVersionToString()

MapSnmpVersionToString()

void MapSnmpVersionToString(U_INT32 snmpVersionAsInt, CHAR *snmpVersionAsString)

Before writing in the text file corresponding string will be mapped

Arguments:
1. Snmp version value as Integer(IN).
2. Snmp version value as String(IN/OUT);
Return type:
Nothing.
Bugs:
null
See Also:
MapSnmpVersionToInteger()

MapStorageTypeToIneger()

void MapStorageTypeToIneger(CHAR *storageTypeAsString, INT32 *storageTypeAsInt)

After reading from the text file corresponding macro will be mapped

Arguments:
1. Row status value as String(IN).
2. Row status value as Integer(IN/OUT);
Return type:
Nothing.
Bugs:
null
See Also:
MapStorageTypeToString()

MapStorageTypeToString()

void MapStorageTypeToString(INT32 storageTypeAsInt, CHAR *storageTypeAsString)

Before writing to the text file corresponding string will be mapped

Arguments:
1. Row status value as Integer(IN).
2. Row status value as String(IN/OUT);
Return type:
Nothing.
Bugs:
null
See Also:
MapStorageTypeToIneger()

MapToSNMPv1Error()

LONG MapToSNMPv1Error(LONG errStatus)

It will convert the given snmp error into SNMPv1 Error if needed.

Arguments:
1. Error status value (IN).
Return type:
Converted SNMPv1 Error.
Bugs:
null

MapTrapTypeToInteger()

void MapTrapTypeToInteger(CHAR *typeAsString, INT32 *typeAsInt)

After reading from the text file corresponding value will be mapped.

Arguments:
1. Trap type value as string(IN).
2. Trap type value as integer(IN/OUT).
Return type:
Nothing.
Bugs:
null
See Also:
MapTrapTypeToString()

MapTrapTypeToString()

void MapTrapTypeToString(INT32 typeAsInt, CHAR *typeAsString)

Before writing in the text file corresponding macro will be mapped.

Arguments:
1. Trap type value as integer(IN).
2. Trap type value as string(IN/OUT).
Return type:
Nothing.
Bugs:
null
See Also:
MapTrapTypeToInteger()

ParseSnmpMsgLen()

U_CHAR* ParseSnmpMsgLen(U_CHAR *pkt, U_LONG *length)

It will parse the header length of the snmp packet

Arguments:
1. Reference to the packet.
2. Reference of length.
Return type:
Reference to the packet after parsing length..
Bugs:
null

RegisterListenerBeforeRestartSnmpService()

CHAR RegisterListenerBeforeRestartSnmpService(void *funPtr)

This method will register a method which will be excecuted before restarting the snmp service.

Arguments:
Funtion reference (IN).
Return type:
SUCCESS or FAILURE.
Bugs:
null

RemoveSnmpPktHeaderLength()

U_CHAR* RemoveSnmpPktHeaderLength(U_CHAR *pkt)

It will skip the header length and return the pointer on which original data starts.

Arguments:
1. Starting address of header (IN).
Return type:
Location where original data starts.
Bugs:
Guess skipping more than four bytes has no meaning.

RestartSnmpAgentService()

CHAR RestartSnmpAgentService(LONG port, CHAR *host)

This method will stop the already running service and restart the service for specified port.

Arguments:
1.port(IN)
2.host(IN).
Return type:
SUCCESS or SOCK_ERR.
Bugs:
null

SendAndReceiveSnmpPdu()

SnmpPdu* SendAndReceiveSnmpPdu(SnmpPdu *pdu, CHAR *remoteHost, INT32 remotePort, CHAR *status,UsmSecParamsReference *usmSecParams) or SnmpPdu *SendAndReceiveSnmpPdu(SnmpPdu *pdu, CHAR *remoteHost, INT32 remotePort, CHAR *status)

This function will first creates a tdInfo with the remote host and remote port values and then open an Snmp session. Then it sends the pdu to the corresponding host and port and finally gets back the response in the form of rcvdPdu. Also, the rcvdPdu informations are displayed.

Arguments:
1. Reference to the pdu (IN).
2. Host name (IN).
3. Port number (IN).
4. Status value to identify the failure type (OUT).
Return type:
Reference to the received Snmp Pdu.
Bugs:
null

SendPduAndWaitForTdInfoResp()

U_CHAR SendPduAndWaitForTdInfoResp(TransportDomainInfo *tdInfo, SnmpPdu *trapPdu, UsmSecParamsReference *usmSecParams) or U_CHAR SendPduAndWaitForTdInfoResp(TransportDomainInfo *tdInfo, SnmpPdu *trapPdu)

This function will send the created pdu to the master agent and waits for the response and returns SUCCESS or FAILURE depends on the response received from the master agent.

Arguments:
1. Reference to the tdInfo (IN).
2. Reference to the pdu (IN).
Return type:
SUCCESS or FAILURE
Bugs:
null

SendSnmpPdu()

CHAR SendSnmpPdu(TransportDomainInfo *tdInfo, SnmpPdu *trapPdu, UsmSecParamsReference *usmSecParams) or CHAR SendSnmpPdu(TransportDomainInfo *tdInfo, SnmpPdu *trapPdu)

It will first create the Snmp message for the specified pdu and the transport domain values and finally send the Snmp message to the manager.

Arguments:
1. Reference to the tdInfo(IN).
2. Reference to the Pdu (IN).
Return type:
SUCCESS or FAILURE.
Bugs:
null

SplitIndexValue()

CHAR SplitIndexValue(U_CHAR *indexDataTypes, INT32 indexDataTypeLen, CHAR impliedIndexFlag, OID *inst, INT32 instLen, U_CHAR **indexes, INT32 *indexesLen, INT32 *indexLen,U_CHAR *errorStatus)

It will split the given instance value into number of index and store then in "indexes" variable, the corresponding length of each index will be inindexesLen variable.

Arguments:
1. Reference to index data types(IN).
2. Length of index data type(IN).
3. ImpiledIndex flag (IN).
4. instance (IN).
5. instance length (IN/OUT).
6. indeces (IN/UT).
7. indeces length(IN/OUT).
8. indexLen (IN/OUT).
Return type:
The status of the process (SUCCESS or FAILURE).
Bugs:
null

StartReceivingSnmpRequest()

CHAR StartReceivingSnmpRequest()

This method will set the flag true which will start receiving the request by the snmp service.

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

StartSnmpAgentService()

CHAR StartSnmpAgentService(LONG port, CHAR *host)

This method will start the snmp service at the specified port.ie it will open a new snmp session for the new port.

Arguments:
1. port (IN).
2. Host (IN).
Return type:
SUCCESS or SOCK_ERR.
Bugs:
null

StopReceivingSnmpRequest()

CHAR StopReceivingSnmpRequest()

This method will set the flag false which will stop receiving the request by the snmp service.

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

StopSnmpAgentService()

CHAR StopSnmpAgentService()

This method will stop the snmp service.ie it will close the snmp session.

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

ValidateOid()

CHAR ValidateOid(OID * src,INT32 len)

Check the received Oid for Validation.

Arguments:
1. The Oid to be validated (IN).
2. The length of the Oid (IN).
Return type:
SUCCESS if the Oid is a valid one else FALSE.
Bugs:
null

WaitForSnmpThreadsToIdle()

CHAR WaitForSnmpThreadsToIdle(ThreadInfo *threadPool, U_INT16 poolSize)

This method will wait till all threads become wating state.

Arguments:
1.ThreadPool(IN)
2.ThreadPool size(IN).
Return type:
SUCCESS or FAILURE.
Bugs:
null


OverView Index Help                                                                WebNMS Agent Toolkit C Edition 6 

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