Skip to content

Commit 94d6140

Browse files
committed
doc UPDATE client context use clarification
1 parent 2d1e8d3 commit 94d6140

File tree

2 files changed

+39
-43
lines changed

2 files changed

+39
-43
lines changed

src/session_client.h

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,9 @@ void nc_client_destroy(void);
135135
*
136136
* @param[in] fdin Input file descriptor for reading (clear) data from NETCONF server.
137137
* @param[in] fdout Output file descriptor for writing (clear) data for NETCONF server.
138-
* @param[in] ctx Optional custom context to use for the session. Disregarding whether set or not, any YANG modules
139-
* not present and supported by the server are attempted to be loaded using \<get-schema\> (if supported) and/or by
140-
* searching the searchpath (see ::nc_client_set_schema_searchpath()).
138+
* @param[in,out] ctx Optional custom context to use for the session. If not set, a default context is created.
139+
* Any YANG modules not present in the context and supported by the server are loaded using \<get-schema\>
140+
* (if supported) and/or by searching the searchpath (see ::nc_client_set_schema_searchpath()).
141141
* @return Created NETCONF session object or NULL in case of error.
142142
*/
143143
struct nc_session *nc_connect_inout(int fdin, int fdout, struct ly_ctx *ctx);
@@ -150,9 +150,9 @@ struct nc_session *nc_connect_inout(int fdin, int fdout, struct ly_ctx *ctx);
150150
* by sending and processing NETCONF \<hello\> messages.
151151
*
152152
* @param[in] address Path to the unix socket.
153-
* @param[in] ctx Optional custom context to use for the session. Disregarding whether set or not, any YANG modules
154-
* not present and supported by the server are attempted to be loaded using \<get-schema\> (if supported) and/or by
155-
* searching the searchpath (see ::nc_client_set_schema_searchpath()).
153+
* @param[in,out] ctx Optional custom context to use for the session. If not set, a default context is created.
154+
* Any YANG modules not present in the context and supported by the server are loaded using \<get-schema\>
155+
* (if supported) and/or by searching the searchpath (see ::nc_client_set_schema_searchpath()).
156156
* @return Created NETCONF session object or NULL in case of error.
157157
*/
158158
struct nc_session *nc_connect_unix(const char *address, struct ly_ctx *ctx);
@@ -349,9 +349,9 @@ const char *nc_client_ssh_get_username(void);
349349
* @param[in] host Hostname or address (both Ipv4 and IPv6 are accepted) of the target server.
350350
* 'localhost' is used by default if NULL is specified.
351351
* @param[in] port Port number of the target server. Default value 830 is used if 0 is specified.
352-
* @param[in] ctx Optional custom context to use for the session. Disregarding whether set or not, any YANG modules
353-
* not present and supported by the server are attempted to be loaded using \<get-schema\> (if supported) and/or by
354-
* searching the searchpath (see ::nc_client_set_schema_searchpath()).
352+
* @param[in,out] ctx Optional custom context to use for the session. If not set, a default context is created.
353+
* Any YANG modules not present in the context and supported by the server are loaded using \<get-schema\>
354+
* (if supported) and/or by searching the searchpath (see ::nc_client_set_schema_searchpath()).
355355
* @return Created NETCONF session object or NULL on error.
356356
*/
357357
struct nc_session *nc_connect_ssh(const char *host, uint16_t port, struct ly_ctx *ctx);
@@ -366,9 +366,9 @@ struct nc_session *nc_connect_ssh(const char *host, uint16_t port, struct ly_ctx
366366
*
367367
* @param[in] ssh_session libssh structure representing SSH session object. It is fully managed by the created session
368368
* including freeing it.
369-
* @param[in] ctx Optional custom context to use for the session. Disregarding whether set or not, any YANG modules
370-
* not present and supported by the server are attempted to be loaded using \<get-schema\> (if supported) and/or by
371-
* searching the searchpath (see ::nc_client_set_schema_searchpath()).
369+
* @param[in,out] ctx Optional custom context to use for the session. If not set, a default context is created.
370+
* Any YANG modules not present in the context and supported by the server are loaded using \<get-schema\>
371+
* (if supported) and/or by searching the searchpath (see ::nc_client_set_schema_searchpath()).
372372
* @return Created NETCONF session object or NULL on error.
373373
*/
374374
struct nc_session *nc_connect_libssh(ssh_session ssh_session, struct ly_ctx *ctx);
@@ -378,9 +378,9 @@ struct nc_session *nc_connect_libssh(ssh_session ssh_session, struct ly_ctx *ctx
378378
*
379379
* @param[in] session Existing NETCONF session. The session has to be created on SSH transport layer using libssh -
380380
* it has to be created by nc_connect_ssh(), nc_connect_libssh() or nc_connect_ssh_channel().
381-
* @param[in] ctx Optional custom context to use for the session. Disregarding whether set or not, any YANG modules
382-
* not present and supported by the server are attempted to be loaded using \<get-schema\> (if supported) and/or by
383-
* searching the searchpath (see ::nc_client_set_schema_searchpath()).
381+
* @param[in,out] ctx Optional custom context to use for the session. If not set, a default context is created.
382+
* Any YANG modules not present in the context and supported by the server are loaded using \<get-schema\>
383+
* (if supported) and/or by searching the searchpath (see ::nc_client_set_schema_searchpath()).
384384
* @return Created NETCONF session object or NULL on error.
385385
*/
386386
struct nc_session *nc_connect_ssh_channel(struct nc_session *session, struct ly_ctx *ctx);
@@ -464,9 +464,9 @@ void nc_client_tls_get_crl_paths(const char **crl_file, const char **crl_dir);
464464
* @param[in] host Hostname or address (both Ipv4 and IPv6 are accepted) of the target server.
465465
* 'localhost' is used by default if NULL is specified. It is verified by TLS when connecting to it.
466466
* @param[in] port Port number of the target server. Default value 6513 is used if 0 is specified.
467-
* @param[in] ctx Optional custom context to use for the session. Disregarding whether set or not, any YANG modules
468-
* not present and supported by the server are attempted to be loaded using \<get-schema\> (if supported) and/or by
469-
* searching the searchpath (see ::nc_client_set_schema_searchpath()).
467+
* @param[in,out] ctx Optional custom context to use for the session. If not set, a default context is created.
468+
* Any YANG modules not present in the context and supported by the server are loaded using \<get-schema\>
469+
* (if supported) and/or by searching the searchpath (see ::nc_client_set_schema_searchpath()).
470470
* @return Created NETCONF session object or NULL on error.
471471
*/
472472
struct nc_session *nc_connect_tls(const char *host, uint16_t port, struct ly_ctx *ctx);
@@ -477,9 +477,9 @@ struct nc_session *nc_connect_tls(const char *host, uint16_t port, struct ly_ctx
477477
* The TLS session supplied is expected to be fully connected and authenticated!
478478
*
479479
* @param[in] tls libssl structure representing the TLS session object.
480-
* @param[in] ctx Optional custom context to use for the session. Disregarding whether set or not, any YANG modules
481-
* not present and supported by the server are attempted to be loaded using \<get-schema\> (if supported) and/or by
482-
* searching the searchpath (see ::nc_client_set_schema_searchpath()).
480+
* @param[in,out] ctx Optional custom context to use for the session. If not set, a default context is created.
481+
* Any YANG modules not present in the context and supported by the server are loaded using \<get-schema\>
482+
* (if supported) and/or by searching the searchpath (see ::nc_client_set_schema_searchpath()).
483483
* @return Created NETCONF session object or NULL on error.
484484
*/
485485
struct nc_session *nc_connect_libssl(SSL *tls, struct ly_ctx *ctx);

src/session_client_ch.h

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* @brief libnetconf2 Call Home session client manipulation
55
*
66
* @copyright
7-
* Copyright (c) 2015 - 2021 CESNET, z.s.p.o.
7+
* Copyright (c) 2015 - 2023 CESNET, z.s.p.o.
88
*
99
* This source code is licensed under BSD 3-Clause License (the "License").
1010
* You may not use this file except in compliance with the License.
@@ -44,8 +44,10 @@ extern "C" {
4444
* @brief Accept a Call Home connection on any of the listening binds.
4545
*
4646
* @param[in] timeout Timeout for receiving a new connection in milliseconds, 0 for
47-
* non-blocking call, -1 for infinite waiting.
48-
* @param[in] ctx Session context to use. Can be NULL.
47+
* non-blocking call, -1 for infinite waiting.
48+
* @param[in,out] ctx Optional custom context to use for the session. If not set, a default context is created.
49+
* Any YANG modules not present in the context and supported by the server are loaded using \<get-schema\>
50+
* (if supported) and/or by searching the searchpath (see ::nc_client_set_schema_searchpath()).
4951
* @param[out] session New session.
5052
* @return 1 on success, 0 on timeout, -1 on error.
5153
*/
@@ -73,7 +75,7 @@ int nc_accept_callhome(int timeout, struct ly_ctx *ctx, struct nc_session **sess
7375
* nc_client_ssh_ch_get_auth_hostkey_check_clb()).
7476
*
7577
* @param[in] auth_hostkey_check Function to call, returns 0 on success, non-zero in error.
76-
* If NULL, the default callback is set.
78+
* If NULL, the default callback is set.
7779
* @param[in] priv Optional private data to be passed to the callback function.
7880
*/
7981
void nc_client_ssh_ch_set_auth_hostkey_check_clb(int (*auth_hostkey_check)(const char *hostname, ssh_session session, void *priv),
@@ -97,7 +99,7 @@ void nc_client_ssh_ch_get_auth_hostkey_check_clb(int (**auth_hostkey_check)(cons
9799
* nc_client_ssh_ch_get_auth_password_clb()).
98100
*
99101
* @param[in] auth_password Function to call, returns the password for username\@hostname.
100-
* If NULL, the default callback is set.
102+
* If NULL, the default callback is set.
101103
* @param[in] priv Optional private data to be passed to the callback function.
102104
*/
103105
void nc_client_ssh_ch_set_auth_password_clb(char *(*auth_password)(const char *username, const char *hostname, void *priv),
@@ -121,8 +123,7 @@ void nc_client_ssh_ch_get_auth_password_clb(char *(**auth_password)(const char *
121123
* nc_client_ssh_ch_get_auth_interactive_clb()).
122124
*
123125
* @param[in] auth_interactive Function to call for every question, returns the answer for
124-
* authentication name with instruction and echoing prompt.
125-
* If NULL, the default callback is set.
126+
* authentication name with instruction and echoing prompt. If NULL, the default callback is set.
126127
* @param[in] priv Optional private data to be passed to the callback function.
127128
*/
128129
void nc_client_ssh_ch_set_auth_interactive_clb(char *(*auth_interactive)(const char *auth_name, const char *instruction,
@@ -147,8 +148,8 @@ void nc_client_ssh_ch_get_auth_interactive_clb(char *(**auth_interactive)(const
147148
* freeing the private data when necessary (the private data can be obtained by
148149
* nc_client_ssh_ch_get_auth_privkey_passphrase_clb()).
149150
*
150-
* @param[in] auth_privkey_passphrase Function to call for every question, returns
151-
* the passphrase for the specific private key.
151+
* @param[in] auth_privkey_passphrase Function to call for every question, returns the passphrase for the specific
152+
* private key.
152153
* @param[in] priv Optional private data to be passed to the callback function.
153154
*/
154155
void nc_client_ssh_ch_set_auth_privkey_passphrase_clb(char *(*auth_privkey_passphrase)(const char *privkey_path, void *priv),
@@ -301,7 +302,7 @@ int nc_client_tls_ch_del_bind(const char *address, uint16_t port);
301302
*
302303
* @param[in] client_cert Path to the file containing the client certificate.
303304
* @param[in] client_key Path to the file containing the private key for the @p client_cert.
304-
* If NULL, key is expected to be stored with @p client_cert.
305+
* If NULL, key is expected to be stored with @p client_cert.
305306
* @return 0 on success, -1 on error.
306307
*/
307308
int nc_client_tls_ch_set_cert_key_paths(const char *client_cert, const char *client_key);
@@ -310,29 +311,26 @@ int nc_client_tls_ch_set_cert_key_paths(const char *client_cert, const char *cli
310311
* @brief Get client Call Home authentication identity - a certificate and a private key.
311312
*
312313
* @param[out] client_cert Path to the file containing the client certificate. Can be NULL.
313-
* @param[out] client_key Path to the file containing the private key for the @p client_cert.
314-
* Can be NULL.
314+
* @param[out] client_key Path to the file containing the private key for the @p client_cert. Can be NULL.
315315
*/
316316
void nc_client_tls_ch_get_cert_key_paths(const char **client_cert, const char **client_key);
317317

318318
/**
319319
* @brief Set client Call Home trusted CA certificates.
320320
*
321321
* @param[in] ca_file Location of the CA certificate file used to verify server certificates.
322-
* For more info, see the documentation for SSL_CTX_load_verify_locations() from OpenSSL.
322+
* For more info, see the documentation for SSL_CTX_load_verify_locations() from OpenSSL.
323323
* @param[in] ca_dir Location of the CA certificates directory used to verify the server certificates.
324-
* For more info, see the documentation for SSL_CTX_load_verify_locations() from OpenSSL.
324+
* For more info, see the documentation for SSL_CTX_load_verify_locations() from OpenSSL.
325325
* @return 0 on success, -1 on error.
326326
*/
327327
int nc_client_tls_ch_set_trusted_ca_paths(const char *ca_file, const char *ca_dir);
328328

329329
/**
330330
* @brief Get client Call Home trusted CA certificates.
331331
*
332-
* @param[out] ca_file Location of the CA certificate file used to verify server certificates.
333-
* Can be NULL.
334-
* @param[out] ca_dir Location of the CA certificates directory used to verify the server certificates.
335-
* Can be NULL.
332+
* @param[out] ca_file Location of the CA certificate file used to verify server certificates. Can be NULL.
333+
* @param[out] ca_dir Location of the CA certificates directory used to verify the server certificates. Can be NULL.
336334
*/
337335
void nc_client_tls_ch_get_trusted_ca_paths(const char **ca_file, const char **ca_dir);
338336

@@ -348,10 +346,8 @@ int nc_client_tls_ch_set_crl_paths(const char *crl_file, const char *crl_dir);
348346
/**
349347
* @brief Get client Call Home Certificate Revocation Lists.
350348
*
351-
* @param[out] crl_file Location of the CRL certificate file used to check for revocated certificates.
352-
* Can be NULL.
353-
* @param[out] crl_dir Location of the CRL certificate directory used to check for revocated certificates.
354-
* Can be NULL.
349+
* @param[out] crl_file Location of the CRL certificate file used to check for revocated certificates. Can be NULL.
350+
* @param[out] crl_dir Location of the CRL certificate directory used to check for revocated certificates. Can be NULL.
355351
*/
356352
void nc_client_tls_ch_get_crl_paths(const char **crl_file, const char **crl_dir);
357353

0 commit comments

Comments
 (0)