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

INITIALIZATION AND CLEANUP

21       Before creating any connection, and in general using any upscli
22       function, you must call upscli_init(3) with proper parameters to
23       initialize upscli module.
24
25       To register specific host security policy, you must call
26       upscli_add_host_cert(3) before initialize connection to it.
27
28       In the same way, just before exiting, and after all upscli usage, you
29       must call upscli_cleanup(3) to flush cache files and perform other
30       cleanup.
31

NETWORK FUNCTIONS

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

ERROR HANDLING

54       In the event of an error, upscli_strerror(3) will provide
55       human-readable details on what happened. upscli_upserror(3) may also be
56       used to retrieve the error number. These numbers are defined in
57       upsclient.h as UPSCLI_ERR_*.
58

SEE ALSO

60       libupsclient-config(1), upscli_init(3), upscli_cleanup(3),
61       upscli_add_host_cert(3), upscli_connect(3), upscli_disconnect(3),
62       upscli_fd(3), upscli_getvar(3), upscli_list_next(3),
63       upscli_list_start(3), upscli_readline(3), upscli_sendline(3),
64       upscli_splitaddr(3), upscli_splitname(3), upscli_ssl(3),
65       upscli_strerror(3), upscli_upserror(3)
66
67
68
69Network UPS Tools 2.8.0           04/26/2022                      UPSCLIENT(3)
Impressum