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

📄 v3_ntfy.c

📁 wm PNE 3.3 source code, running at more than vxworks6.x version.
💻 C
📖 第 1 页 / 共 4 页
字号:
* SNMP_Notify_Destroy(), SNMP_Notify_Lookup(), SNMP_Notify_Name(), * SNMP_Notify_Next_Notify(), SNMP Notify Table Field Routines*/int  SNMP_Notify_Install(SNMP_NOTIFY_T *in_notify,		      bits8_t       *notify_name,		      ALENGTH_T      notify_name_len){SNMP_NOTIFY_T **notify;/* see if the naming information is reasonable */if ((notify_name_len == 0) || (notify_name_len > ETC_NOTIFY_MAX))    return(-1);/* see if the notify already exists */notify = notify_find_before(notify_name, notify_name_len);if (*notify &&    (EBufferUsed(&((*notify)->notify_name)) == notify_name_len) &&    (MEMCMP(EBufferStart(&((*notify)->notify_name)), 	    notify_name, 	    notify_name_len) == 0))    return(-1);/* allocate space for the name */EBufferAllocateLoad(BFL_IS_ALLOC, 		    &(in_notify->notify_name), 		    notify_name, 		    notify_name_len);if (EBufferUsed(&(in_notify->notify_name)) == 0)    return(-1);/* insert the notify into the list */in_notify->next = *notify;*notify = in_notify;return(0);}/********************************************************************************* SNMP_Notify_Deinstall - remove the specified notify entry from the notify table* SYNOPSIS** \cs* void SNMP_Notify_Deinstall*     (*     SNMP_NOTIFY_T *  notify *     )* \ce** DESCRIPTION** This routine removes the specified notify entry from the notify table and * cleans up any resources that might have been used for indexing purposes.** Parameters:* \is* \i <*notify>* Specify the notify entry to remove from the notify table.* \ie** RETURNS: None.** ERRNO: N/A** SEE ALSO: SNMP_Notify_Create(), SNMP_Notify_Destroy(), SNMP_Notify_Install(), * SNMP_Notify_Lookup(), SNMP_Notify_Name(), SNMP_Notify_Next_Notify(), SNMP * Notify Table Field Routines*/void    SNMP_Notify_Deinstall(SNMP_NOTIFY_T *in_notify){SNMP_NOTIFY_T **notify;for(notify = &root_notify;     *notify;     notify = &(*notify)->next)    if (*notify == in_notify) {        *notify = in_notify->next;	EBufferClean(&(in_notify)->notify_name);	in_notify->next = 0;	return;        }return;}/********************************************************************************* SNMP_Notify_Name - extract the indexing information for the specified notify entry* SYNOPSIS** \cs* void SNMP_Notify_Name *     ( *     SNMP_NOTIFY_T *  notify,*     bits8_t       *  notify_name,*     ALENGTH_T     *  notify_name_len*     )* \ce** DESCRIPTION** This routine extracts the indexing information for the specified notify * entry. After this routine completes, check the values in the <notify_name> * and <notify_name_len> fields.** Parameters:* \is* \i <*notify>* Specify the notify entry from which to extract indexing information.* \i <*notify_name>* Specify the notify name, which corresponds to the MIB object * <snmpNotifyName>.* \i <*notify_name_len>* On input, specifies the amount of space available in <notify_name>. On * output, it is the amount of space required to hold the notify name. If * <notify_name> is long enough to hold the name then the name is copied to * <notify_name>.* \ie** RETURNS: None.** ERRNO: N/A** SEE ALSO: SNMP_Notify_Create(), SNMP_Notify_Deinstall(), * SNMP_Notify_Destroy(), SNMP_Notify_Install(), SNMP_Notify_Lookup(), * SNMP_Notify_Next_Notify(), SNMP Notify Table Field Routines*/void  SNMP_Notify_Name(SNMP_NOTIFY_T *notify,		   bits8_t       *notify_name,		   ALENGTH_T     *notify_name_len){if (EBufferUsed(&(notify->notify_name)) &&     (*notify_name_len >= EBufferUsed(&(notify->notify_name)))) {    MEMCPY(notify_name, 	   EBufferStart(&(notify->notify_name)), 	   EBufferUsed(&(notify->notify_name)));    }*notify_name_len = EBufferUsed(&(notify->notify_name));return;}/****************************************************************************\NOMANUALNAME:    notify filter profile listPURPOSE: This is the list of notify_filter_profile objects that we         know about.  It is ordered by params name (from the         snmpTargetParamsTable), the same as the indexing for the mib.****************************************************************************//****************************************************************************NAME: notify_profile_find_beforePURPOSE: Search through the list until we find the         notify_filter_profile structure we are looking for.  We         return a pointer to the pointer that would point to the         requested notify_filter_profile if it were to exist.  The         calling routine is responsible for determining if the         requested notify_filter_profile exists.  This construction         allows us to reuse this code for all of the find routines         (lookup and install).PARAMETERS: bits8_t   * pointer to name buffer	    ALENGTH_T   number of bytes in name	    ALENGTH_T   length of requested name from object idRETURNS: SNMP_NOTIFY_FILTER_PROFILE_T ** pointer to pointer that would		                 point to the notify_filter_profile if		                 it were to exist.****************************************************************************/static SNMP_NOTIFY_FILTER_PROFILE_T **  notify_profile_find_before(bits8_t   *params_name,			     ALENGTH_T  params_name_len){SNMP_NOTIFY_FILTER_PROFILE_T **notify_profile;ALENGTH_T                      min_name_len;int                            compare;for(notify_profile = &root_notify_filter_profile;     *notify_profile;     notify_profile = &(*notify_profile)->next) {    min_name_len = min(params_name_len, 		       EBufferUsed(&((*notify_profile)->params_name)));    if ((compare = MEMCMP(EBufferStart(&((*notify_profile)->params_name)), 			  params_name,			  min_name_len)) >= 0) {        if (compare)	    break;        else if (min_name_len < params_name_len)	    continue;	break;        }    }return(notify_profile);}/********************************************************************************* SNMP_Notify_Profile_Lookup - find a notify filter profile entry matching the indices* SYNOPSIS** \cs* SNMP_NOTIFY_FILTER_PROFILE_T * SNMP_Notify_Profile_Lookup *     (*     bits8_t   *  params_name,*     ALENGTH_T    params_name_len*     )* \ce** DESCRIPTION** This routine finds a notify filter profile entry matching the specified * indices.** Parameters:* \is* \i <*params_name>* Specify the name of the parameter from the <snmpTargetParamsTable>.* \i <params_name_len>* Specify the length in bytes of the parameter name.* \ie** RETURNS: If successful, this routine returns a pointer to the entry. * Otherwise, it returns 0.** ERRNO: N/A** SEE ALSO: SNMP_Notify_Profile_Create(), SNMP_Notify_Profile_Deinstall(), * SNMP_Notify_Profile_Destroy(), SNMP_Notify_Profile_Install(), * SNMP_Notify_Profile_Name(), SNMP_Notify_Profile_Next_Profile(), SNMP Notify * Filter Profile Table Field Routines*/SNMP_NOTIFY_FILTER_PROFILE_T *  SNMP_Notify_Profile_Lookup(bits8_t   *params_name,			     ALENGTH_T  params_name_len){SNMP_NOTIFY_FILTER_PROFILE_T **notify_profile;notify_profile = notify_profile_find_before(params_name, params_name_len);if (*notify_profile &&     (params_name_len == EBufferUsed(&((*notify_profile)->params_name))) &&    (MEMCMP(EBufferStart(&((*notify_profile)->params_name)), 	    params_name,	    params_name_len) == 0))  return(*notify_profile);return(0);}/****************************************************************************\NOMANUALNAME: SNMP_Notify_Profile_NextPURPOSE: Find the next notify_filter_profile after the named one.	the indexing information is of the form:	<params_name>	but as this is a next we might not have all of it...PARAMETERS: 	 int	 tcount number of subids	 OIDC_T *tlist  list of subids	 RETURNS: SNMP_NOTIFY_FILTER_PROFILE_T * pointer to                                        notify_filter_profile or 0 if                                        none found****************************************************************************/SNMP_NOTIFY_FILTER_PROFILE_T *  SNMP_Notify_Profile_Next(int     tcount,			   OIDC_T *tlist){SNMP_NOTIFY_FILTER_PROFILE_T *notify_profile;bits8_t *params_name;OIDC_T min_name_len = 0, *temp_oid, len;if (tcount == 0)    return(root_notify_filter_profile);for (notify_profile = root_notify_filter_profile;     notify_profile;     notify_profile = notify_profile->next) {     params_name = EBufferStart(&(notify_profile)->params_name);     min_name_len = min(tcount, EBufferUsed(&(notify_profile->params_name)));     temp_oid = tlist;     for (len = min_name_len; 	  len && (*params_name == *temp_oid);	  len--, params_name++, temp_oid++)         ;     if (len) {         if (*params_name > *temp_oid)	     return(notify_profile);         }     else {         if (EBufferUsed(&(notify_profile->params_name)) > tcount)	     return(notify_profile);         }     }return(0);}/********************************************************************************* SNMP_Notify_Profile_Next_Profile() - find the next notify filter profile * entry in the table* SYNOPSIS** \cs* SNMP_NOTIFY_FILTER_PROFILE_T *  SNMP_Notify_Profile_Next_Profile *     (*     SNMP_NOTIFY_FILTER_PROFILE_T *  notify_profile*     )* \ce** DESCRIPTION** This routine finds the notify filter profile entry in the notify filter * profile table after the specified notify filter profile entry. Use this * routine to step through the notify filter profile table to find all installed * notify filter profiles.** Parameters:* \is* \i <*notify_profile>* Point to the notify filter profile entry.* \ie** RETURNS: If successful, this routine returns a pointer to the notify filter * profile. If there is no successor or the specified notify filter profile is * not installed, it returns 0. If the notify filter profile is specified as 0, * then it returns a pointer to the first notify filter profile entry in the * table.** ERRNO: N/A** SEE ALSO: SNMP_Notify_Profile_Create(), SNMP_Notify_Profile_Deinstall(), * SNMP_Notify_Profile_Destroy(), SNMP_Notify_Profile_Install(), * SNMP_Notify_Profile_Lookup(), SNMP_Notify_Profile_Name(), SNMP Notify Filter * Profile Table Field Routines*/SNMP_NOTIFY_FILTER_PROFILE_T *  SNMP_Notify_Profile_Next_Profile (SNMP_NOTIFY_FILTER_PROFILE_T *notify_profile){if (notify_profile)    return(notify_profile->next);return(root_notify_filter_profile);}/********************************************************************************* SNMP_Notify_Profile_Destroy - destroy a notify filter profile and frees resources* SYNOPSIS** \cs* void SNMP_Notify_Profile_Destroy *     (*     SNMP_NOTIFY_FILTER_PROFILE_T *  notify_profile*     )* \ce** DESCRIPTION** This routine destroys the specified notify filter profile entry, frees the * space for the entry, and frees the space for any resources the entry might * contain.** \&NOTE: If the specified notify filter profile entry has been installed, call * SNMP_Notify_Profile_Deinstall() before calling this routine.** Parameters:* \is* \i <*notify_profile>* Specify the notify filter profile entry to remove from the notify filter * profile table.* \ie** RETURNS: None.** ERRNO: N/A** SEE ALSO: SNMP_Notify_Profile_Create(), SNMP_Notify_Profile_Deinstall(), * SNMP_Notify_Profile_Install(), SNMP_Notify_Profile_Lookup(), * SNMP_Notify_Profile_Name(), SNMP_Notify_Profile_Next_Profile(), SNMP Notify * Filter Profile Table Field Routines*/void  SNMP_Notify_Profile_Destroy(SNMP_NOTIFY_FILTER_PROFILE_T *notify_profile){EBufferClean(&notify_profile->profile_name);SNMP_memory_free_lt(notify_profile);}/********************************************************************************* SNMP_Notify_Profile_Create - create a notify filter profile structure* SYNOPSIS** \cs* SNMP_NOTIFY_FILTER_PROFILE_T *  SNMP_Notify_Profile_Create*     (

⌨️ 快捷键说明

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