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

📄 v3mt_con.c

📁 wm PNE 3.3 source code, running at more than vxworks6.x version.
💻 C
字号:
/* *  Copyright 2000-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. *//* *  Copyright 1998 Integrated Systems, Inc. *  All rights reserved. *//* * $Log: v3mt_con.c,v $ * Revision 1.2  2001/11/06 21:20:33  josh * revised new path hacking * * Revision 1.1.1.1  2001/11/05 17:47:40  tneale * Tornado shuffle * * Revision 9.2  2001/01/19 22:22:00  paul * Update copyright. * * Revision 9.1  2000/03/17 00:17:48  meister * Update copyright message * * Revision 9.0  1998/10/16 22:09:57  sar * Update version stamp to match release * * Revision 1.7  1998/09/04 15:11:07  sar * Added some casts to try and keep the msc compiler happy and not * complaining about signed/unsigned mismatches. * * Revision 1.6  1998/07/20 02:09:06  sar * If we have an exact match when doing a next step to the next * entry. * * Revision 1.5  1998/06/19 20:18:57  sar * Make all files include asn1conf.h and snmp.h to make sure we get the * common code * * Revision 1.4  1998/06/09 16:43:55  sar * Moved some context routines to snmp so that they are in the core code * and can be used by the rest of the core.  Also renamed the routines * to keep them separate from usec. * * Revision 1.3  1998/05/30 03:07:33  sar * Updated names used for max lengths of strings for clarity * Update user_lookup * * Revision 1.2  1998/05/23 20:32:05  sar * Correct copyright statement * * Revision 1.1  1998/05/22 19:47:02  sar * Method routines for use with snmp v3 tables.  The tables are: * access, group, context, user and views. * *//* [clearcase]modification history-------------------01b,18apr05,job  update copyright notices01a,24nov03,job  update copyright information*/#include <wrn/wm/snmp/engine/asn1.h>#include <wrn/wm/snmp/engine/snmp.h>#include <wrn/wm/snmp/engine/vbdefs.h>#include <wrn/wm/snmp/engine/snmpdefs.h>#include <wrn/wm/snmp/engine/v3_con.h>#include <wrn/wm/snmp/engine/auxfuncs.h>/****************************************************************************NAME: contexttable_getPURPOSE:  method routine to find a context objectPARAMETERS:	OIDC_T		Last component of the object id leading to			the leaf node in the MIB.  This is usually			the identifier for the particular attribute			in the table.	int		Number of components in the unused part of the			object identifier	OIDC_T *	Unused part of the object identifier	SNMP_PKT_T *	SNMP packet currently being processed.	VB_T *		Variable being processed.RETURNS: void****************************************************************************/void  contexttable_get(OIDC_T      lastmatch,		   int         tcount,		   OIDC_T     *tlist,		   SNMP_PKT_T *pktp,		   VB_T       *vbp){SNMP_CONTEXT_T *con = 0;bits8_t con_name[ETC_CONTEXT_MAX];ALENGTH_T con_len = ETC_CONTEXT_MAX;if ((oid_to_string(tcount, tlist, &con_len, con_name, 0) == 0) &&    ((bits32_t)con_len == (bits32_t)(tcount - 1)))    con = SNMP_V3_Context_Find(con_name, con_len);if (con == 0)    getproc_nosuchins(pktp, vbp);else    getproc_got_string(pktp, vbp, con->length, con->name, 0, VT_STRING);return;}/****************************************************************************NAME: contexttable_nextPURPOSE:  method routine to search out the next context and return	  its name.  This routine contains knowledge about how the	  context list is constructed, if list structure changes	  this routine will need to be updated.PARAMETERS:	OIDC_T		Last component of the object id leading to			the leaf node in the MIB.  This is usually			the identifier for the particular attribute			in the table.	int		Number of components in the unused part of the			object identifier	OIDC_T *	Unused part of the object identifier	SNMP_PKT_T *	SNMP packet currently being processed.	VB_T *		Variable being processed.RETURNS: void****************************************************************************/void  contexttable_next(OIDC_T      lastmatch,		    int         tcount,		    OIDC_T     *tlist,		    SNMP_PKT_T *pktp,		    VB_T       *vbp){SNMP_CONTEXT_T *con = 0;ALENGTH_T con_len, req_len;unsigned int i;if (tcount == 0) {    con = v3_context_root;    }else if (tlist[0] > ETC_CONTEXT_MAX) {    nextproc_no_next(pktp, vbp);    return;    }else {    req_len = (ALENGTH_T)(*tlist++);    tcount--;    con_len = (ALENGTH_T)(min((bits32_t)req_len, (bits32_t)tcount));    /* skip over any contexts that are shorter than what we want */    for (con = v3_context_root;	 con && (con->length < req_len);	 con = con->next)        ; /* no body for for loop */    for (; con && (con->length == req_len); con = con->next) {        for(i = 0; (i < con_len) && (con->name[i] == tlist[i]); i++)	    ; /* no body for for loop */	if (i == con_len) {	    if (con_len == req_len)	        con = con->next;	    break;	    }	if (con->name[i] > tlist[i])	    break;        }    }if (con == 0)    nextproc_no_next(pktp, vbp);else {    nextproc_next_instance_string(pktp, vbp, con->length, con->name, 0);    getproc_got_string(pktp, vbp, con->length, con->name, 0, VT_STRING);    }return;}

⌨️ 快捷键说明

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