# # Define types of data by mib type, and translate into needed C code. # # type: the label in question extracted from the mib. # asnType: the internal type #define we should use for this type. # variable: the name of the variable we're going to use. # variablePtr: How to get a pointer to the variable above (may be # the same, if variable is also a pointer) # cast: how to cast from a void * or a char * to a pointer of # your type. # writeInit: variable declaration # case: initialization of the variable to a bogus value. # # copy: copies the previous definition into the current one, # if most of it (or all of it) is the same. ############################################################################ type: OCTETSTR asnType: ASN_OCTET_STR variable: string variablePtr: string cast: char * writeInit: static unsigned char string[SPRINT_MAX_LEN]; case: *string = 0; case: *var_len = strlen(string); case: return (unsigned char *) string; ############################################################################ type: INTEGER asnType: ASN_INTEGER variable: long_ret variablePtr: &long_ret cast: long * writeInit: static long *long_ret; case: long_ret = 0; case: return (unsigned char *) &long_ret; ############################################################################ type: INTEGER32 copy: INTEGER ############################################################################ type: UNSIGNED32 asnType: ASN_UNSIGNED variable: ulong_ret variablePtr: &ulong_ret cast: unsigned long * writeInit: static unsigned long *ulong_ret; case: ulong_ret = 0; case: return (unsigned char *) &ulong_ret; ############################################################################ type: OBJECTID asnType: ASN_OBJECT_ID variable: objid variablePtr: objid cast: oid * writeInit: static oid *objid; case: objid[0] = 0; case: objid[1] = 0; case: *var_len = 2*sizeof(oid); case: return (unsigned char *) objid; ############################################################################ type: COUNTER64 asnType: ASN_COUNTER64 variable: c64 variablePtr: &c64 cast: struct counter64 * writeInit: struct counter64 *c64; case: c64.high = 0; case: c64.low = 0; case: *var_len = sizeof(c64); case: return (unsigned char *) &c64; ############################################################################ type: COUNTER copy: INTEGER delete: asnType asnType: ASN_COUNTER ############################################################################ type: NETADDR copy: ASN_OBJECT_ID ############################################################################ type: UINTEGER copy: INTEGER delete: asnType asnType: ASN_UINTEGER ############################################################################ type: IPADDR copy: OCTETSTR delete: asnType asnType: ASN_IPADDRESS ############################################################################ type: BITS copy: OCTETSTR ############################################################################ type: GAUGE copy: INTEGER delete: asnType asnType: ASN_GAUGE ############################################################################ type: OPAQUE copy: OCTETSTR delete: asnType asnType: ASN_OPAQUE ############################################################################ type: TICKS copy: INTEGER delete: asnType asnType: ASN_TIMETICKS