libnetconf  0.10.0-146_trunk
NETCONF Library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
netconf.h File Reference

libnetconf's general public functions and structures definitions. More...

#include <stdint.h>
#include <sys/types.h>
Include dependency graph for netconf.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define NC_INIT_ALL   0xffff8fff
 
#define NC_INIT_CLIENT   0x00004000
 
#define NC_INIT_DATASTORES   0x00000100
 
#define NC_INIT_KEEPALIVECHECK   0x00000080
 
#define NC_INIT_LIBSSH_PTHREAD   0x00000200
 
#define NC_INIT_MONITORING   0x00000008
 
#define NC_INIT_MULTILAYER   0x00001000
 
#define NC_INIT_NACM   0x00000004
 
#define NC_INIT_NOTIF   0x00000002
 
#define NC_INIT_SINGLELAYER   0x00002000
 
#define NC_INIT_URL   0x00000040
 
#define NC_INIT_VALIDATE   0x00000020
 
#define NC_INIT_WD   0x00000010
 
#define NC_INITRET_NOTFIRST   0x00000001
 
#define NC_INITRET_RECOVERY   0x00000002
 
#define nc_msgid   char*
 Type representing NETCONF message-id attribute. More...
 

Typedefs

typedef struct nc_msg nc_ntf
 Event notification message. More...
 
typedef struct nc_msg nc_reply
 reply message. More...
 
typedef struct nc_msg nc_rpc
 rpc message. More...
 

Enumerations

enum  NC_CAP_ATTR { NC_CAP_ATTR_WITHDEFAULTS_MODE = 1 }
 RPC attributes list. More...
 
