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

📄 ax_sa_cr.c

📁 wm PNE 3.3 source code, running at more than vxworks6.x version.
💻 C
📖 第 1 页 / 共 4 页
字号:
*     int               index, *     int               tcount, *     OIDC_T         *  tlist, *     bits8_t        *  ipp *     )* \ce** DESCRIPTION** This routine binds an IP address valued 'VarBind' into the list of an AgentX * packet structure created by envoy_ax_pkt_create_variables().** PARAMETERS* \is* \i <*ax_pkt>* Specify an AgentX packet.* \i <index>* Specify the zero-based index indicating which 'VarBind' entry to use.* \i <tcount>* Specify the component count of the object identifier of the 'VarBind' being * bound.* \i <*tlist>* Specify the components of the object identifier of the 'VarBind' being bound.* \i <*ipp>* Specify a pointer to a four-byte field containing the IP address to be bound * in network order.* \ie** RETURNS: If successful, this routine returns 0. Otherwise, it returns -1.** ERRNO: N/A** SEE ALSO: envoy_ax_bind_integer(), envoy_ax_bind_null(), * envoy_ax_bind_object_id(), envoy_ax_bind_string(), envoy_ax_bind_uint(), * envoy_ax_bind_uint_64(), envoy_ax_pkt_create_variables()*/int  envoy_ax_bind_ip_address(ENVOY_AX_PKT_T *ax_pkt,			   int             indx,			   int             tcount,			   OIDC_T         *tlist,			   bits8_t        *ipp){VB_T    *vbp;if ((vbp = ax_index_to_vbp(ax_pkt, indx)) == 0)    return -1;if (build_object_id(tcount, tlist, &(vbp->vb_obj_id)) == -1)    return -1;vbp->vb_data_flags_n_type = VT_IPADDRESS;       (void) MEMCPY((PTR_T)vbp->value_u.v_network_address, (PTR_T)ipp, 4);return 0;}/********************************************************************************* envoy_ax_bind_null - bind an NULL valued 'VarBind' into the list* SYNOPSIS** \cs* int envoy_ax_bind_null*     ( *     ENVOY_AX_PKT_T *  ax_pkt, *     int               index, *     int               tcount, *     OIDC_T         *  tlist*     )* \ce** DESCRIPTION** This routine binds an NULL valued 'VarBind' into the list of an AgentX packet * structure created by envoy_ax_pkt_create_variables().** PARAMETERS* \is* \i <*ax_pkt>* Specify an AgentX packet.* \i <index>* Specify the zero-based index indicating which 'VarBind' entry to use.* \i <tcount>* Specify the component count of the object identifier of the 'VarBind' being * bound.* \i <*tlist>* Specify the components of the object identifier of the 'VarBind' being bound.* \ie** RETURNS: If successful, this routine returns 0. Otherwise, it returns -1.** ERRNO: N/A** SEE ALSO: envoy_ax_bind_integer(), envoy_ax_bind_ip_address(), * envoy_ax_bind_object_id(), envoy_ax_bind_string(), envoy_ax_bind_uint(), * envoy_ax_bind_uint_64(), envoy_ax_pkt_create_variables()*/int  envoy_ax_bind_null(ENVOY_AX_PKT_T *ax_pkt,		     int             indx,		     int             tcount,		     OIDC_T         *tlist){VB_T    *vbp;if ((vbp = ax_index_to_vbp(ax_pkt, indx)) == 0)    return -1;if (build_object_id(tcount, tlist, &(vbp->vb_obj_id)) == -1)    return -1;vbp->vb_data_flags_n_type = VT_EMPTY;return 0;}/********************************************************************************* envoy_ax_bind_object_id - bind an object ID valued 'VarBind' into the list* SYNOPSIS** \cs* int envoy_ax_bind_object_id*     ( *     ENVOY_AX_PKT_T *  ax_pkt, *     int               index, *     int               tcount, *     OIDC_T         *  tlist, *     int               valc, *     OIDC_T         *  vall*     )* \ce** DESCRIPTION** This routine binds an object ID valued 'VarBind' into the list of an AgentX * packet structure created by envoy_ax_pkt_create_variables().** PARAMETERS* \is* \i <*ax_pkt>* Specify an AgentX packet.* \i <index>* Specify the zero-based index indicating which 'VarBind' entry to use.* \i <tcount>* Specify the component count of the object identifier of the 'VarBind' being * bound.* \i <*tlist>* Specify the components of the object identifier of the 'VarBind' being bound.* \i <valc>* Specify the component count of the value of the 'VarBind' being bound.* \i <*vall>* Specify the components of the value of the 'VarBind' being bound.* \ie** RETURNS: If successful, this routine returns 0. Otherwise, it returns -1.** ERRNO: N/A** SEE ALSO: envoy_ax_bind_integer(), envoy_ax_bind_ip_address(), * envoy_ax_bind_null(), envoy_ax_bind_string(), envoy_ax_bind_uint(), * envoy_ax_bind_uint_64(), envoy_ax_pkt_create_variables()*/int  envoy_ax_bind_object_id(ENVOY_AX_PKT_T *ax_pkt,			  int             indx,			  int             tcount,			  OIDC_T         *tlist,			  int             valc,			  OIDC_T         *vall){VB_T    *vbp;if ((vbp = ax_index_to_vbp(ax_pkt, indx)) == 0)    return -1;if (build_object_id(tcount, tlist, &(vbp->vb_obj_id)) == -1)    return -1;if (build_object_id(valc, vall, &(vbp->value_u.v_object)) == -1) {    Clean_Obj_ID(&(vbp->vb_obj_id));    return -1;    }vbp->vb_data_flags_n_type = VT_OBJECT;return 0;}/********************************************************************************* envoy_ax_bind_string - bind a string valued 'VarBind' into the list* SYNOPSIS** \cs* int envoy_ax_bind_string*     ( *     ENVOY_AX_PKT_T *  ax_pkt, *     int               index, *     int               tcount, *     OIDC_T         *  tlist, *     bits8_t           flags_n_type, *     int               leng, *     bits8_t        *  strp, *     int               statflg*     )* \ce** DESCRIPTION** This routine binds a string valued 'VarBind' into the list of an AgentX * packet structure created by envoy_ax_pkt_create_variables().** PARAMETERS* \is* \i <*ax_pkt>* Specify an AgentX packet.* \i <index>* Specify the zero-based index indicating which 'VarBind' entry to use.* \i <tcount>* Specify the component count of the object identifier of the 'VarBind' being * bound.* \i <*tlist>* Specify the components of the object identifier of the 'VarBind' being bound.* \i <flags_n_type>* Specify one of the 'VarBindType' constants 'VT_STRING' or 'VT_OPAQUE', which * are defined in the file 'vbdefs.h'.* \i <leng>* Specify the length of the string to be copied.* \i <*strp>* Specify the address of string to be bound.* \i <statflg>* Indicate whether to copy (0) the string, or use it in its current location * (1).* \ie** RETURNS: If successful, this routine returns 0. Otherwise, it returns -1.** ERRNO: N/A** SEE ALSO: envoy_ax_bind_integer(), envoy_ax_bind_ip_address(), * envoy_ax_bind_null(), envoy_ax_bind_object_id(), envoy_ax_bind_uint(), * envoy_ax_bind_uint_64(), envoy_ax_pkt_create_variables()*/int  envoy_ax_bind_string(ENVOY_AX_PKT_T *ax_pkt,		       int             indx,		       int             tcount,		       OIDC_T         *tlist,		       bits8_t         flags_n_type,		       int             leng,		       bits8_t        *strp,		       int             statflg){VB_T    *vbp;OCTET_T *buffp;if ((vbp = ax_index_to_vbp(ax_pkt, indx)) == 0)    return -1;if (build_object_id(tcount, tlist, &(vbp->vb_obj_id)) == -1)    return -1;if ((statflg == 0) && (leng != 0)){    if ((buffp = (bits8_t *)SNMP_memory_alloc((unsigned int)leng)) == 0) {        Clean_Obj_ID(&(vbp->vb_obj_id));        return -1;        }    (void) MEMCPY((PTR_T)buffp, (PTR_T)strp,                  (unsigned int)leng); /* Length known to be != zero */    EBufferPreLoad(BFL_IS_DYNAMIC, &(vbp->value_u.v_string), buffp, leng);    } else { /* Buffer is either static or has zero length */    EBufferPreLoad(BFL_IS_STATIC, &(vbp->value_u.v_string),                   leng != 0 ? strp : 0, leng);    }vbp->vb_data_flags_n_type = flags_n_type;return 0;}/********************************************************************************* envoy_ax_bind_uint_64 - bind a 64-bit counter valued 'VarBind' into the list* SYNOPSIS** \cs* int envoy_ax_bind_uint_64*     ( *     ENVOY_AX_PKT_T *  ax_pkt, *     int               index, *     int               tcount, *     OIDC_T         *  tlist, *     bits8_t           flags_n_type, *     bits32_t          high, *     bits32_t          low *     )* \ce** DESCRIPTION** This routine binds a 64-bit counter valued 'VarBind' into the list of an * AgentX packet structure created by envoy_ax_pkt_create_variables().** PARAMETERS* \is* \i <*ax_pkt>* Specify an AgentX packet.* \i <index>* Specify the zero-based index indicating which 'VarBind' entry to use.* \i <tcount>* Specify the component count of the object identifier of the 'VarBind' being * bound.* \i <*tlist>* Specify the components of the object identifier of the 'VarBind' being bound.* \i <flags_n_type>* Specify the 'VarBindType' constant 'VT_COUNTER64', which is defined in the * file 'vbdefs.h'.* \i <high>* Specify the high 32-bit quantity of the 64-bit counter.* \i <low>* Specify the low 32-bit quantity of the 64-bit counter.* \ie** RETURNS: If successful, this routine returns 0. Otherwise, it returns -1.** ERRNO: N/A** SEE ALSO: envoy_ax_bind_integer(), envoy_ax_bind_ip_address(), * envoy_ax_bind_null(), envoy_ax_bind_object_id(), envoy_ax_bind_string(), * envoy_ax_bind_uint(), envoy_ax_pkt_create_variables()*/int  envoy_ax_bind_uint_64(ENVOY_AX_PKT_T *ax_pkt,			int             indx,			int             tcount,			OIDC_T         *tlist,			bits8_t         flags_n_type,			bits32_t        high,			bits32_t        low){VB_T    *vbp;if (flags_n_type != VT_COUNTER64)    return (-1);if ((vbp = ax_index_to_vbp(ax_pkt, indx)) == 0)    return (-1);if (build_object_id(tcount, tlist, &(vbp->vb_obj_id)) == -1)    return (-1);vbp->vb_data_flags_n_type = flags_n_type;vbp->value_u.v_counter64.high = high;vbp->value_u.v_counter64.low = low;return 0;}/********************************************************************************* envoy_ax_bind_uint - bind a 32-bit unsigned valued 'VarBind' into the list* SYNOPSIS** \cs* int envoy_ax_bind_uint  *     ( *     ENVOY_AX_PKT_T *  ax_pkt, *     int               index, *     int               tcount, *     OIDC_T         *  tlist, *     bits8_t           flags_n_type, *     bits32_t          value *     )* \ce** DESCRIPTION** This routine binds a 32-bit unsigned valued 'VarBind' into the list of an * AgentX packet structure created by envoy_ax_pkt_create_variables().** PARAMETERS* \is* \i <*ax_pkt>* Specify an AgentX packet.* \i <index>* Specify the zero-based index indicating which 'VarBind' entry to use.* \i <tcount>* Specify the component count of the object identifier of the 'VarBind' being * bound.* \i <*tlist>* Specify the components of the object identifier of the 'VarBind' being bound.* \i <flags_n_type>* Specify one of the 'VarBindType' constants 'VT_COUNTER', 'VT_GAUGE', or * 'VT_TIMETICKS', which are defined in the file 'vbdefs.h'.* \i <leng>* Specify the length of the string to be copied.* \i <value>* Specify the unsigned integer value to be bound.* \ie** RETURNS: If successful, this routine returns 0. Otherwise, it returns -1.** ERRNO: N/A** SEE ALSO: envoy_ax_bind_integer(), envoy_ax_bind_ip_address(), * envoy_ax_bind_null(), envoy_ax_bind_object_id(), envoy_ax_bind_string(), * envoy_ax_bind_uint_64(), envoy_ax_pkt_create_variables()*/int  envoy_ax_bind_uint(ENVOY_AX_PKT_T *ax_pkt,		     int             indx,		     int             tcount,		     OIDC_T         *tlist,		     bits8_t         flags_n_type,		     bits32_t        value){VB_T    *vbp;if (!((flags_n_type == VT_COUNTER) || (flags_n_type == VT_GAUGE) ||       (flags_n_type == VT_TIMETICKS)))    return -1;if ((vbp = ax_index_to_vbp(ax_pkt, indx)) == 0)    return -1;if (build_object_id(tcount, tlist, &(vbp->vb_obj_id)) == -1)    return -1;vbp->vb_data_flags_n_type = flags_n_type;vbp->value_u.v_counter = value;return 0;}

⌨️ 快捷键说明

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