1UPSCLIENT(3)                      NUT Manual                      UPSCLIENT(3)
2
3
4

NAME

6       upsclient - Network UPS Tools client access library
7

DESCRIPTION

9       The Network UPS Tools (NUT) upsclient library provides a number of
10       useful functions for programs to use when communicating with upsd(8).
11       Many of the low-level socket and protocol details are handled
12       automatically when using this interface.
13
14       State is maintained across calls in an opaque structure called
15       UPSCONN_t. Callers are expected to create one per connection. These
16       will be provided to most of the upsclient functions. The format of this
17       structure is subject to change, and client programs must not reference
18       elements within it directly.
19

NETWORK FUNCTIONS

21       To create a new connection, use upscli_connect(3). This will also
22       initialize the UPSCONN_t structure. To verify that a connection has
23       been established later, upscli_fd(3) can be used to return the file
24       descriptor. Clients wishing to check for the presence and operation of
25       SSL on a connection may call upscli_ssl(3).
26
27       The majority of clients will use upscli_get(3) to retrieve single items
28       from the server. To retrieve a list, use upscli_list_start(3) to get it
29       started, then call upscli_list_next(3) for each element.
30
31       Raw lines of text may be sent to upsd(8) with upscli_sendline(3).
32       Reading raw lines is possible with upscli_readline(3). Client programs
33       are expected to format these lines according to the protocol, as no
34       checking will be performed before transmission.
35
36       At the end of a connection, you must call upsclient_disconnect(3) to
37       disconnect from upsd and release any dynamic memory associated with the
38       UPSCONN_t structure. Failure to call this function will result in
39       memory and file descriptor leaks in your program.
40

ERROR HANDLING

42       In the event of an error, upscli_strerror(3) will provide
43       human-readable details on what happened. upscli_upserror(3) may also be
44       used to retrieve the error number. These numbers are defined in
45       upsclient.h as UPSCLI_ERR_*.
46

SEE ALSO

48       libupsclient-config(1), upscli_connect(3), upscli_disconnect(3),
49       upscli_fd(3), upscli_getvar(3), upscli_list_next(3),
50       upscli_list_start(3), upscli_readline(3), upscli_sendline(3),
51       upscli_splitaddr(3), upscli_splitname(3), upscli_ssl(3),
52       upscli_strerror(3), upscli_upserror(3)
53
54
55
56Network UPS Tools                 09/15/2011                      UPSCLIENT(3)
Impressum