blob: 1d3dc9b62123ee6a21e285939525bb97589eac03 [file] [log] [blame]
Radek Krejcid0d19522015-09-02 13:49:25 +02001/**
2 * \file libnetconf.h
3 * \author Radek Krejci <rkrejci@cesnet.cz>
Michal Vaskofdfd9dd2016-02-29 10:18:46 +01004 * \author Michal Vasko <mvasko@cesnet.cz>
Radek Krejcid0d19522015-09-02 13:49:25 +02005 * \brief libnetconf2 main internal header.
6 *
7 * Copyright (c) 2015 CESNET, z.s.p.o.
8 *
Radek Krejci9b81f5b2016-02-24 13:14:49 +01009 * This source code is licensed under BSD 3-Clause License (the "License").
10 * You may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
Michal Vaskoafd416b2016-02-25 14:51:46 +010012 *
Radek Krejci9b81f5b2016-02-24 13:14:49 +010013 * https://opensource.org/licenses/BSD-3-Clause
Radek Krejcid0d19522015-09-02 13:49:25 +020014 */
15
16#ifndef NC_LIBNETCONF_H_
17#define NC_LIBNETCONF_H_
18
19#include "config.h"
Radek Krejci206fcd62015-10-07 15:42:48 +020020#include "netconf.h"
Radek Krejcid0d19522015-09-02 13:49:25 +020021#include "log_p.h"
Radek Krejciac6d3472015-10-22 15:47:18 +020022#include "session_p.h"
23#include "messages_p.h"
Radek Krejciac6d3472015-10-22 15:47:18 +020024
25/* Tests whether string is empty or non-empty. */
26#define strisempty(str) ((str)[0] == '\0')
27#define strnonempty(str) ((str)[0] != '\0')
Radek Krejcid0d19522015-09-02 13:49:25 +020028
Michal Vaskofdfd9dd2016-02-29 10:18:46 +010029/**
30 * @mainpage About
31 *
32 * libnetconf2 is a NETCONF library in C handling NETCONF authentication and all NETCONF
33 * RPC communication both server and client-side. NETCONF datastore and session management is not a part of this library,
34 * but it helps a lot with the sessions.
35 *
36 * @section about-features Main Features
37 *
38 * - Creating SSH (using libssh) or TLS (using OpenSSL) authenticated NETCONF sessions.
39 * - Creating NETCONF sessions with a pre-established transport protocol
40 * (using this mechanism the communication can be tunneled through sshd(8), for instance).
41 * - Creating NETCONF Call Home sessions.
42 * - Creating, sending, receiving, and replying to RPCs.
43 * - Receiving notifications.
44 *
45 * - \todo Creating and sending notifications.
46 *
47 * @section about-license License
48 *
49 * Copyright (c) 2015-2016 CESNET, z.s.p.o.
50 *
51 * (The BSD 3-Clause License)
52 *
53 * Redistribution and use in source and binary forms, with or without
54 * modification, are permitted provided that the following conditions
55 * are met:
56 * 1. Redistributions of source code must retain the above copyright
57 * notice, this list of conditions and the following disclaimer.
58 * 2. Redistributions in binary form must reproduce the above copyright
59 * notice, this list of conditions and the following disclaimer in
60 * the documentation and/or other materials provided with the
61 * distribution.
62 * 3. Neither the name of the Company nor the names of its contributors
63 * may be used to endorse or promote products derived from this
64 * software without specific prior written permission.
65 */
66
67/**
68 * @page howto How To ...
69 *
70 * - @subpage howtoinit
71 * - @subpage howtoclient
72 * - @subpage howtoserver
73 * - @subpage howtoclientcomm
74 * - @subpage howtoservercomm
75 */
76
77/**
78 * @page howtoinit Init and Thread-safety Information
79 *
Michal Vaskoa7b8ca52016-03-01 12:09:29 +010080 * Before working with the library, it must be initialized using nc_client_init()
Michal Vasko26394692016-03-17 16:24:55 +010081 * or nc_server_init(). Optionally, a client can use nc_client_set_schema_searchpath()
82 * to set the path to a directory with modules that will be loaded from there if they
83 * could not be downloaded from the server (it does not support \<get-schema\>).
84 * However, to be able to create at least the \<get-schema\> RPC, this directory must
85 * contain the module _ietf-netconf-monitoring_. If this directory is not set,
86 * the default _libnetconf2_ schema directory is used that includes this module
87 * and a few others.
88 *
89 * Based on how the library was compiled, also _libssh_ and/or
Michal Vasko15b7a982016-03-02 10:53:31 +010090 * _libssh_/_libcrypto_ are initialized (for multi-threaded use) too. It is advised
91 * to compile _libnetconf2_, for instance, with TLS support even if you do not want
92 * to use _lnc2_ TLS functions, but only use _libssl/libcrypto_ functions in your
93 * application. You can then use _libnetconf2_ cleanup function and do not
Michal Vaskoa7b8ca52016-03-01 12:09:29 +010094 * trouble yourself with the cleanup.
Michal Vaskofdfd9dd2016-02-29 10:18:46 +010095 *
96 * To prevent any reachable memory at the end of your application, there
97 * are complementary destroy functions available. If your application is
98 * multi-threaded, call the destroy functions in the last thread, after all
99 * the other threads have ended. In every other thread you should call
100 * nc_thread_destroy() just before it exits.
101 *
Michal Vasko15b7a982016-03-02 10:53:31 +0100102 * If _libnetconf2_ is used in accordance with this information, there should
Michal Vaskofdfd9dd2016-02-29 10:18:46 +0100103 * not be memory leaks of any kind at program exit. For thread-safety details
Michal Vasko15b7a982016-03-02 10:53:31 +0100104 * of _libssh_, _libssl_, and _libcrypto_, please refer to the corresponding project
105 * documentation. _libnetconf2_ thread-safety information is below.
Michal Vaskofdfd9dd2016-02-29 10:18:46 +0100106 *
Michal Vasko15b7a982016-03-02 10:53:31 +0100107 * Client is __NOT__ thread-safe and there is no access control in the client
108 * functions at all. Server is __MOSTLY__ thread-safe meaning you can set all the
Michal Vaskofdfd9dd2016-02-29 10:18:46 +0100109 * options simultaneously while listening for or accepting new sessions or
110 * polling the existing ones. It should even be safe to poll one session in
111 * several threads, but it is definitely discouraged. Generally, servers can
112 * use more threads without any problems as long as they keep their workflow sane
113 * (behavior such as freeing sessions only after no thread uses them or similar).
114 *
115 * Functions List
116 * --------------
117 *
Michal Vaskoa7b8ca52016-03-01 12:09:29 +0100118 * Available in __nc_client.h__.
119 *
120 * - nc_client_init()
121 * - nc_client_destroy()
122 *
Michal Vasko26394692016-03-17 16:24:55 +0100123 * - nc_client_set_schema_searchpath()
124 * - nc_client_get_schema_searchpath()
125 *
Michal Vaskoa7b8ca52016-03-01 12:09:29 +0100126 * Available in __nc_server.h__.
127 *
128 * - nc_server_init()
129 * - nc_server_destroy()
130 *
Michal Vaskofdfd9dd2016-02-29 10:18:46 +0100131 * Available in both __nc_client.h__ and __nc_server.h__.
132 *
Michal Vaskofdfd9dd2016-02-29 10:18:46 +0100133 * - nc_thread_destroy()
134 */
135
136/**
137 * @page howtoclient Client sessions
138 *
Michal Vasko15b7a982016-03-02 10:53:31 +0100139 * To connect to a NETCONF server, a NETCONF session must be established,
140 * which requires a working transport session. It is possible to create
141 * NETCONF sessions with SSH (using _libssh_) or TLS (using _libssl/libcrypto_)
142 * as the underlying transport protocol. It is also possible to establish
143 * the transport protocol outside _libnetconf2_ and then provide these file
144 * descriptors (FD) for full NETCONF session creation.
145 *
Michal Vaskofdfd9dd2016-02-29 10:18:46 +0100146 * There are a lot of options for both an SSH and a TLS client. All of them
147 * have setters and getters so that there is no need to duplicate them in
148 * a client.
149 *
150 * SSH
151 * ===
152 *
Michal Vasko15b7a982016-03-02 10:53:31 +0100153 * Connecting to a server using SSH does not strictly require to set any
154 * options, there are sensible default values for all the basic ones.
155 * Except all the SSH options, optionally some authetication callbacks can be set,
Michal Vaskofdfd9dd2016-02-29 10:18:46 +0100156 * which are particulary useful in automated clients (passwords cannot be
157 * asked a user) or simply if any additional information is retrieved some
158 * other way than from standard terminal input.
159 *
Michal Vasko15b7a982016-03-02 10:53:31 +0100160 * Having the default options or changing any unsuitable ones, there are 2 functions
161 * to use for a new server connection. nc_connect_ssh() is the standard function
162 * that creates sessions using the set options. If there are some options, which
163 * cannot be changed with the provided API, there is nc_connect_libssh() available.
164 * It requires a _libssh_ session, in which all the SSH options can be modified
165 * and even the connection established. This allows for full customization and
166 * should fit any specific situation.
167 *
168 * New NETCONF sessions can also be created on existing authenticated SSH sessions.
169 * There is a new SSH channel needed, on which the NETCONF session is then created.
170 * Use nc_connect_ssh_channel() for this purpose.
Michal Vaskofdfd9dd2016-02-29 10:18:46 +0100171 *
172 * Functions List
173 * --------------
174 *
175 * Available in __nc_client.h__.
176 *
177 * - nc_client_ssh_set_auth_hostkey_check_clb()
178 * - nc_client_ssh_set_auth_password_clb()
179 * - nc_client_ssh_set_auth_interactive_clb()
180 * - nc_client_ssh_set_auth_privkey_passphrase_clb()
181 * - nc_client_ssh_add_keypair()
182 * - nc_client_ssh_del_keypair()
183 * - nc_client_ssh_get_keypair_count()
184 * - nc_client_ssh_get_keypair()
185 * - nc_client_ssh_set_auth_pref()
186 * - nc_client_ssh_get_auth_pref()
187 * - nc_client_ssh_set_username()
188 * - nc_client_ssh_get_username()
189 *
190 * - nc_connect_ssh()
191 * - nc_connect_libssh()
192 * - nc_connect_ssh_channel()
193 *
194 *
195 * TLS
196 * ===
197 *
Michal Vasko15b7a982016-03-02 10:53:31 +0100198 * To connect to a server using TLS, there must be some client identification
199 * options set. Client must specify its certificate with a private key using
200 * nc_client_tls_set_cert_key_paths(). Also, the Certificate Authority of
201 * a server certificate must be considered trusted. Paths to all the trusted
202 * CA certificates can be set by nc_client_tls_set_trusted_ca_paths().
Michal Vaskofdfd9dd2016-02-29 10:18:46 +0100203 *
Michal Vasko15b7a982016-03-02 10:53:31 +0100204 * Then there are again 2 functions for connecting, nc_connect_tls() being
205 * the standard way of connecting. nc_connect_libssl() again enables
206 * to customize the TLS session in every way _libssl_ allows.
Michal Vaskofdfd9dd2016-02-29 10:18:46 +0100207 *
208 * Functions List
209 * --------------
210 *
211 * Available in __nc_client.h__.
212 *
213 * - nc_client_tls_set_cert_key_paths()
214 * - nc_client_tls_get_cert_key_paths()
215 * - nc_client_tls_set_trusted_ca_paths()
216 * - nc_client_tls_get_trusted_ca_paths()
217 * - nc_client_tls_set_crl_paths()
218 * - nc_client_tls_get_crl_paths()
219 *
220 * - nc_connect_tls()
221 * - nc_connect_libssl()
222 *
223 *
224 * FD
225 * ==
226 *
227 * If you authenticated the connection using some tunneling software, you
Michal Vasko15b7a982016-03-02 10:53:31 +0100228 * can pass its file descriptors to _libnetconf2_ using nc_connect_inout(),
229 * which will continue to establish a full NETCONF session.
Michal Vaskofdfd9dd2016-02-29 10:18:46 +0100230 *
231 * Funtions List
232 * -------------
233 *
234 * Available in __nc_client.h__.
235 *
236 * - nc_connect_inout()
237 *
238 *
239 * Call Home
240 * =========
241 *
242 * Call Home needs the same options set as standard SSH or TLS and the functions
243 * reflect it exactly. However, to accept a connection, the client must first
Michal Vasko15b7a982016-03-02 10:53:31 +0100244 * specify addresses and ports, which to listen on by nc_client_ssh_ch_add_bind_listen()
245 * and nc_client_tls_ch_add_bind_listen(). Then connections can be
246 * accepted using nc_accept_callhome().
Michal Vaskofdfd9dd2016-02-29 10:18:46 +0100247 *
248 * Functions List
249 * --------------
250 *
251 * Available in __nc_client.h__.
252 *
253 * - nc_client_ssh_ch_set_auth_hostkey_check_clb()
254 * - nc_client_ssh_ch_set_auth_password_clb()
255 * - nc_client_ssh_ch_set_auth_interactive_clb()
256 * - nc_client_ssh_ch_set_auth_privkey_passphrase_clb()
257 * - nc_client_ssh_ch_add_bind_listen()
258 * - nc_client_ssh_ch_del_bind()
259 * - nc_client_ssh_ch_add_keypair()
260 * - nc_client_ssh_ch_del_keypair()
261 * - nc_client_ssh_ch_get_keypair_count()
262 * - nc_client_ssh_ch_get_keypair()
263 * - nc_client_ssh_ch_set_auth_pref()
264 * - nc_client_ssh_ch_get_auth_pref()
265 * - nc_client_ssh_ch_set_username()
266 * - nc_client_ssh_ch_get_username()
267 *
268 * - nc_client_tls_ch_add_bind_listen()
269 * - nc_client_tls_ch_del_bind()
270 * - nc_client_tls_ch_set_cert_key_paths()
271 * - nc_client_tls_ch_get_cert_key_paths()
272 * - nc_client_tls_ch_set_trusted_ca_paths()
273 * - nc_client_tls_ch_get_trusted_ca_paths()
274 * - nc_client_tls_ch_set_crl_paths()
275 * - nc_client_tls_ch_get_crl_paths()
276 *
277 * - nc_accept_callhome()
278 *
279 *
280 * Cleanup
281 * =======
282 *
283 * These options and the schema searchpath are stored in dynamically
Michal Vasko15b7a982016-03-02 10:53:31 +0100284 * allocated memory. They are freed as a part of [destroying the client](@ref howtoinit).
Michal Vaskofdfd9dd2016-02-29 10:18:46 +0100285 */
286
287/**
288 * @page howtoserver Server sessions
289 *
290 * Init
291 * ====
292 *
Michal Vaskoa7b8ca52016-03-01 12:09:29 +0100293 * Server takes an argument for its [initialization function](@ref howtoinit).
294 * In it, you set the server context, which determines what modules it
295 * supports and what capabilities to advertise. Few capabilities that
Michal Vasko15b7a982016-03-02 10:53:31 +0100296 * cannot be learnt from the context are set with separate functions
297 * nc_server_set_capab_withdefaults() and nc_server_set_capab_interleave().
298 * Timeout for receiving the _hello_ message on a new session can be set
299 * by nc_server_set_hello_timeout() and the timeout for disconnecting
300 * an inactive session by nc_server_set_idle_timeout().
Michal Vaskofdfd9dd2016-02-29 10:18:46 +0100301 *
302 * Context does not only determine server modules, but its overall
303 * functionality as well. For every RPC the server should support,
304 * an nc_rpc_clb callback should be set on that node in the context.
305 * Server then calls these as appropriate [during poll](@ref howtoservercomm).
306 *
Michal Vasko15b7a982016-03-02 10:53:31 +0100307 * Just like in the [client](@ref howtoclient), you can let _libnetconf2_
308 * establish SSH or TLS transport or do it yourself and only provide the file
309 * descriptors of the connection.
310 *
Michal Vaskofdfd9dd2016-02-29 10:18:46 +0100311 * Server options can be only set, there are no getters.
312 *
313 * Functions List
314 * --------------
315 *
316 * Available in __nc_server.h__.
317 *
Michal Vaskofdfd9dd2016-02-29 10:18:46 +0100318 * - nc_server_set_capab_withdefaults()
319 * - nc_server_set_capab_interleave()
320 * - nc_server_set_hello_timeout()
321 * - nc_server_set_idle_timeout()
322 *
323 *
324 * SSH
325 * ===
326 *
Michal Vasko15b7a982016-03-02 10:53:31 +0100327 * To be able to accept SSH connections, individual endpoints must be added
328 * with nc_server_ssh_add_endpt_listen() and their options set. The only
329 * mandatory SSH option before sessions can be established on an endpoint
330 * is the host key, set it using nc_server_ssh_endpt_set_hostkey().
Michal Vaskofdfd9dd2016-02-29 10:18:46 +0100331 *
332 * Functions List
333 * --------------
334 *
335 * Available in __nc_server.h__.
336 *
337 * - nc_server_ssh_add_endpt_listen()
338 * - nc_server_ssh_endpt_set_address()
339 * - nc_server_ssh_endpt_set_port()
340 * - nc_server_ssh_del_endpt()
341 *
342 * - nc_server_ssh_endpt_set_hostkey()
343 * - nc_server_ssh_endpt_set_banner()
344 * - nc_server_ssh_endpt_set_auth_methods()
345 * - nc_server_ssh_endpt_set_auth_attempts()
346 * - nc_server_ssh_endpt_set_auth_timeout()
347 * - nc_server_ssh_endpt_add_authkey()
348 * - nc_server_ssh_endpt_del_authkey()
349 *
350 *
351 * TLS
352 * ===
353 *
Michal Vasko15b7a982016-03-02 10:53:31 +0100354 * TLS works with endpoints too, but its options differ
355 * significantly from the SSH ones, especially in the _cert-to-name_
Michal Vaskofdfd9dd2016-02-29 10:18:46 +0100356 * options that TLS uses to derive usernames from client certificates.
Michal Vasko15b7a982016-03-02 10:53:31 +0100357 * So, after starting listening on an endpoint with nc_server_tls_add_endpt_listen(),
358 * you need to set the server certificate (nc_server_tls_endpt_set_cert()
359 * or nc_server_tls_endpt_set_cert_path()) and private key (nc_server_tls_endpt_set_key()
360 * or nc_server_tls_endpt_set_key_path()).
361 *
362 * To accept client certificates, they must first be considered trusted,
363 * which you have three ways of achieving. You can add each of their Certificate Authority
364 * certificates to the trusted ones or mark a specific client certificate
365 * as trusted using nc_server_tls_endpt_add_trusted_cert(). Lastly, you can
366 * set paths with all the trusted CA certificates with nc_server_tls_endpt_set_trusted_ca_paths().
367 *
368 * Then, from each trusted client certificate a username must be derived
369 * for the NETCONF session. This is accomplished by finding a matching
370 * _cert-to-name_ entry. They are added using nc_server_tls_endpt_add_ctn().
371 *
372 * If you need to remove trusted certificates or Certificate Revocation
373 * Lists, you must first clear them all with nc_server_tls_endpt_clear_certs()
374 * and nc_server_tls_endpt_clear_crls(), respectively. Then add all
375 * the certificates again.
Michal Vaskofdfd9dd2016-02-29 10:18:46 +0100376 *
377 * Functions List
378 * --------------
379 *
380 * Available in __nc_server.h__.
381 *
382 * - nc_server_tls_add_endpt_listen()
383 * - nc_server_tls_endpt_set_address()
384 * - nc_server_tls_endpt_set_port()
385 * - nc_server_tls_del_endpt()
386 *
387 * - nc_server_tls_endpt_set_cert()
388 * - nc_server_tls_endpt_set_cert_path()
389 * - nc_server_tls_endpt_set_key()
390 * - nc_server_tls_endpt_set_key_path()
391 * - nc_server_tls_endpt_add_trusted_cert()
392 * - nc_server_tls_endpt_add_trusted_cert_path()
393 * - nc_server_tls_endpt_set_trusted_ca_paths()
394 * - nc_server_tls_endpt_clear_certs()
395 * - nc_server_tls_endpt_set_crl_paths()
396 * - nc_server_tls_endpt_clear_crls()
397 * - nc_server_tls_endpt_add_ctn()
398 * - nc_server_tls_endpt_del_ctn()
399 *
400 * FD
401 * ==
402 *
403 * If you used a tunneling software, which does its own authentication,
Michal Vasko15b7a982016-03-02 10:53:31 +0100404 * you can accept a NETCONF session on its file descriptors with
405 * nc_accept_inout().
Michal Vaskofdfd9dd2016-02-29 10:18:46 +0100406 *
407 * Functions List
408 * --------------
409 *
410 * Available in __nc_server.h__.
411 *
412 * - nc_accept_inout()
413 *
414 *
415 * Call Home
416 * =========
417 *
418 * Call Home does not work with endpoints like standard sessions.
Michal Vasko15b7a982016-03-02 10:53:31 +0100419 * Connecting is similar to the [client](@ref howtoclient), just call
420 * nc_connect_callhome_ssh() or nc_connect_callhome_tls(). Any options
421 * must be reset manually by nc_server_ssh_ch_clear_opts()
422 * or nc_server_tls_ch_clear_crls() after another Call Home session
Michal Vaskofdfd9dd2016-02-29 10:18:46 +0100423 * (with different options than the previous one) is to be established.
424 * Also, monitoring of these sessions is up to the application.
425 *
426 * Functions List
427 * --------------
428 *
429 * Available in __nc_server.h__.
430 *
431 * - nc_connect_callhome_ssh()
432 * - nc_connect_callhome_tls()
433 *
434 * - nc_server_ssh_ch_set_hostkey()
435 * - nc_server_ssh_ch_set_banner()
436 * - nc_server_ssh_ch_set_auth_methods()
437 * - nc_server_ssh_ch_set_auth_attempts()
438 * - nc_server_ssh_ch_set_auth_timeout()
439 * - nc_server_ssh_ch_add_authkey()
440 * - nc_server_ssh_ch_del_authkey()
441 * - nc_server_ssh_ch_clear_opts()
442 *
443 * - nc_server_tls_ch_set_cert()
444 * - nc_server_tls_ch_set_cert_path()
445 * - nc_server_tls_ch_set_key()
446 * - nc_server_tls_ch_set_key_path()
447 * - nc_server_tls_ch_add_trusted_cert()
448 * - nc_server_tls_ch_add_trusted_cert_path()
449 * - nc_server_tls_ch_set_trusted_ca_paths()
450 * - nc_server_tls_ch_clear_certs()
451 * - nc_server_tls_ch_set_crl_paths()
452 * - nc_server_tls_ch_clear_crls()
453 * - nc_server_tls_ch_add_ctn()
454 * - nc_server_tls_ch_del_ctn()
455 * - nc_server_tls_ch_clear_opts()
456 *
457 *
458 * Connecting And Cleanup
459 * ======================
460 *
Michal Vasko15b7a982016-03-02 10:53:31 +0100461 * When accepting connections with nc_accept(), all the endpoints are examined
Michal Vaskofdfd9dd2016-02-29 10:18:46 +0100462 * and the first with a pending connection is used. To remove all
Michal Vasko15b7a982016-03-02 10:53:31 +0100463 * the endpoints and free any used dynamic memory, [destroy](@ref howtoinit) the server.
Michal Vaskofdfd9dd2016-02-29 10:18:46 +0100464 *
465 * Functions List
466 * --------------
467 *
468 * Available in __nc_server.h__.
469 *
470 * - nc_accept()
Michal Vaskofdfd9dd2016-02-29 10:18:46 +0100471 */
472
473/**
474 * @page howtoclientcomm Client communication
475 *
Michal Vasko15b7a982016-03-02 10:53:31 +0100476 * To send RPCs on a session, you simply create an RPC, send it using nc_send_rpc(),
477 * and then wait for a reply using nc_recv_reply(). If you are subscribed, there are 2 ways
Michal Vaskofdfd9dd2016-02-29 10:18:46 +0100478 * of receiving notifications. Either you wait for them the same way
Michal Vasko15b7a982016-03-02 10:53:31 +0100479 * as for standard replies with nc_recv_notif() or you create a dispatcher
480 * with nc_recv_notif_dispatch() that asynchronously (in a separate thread)
481 * reads notifications and passes them to your callback.
Michal Vaskofdfd9dd2016-02-29 10:18:46 +0100482 *
483 * Functions List
484 * --------------
485 *
486 * Available in __nc_client.h__.
487 *
488 * - nc_rpc_generic()
489 * - nc_rpc_generic_xml()
490 * - nc_rpc_getconfig()
491 * - nc_rpc_edit()
492 * - nc_rpc_copy()
493 * - nc_rpc_delete()
494 * - nc_rpc_lock()
495 * - nc_rpc_unlock()
496 * - nc_rpc_get()
497 * - nc_rpc_kill()
498 * - nc_rpc_commit()
499 * - nc_rpc_discard()
500 * - nc_rpc_cancel()
501 * - nc_rpc_validate()
502 * - nc_rpc_getschema()
503 * - nc_rpc_subscribe()
504 *
505 * - nc_send_rpc()
506 * - nc_recv_reply()
507 * - nc_recv_notif()
508 * - nc_recv_notif_dispatch()
509 */
510
511/**
512 * @page howtoservercomm Server communication
513 *
514 * Once at least one session is established, an nc_pollsession structure
Michal Vasko15b7a982016-03-02 10:53:31 +0100515 * should be created with nc_ps_new(), filled with the session using
516 * nc_ps_add_session() and finally polled with nc_ps_poll(). Based on
517 * the return value from the poll, further actions can be taken. More
518 * sessions can be polled at the same time and any requests received on
Michal Vaskofdfd9dd2016-02-29 10:18:46 +0100519 * the sessions are [handled internally](@ref howtoserver).
520 *
Michal Vasko15b7a982016-03-02 10:53:31 +0100521 * If an SSH NETCONF session asks for a new channel, you can accept
522 * this request with nc_ps_accept_ssh_channel().
523 *
Michal Vaskofdfd9dd2016-02-29 10:18:46 +0100524 * Functions List
525 * --------------
526 *
Michal Vasko15b7a982016-03-02 10:53:31 +0100527 * Available in __nc_server.h__.
Michal Vaskofdfd9dd2016-02-29 10:18:46 +0100528 *
529 * - nc_ps_new()
530 * - nc_ps_add_session()
531 * - nc_ps_del_session()
Michal Vasko0fdb7ac2016-03-01 09:03:12 +0100532 * - nc_ps_session_count()
Michal Vaskofdfd9dd2016-02-29 10:18:46 +0100533 * - nc_ps_free()
534 *
535 * - nc_ps_poll()
536 * - nc_ps_clear()
537 * - nc_ps_accept_ssh_channel()
538 */
539
Radek Krejcid0d19522015-09-02 13:49:25 +0200540#endif /* NC_LIBNETCONF_H_ */