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

Miscellaneous macros, types, structure and functions for a generic use by both server and client applications. More...

Macros

#define NC_NS_BASE   "urn:ietf:params:xml:ns:netconf:base:1.0"
 Base NETCONF namespace. More...
 
#define NC_NS_NOTIF   "urn:ietf:params:xml:ns:netconf:notification:1.0"
 Notifications namespace. More...
 
#define NC_PORT_CH_SSH   4334
 Default NETCONF over SSH Call Home port. More...
 
#define NC_PORT_CH_TLS   4335
 Default NETCONF over TLS Call Home port. More...
 
#define NC_PORT_SSH   830
 Default NETCONF over SSH port. More...
 
#define NC_PORT_TLS   6513
 Default NETCONF over TLS port. More...
 
#define nc_set_rpc_callback(node, cb)   (node->priv = cb)
 Set RPC callback to a schema node. More...
 

Typedefs

typedef enum NC_DATASTORE_TYPE NC_DATASTORE
 Enumeration of the supported types of datastores defined by NETCONF. More...
 
typedef enum NC_MSG_TYPE NC_MSG_TYPE
 Enumeration of NETCONF message types. More...
 
typedef enum NC_PARAMTYPE NC_PARAMTYPE
 Enumeration of function parameter treatments. More...
 
typedef enum NC_REPLY NC_RPL
 Enumeration of NETCONF (both server and client) rpc-reply types. More...
 
typedef enum NC_SESSION_TERM_REASON NC_SESSION_TERM_REASON
 Enumeration of reasons of the NETCONF session termination as defined in RFC 6470. More...
 
typedef enum NC_VERB_LEVEL NC_VERB_LEVEL
 Verbosity levels. More...
 
typedef enum NC_WITHDEFAULTS_MODE NC_WD_MODE
 Enumeration of NETCONF with-defaults capability modes. More...
 

Enumerations

enum  NC_DATASTORE_TYPE {
  NC_DATASTORE_ERROR = 0, NC_DATASTORE_CONFIG, NC_DATASTORE_URL, NC_DATASTORE_RUNNING,
  NC_DATASTORE_STARTUP, NC_DATASTORE_CANDIDATE
}
 Enumeration of the supported types of datastores defined by NETCONF. More...
 
enum  NC_MSG_TYPE {
  NC_MSG_ERROR, NC_MSG_WOULDBLOCK, NC_MSG_NONE, NC_MSG_HELLO,
  NC_MSG_BAD_HELLO, NC_MSG_RPC, NC_MSG_REPLY, NC_MSG_REPLY_ERR_MSGID,
  NC_MSG_NOTIF
}
 Enumeration of NETCONF message types. More...
 
enum  NC_PARAMTYPE { NC_PARAMTYPE_CONST, NC_PARAMTYPE_FREE, NC_PARAMTYPE_DUP_AND_FREE }
 Enumeration of function parameter treatments. More...
 
enum  NC_REPLY { NC_RPL_OK, NC_RPL_DATA, NC_RPL_ERROR, NC_RPL_NOTIF }
 Enumeration of NETCONF (both server and client) rpc-reply types. More...
 
enum  NC_SESSION_TERM_REASON {
  NC_SESSION_TERM_ERR = -1, NC_SESSION_TERM_NONE = 0, NC_SESSION_TERM_CLOSED, NC_SESSION_TERM_KILLED,
  NC_SESSION_TERM_DROPPED, NC_SESSION_TERM_TIMEOUT, NC_SESSION_TERM_BADHELLO, NC_SESSION_TERM_OTHER
}
 Enumeration of reasons of the NETCONF session termination as defined in RFC 6470. More...
 
enum  NC_VERB_LEVEL {
  NC_VERB_ERROR = 0, NC_VERB_WARNING = 1, NC_VERB_VERBOSE = 2, NC_VERB_DEBUG = 3,
  NC_VERB_DEBUG_LOWLVL = 4
}
 Verbosity levels. More...
 
enum  NC_WITHDEFAULTS_MODE {
  NC_WD_UNKNOWN = 0, NC_WD_ALL, NC_WD_ALL_TAG, NC_WD_TRIM,
  NC_WD_EXPLICIT
}
 Enumeration of NETCONF with-defaults capability modes. More...
 

Functions

void nc_libssh_thread_verbosity (int level)
 Set libssh verbosity level. More...
 
void nc_set_print_clb_session (void(*clb)(const struct nc_session *, NC_VERB_LEVEL, const char *))
 Set libnetconf print callback. More...
 
void nc_verbosity (NC_VERB_LEVEL level)
 Set libnetconf's verbosity level. More...
 

Variables

const char * nc_msgtype2str []
 Messages of NETCONF message type enum. More...
 

Detailed Description

Miscellaneous macros, types, structure and functions for a generic use by both server and client applications.

Macro Definition Documentation

#define NC_NS_BASE   "urn:ietf:params:xml:ns:netconf:base:1.0"

Base NETCONF namespace.

Definition at line 29 of file netconf.h.

#define NC_NS_NOTIF   "urn:ietf:params:xml:ns:netconf:notification:1.0"

Notifications namespace.

Definition at line 31 of file netconf.h.

#define NC_PORT_SSH   830

Default NETCONF over SSH port.

Definition at line 34 of file netconf.h.

#define NC_PORT_CH_SSH   4334

Default NETCONF over SSH Call Home port.

Definition at line 36 of file netconf.h.

#define NC_PORT_TLS   6513

Default NETCONF over TLS port.

Definition at line 39 of file netconf.h.

#define NC_PORT_CH_TLS   4335

Default NETCONF over TLS Call Home port.

Definition at line 41 of file netconf.h.

