nut-debian/docs/man/upscli_connect.txt

54 lines
1.6 KiB
Plaintext
Raw Normal View History

2011-01-26 11:35:08 +02:00
UPSCLI_CONNECT(3)
=================
NAME
----
upscli_connect - Open a connection to a NUT upsd
SYNOPSIS
--------
#include <upsclient.h>
2022-07-10 10:23:45 +03:00
int upscli_connect(UPSCONN_t *ups, const char *host, uint16_t port, int flags);
2011-01-26 11:35:08 +02:00
DESCRIPTION
-----------
2022-07-10 10:23:45 +03:00
2011-01-26 11:35:08 +02:00
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
2022-07-10 10:23:45 +03:00
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.
2011-01-26 11:35:08 +02:00
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
--------
2022-07-10 10:23:45 +03:00
linkman:upscli_disconnect[3], linkman:upscli_fd[3],
linkman:upscli_splitaddr[3], linkman:upscli_splitname[3],
linkman:upscli_ssl[3], linkman:upscli_strerror[3],
2011-01-26 11:35:08 +02:00
linkman:upscli_upserror[3]