9 /* public functions & variables from main.c */
10 extern const char *progname
, *upsname
, *device_name
;
11 extern char *device_path
;
12 extern int upsfd
, extrafd
, broken_driver
, experimental_driver
, do_lock_port
, exit_flag
;
13 extern unsigned int poll_interval
;
15 /* functions & variables required in each driver */
16 void upsdrv_initups(void); /* open connection to UPS, fail if not found */
17 void upsdrv_initinfo(void); /* prep data, settings for UPS monitoring */
18 void upsdrv_updateinfo(void); /* update state data if possible */
19 void upsdrv_shutdown(void); /* make the UPS power off the load */
20 void upsdrv_help(void); /* tack on anything useful for the -h text */
21 void upsdrv_banner(void); /* print your version information */
22 void upsdrv_cleanup(void); /* free any resources before shutdown */
24 /* --- details for the variable/value sharing --- */
26 /* main calls this driver function - it needs to call addvar */
27 void upsdrv_makevartable(void);
29 /* retrieve the value of variable <var> if possible */
30 char *getval(const char *var
);
32 /* see if <var> has been defined, even if no value has been given to it */
33 int testvar(const char *var
);
35 /* extended variable table - used for -x defines/flags */
36 typedef struct vartab_s
{
37 int vartype
; /* VAR_* value, below */
38 char *var
; /* left side of =, or whole word if none */
39 char *val
; /* right side of = */
40 char *desc
; /* 40 character description for -h text */
41 int found
; /* set once encountered, for testvar() */
42 struct vartab_s
*next
;
45 /* flags to define types in the vartab */
47 #define VAR_FLAG 0x0001 /* argument is a flag (no value needed) */
48 #define VAR_VALUE 0x0002 /* argument requires a value setting */
49 #define VAR_SENSITIVE 0x0004 /* do not publish in driver.parameter */
51 /* callback from driver - create the table for future -x entries */
52 void addvar(int vartype
, const char *name
, const char *desc
);
54 /* subdriver description structure */
55 typedef struct upsdrv_info_s
{
56 const char *name
; /* driver full name, for banner printing, ... */
57 const char *version
; /* driver version */
58 const char *authors
; /* authors name */
59 const int status
; /* driver development status */
60 struct upsdrv_info_s
*subdrv_info
[2]; /* sub driver information */
63 /* flags to define the driver development status */
64 #define DRV_BROKEN 0x0001 /* dito... */
65 #define DRV_EXPERIMENTAL 0x0002 /* dito... */
66 #define DRV_BETA 0x0004 /* more stable and complete, but still
67 * not suitable for production systems
69 #define DRV_STABLE 0x0008 /* suitable for production systems, but
70 * not 100 % feature complete */
71 #define DRV_COMPLETE 0x0010 /* gold level: implies 100 % of the
72 * protocol implemented and the full QA
74 /* FIXME: complete with mfr support, and other interesting info */
76 /* public driver information from the driver file */
77 extern upsdrv_info_t upsdrv_info
;