diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2014-12-02 09:01:21 +0000 |
---|---|---|
committer | <> | 2014-12-04 16:11:25 +0000 |
commit | bdab5265fcbf3f472545073a23f8999749a9f2b9 (patch) | |
tree | c6018dd03dea906f8f1fb5f105f05b71a7dc250a /ntpsnmpd/ntpSnmpSubagentObject.h | |
download | ntp-d4b7cd9723cce9561fa15f74b90b85a3a61b5ef8.tar.gz |
Imported from /home/lorry/working-area/delta_ntp/ntp-dev-4.2.7p482.tar.gz.ntp-dev-4.2.7p482
Diffstat (limited to 'ntpsnmpd/ntpSnmpSubagentObject.h')
-rw-r--r-- | ntpsnmpd/ntpSnmpSubagentObject.h | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/ntpsnmpd/ntpSnmpSubagentObject.h b/ntpsnmpd/ntpSnmpSubagentObject.h new file mode 100644 index 0000000..41d5ac9 --- /dev/null +++ b/ntpsnmpd/ntpSnmpSubagentObject.h @@ -0,0 +1,81 @@ +/***************************************************************************** + * + * ntpSnmpSubAgentObject.h + * + * Definitions and macros for ntpSnmpSubAgentObject.c + * + ****************************************************************************/ + + +#ifndef NTPSNMPSUBAGENTOBJECT_H +#define NTPSNMPSUBAGENTOBJECT_H + +/* Function Prototypes */ +size_t ntpsnmpd_parse_string(const char *string, char *field, size_t + fieldsize, char *value, size_t valuesize); +size_t ntpsnmpd_cut_string(const char *string, char *dest, char delim, + int fieldnumber, size_t maxsize); +size_t read_ntp_value(const char *variable, char *value, + size_t valuesize); + +/* Initialization */ +void init_ntpSnmpSubagentObject(void); + +/* MIB Section 1 Callback Functions*/ +Netsnmp_Node_Handler get_ntpEntSoftwareName; +Netsnmp_Node_Handler get_ntpEntSoftwareVersion; +Netsnmp_Node_Handler get_ntpEntSoftwareVendor; +Netsnmp_Node_Handler get_ntpEntSystemType; +Netsnmp_Node_Handler get_ntpEntTimeResolution; +Netsnmp_Node_Handler get_ntpEntTimePrecision; +Netsnmp_Node_Handler get_ntpEntTimeDistance; + +/* MIB Section 2 Callback Functions (TODO) */ +Netsnmp_Node_Handler get_ntpEntStatusCurrentMode; +Netsnmp_Node_Handler get_ntpEntStatusCurrentModeVal; +Netsnmp_Node_Handler get_ntpEntStatusStratum; +Netsnmp_Node_Handler get_ntpEntStatusActiveRefSourceId; +Netsnmp_Node_Handler get_ntpEntStatusActiveRefSourceName; +Netsnmp_Node_Handler get_ntpEntStatusActiveOffset; + +#define NTPV4_OID 1,3,6,1,2,1,197 /* mib-2 197 */ + + +/* + * The following macros simplify the registration of the callback + * functions and register the name and OID of either read-only (RO) or + * read-write (RW) functions. + */ + +#define SETUP_OID_RO(oidname, ...) \ +static oid oidname##_oid [] = { __VA_ARGS__ }; \ +{ \ + netsnmp_register_read_only_instance( \ + netsnmp_create_handler_registration( \ + "#oidname", \ + get_##oidname, \ + oidname##_oid, \ + OID_LENGTH \ + ( oidname##_oid ), \ + HANDLER_CAN_RONLY)); \ +} + +#define SETUP_OID_RW(oidname, ...) \ +static oid oidname##_oid [] = { __VA_ARGS__ }; \ +{ \ + netsnmp_register_instance( \ + netsnmp_create_handler_registration( \ + "#oidname", \ + do_##oidname, \ + oidname##_oid, \ + OID_LENGTH \ + ( oidname##_oid ), \ + HANDLER_CAN_RWRITE)); \ +} + +#define NTP_OID_RO(oidname, w, x, y, z) \ + SETUP_OID_RO(oidname, NTPV4_OID, w, x, y, z) +#define NTP_OID_RW(oidname, w, x, y, z) \ + SETUP_OID_RW(oidname, NTPV4_OID, w, x, y, z) + +#endif |