~ubuntu-branches/ubuntu/saucy/nut/saucy

« back to all changes in this revision

Viewing changes to drivers/dstate.h

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2005-07-20 19:48:50 UTC
  • mto: (16.1.1 squeeze)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20050720194850-oo61wjr33rrx2mre
Tags: upstream-2.0.2
ImportĀ upstreamĀ versionĀ 2.0.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#ifndef DSTATE_H_SEEN
21
21
#define DSTATE_H_SEEN 1
22
22
 
 
23
#include "attribute.h"
 
24
 
23
25
#include "parseconf.h"
 
26
#include "upshandler.h"
24
27
 
25
28
#define DS_LISTEN_BACKLOG 16
26
29
#define DS_MAX_READ 256         /* don't read forever from upsd */
27
30
 
 
31
/* return values for instcmd and set calls */
 
32
 
 
33
#define STAT_INSTCMD_HANDLED    0x0001          /* all we do for now */
 
34
#define STAT_INSTCMD_UNKNOWN    0x0002
 
35
/* FUTURE: add details: pass/fail, etc */
 
36
 
 
37
#define STAT_SET_HANDLED        0x0010
 
38
#define STAT_SET_UNKNOWN        0x0011
 
39
/* FUTURE: same */ 
 
40
 
28
41
/* track client connections */
29
42
struct conn_t {
30
43
        int     fd;
32
45
        void    *next;
33
46
};
34
47
 
 
48
        extern  struct  ups_handler     upsh;
 
49
 
35
50
void dstate_init(const char *prog, const char *port);
36
 
void dstate_poll_fds(int interval);
37
 
int dstate_setinfo(const char *var, const char *fmt, ...);
38
 
int dstate_addenum(const char *var, const char *fmt, ...);
 
51
int dstate_poll_fds(int interval, int extrafd);
 
52
int dstate_setinfo(const char *var, const char *fmt, ...)
 
53
        __attribute__ ((__format__ (__printf__, 2, 3)));
 
54
int dstate_addenum(const char *var, const char *fmt, ...)
 
55
        __attribute__ ((__format__ (__printf__, 2, 3)));
39
56
void dstate_setflags(const char *var, int flags);
40
57
void dstate_setaux(const char *var, int aux);
41
58
const char *dstate_getinfo(const char *var);
50
67
void dstate_dataok(void);
51
68
void dstate_datastale(void);
52
69
 
 
70
int dstate_is_stale(void);
 
71
 
 
72
/* clean out the temp space for a new pass */
 
73
void status_init(void);
 
74
 
 
75
/* add a status element */
 
76
void status_set(const char *buf);
 
77
 
 
78
/* write the temporary status_buf into ups.status */
 
79
void status_commit(void);
 
80
 
 
81
/* similar functions for ups.alarm */
 
82
void alarm_init(void);
 
83
void alarm_set(const char *buf);
 
84
void alarm_commit(void);
 
85
 
53
86
#endif  /* DSTATE_H_SEEN */