ntpSnmpSubagentObject.h revision 1.1
1/* $NetBSD: ntpSnmpSubagentObject.h,v 1.1 2009/12/13 16:56:33 kardel Exp $ */ 2 3/***************************************************************************** 4 * 5 * ntpSnmpSubAgentObject.h 6 * 7 * Definitions and macros for ntpSnmpSubAgentObject.c 8 * 9 ****************************************************************************/ 10 11 12#ifndef NTPSNMPSUBAGENTOBJECT_H 13#define NTPSNMPSUBAGENTOBJECT_H 14 15/* Function Prototypes */ 16int ntpsnmpd_strip_string(char *string); 17int ntpsnmpd_parse_string(char *src, char *field, int fieldsize, char *value, int valuesize); 18int ntpsnmpd_cut_string(char *src, char *dest, const char delim, int fieldnumber, int maxsize); 19unsigned int read_ntp_value(char *variable, char *rbuffer, unsigned int maxlength); 20 21/* Initialization */ 22void init_ntpSnmpSubagentObject(void); 23 24/* MIB Section 1 Callback Functions*/ 25Netsnmp_Node_Handler get_ntpEntSoftwareName; 26Netsnmp_Node_Handler get_ntpEntSoftwareVersion; 27Netsnmp_Node_Handler get_ntpEntSoftwareVersionVal; 28Netsnmp_Node_Handler get_ntpEntSoftwareVendor; 29Netsnmp_Node_Handler get_ntpEntSystemType; 30Netsnmp_Node_Handler get_ntpEntTimeResolution; 31Netsnmp_Node_Handler get_ntpEntTimeResolutionVal; 32Netsnmp_Node_Handler get_ntpEntTimePrecision; 33Netsnmp_Node_Handler get_ntpEntTimePrecisionVal; 34Netsnmp_Node_Handler get_ntpEntTimeDistance; 35 36/* MIB Section 2 Callback Functions (TODO) */ 37Netsnmp_Node_Handler get_ntpEntStatusCurrentMode; 38Netsnmp_Node_Handler get_ntpEntStatusCurrentModeVal; 39Netsnmp_Node_Handler get_ntpEntStatusStratum; 40Netsnmp_Node_Handler get_ntpEntStatusActiveRefSourceId; 41Netsnmp_Node_Handler get_ntpEntStatusActiveRefSourceName; 42Netsnmp_Node_Handler get_ntpEntStatusActiveOffset; 43 44/* TODO: This needs to be changed as soon as the official OID has been registered with IANA */ 45#define NTPV4_OID 1,3,6,1,4,1,5597,99 46 47 48/* The following two macros simplify the registration of the callback functions 49 * and allow to easily specify the name and OID of either read-only (RO) or read-write (RW) functions 50 */ 51 52#define _SETUP_OID_RO( _oidname, ... ) \ 53 static oid _oidname##_oid [] = { __VA_ARGS__ }; \ 54 { \ 55 netsnmp_register_read_only_instance(netsnmp_create_handler_registration \ 56 ("#_oidname", \ 57 get_##_oidname, \ 58 _oidname##_oid, \ 59 OID_LENGTH \ 60 ( _oidname##_oid ), \ 61 HANDLER_CAN_RONLY)); \ 62 } 63 64#define _SETUP_OID_RW( _oidname, ... ) \ 65 static oid _oidname##_oid [] = { __VA_ARGS__ }; \ 66 { \ 67 netsnmp_register_instance(netsnmp_create_handler_registration \ 68 ("#_oidname", \ 69 do_##_oidname, \ 70 _oidname##_oid, \ 71 OID_LENGTH \ 72 ( _oidname##_oid ), \ 73 HANDLER_CAN_RWRITE)); \ 74 } 75 76 77#endif 78