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 (void(*clb)(NC_VERB_LEVEL, const char *))
| Deprecated, use nc_set_print_clb_session() instead. 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

## NC_NS_BASE

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

Base NETCONF namespace.

Definition at line 30 of file netconf.h.

## NC_NS_NOTIF

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

Notifications namespace.

Definition at line 32 of file netconf.h.

## NC_PORT_CH_SSH

#define NC_PORT_CH_SSH 4334

Default NETCONF over SSH Call Home port.

Definition at line 37 of file netconf.h.

## NC_PORT_CH_TLS

#define NC_PORT_CH_TLS 4335

Default NETCONF over TLS Call Home port.

Definition at line 42 of file netconf.h.

## NC_PORT_SSH

#define NC_PORT_SSH 830

Default NETCONF over SSH port.

Definition at line 35 of file netconf.h.

## NC_PORT_TLS

#define NC_PORT_TLS 6513

Default NETCONF over TLS port.

Definition at line 40 of file netconf.h.

## nc_set_rpc_callback

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

Set RPC callback to a schema node.

Parameters

  [in] | node | const struct lysc_node *node
  [in] | cb | nc_rpc_clb cb

Definition at line 50 of file netconf.h.

## Typedef Documentation

## NC_DATASTORE

typedef enum NC_DATASTORE_TYPE NC_DATASTORE

Enumeration of the supported types of datastores defined by NETCONF.

## NC_MSG_TYPE

typedef enum NC_MSG_TYPE NC_MSG_TYPE

Enumeration of NETCONF message types.

## NC_PARAMTYPE

typedef enum NC_PARAMTYPE NC_PARAMTYPE

Enumeration of function parameter treatments.

## NC_RPL

typedef enum NC_REPLY NC_RPL

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

## NC_SESSION_TERM_REASON

typedef enum NC_SESSION_TERM_REASON NC_SESSION_TERM_REASON

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

## NC_VERB_LEVEL

typedef enum NC_VERB_LEVEL NC_VERB_LEVEL

Verbosity levels.

## NC_WD_MODE

typedef enum NC_WITHDEFAULTS_MODE NC_WD_MODE

Enumeration of NETCONF with-defaults capability modes.

## Enumeration Type Documentation

## NC_DATASTORE_TYPE

enum NC_DATASTORE_TYPE

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 89 of file netconf.h.

## NC_MSG_TYPE

enum NC_MSG_TYPE

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 69 of file netconf.h.

## NC_PARAMTYPE

enum NC_PARAMTYPE

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 122 of file netconf.h.

## NC_REPLY

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 112 of file netconf.h.

## NC_SESSION_TERM_REASON

enum NC_SESSION_TERM_REASON

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 55 of file netconf.h.

## NC_VERB_LEVEL

enum NC_VERB_LEVEL

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 32 of file log.h.

## NC_WITHDEFAULTS_MODE

enum NC_WITHDEFAULTS_MODE

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 101 of file netconf.h.

## Function Documentation

## nc_libssh_thread_verbosity()

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] | level | libssh verbosity level.

## nc_set_print_clb()

void nc_set_print_clb | ( | void(*)(NC_VERB_LEVEL, const char *) | clb | ) |

Deprecated, use nc_set_print_clb_session() instead.

Parameters

  [in] | clb | Callback that is called for every message.

## nc_set_print_clb_session()

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] | clb | Callback that is called for every message.

## nc_verbosity()

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] | level | Enabled verbosity level (includes all the levels with higher priority).

## Variable Documentation

## nc_msgtype2str

const char* nc_msgtype2str[]

extern

Messages of NETCONF message type enum.