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

📄 v3mt_tgt.c

📁 wm PNE 3.3 source code, running at more than vxworks6.x version.
💻 C
📖 第 1 页 / 共 5 页
字号:
    }#endif /* #if INSTALL_ENVOY_SNMP_COEXISTENCE */else    return GEN_ERR;return NO_ERROR;}void  snmpTargetAddrEntry_get(OIDC_T      lastmatch,                          int         tcount,                          OIDC_T     *tlist,                          SNMP_PKT_T *pktp,                          VB_T       *vbp){SNMP_TARGET_ADDR_T *taddr = 0;bits8_t name[ETC_TARGET_ADDR_MAX];ALENGTH_T name_len = ETC_TARGET_ADDR_MAX;int error;/* find all the varbinds that share the same getproc and instance */group_by_getproc_and_instance(pktp, vbp, tcount, tlist);/* use the instance (tcount and tlist) to look up the entry in the * table.  */if ((oid_to_string(tcount, tlist, &name_len, name, 1) == 0)  &&    (name_len != 0))    taddr = SNMP_Target_Addr_Lookup(name, name_len);if (taddr == 0) {    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 = snmpTargetAddrEntry_get_value(vbp->vb_ml.ml_last_match, 						   pktp, vbp, taddr)) 	    != NO_ERROR)	    getproc_error(pktp, vbp, error);        }    }}void  snmpTargetAddrEntry_next(OIDC_T      lastmatch,                           int         tcount,                           OIDC_T     *tlist,                           SNMP_PKT_T *pktp,                           VB_T       *vbp){SNMP_TARGET_ADDR_T *taddr;OIDC_T best_inst[ETC_TARGET_ADDR_MAX];int error;/* find all the varbinds that share the same getproc and instance */group_by_getproc_and_instance(pktp, vbp, tcount, tlist);taddr = SNMP_Target_Addr_Next(tcount, tlist);if ((taddr) && ((error = string_to_oid(SNMP_Target_Addr_Get_Name_Len(taddr),				       SNMP_Target_Addr_Get_Name(taddr),				       ETC_TARGET_ADDR_MAX,				       best_inst, 1)) == 0)) {    for ( ; vbp ; vbp = vbp->vb_link ) {        if ((error = snmpTargetAddrEntry_get_value(vbp->vb_ml.ml_last_match, 						   pktp, vbp, taddr)) 	    == NO_ERROR)	    nextproc_next_instance(pktp, vbp, 				   SNMP_Target_Addr_Get_Name_Len(taddr),				   best_inst);	else	    nextproc_error(pktp, vbp, error);        }    }else /* there's no more in this table */    for ( ; vbp ; vbp = vbp->vb_link )        nextproc_no_next(pktp, vbp);}/****************************************************************************NAME: taddrtable_destroy_cleanupPURPOSE: Cleanup after a target_addr test (delete) succeeded but some         other test failed.  We merely call the DESTROY_BACKOUT macro         to allow the customer to restore any changed state.  Expects         the pointer to point to a VB_TPARAMETERS: 	ptr_t   A pointer to the vb that points to the target_addr		that we were going to delete, cast as a ptr_tRETURNS: Nothing****************************************************************************/static void   taddrtable_destroy_cleanup(ptr_t taddrptr){SNMP_V3_TADDR_DESTROY_BACKOUT(((VB_T *)taddrptr)->vb_priv, 0);}/****************************************************************************NAME: taddrtable_create_cleanupPURPOSE: Cleanup after a target_addr create test succeeded but some         other test failed.  As this is a create the state pointer         points to a structure that is installed, we need to deinstall         it, call the backout routine, and cleanup the state.	 Expects the pointer to point to a VB_TPARAMETERS: 	ptr_t   A pointer to the vb that points to the target_addr		that we were going to create, cast as a ptr_tRETURNS: Nothing****************************************************************************/static void  taddrtable_create_cleanup(ptr_t taddrptr){SNMP_TARGET_ADDR_T *taddr;taddr = (SNMP_TARGET_ADDR_T *)(((VB_T *)taddrptr)->vb_priv);SNMP_V3_TADDR_CREATE_BACKOUT(0, taddr);SNMP_Target_Addr_Deinstall(taddr);SNMP_Target_Addr_Destroy(taddr);}/****************************************************************************NAME: taddrtable_update_cleanupPURPOSE: Cleanup after a target_addr update test succeeded but some         other test failed.  As this is an update the state pointer         points to a structure that isn't installed.  The next pointer         of that structure points to the installed copy.  We call the         backout routine and cleanup the state.PARAMETERS: 	ptr_t   A pointer to the vb that points to the target_addr	        that contained the update information,		cast as a ptr_tRETURNS: Nothing****************************************************************************/static void  taddrtable_update_cleanup(ptr_t taddrptr){SNMP_TARGET_ADDR_T *taddr;taddr = (SNMP_TARGET_ADDR_T *)(((VB_T *)taddrptr)->vb_priv);SNMP_V3_TADDR_UPDATE_BACKOUT(taddr->next, taddr);SNMP_Target_Addr_Destroy(taddr);}/****************************************************************************NAME:  taddrtable_destroy_undoPURPOSE: This routine attempts to undo a previous destroy set.  It	  expects the old information to be pointed to by vb_priv and	  tries to reinstall it.  If we can't reinstall the	  target_addr we leave the cleanup routine alone in order to	  get the FINISHED macro to run.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 processsed.	VB_T	   *	Variable being processed.RETURNS:  void****************************************************************************//*ARGSUSED*/static void  taddrtable_destroy_undo(OIDC_T	 last_match,			  int		 tcount,			  OIDC_T	*tlist,			  SNMP_PKT_T 	*pktp,			  VB_T		*vbp){SNMP_TARGET_ADDR_T *taddr;bits8_t name[ETC_TARGET_ADDR_MAX];ALENGTH_T name_len = ETC_TARGET_ADDR_MAX;/* assume things will go well and mark the vbp as done */undoproc_good(pktp, vbp);/* get the name info, no need to check as it's already been validated */oid_to_string(tcount, tlist, &name_len, name, 1);/* find the state block we saved and then reset the vb_priv info   so we don't have any accidents later */taddr      = (SNMP_TARGET_ADDR_T *)vbp->vb_priv;vbp->vb_priv = 0;if (SNMP_Target_Addr_Install(taddr, name, name_len) == 0) {#if defined(SNMP_V3_TADDR_DESTROY_UNDO)    if (SNMP_V3_TADDR_DESTROY_UNDO(pktp, vbp, 0, taddr) == 0) {        vbp->vb_free_priv = 0;	return;        }    else        SNMP_Target_Addr_Deinstall(taddr);#else    vbp->vb_free_priv = 0;    return;#endif    }SNMP_Target_Addr_Destroy(taddr);undoproc_error(pktp, vbp, UNDO_FAILED);return;}/****************************************************************************NAME:  taddrtable_create_undoPURPOSE:  This routine attempts to undo a previous create set.  It expects	  the new information to be pointed to by vb_priv and tries	  to deinstall and destroy the entry.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 processsed.	VB_T	   *	Variable being processed.RETURNS:  void****************************************************************************//*ARGSUSED*/static void  taddrtable_create_undo(OIDC_T	 	 last_match,			 int		 tcount,			 OIDC_T		*tlist,			 SNMP_PKT_T 	*pktp,			 VB_T		*vbp){SNMP_TARGET_ADDR_T *taddr;/* assume things will go well */undoproc_good(pktp, vbp);/* find the state block we saved and then reset the vb_priv info   so we don't have any accidents later */taddr = (SNMP_TARGET_ADDR_T *)vbp->vb_priv;vbp->vb_priv	  = 0;vbp->vb_free_priv = 0;#if defined(SNMP_V3_TADDR_CREATE_UNDO)if (SNMP_V3_TADDR_CREATE_UNDO(pktp, vbp, taddr, 0)) {    undoproc_error(pktp, vbp, UNDO_FAILED);    return;    }#endifSNMP_Target_Addr_Deinstall(taddr);SNMP_Target_Addr_Destroy(taddr);return;}/****************************************************************************NAME:  taddrtable_update_undoPURPOSE:  This routine attempts to undo a previous update set.  It expects	  the struct pointed to by vb_priv to contain the old information	  and a pointer to the new (installed) struct.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 processsed.	VB_T	   *	Variable being processed.RETURNS:  void****************************************************************************//*ARGSUSED*/static void  taddrtable_update_undo(OIDC_T		 last_match,			 int		 tcount,			 OIDC_T		*tlist,			 SNMP_PKT_T 	*pktp,			 VB_T		*vbp){SNMP_TARGET_ADDR_T *cur_taddr, *sav_taddr;/* assume things will go well */undoproc_good(pktp, vbp);/* find the state block we saved and then reset the vb_priv info   so we don't have any accidents later */sav_taddr = (SNMP_TARGET_ADDR_T *)vbp->vb_priv;vbp->vb_priv	  = 0;vbp->vb_free_priv = 0;cur_taddr = sav_taddr->next;#if defined(SNMP_V3_TADDR_UPDATE_UNDO)if (SNMP_V3_TADDR_UPDATE_UNDO(pktp, vbp, cur_taddr, sav_taddr)) {    undoproc_error(pktp, vbp, UNDO_FAILED);    SNMP_Target_Addr_Destroy(sav_taddr);    return;    }#endif/* swap the info from saved target_addr back into current target_addr,   we only need to move strings if the names are different finally   free the saved block */if (oidcmp(SNMP_Target_Addr_Get_TDomain(cur_taddr)->num_components,	   SNMP_Target_Addr_Get_TDomain(cur_taddr)->component_list,	   SNMP_Target_Addr_Get_TDomain(sav_taddr)->num_components,	   SNMP_Target_Addr_Get_TDomain(sav_taddr)->component_list) == 0) {    Clean_Obj_ID(SNMP_Target_Addr_Get_TDomain(cur_taddr));    MEMCPY(SNMP_Target_Addr_Get_TDomain(cur_taddr),	   SNMP_Target_Addr_Get_TDomain(sav_taddr),	   sizeof(OBJ_ID_T));    SNMP_Target_Addr_Get_TDomain(sav_taddr)->component_list = 0;    }if (SNMP_Target_Addr_Get_TAddress(cur_taddr) !=    SNMP_Target_Addr_Get_TAddress(sav_taddr)) {    EBufferClean(&cur_taddr->taddress);    MEMCPY(&cur_taddr->taddress, &sav_taddr->taddress, sizeof(EBUFFER_T));    EBufferInitialize(&sav_taddr->taddress);    }if (SNMP_Target_Addr_Get_TMask(cur_taddr) !=    SNMP_Target_Addr_Get_TMask(sav_taddr)) {    EBufferClean(&cur_taddr->tmask);    MEMCPY(&cur_taddr->tmask, &sav_taddr->tmask, sizeof(EBUFFER_T));    EBufferInitialize(&sav_taddr->taddress);    }SNMP_Target_Addr_Set_Timeout(cur_taddr, 			     SNMP_Target_Addr_Get_Timeout(sav_taddr));SNMP_Target_Addr_Set_Retry_Count(cur_taddr,				 SNMP_Target_Addr_Get_Retry_Count(sav_taddr));SNMP_Target_Addr_Set_MMS(cur_taddr,			 SNMP_Target_Addr_Get_MMS(sav_taddr));if (SNMP_Target_Addr_Get_Tag_List(cur_taddr) !=    SNMP_Target_Addr_Get_Tag_List(sav_taddr)) {    EBufferClean(&cur_taddr->tag_list);    MEMCPY(&cur_taddr->tag_list, &sav_taddr->tag_list, sizeof(EBUFFER_T));    EBufferInitialize(&sav_taddr->tag_list);    }if (SNMP_Target_Addr_Get_Params(cur_taddr) !=    SNMP_Target_Addr_Get_Params(sav_taddr)) {    EBufferClean(&cur_taddr->params);    MEMCPY(&cur_taddr->params, &sav_taddr->params, sizeof(EBUFFER_T));    EBufferInitialize(&sav_taddr->params);    }SNMP_Target_Addr_Set_Status(cur_taddr, 			    SNMP_Target_Addr_Get_Status(sav_taddr));SNMP_Target_Addr_Set_Storage(cur_taddr, 			     SNMP_Target_Addr_Get_Storage(sav_taddr));

⌨️ 快捷键说明

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