Patrick Welche <prlw1@cam.ac.uk>
[netbsd-mini2440.git] / external / bsd / ntp / dist / ntpsnmpd / ntpSnmpSubagentObject.h
blobea145b3ed7be0155f9d1bbfe3db8b13cc007bbb2
1 /* $NetBSD$ */
3 /*****************************************************************************
5 * ntpSnmpSubAgentObject.h
7 * Definitions and macros for ntpSnmpSubAgentObject.c
9 ****************************************************************************/
12 #ifndef NTPSNMPSUBAGENTOBJECT_H
13 #define NTPSNMPSUBAGENTOBJECT_H
15 /* Function Prototypes */
16 int ntpsnmpd_strip_string(char *string);
17 int ntpsnmpd_parse_string(char *src, char *field, int fieldsize, char *value, int valuesize);
18 int ntpsnmpd_cut_string(char *src, char *dest, const char delim, int fieldnumber, int maxsize);
19 unsigned int read_ntp_value(char *variable, char *rbuffer, unsigned int maxlength);
21 /* Initialization */
22 void init_ntpSnmpSubagentObject(void);
24 /* MIB Section 1 Callback Functions*/
25 Netsnmp_Node_Handler get_ntpEntSoftwareName;
26 Netsnmp_Node_Handler get_ntpEntSoftwareVersion;
27 Netsnmp_Node_Handler get_ntpEntSoftwareVersionVal;
28 Netsnmp_Node_Handler get_ntpEntSoftwareVendor;
29 Netsnmp_Node_Handler get_ntpEntSystemType;
30 Netsnmp_Node_Handler get_ntpEntTimeResolution;
31 Netsnmp_Node_Handler get_ntpEntTimeResolutionVal;
32 Netsnmp_Node_Handler get_ntpEntTimePrecision;
33 Netsnmp_Node_Handler get_ntpEntTimePrecisionVal;
34 Netsnmp_Node_Handler get_ntpEntTimeDistance;
36 /* MIB Section 2 Callback Functions (TODO) */
37 Netsnmp_Node_Handler get_ntpEntStatusCurrentMode;
38 Netsnmp_Node_Handler get_ntpEntStatusCurrentModeVal;
39 Netsnmp_Node_Handler get_ntpEntStatusStratum;
40 Netsnmp_Node_Handler get_ntpEntStatusActiveRefSourceId;
41 Netsnmp_Node_Handler get_ntpEntStatusActiveRefSourceName;
42 Netsnmp_Node_Handler get_ntpEntStatusActiveOffset;
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
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
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)); \
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)); \
77 #endif