Imported Upstream version 2.6.0
This commit is contained in:
parent
26fb71b504
commit
459aaf9392
510 changed files with 40508 additions and 18859 deletions
|
|
@ -3,7 +3,7 @@
|
|||
* Based on NET-SNMP API (Simple Network Management Protocol V1-2)
|
||||
*
|
||||
* Copyright (C)
|
||||
* 2002-2008 Arnaud Quette <arnaud.quette@free.fr>
|
||||
* 2002-2010 Arnaud Quette <arnaud.quette@free.fr>
|
||||
* 2002-2006 Dmitry Frolov <frolov@riss-telecom.ru>
|
||||
* J.W. Hoogervorst <jeroen@hoogervorst.net>
|
||||
* Niels Baggesen <niels@baggesen.net>
|
||||
|
|
@ -35,19 +35,19 @@ for each OID request we made), instead of sending many small packets
|
|||
- add support for registration and traps (manager mode),
|
||||
- complete mib2nut data (add all OID translation to NUT)
|
||||
- externalize mib2nut data in .m2n files and load at driver startup using parseconf()...
|
||||
- ... and use Net-SNMP lookup mecanism for OIDs (use string path, not numeric)
|
||||
- adjust information logging.
|
||||
|
||||
- move to numeric OIDs
|
||||
- move numeric OIDs into th mib2nut tables and remove defines
|
||||
- move mib2nut into c files (à la usbhid-ups)?
|
||||
- add a claim function and move to usbhid-ups style
|
||||
- add a claim function and move to usbhid-ups style for specific processing
|
||||
- rework the flagging system
|
||||
*/
|
||||
|
||||
#ifndef SNMP_UPS_H
|
||||
#define SNMP_UPS_H
|
||||
|
||||
/* workaround for buggy Net-SNMP config */
|
||||
/* FIXME: still needed?
|
||||
* workaround for buggy Net-SNMP config */
|
||||
#ifdef PACKAGE_BUGREPORT
|
||||
#undef PACKAGE_BUGREPORT
|
||||
#endif
|
||||
|
|
@ -143,28 +143,39 @@ typedef struct {
|
|||
#define SU_STATUS_INDEX(t) (((t) >> 8) & 7)
|
||||
|
||||
/* Phase specific data */
|
||||
#define SU_PHASES (0xF << 12)
|
||||
#define SU_PHASES (0x3F << 12)
|
||||
#define SU_INPHASES (0x3 << 12)
|
||||
#define SU_INPUT_1 (1 << 12) /* only if 1 input phase */
|
||||
#define SU_INPUT_3 (1 << 13) /* only if 3 input phases */
|
||||
#define SU_OUTPHASES (0x3 << 14)
|
||||
#define SU_OUTPUT_1 (1 << 14) /* only if 1 output phase */
|
||||
#define SU_OUTPUT_3 (1 << 15) /* only if 3 output phases */
|
||||
#define SU_BYPPHASES (0x3 << 16)
|
||||
#define SU_BYPASS_1 (1 << 16) /* only if 1 bypass phase */
|
||||
#define SU_BYPASS_3 (1 << 17) /* only if 3 bypass phases */
|
||||
/* FIXME: use input.phases and output.phases to replace this */
|
||||
|
||||
|
||||
/* hints for su_ups_set, applicable only to rw vars */
|
||||
#define SU_TYPE_INT (0 << 16) /* cast to int when setting value */
|
||||
#define SU_TYPE_STRING (1 << 16) /* cast to string. FIXME: redundant with ST_FLAG_STRING */
|
||||
#define SU_TYPE_TIME (2 << 16) /* cast to int */
|
||||
#define SU_TYPE_CMD (3 << 16) /* instant command */
|
||||
#define SU_TYPE(t) ((t)->flags & (7 << 16))
|
||||
#define SU_TYPE_INT (0 << 18) /* cast to int when setting value */
|
||||
#define SU_TYPE_STRING (1 << 18) /* cast to string. FIXME: redundant with ST_FLAG_STRING */
|
||||
#define SU_TYPE_TIME (2 << 18) /* cast to int */
|
||||
#define SU_TYPE_CMD (3 << 18) /* instant command */
|
||||
#define SU_TYPE(t) ((t)->flags & (7 << 18))
|
||||
|
||||
#define SU_VAR_COMMUNITY "community"
|
||||
#define SU_VAR_VERSION "snmp_version"
|
||||
#define SU_VAR_MIBS "mibs"
|
||||
#define SU_VAR_SDTYPE "sdtype"
|
||||
#define SU_VAR_POLLFREQ "pollfreq"
|
||||
#define SU_VAR_SDTYPE "sdtype"
|
||||
/* SNMP v3 related parameters */
|
||||
#define SU_VAR_SECLEVEL "secLevel"
|
||||
#define SU_VAR_SECNAME "secName"
|
||||
#define SU_VAR_AUTHPASSWD "authPassword"
|
||||
#define SU_VAR_PRIVPASSWD "privPassword"
|
||||
#define SU_VAR_AUTHPROT "authProtocol"
|
||||
#define SU_VAR_PRIVPROT "privProtocol"
|
||||
|
||||
|
||||
#define SU_INFOSIZE 128
|
||||
#define SU_BUFSIZE 32
|
||||
|
|
@ -191,8 +202,7 @@ typedef struct {
|
|||
} mib2nut_info_t;
|
||||
|
||||
/* Common SNMP functions */
|
||||
void nut_snmp_init(const char *type, const char *host, const char *version,
|
||||
const char *community);
|
||||
void nut_snmp_init(const char *type, const char *hostname);
|
||||
void nut_snmp_cleanup(void);
|
||||
struct snmp_pdu *nut_snmp_get(const char *OID);
|
||||
bool_t nut_snmp_get_str(const char *OID, char *buf, size_t buf_len,
|
||||
|
|
@ -230,7 +240,7 @@ struct snmp_session g_snmp_sess, *g_snmp_sess_p;
|
|||
const char *OID_pwr_status;
|
||||
int g_pwr_battery;
|
||||
int pollfreq; /* polling frequency */
|
||||
int input_phases, output_phases;
|
||||
extern int input_phases, output_phases, bypass_phases;
|
||||
|
||||
#endif /* SNMP_UPS_H */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue