📄 snmpddoc.c
字号:
/* * Copyright 1984-2005 Wind River Systems, Inc. * All rights reserved. Provided under license only. * Distribution or other use of this software is only * permitted pursuant to the terms of a license agreement * from Wind River Systems (and is otherwise prohibited). * Refer to that license agreement for terms of use. */#include <copyright_wrs.h>/* snmpdLib/snmpdLibDoc.c - entry points to the SNMP v1/v2c agent *//* modification history --------------------01d,19apr05,job update copyright notices01c,02dec03,job update copyright information01b,05dec00,ten added info on RFC2275 support routines.01a,06oct98,jmp written from snmpdLib.c.*//* * $Log: snmpddoc.c,v $ * Revision 1.1.1.1 2001/11/05 17:47:49 tneale * Tornado shuffle * * Revision 1.4 2001/04/16 19:38:42 josh * merging the kingfisher branch onto the trunk * * Revision 1.3.2.2 2001/03/12 22:11:32 tneale * Updated copyright * * Revision 1.3.2.1 2000/12/05 22:04:15 tneale * Added info on the routines for RFC2275 support * * Revision 1.3 2000/03/07 21:17:25 josh * fixing log comments * * Revision 1.2 2000/03/07 20:58:35 josh * putting CVS headers and logs into files that were lacking * *//*DESCRIPTIONThis module implements the WindNet SNMPv1/v2c agent for VxWorks. Thisagent provides for the management of objects defined by the MIB-IIstandard. The agent management information base can be extended toinclude additional user-defined MIBs. The agent also provides supportfor asynchronous method routines and dynamic loading of MIBs.INCLUDE FILES: snmpdLib.hSEE ALSO:The SNMP version 1 framework is defined by the following Request For Comments (RFCs): 1155, 1157, 1212. MIB-II is defined by RFC 1213. For more information about SNMP, refer to these documents.For more information about the VxWorks SNMP agent, see the .I "WindNet SNMP VxWorks Component Release Supplement."*//********************************************************************************* snmpdPktProcess - process a packet returned by the transport** This routine is invoked by the user-IO layer to process a received* packet. The buffer <pBuf> (provided by the agent designer) must* contain a packet of size <pktSize>. The source address of the* sending machine is indicated by <pRemoteAddr>, and the address of the* receiver by <pLocalAddr>. These three parameters, <pRemoteAddr>,* <pLocalAddr>, and <pSnmpEndpoint>, are passed down to user-provided* transport routines. The transport endpoint is passed in* <pSnmpEndpoint>** RETURNS: N/A**/void snmpdPktProcess ( int pktSize, /* packe length */ char * pBuf, /* packet buffer */ void * pRemoteAddr, /* remote transport address */ void * pLocalAddr, /* local transport address */ void * pSnmpEndpoint /* snmp transport end point */ ) { ... }/******************************************************************************** * snmpdLog - log messages from the SNMP agent ** This routine logs messages generated by the SNMP agent. Messages are* sent to the standard console. If <level> is less than or equal to* SNMP_TRACE_LEVEL (in `configAll.h'), the message is printed, otherwise* it is ignored. The value of <level> must be one of 1, 2, or 3.** RETURNS: N/A**/void snmpdLog ( int level, /* level of this message */ char * string /* message string */ ) { ... }/******************************************************************************** * snmpdViewEntrySet - install an entry in the view table** This function creates an entry in the view table. The view subtree* is specified by <pTreeOid> and <treeOidLen>.** The installed entry has an index of <index>. The specified view is* included in or excluded from the view table depending on the value* of <viewType> (VIEW_INCLUDED or VIEW_EXCLUDED, respectively). The* entry mask is specified by <pmask>; <maskLen> must be the mask* length in bytes.** RETURNS: OK on success, otherwise ERROR*/STATUS snmpdViewEntrySet ( OIDC_T * pTreeOid, /* sub tree for view */ int treeOidLen, /* length of subtree oid */ UINT_16_T index, /* index of entry */ uchar_t * pMask, /* mask for entry */ int maskLen, /* mask length in bytes */ int viewType /* type of view (INCLUDED/EXCLUDED) */ ) { ... }/********************************************************************************* snmpdViewEntryRemove - remove an entry from the view table** This routine removes an entry from the view table and deallocates* the associated resources. The entry should have been previously* created with snmpdViewEntrySet().** RETURNS: N/A** SEE ALSO: snmpdViewEntrySet()*/void snmpdViewEntryRemove ( OIDC_T * pTreeOid, /* oid of view subtree to remove */ int treeOidLen, /* length of view subtree oid */ UINT_16_T index /* index of entry */ ) { }/********************************************************************************* snmpdTreeAdd - dynamically add a subtree to the SNMP agent MIB tree** This routine adds the specified MIB subtree, located in memory at* the address <pTreeAddr>, to the agent's MIB data tree at the node* with the object identifier specified by <pTreeOidStr>. This subtree* is normally generated with the `-start' option to `mibcomp'.** RETURNS: OK on success, otherwise ERROR.** SEE ALSO:* .I WindNet SNMPv1v2c VxWorks Component Release Supplement*/STATUS snmpdTreeAdd ( char * pTreeOidStr, MIBNODE_T * pTreeAddr ) { ... }/********************************************************************************* snmpdView2275EntrySet - install an entry in the view table (2275 version)** This function creates an entry in the view table. The view subtree* is specified by <pTreeOid> and <treeOidLen>.** The installed entry has a name of <pName> and nameLen. The specified* view is included in or excluded from the view table depending on the* value of <viewType> (VIEW_INCLUDED or VIEW_EXCLUDED, respectively). The* entry mask is specified by <pmask>; <maskLen> must be the mask* length in bytes.** RETURNS: OK on success, otherwise ERROR**/ STATUS snmpdView2275EntrySet ( OIDC_T * pTreeOid, /* sub tree for view */ int treeOidLen, /* length of subtree oid */ uchar_t * pName, /* name of entry */ ALENGTH_T nameLen, /* length of name */ uchar_t * pMask, /* mask for entry */ int maskLen, /* mask length in bytes */ int viewType /* type of view (INCLUDED/EXCLUDED) */ ) { ... } /********************************************************************************* snmpdView2275EntryRemove - remove an entry from the view table (2275 version)** This routine removes an entry from the view table and deallocates* the associated resources. The entry should have been previously* created with snmpdView2275EntrySet().** RETURNS: N/A** SEE ALSO: snmpdView2275EntrySet()*/ void snmpdView2275EntryRemove ( OIDC_T * pTreeOid, /* oid of view subtree to remove */ int treeOidLen, /* length of view subtree oid */ uchar_t * pName, /* name of entry */ ALENGTH_T nameLen /* length of name */ ) { ... } /******************************************************************************* snmpdTreeRemove - dynamically remove part of the SNMP agent MIB tree** This routine deletes part of the SNMP agent MIB tree at* runtime. Once the specified subtree is deleted, any further requests* to access objects of that subtree fail.** RETURNS: N/A** SEE ALSO:* .I WindNet SNMPv1v2c VxWorks Component Release Supplement*/void snmpdTreeRemove ( char * pTreeOidStr /* char string specifying oid of tree to remove */ ) { ... } /******************************************************************************** snmpdTrapSend - general interface to trap facilities** This routine sends a trap of type <trapType> and specific* <trapSpecific> to all the specified destinations, given an array of* destinations in <ppDestAddrTbl> of len <numDestn>.** The <version> parameter is either SNMP_VERSION_1 or SNMP_VERSION_2,* depending on whether a v1-style or v2-style trap is to be generated.* The community used is specified by <pTrapCmnty>. <pLocalAddr>* indicates a local address to use for a sending endpoint. <pMyOid>* and <myOidlen> specify the system object identifier (<sysObjId>) to* use.** <numVarBinds> indicates the number of variable bindings that are to* be encoded in the packet. <trapVarBindsRtn> is the routine to use* for doing the variable bindings. <pCookie> is passed to this* routine as shown below:** .CS* (*trapVarBindsRtn) (pPkt, pCookie)* .CE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -