1 /*****************************************************************************
3 * ntpSnmpSubAgentObject.h
5 * Definitions and macros for ntpSnmpSubAgentObject.c
7 ****************************************************************************/
10 #ifndef NTPSNMPSUBAGENTOBJECT_H
11 #define NTPSNMPSUBAGENTOBJECT_H
13 /* Function Prototypes */
14 size_t ntpsnmpd_parse_string(const char *string, char *field, size_t
15 fieldsize, char *value, size_t valuesize);
16 size_t ntpsnmpd_cut_string(const char *string, char *dest, char delim,
17 int fieldnumber, size_t maxsize);
18 size_t read_ntp_value(const char *variable, char *value,
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_ntpEntSoftwareVendor;
28 Netsnmp_Node_Handler get_ntpEntSystemType;
29 Netsnmp_Node_Handler get_ntpEntTimeResolution;
30 Netsnmp_Node_Handler get_ntpEntTimePrecision;
31 Netsnmp_Node_Handler get_ntpEntTimeDistance;
33 /* MIB Section 2 Callback Functions (TODO) */
34 Netsnmp_Node_Handler get_ntpEntStatusCurrentMode;
35 Netsnmp_Node_Handler get_ntpEntStatusCurrentModeVal;
36 Netsnmp_Node_Handler get_ntpEntStatusStratum;
37 Netsnmp_Node_Handler get_ntpEntStatusActiveRefSourceId;
38 Netsnmp_Node_Handler get_ntpEntStatusActiveRefSourceName;
39 Netsnmp_Node_Handler get_ntpEntStatusActiveOffset;
41 #define NTPV4_OID 1,3,6,1,2,1,197 /* mib-2 197 */
45 * The following macros simplify the registration of the callback
46 * functions and register the name and OID of either read-only (RO) or
47 * read-write (RW) functions.
50 #define SETUP_OID_RO(oidname, ...) \
51 static oid oidname##_oid [] = { __VA_ARGS__ }; \
53 netsnmp_register_read_only_instance( \
54 netsnmp_create_handler_registration( \
60 HANDLER_CAN_RONLY)); \
63 #define SETUP_OID_RW(oidname, ...) \
64 static oid oidname##_oid [] = { __VA_ARGS__ }; \
66 netsnmp_register_instance( \
67 netsnmp_create_handler_registration( \
73 HANDLER_CAN_RWRITE)); \
76 #define NTP_OID_RO(oidname, w, x, y, z) \
77 SETUP_OID_RO(oidname, NTPV4_OID, w, x, y, z)
78 #define NTP_OID_RW(oidname, w, x, y, z) \
79 SETUP_OID_RW(oidname, NTPV4_OID, w, x, y, z)