File: upscli_connect.txt

package info (click to toggle)
nut 2.8.1-5
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 18,284 kB
  • sloc: ansic: 108,785; sh: 9,370; cpp: 3,370; makefile: 2,842; python: 1,029; perl: 763; xml: 47
file content (53 lines) | stat: -rw-r--r-- 1,609 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
UPSCLI_CONNECT(3)
=================

NAME
----

upscli_connect - Open a connection to a NUT upsd

SYNOPSIS
--------

 #include <upsclient.h>

 int upscli_connect(UPSCONN_t *ups, const char *host, uint16_t port, int flags);

DESCRIPTION
-----------

The *upscli_connect()* function takes the pointer 'ups' to a
`UPSCONN_t` state structure and opens a TCP connection to the 'host' on
the given 'port'.

'flags' may be either `UPSCLI_CONN_TRYSSL` to try a SSL
connection, or `UPSCLI_CONN_REQSSL` to require a SSL connection.

Introduced in version 2.7, an additional flag `UPSCLI_CONN_CERTVERIF`
now exists to verify the signature offered during the SSL handshake.
This flag should be used in conjunction with linkman:upscli_init[3]
and/or linkman:upscli_add_host_cert[3] calls before connecting in
order to define a CA certificate with which to verify.

If SSL mode is required, this function will only return successfully if
it is able to establish a SSL connection with the server.  Possible
reasons for failure include no SSL support on the server, and if
*upsclient* itself hasn't been compiled with SSL support.

You must call linkman:upscli_disconnect[3] when finished with a
connection, or your program will slowly leak memory and file
descriptors.

RETURN VALUE
------------

The *upscli_connect()* function modifies the `UPSCONN_t` structure and
returns 0 on success, or -1 if an error occurs.

SEE ALSO
--------

linkman:upscli_disconnect[3], linkman:upscli_fd[3],
linkman:upscli_splitaddr[3], linkman:upscli_splitname[3],
linkman:upscli_ssl[3], linkman:upscli_strerror[3],
linkman:upscli_upserror[3]