enum  NC_DATASTORE {
  NC_DATASTORE_ERROR, 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_EDIT_DEFOP_TYPE {
  NC_EDIT_DEFOP_ERROR = -1, NC_EDIT_DEFOP_NOTSET = 0, NC_EDIT_DEFOP_MERGE = 1, NC_EDIT_DEFOP_REPLACE = 2,
  NC_EDIT_DEFOP_NONE = 3
}
 Enumeration of edit-config's <default-operation> element values. More...
 
enum  NC_EDIT_ERROPT_TYPE {
  NC_EDIT_ERROPT_ERROR = -1, NC_EDIT_ERROPT_NOTSET = 0, NC_EDIT_ERROPT_STOP = 1, NC_EDIT_ERROPT_CONT = 2,
  NC_EDIT_ERROPT_ROLLBACK = 3
}
 Enumeration of edit-config's <error-option> element values. More...
 
enum  NC_EDIT_OP_TYPE {
  NC_EDIT_OP_ERROR = -1, NC_EDIT_OP_MERGE = 1, NC_EDIT_OP_NOTSET = 0, NC_EDIT_OP_REPLACE = 2,
  NC_EDIT_OP_CREATE, NC_EDIT_OP_DELETE, NC_EDIT_OP_REMOVE
}
 Enumeration of edit-config's operation attribute values. More...
 
enum  NC_EDIT_TESTOPT_TYPE {
  NC_EDIT_TESTOPT_ERROR = -1, NC_EDIT_TESTOPT_NOTSET = 0, NC_EDIT_TESTOPT_TESTSET = 1, NC_EDIT_TESTOPT_SET = 2,
  NC_EDIT_TESTOPT_TEST = 3
}
 Enumeration of edit-config's <test-option> element values. More...
 
enum  NC_ERR_PARAM {
  NC_ERR_PARAM_TYPE, NC_ERR_PARAM_TAG, NC_ERR_PARAM_SEVERITY, NC_ERR_PARAM_APPTAG,
  NC_ERR_PARAM_PATH, NC_ERR_PARAM_MSG, NC_ERR_PARAM_INFO_BADATTR, NC_ERR_PARAM_INFO_BADELEM,
  NC_ERR_PARAM_INFO_BADNS, NC_ERR_PARAM_INFO_SID
}
 
enum  NC_FILTER_TYPE { NC_FILTER_UNKNOWN, NC_FILTER_SUBTREE }
 Enumeration of supported NETCONF filter types. More...
 
enum  NC_MSG_TYPE {
  NC_MSG_UNKNOWN, NC_MSG_WOULDBLOCK, NC_MSG_NONE, NC_MSG_HELLO,
  NC_MSG_RPC, NC_MSG_REPLY, NC_MSG_NOTIFICATION = -5
}
 Enumeration of NETCONF message types. More...
 
enum  NC_NOTIF_TYPE { NC_NTF_UNKNOWN, NC_NTF_BASE }
 
enum  NC_OP {
  NC_OP_UNKNOWN, NC_OP_GETCONFIG, NC_OP_GET, NC_OP_EDITCONFIG,
  NC_OP_CLOSESESSION, NC_OP_KILLSESSION, NC_OP_COPYCONFIG, NC_OP_DELETECONFIG,
  NC_OP_LOCK, NC_OP_UNLOCK, NC_OP_COMMIT, NC_OP_DISCARDCHANGES,
  NC_OP_CREATESUBSCRIPTION, NC_OP_GETSCHEMA, NC_OP_VALIDATE
}
 Enumeration of supported <rpc> operations. More...
 
enum  NC_REPLY_TYPE {
  NC_REPLY_UNKNOWN, NC_REPLY_HELLO, NC_REPLY_OK, NC_REPLY_ERROR,
  NC_REPLY_DATA
}
 Enumeration of <rpc-reply> types. More...
 
enum  NC_RPC_TYPE {
  NC_RPC_UNKNOWN, NC_RPC_HELLO, NC_RPC_DATASTORE_READ, NC_RPC_DATASTORE_WRITE,
  NC_RPC_SESSION
}
 Enumeration of <rpc> operation types. More...
 
enum  NC_SESSION_STATUS {
  NC_SESSION_STATUS_ERROR = -1, NC_SESSION_STATUS_STARTUP = 0, NC_SESSION_STATUS_WORKING = 1, NC_SESSION_STATUS_CLOSING = 2,
  NC_SESSION_STATUS_CLOSED = 3, NC_SESSION_STATUS_DUMMY = 4
}
 Enumeration of the possible states of a NETCONF session. More...
 
enum  NC_SESSION_TERM_REASON {
  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_TRANSPORT { NC_TRANSPORT_UNKNOWN = -1, NC_TRANSPORT_SSH, NC_TRANSPORT_TLS }
 Supported NETCONF transport protocols enumeration. To change currently used transport protocol, call nc_session_transport(). More...
 
enum  NC_VERB_LEVEL { NC_VERB_ERROR, NC_VERB_WARNING, NC_VERB_VERBOSE, NC_VERB_DEBUG }
 Verbosity levels. More...
 
enum  NCWD_MODE {
  NCWD_MODE_NOTSET = 0, NCWD_MODE_ALL = 1, NCWD_MODE_TRIM = 2, NCWD_MODE_EXPLICIT = 4,
  NCWD_MODE_ALL_TAGGED = 8, NCWD_MODE_IMPL_TAGGED = 16
}
 Enumeration of <with-defaults> element values. More...
 

Functions

int nc_close (void)
 Release libnetconf resources. Init flag is used to determine if close should be applied as system-wide (NC_INIT_MULTILAYER) or not (NC_INIT_SINGLELAYER). System-wide nc_close() closes all the shared structures if no other libnetconf participant is currently running. Local release of the calling instance from the shared structures is done in both cases. More...
 
time_t nc_datetime2time (const char *datetime)
 Transform given string in RFC 3339 compliant format to the time_t (seconds since the epoch) accepted by most Linux functions. More...
 
void nc_hello_timeout (int timeout)
 Set <hello> timeout - how long libnetconf will wait for the <hello> message from the other side. Default value is -1 (infinite timeout). More...
 
int nc_init (int flags)
 Initialize libnetconf for system-wide usage. This initialization is shared across all the processes. More...
 
char * nc_time2datetime (time_t time, const char *tz)
 Transform given time_t (seconds since the epoch) into the RFC 3339 format accepted by NETCONF functions. More...
 
void nc_verb_error (const char *format,...)
 Function for logging error messages. More...
 
void nc_verb_verbose (const char *format,...)
 Function for logging verbose messages. More...
 
void nc_verb_warning (const char *format,...)
 Function for logging warning messages. More...
 
void nc_verbosity (NC_VERB_LEVEL level)
 Set libnetconf's verbosity level. More...
 

Detailed Description

libnetconf's general public functions and structures definitions.

Author
Radek Krejci rkrej.nosp@m.ci@c.nosp@m.esnet.nosp@m..cz Copyright (c) 2012-2014 CESNET, z.s.p.o.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of the Company nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

ALTERNATIVELY, provided that this notice is retained in full, this product may be distributed under the terms of the GNU General Public License (GPL) version 2 or later, in which case the provisions of the GPL apply INSTEAD OF those given above.

This software is provided ``as is, and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the company or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.

Macro Definition Documentation

#define NC_INIT_ALL   0xffff8fff

nc_init()'s flag to enable all optional features/subsystems

#define NC_INIT_CLIENT   0x00004000

nc_init()'s flag for NETCONF clients

#define NC_INIT_DATASTORES   0x00000100

nc_init()'s flag to use internal datastores

#define NC_INIT_KEEPALIVECHECK   0x00000080

nc_init()'s flag to enable check of monitored sessions. Sometimes the process holding a monitored session crashes and status information of the session is not properly removed from the monitored sessions list. If this option is used, libnetconf checks if the process holding the session is still alive. To do this properly, the session is connected with the PID of the nc_session_monitor() caller. If the PID changes (e.g. after fork() or daemon()), the process is supposed to call nc_session_monitor() againg.

#define NC_INIT_LIBSSH_PTHREAD   0x00000200

nc_init()'s flag to initialize libssh pthread callbacks

#define NC_INIT_MONITORING   0x00000008

nc_init()'s flag to enable ietf-netconf-monitoring module

#define NC_INIT_MULTILAYER   0x00001000

nc_init()'s flag for multi-layer server architecture

#define NC_INIT_NACM   0x00000004

nc_init()'s flag to enable Acccess Control subsystem

#define NC_INIT_NOTIF   0x00000002

nc_init()'s flag to enable Notification subsystem.

#define NC_INIT_SINGLELAYER   0x00002000

nc_init()'s flag for single-layer server architecture

#define NC_INIT_URL   0x00000040

nc_init()'s flag to enable server's URL capability

#define NC_INIT_VALIDATE   0x00000020

nc_init()'s flag to enable server's validation capability

#define NC_INIT_WD   0x00000010

nc_init()'s flag to enable with-default capability

#define NC_INITRET_NOTFIRST   0x00000001

nc_init()'s return flag for this process not calling nc_init() first

#define NC_INITRET_RECOVERY   0x00000002

nc_init()'s return flag for this process crashing before (not calling nc_close())

Enumeration Type Documentation

Enumerator
NC_ERR_PARAM_TYPE 

error-type - The conceptual layer that the error occurred, accepted values include 'transport', 'rpc', 'protocol', 'application'.

NC_ERR_PARAM_TAG 

error-tag - Contains a string identifying the error condition.

NC_ERR_PARAM_SEVERITY 

error-severity - The error severity, accepted values are 'error' and 'warning'.

NC_ERR_PARAM_APPTAG 

error-app-tag - Contains a string identifying the data-model-specific or implementation-specific error condition, if one exists. This element will not be present if no appropriate application error-tag can be associated with a particular error condition. If both a data-model-specific and an implementation-specific error-app-tag exist then the data-model-specific value MUST be used by the server.

NC_ERR_PARAM_PATH 

error-path - Contains an absolute XPath expression identifying the element path to the node that is associated with the error being reported.

NC_ERR_PARAM_MSG 

error-message - A string describing the error.

NC_ERR_PARAM_INFO_BADATTR 

bad-attribute in error-info - name of the attribute, contained in the 'bad-attribute', 'missing-attribute' and 'unknown-attribute' errors.

NC_ERR_PARAM_INFO_BADELEM 

bad-element in error-info - name of the element, contained in 'missing-attribute', bad-attribute', 'unknown-attribute', 'missing-element', 'bad-element', 'unknown-element' and 'unknown-namespace' errors.

NC_ERR_PARAM_INFO_BADNS 

bad-namespace in error-info - name of an unexpected namespace, contained in the 'unknown-namespace' error.

NC_ERR_PARAM_INFO_SID 

session-id in error-info - session ID of the session holding the requested lock, contained in 'lock-denied' error.

Enumerator
NC_NTF_UNKNOWN 
NC_NTF_BASE