UNIX proxy communication.
More...
UNIX proxy communication.
int nc_proxy_unix_connect |
( |
const char * |
address, |
|
|
const char * |
username |
|
) |
| |
Connect to a server UNIX socket to act as a NETCONF proxy.
- Parameters
-
[in] | address | UNIX socket path to connect to. |
[in] | username | NETCONF username to use for UNIX authentication. |
- Returns
- Connected non-blocking file descriptor.
-
-1 on error.
int nc_proxy_read_msg |
( |
int |
fd, |
|
|
NC_PROT_VERSION |
version, |
|
|
int |
timeout_ms, |
|
|
char ** |
buf, |
|
|
uint32_t * |
buf_len |
|
) |
| |
Read a full chunked-framing message from a FD.
- Parameters
-
[in] | fd | File descriptor to read from. |
[in] | version | NETCONF version to use for message encapsulation. |
[in] | timeout_ms | Timeout for reading in milliseconds. Use negative value for blocking read, 0 for non-blocking read. |
[in,out] | buf | Buffer to write into, is enlarged as needed. |
[in,out] | buf_len | Length of buf . |
- Returns
- Number of message characters read (not counting metadata).
-
0 if no data were read before the timeout elapsed.
-
-1 on error.
int nc_proxy_write_msg |
( |
int |
fd, |
|
|
NC_PROT_VERSION |
version, |
|
|
const char * |
buf, |
|
|
uint32_t |
buf_len |
|
) |
| |
Write data encapsulated as a chunked-framing message to a FD.
Keeps writing until all the data are written or a fatal error is encountered.
- Parameters
-
[in] | fd | File descriptor to write to. |
[in] | version | NETCONF version to use for message encapsulation. |
[in] | buf | Buffer with the message to write. |
[in] | buf_len | Length of the message in buf . |
- Returns
- Number of message characters written (not counting metadata).
-
0 if no data were written before the timeout elapsed.
-
-1 on error.
int nc_proxy_unix_close |
( |
int |
fd | ) |
|
Close the UNIX proxy connection to a server.
- Parameters
-
[in] | fd | Connected UNIX socket file descriptor. |
- Returns
- 0 on success.
-
-1 on error.