libnetconf2  4.0.2
NETCONF server and client library in C.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
UNIX Proxy

UNIX proxy communication. More...

Functions

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. More...
 
int nc_proxy_unix_close (int fd)
 Close the UNIX proxy connection to a server. More...
 
int nc_proxy_unix_connect (const char *address, const char *username)
 Connect to a server UNIX socket to act as a NETCONF proxy. More...
 
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. More...
 

Detailed Description

UNIX proxy communication.

Function Documentation

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]addressUNIX socket path to connect to.
[in]usernameNETCONF 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.

Set version according to the current NETCONF specification. That will almost always result in using NETCONF 1.0 encapsulation for the hello message (first exchanged message) and NETCONF 1.1 for all the following messages (as long as the server supports this NETCONF version).

Parameters
[in]fdFile descriptor to read from.
[in]versionNETCONF version to use for message encapsulation.
[in]timeout_msTimeout for reading in milliseconds. Use negative value for blocking read, 0 for non-blocking read.
[in,out]bufBuffer to write into, is enlarged as needed.
[in,out]buf_lenLength 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.

Set version based on the information for nc_proxy_read_msg().

Parameters
[in]fdFile descriptor to write to.
[in]versionNETCONF version to use for message encapsulation.
[in]bufBuffer with the message to write.
[in]buf_lenLength 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]fdConnected UNIX socket file descriptor.
Returns
0 on success.
-1 on error.