#define nc_set_rpc_callback (   node,
  cb 
)    (node->priv = cb)

Set RPC callback to a schema node.

Parameters
[in]nodeconst struct lysc_node *node
[in]cbnc_rpc_clb cb

Definition at line 49 of file netconf.h.

Typedef Documentation

Verbosity levels.

Enumeration of reasons of the NETCONF session termination as defined in RFC 6470.

typedef enum NC_MSG_TYPE NC_MSG_TYPE

Enumeration of NETCONF message types.

Enumeration of the supported types of datastores defined by NETCONF.

Enumeration of NETCONF with-defaults capability modes.

typedef enum NC_REPLY NC_RPL

Enumeration of NETCONF (both server and client) rpc-reply types.

typedef enum NC_PARAMTYPE NC_PARAMTYPE

Enumeration of function parameter treatments.

Enumeration Type Documentation

Verbosity levels.

Enumerator
NC_VERB_ERROR 

Print only error messages.

NC_VERB_WARNING 

Print error and warning messages.

NC_VERB_VERBOSE 

Besides errors and warnings, print some other verbose messages.

NC_VERB_DEBUG 

Print almost all messages including some development debug messages.

NC_VERB_DEBUG_LOWLVL 

Print all messages including low level debug messages.

Definition at line 33 of file log.h.

Enumeration of reasons of the NETCONF session termination as defined in RFC 6470.

Enumerator
NC_SESSION_TERM_ERR 

error return code for function getting the session termination reason

NC_SESSION_TERM_NONE 

session still running

NC_SESSION_TERM_CLOSED 

closed by client in a normal fashion

NC_SESSION_TERM_KILLED 

session was terminated by <kill-session> operation

NC_SESSION_TERM_DROPPED 

transport layer connection was unexpectedly closed

NC_SESSION_TERM_TIMEOUT 

terminated because of inactivity

NC_SESSION_TERM_BADHELLO 

<hello> message was invalid

NC_SESSION_TERM_OTHER 

terminated for some other reason

Definition at line 54 of file netconf.h.

Enumeration of NETCONF message types.

Enumerator
NC_MSG_ERROR 

error return value

NC_MSG_WOULDBLOCK 

timeout return value

NC_MSG_NONE 

no message at input or message was processed internally

NC_MSG_HELLO 

<hello> message

NC_MSG_BAD_HELLO 

<hello> message parsing failed

NC_MSG_RPC 

<rpc> message

NC_MSG_REPLY 

<rpc-reply> message

NC_MSG_REPLY_ERR_MSGID 

<rpc-reply> message with missing or wrong message-id attribute value

NC_MSG_NOTIF 

<notification> message

Definition at line 68 of file netconf.h.

Enumeration of the supported types of datastores defined by NETCONF.

Enumerator
NC_DATASTORE_ERROR 

error state of functions returning the datastore type

NC_DATASTORE_CONFIG 

value describing that the datastore is set as config

NC_DATASTORE_URL 

value describing that the datastore data should be given from the URL

NC_DATASTORE_RUNNING 

base NETCONF's datastore containing the current device configuration

NC_DATASTORE_STARTUP 

separated startup datastore as defined in Distinct Startup Capability

NC_DATASTORE_CANDIDATE 

separated working datastore as defined in Candidate Configuration Capability

Definition at line 88 of file netconf.h.

Enumeration of NETCONF with-defaults capability modes.

Enumerator
NC_WD_UNKNOWN 

invalid mode

NC_WD_ALL 

report-all mode

NC_WD_ALL_TAG 

report-all-tagged mode

NC_WD_TRIM 

trim mode

NC_WD_EXPLICIT 

explicit mode

Definition at line 100 of file netconf.h.

enum NC_REPLY

Enumeration of NETCONF (both server and client) rpc-reply types.

Enumerator
NC_RPL_OK 

OK rpc-reply

NC_RPL_DATA 

DATA rpc-reply

NC_RPL_ERROR 

ERROR rpc-reply

NC_RPL_NOTIF 

notification (client-only)

Definition at line 111 of file netconf.h.

Enumeration of function parameter treatments.

Enumerator
NC_PARAMTYPE_CONST 

use the parameter directly, do not free

NC_PARAMTYPE_FREE 

use the parameter directly, free afterwards

NC_PARAMTYPE_DUP_AND_FREE 

make a copy of the argument, free afterwards

Definition at line 121 of file netconf.h.

Function Documentation

void nc_verbosity ( NC_VERB_LEVEL  level)

Set libnetconf's verbosity level.

This level is set for libnetconf2 and alo libyang that is used internally. libyang verbose level can be set explicitly, but must be done so after calling this function. However, if debug verbosity is used, selecting displayed libyang debug message groups must be done explicitly.

Parameters
[in]levelEnabled verbosity level (includes all the levels with higher priority).
void nc_libssh_thread_verbosity ( int  level)

Set libssh verbosity level.

libssh verbosity is set separately because it defines more verbose levels than libnetconf2. Also, you need to set this for every thread unlike libnetconf verbosity.

Values:

  • 0 - no logging,
  • 1 - rare conditions or warnings,
  • 2 - API-accessible entrypoints,
  • 3 - packet id and size,
  • 4 - functions entering and leaving.
Parameters
[in]levellibssh verbosity level.
void nc_set_print_clb_session ( void(*)(const struct nc_session *, NC_VERB_LEVEL, const char *)  clb)

Set libnetconf print callback.

This callback is set for libnetconf2 and also libyang that is used internally. libyang callback can be set explicitly, but must be done so after calling this function.

Parameters
[in]clbCallback that is called for every message.

Variable Documentation

const char* nc_msgtype2str[]

Messages of NETCONF message type enum.