Annotation of embedaddon/ntp/ntpsnmpd/ntpSnmpSubagentObject.h, revision 1.1.1.1
1.1 misho 1: /*****************************************************************************
2: *
3: * ntpSnmpSubAgentObject.h
4: *
5: * Definitions and macros for ntpSnmpSubAgentObject.c
6: *
7: ****************************************************************************/
8:
9:
10: #ifndef NTPSNMPSUBAGENTOBJECT_H
11: #define NTPSNMPSUBAGENTOBJECT_H
12:
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,
19: size_t valuesize);
20:
21: /* Initialization */
22: void init_ntpSnmpSubagentObject(void);
23:
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;
32:
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;
40:
41: #define NTPV4_OID 1,3,6,1,2,1,197 /* mib-2 197 */
42:
43:
44: /*
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.
48: */
49:
50: #define SETUP_OID_RO(oidname, ...) \
51: static oid oidname##_oid [] = { __VA_ARGS__ }; \
52: { \
53: netsnmp_register_read_only_instance( \
54: netsnmp_create_handler_registration( \
55: "#oidname", \
56: get_##oidname, \
57: oidname##_oid, \
58: OID_LENGTH \
59: ( oidname##_oid ), \
60: HANDLER_CAN_RONLY)); \
61: }
62:
63: #define SETUP_OID_RW(oidname, ...) \
64: static oid oidname##_oid [] = { __VA_ARGS__ }; \
65: { \
66: netsnmp_register_instance( \
67: 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: #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)
80:
81: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>