callbacks.h   callbacks.h 
/** /**
* \file callbacks.h * \file callbacks.h
* \author Radek Krejci <rkrejci@cesnet.cz> * \author Radek Krejci <rkrejci@cesnet.cz>
* \brief Functions to set application's callbacks. * \brief Functions to set application's callbacks.
* *
* Copyright (C) 2012 CESNET, z.s.p.o. * Copyright (c) 2012-2014 CESNET, z.s.p.o.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
* 1. Redistributions of source code must retain the above copyright * 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in * notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the * the documentation and/or other materials provided with the
* distribution. * distribution.
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 callbacks_ssh.h   callbacks_ssh.h 
/** /**
* \file callbacks_ssh.h * \file callbacks_ssh.h
* \author Radek Krejci <rkrejci@cesnet.cz> * \author Radek Krejci <rkrejci@cesnet.cz>
* \brief Functions to set libssh2's callbacks. * \brief Functions to set libssh2's callbacks.
* *
* Copyright (C) 2012 CESNET, z.s.p.o. * Copyright (c) 2012-2014 CESNET, z.s.p.o.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
* 1. Redistributions of source code must retain the above copyright * 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in * notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the * the documentation and/or other materials provided with the
* distribution. * distribution.
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 datastore.h   datastore.h 
/** /**
* \file datastore.h * \file datastore.h
* \author Radek Krejci <rkrejci@cesnet.cz> * \author Radek Krejci <rkrejci@cesnet.cz>
* \brief NETCONF datastore handling function prototypes and structures. * \brief NETCONF datastore handling function prototypes and structures.
* *
* Copyright (C) 2012 CESNET, z.s.p.o. * Copyright (c) 2012-2014 CESNET, z.s.p.o.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
* 1. Redistributions of source code must retain the above copyright * 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in * notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the * the documentation and/or other materials provided with the
* distribution. * distribution.
skipping to change at line 56 skipping to change at line 56
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/** /**
* @ingroup store * @ingroup store
* @brief Datastore implementation types provided by libnetconf * @brief Datastore implementation types provided by libnetconf
*/ */
typedef enum { typedef enum {
NCDS_TYPE_EMPTY, /**< No datastore. For read-only devices. */ NCDS_TYPE_EMPTY, /**< No datastore. For read-only devices. */
NCDS_TYPE_FILE /**< Datastores implemented as files */ NCDS_TYPE_FILE, /**< Datastores implemented as files */
NCDS_TYPE_CUSTOM /**< User-defined datastore */
} NCDS_TYPE; } NCDS_TYPE;
/** /**
* @ingroup store * @ingroup store
* @brief Datastore ID. * @brief Datastore ID.
* *
* Each datastore gets its ID after initialisation (ncds_init()). Only * Each datastore gets its ID after initialisation (ncds_init()). Only
* initialised datastores can be used to access the configuration data. * initialised datastores can be used to access the configuration data.
*/ */
typedef int ncds_id; typedef int ncds_id;
skipping to change at line 91 skipping to change at line 92
/** /**
* @ingroup store * @ingroup store
* @def NCDS_RPC_NOT_APPLICABLE * @def NCDS_RPC_NOT_APPLICABLE
* @brief Return value of ncds_apply_rpc() when the requested operation is * @brief Return value of ncds_apply_rpc() when the requested operation is
* not applicable to the specified datastore. * not applicable to the specified datastore.
*/ */
extern char error_area; extern char error_area;
#define NCDS_RPC_NOT_APPLICABLE ((void*)(&error_area)) #define NCDS_RPC_NOT_APPLICABLE ((void*)(&error_area))
/** /**
* \page datastores Datastores Usage
*
* NETCONF defines usage of three datastores: running (mandatory),
* startup (optional via :startup capability) and candidate (optional via
* :candidate capability). libnetconf provides all these datastores.
*
* In addition to the described NETCONF point of view, libnetconf divides a
ll
* datastores (running, startup and candidate) into datastore parts connect
ed
* with a specific (basic) configuration data model. Each datastore part is
* created by ncds_new() or ncds_new_transapi() function. According to the
* specified datastore type, server should set up additional datastore sett
ings
* (see section \ref ds_settings). If some specific validation settings are
needed,
* ncds_set_validation() function can be used (more information about valid
ation
* can be found at a separated \ref validation "page". Finnaly, to activate
* datastore and to get its unique identifier, ncds_init() function must be
* called.
*
* If you want to use some data model that extends (by import or augment
* statement) any of the used data models, functions ncds_add_model() or
* ncds_add_models_path() can be used to specify location of the extension
data
* model(s).
*
* By default, all features defined in configuration data models are disabl
ed.
* To enable specific features or all features at once, you can use
* ncds_feature_enable() and ncds_features_enableall() functions.
*
* To finish changes made to the datastores (adding augment data models,
* enabling and disabling features, etc.), server must call ncds_consolidat
e()
* function.
*
* As a next step, device controlled by the server should be initialized. T
his
* should includes copying startup configuration data into the running
* datastore (and applying them to the current device settings).
*
* \anchor ds_settings
* ## Datastore Settings ##
*
* - Empty Datastore (*NCDS_TYPE_EMPTY*)
*
* There is no additional settings for this datastore type.
*
* - \ref fileds (*NCDS_TYPE_FILE*)
*
* ncds_file_set_path() to set file to store datastore content.
*
* - \ref customds (*NCDS_TYPE_CUSTOM*)
*
* This type of datastore implementation is provided by the server, not b
y
* libnetconf.
*
* ncds_custom_set_data() sets server specific functions implementing the
* datastore. In this case, server is required to implement functions
* from #ncds_custom_funcs structure.
*
*/
/**
* \page validation Data Validation
*
* [RFC6241]: http://tools.ietf.org/html/rfc6241 "RFC 6241"
*
* [RFC 6241][RFC6241] defines NETCONF :validate capability intended to all
ow
* validation of the configuration data. This capability specifies new oper
ation
* \<validate\> and adds \<test-option\> parameter to the \<edit-config\>
* operation.
*
* On the client side, libnetconf allows to create \<validate\> RPC as well
as
* to specify \<test-option\> of \<edit-config\> RPC.
*
* On the server side, libnetconf performs data validation on \ref datastor
es
* "datastore parts" that provides validators. libnetconf use Relax NG sche
ma
* to validate syntax of the datastore content and Schematron to check sema
ntics.
* Validators are loaded as a standalone files generated by *lnctool(1)*, w
hich
* is part of libnetconf standard instalation.
*
* libnetconf automatically searches for the validators during ncds_new() a
nd
* ncds_new_transapi() calls. Validators are supposed to be placed in the s
ame
* directory as data model provided to the mentioned function as its model_
path
* parameter. Alternatively, validators can be connected with the datastore
* manually, using ncds_set_validation(). This function also allows to swit
ch
* off validation on a specific datastore part.
*
* ## lnctool(1) Usage ##
*
* Complete list of *lnctool(1)*'s options can be displayed using -h option
:
*
* $ lnctool -h
*
* Based on a YANG data model, *lnctool(1)* generates all necessary files n
eeded
* by libnetconf. Basically, it generates YIN format of the data model requ
ired
* by ncds_new() and ncds_new_transapi() functions. If you use some extensi
on
* models via ncds_add_model() or ncds_add_models_path(), you have to speci
fy
* also these models as *lnctool(1)*'s \<augment models\> parameter.
*
* When used with -v option, *lnctool(1)* additionally generates Relax NG
* schemas and Schematron XSL stylesheet for validation. Here is an example
* for NACM data model (directory ./models/ contains *ietf-netconf-acm.yang
*
* and *ietf-yang-types.yang* models):
*
* $ lnctool -v -o ./nacm -p ../models/ ./models/ietf-netconf-acm.yang
* ### Converting YANG to YIN
* creating ./nacm/ietf-netconf-acm.yin
* creating ./nacm/ietf-yang-types.yin
* ### Done
* ### Generating Relax NG schemas for validation
* creating ./nacm/ietf-netconf-acm-data.rng
* creating ./nacm/ietf-netconf-acm-gdefs.rng
* ### Done
* ### Generating Schematron Stylesheet
* creating ./nacm/ietf-netconf-acm-schematron.xsl
* ### Done
*
* Path to the output directory should be specified in the server source co
de
* to allow libnetconf to find imported data model (*ietf-yang-types.yin* i
n
* this case).
*
* \note Return value checks are skipped in this example for simplicity. Do
not
* copy-paste this example. Also note, that NACM is one of internal libnetc
onf
* datastores and it is not needed to add it manually by ncds_new(). This i
s
* JUST a simple (stupid) example.
*
* <p></p>
*
* ds = ncds_new(NCDS_TYPE_FILE, "./nacm/ietf-netconf-acm.yin", NULL);
* ncds_file_set_path(ds, ds_path);
* ncds_init(ds);
* ncds_add_models_path("./models/");
* ncds_consolidate();
*
* If the validators files are stored in the same directory as
* a basic data model (*ietf-netconf-acm.yin* in this case), libnetconf
* automatically loads them during ncds_new() or ncds_new_transapi() calls.
If
* you store the validators files somewhere else, ncds_set_validation() fun
ction
* can be used to specify their location:
*
* ncds_set_validation(ds, 1, "./nacm/ietf-netconf-acm-data.rng", "./na
cm/ietf-netconf-acm-schematron.xsl");
*
* If validators files are not found or validation is switched off (via
* ncds_set_validation() with enable parameter set to 0), validation is not
* performed on such datastore part.
*
*/
/**
* @ingroup store * @ingroup store
* @brief Informational function to get basic information about configurati on * @brief Informational function to get basic information about configurati on
* data model in the given file. * data model in the given file.
* @param[in] path Path to the *.yin file with the configuration data model in * @param[in] path Path to the *.yin file with the configuration data model in
* YIN format. * YIN format.
* *
* Caller is responsible to free returned strings and arrays of strings. If a * Caller is responsible to free returned strings and arrays of strings. If a
* caller is not interested in a specific return value, NULL pointer can be * caller is not interested in a specific return value, NULL pointer can be
* set as parameter and the value of such a parameter will not be returned. * set as parameter and the value of such a parameter will not be returned.
* *
skipping to change at line 118 skipping to change at line 263
* the data model * the data model
* @return EXIT_SUCCESS or EXIT_FAILURE on error. * @return EXIT_SUCCESS or EXIT_FAILURE on error.
* *
*/ */
int ncds_model_info(const char* path, char **name, char **version, char **n amespace, char **prefix, char ***rpcs, char ***notifs); int ncds_model_info(const char* path, char **name, char **version, char **n amespace, char **prefix, char ***rpcs, char ***notifs);
/** /**
* @ingroup store * @ingroup store
* @brief Create a new datastore structure of the specified implementation type. * @brief Create a new datastore structure of the specified implementation type.
* @param[in] type Datastore implementation type for the new datastore stru cture. * @param[in] type Datastore implementation type for the new datastore stru cture.
* @param[in] model_path Path to the YIN configuration data model. * @param[in] model_path Base name of the configuration data model files.
* libnetconf expects model_path.yin as a data model, model_path.rng for
* grammar and data types validation, model_path.dsrl for default values
* validation and model_path.sch for semantic validation.
* @param[in] get_state Pointer to a callback function that returns a seria lized * @param[in] get_state Pointer to a callback function that returns a seria lized
* XML document containing the state configuration data of the device. The parameters * XML document containing the state configuration data of the device. The parameters
* it receives are a serialized configuration data model in YIN format and the current * it receives are a serialized configuration data model in YIN format and the current
* content of the running datastore. If NULL is set, \<get\> operation is * content of the running datastore. If NULL is set, \<get\> operation is
* performed in the same way as \<get-config\>. * performed in the same way as \<get-config\>.
* @return Prepared (not configured) datastore structure. To configure the * @return Prepared (not configured) datastore structure. To configure the
* structure, caller must use the parameter setters of the specific datasto re * structure, caller must use the parameter setters of the specific datasto re
* implementation type. Then, the datastore can be initiated (ncds_init()) and * implementation type. Then, the datastore can be initiated (ncds_init()) and
* used to access the configuration data. * used to access the configuration data.
*/ */
struct ncds_ds* ncds_new(NCDS_TYPE type, const char* model_path, char* (*ge t_state)(const char* model, const char* running, struct nc_err ** e)); struct ncds_ds* ncds_new(NCDS_TYPE type, const char* model_path, char* (*ge t_state)(const char* model, const char* running, struct nc_err ** e));
/** /**
* @ingroup transapi * @ingroup transapi
* @brief Create new datastore structure with transaction API support * @brief Create new datastore structure with transaction API support
* @param[in] type Datastore implementation type for the new datastore stru cture. * @param[in] type Datastore implementation type for the new datastore stru cture.
* @param[in] model_path Path to the YIN configuration data model. * @param[in] model_path Base name of the configuration data model files.
* @param[in] callbacks_path Path to shared library with callbacks and othe * libnetconf expects model_path.yin as a data model, model_path.rng for
r functions for transaction API. * grammar and data types validation, model_path.dsrl for default values
* * validation and model_path.sch for semantic validation.
* @param[in] callbacks_path Path to shared library with callbacks and othe
r
* functions for transaction API.
* @return Prepared (not configured) datastore structure. To configure the * @return Prepared (not configured) datastore structure. To configure the
* structure, caller must use the parameter setters of the specific datasto re * structure, caller must use the parameter setters of the specific datasto re
* implementation type. Then, the datastore can be initiated (ncds_init()) and * implementation type. Then, the datastore can be initiated (ncds_init()) and
* used to access the configuration data. * used to access the configuration data.
*/ */
struct ncds_ds* ncds_new_transapi(NCDS_TYPE type, const char* model_path, c onst char* callbacks_path); struct ncds_ds* ncds_new_transapi(NCDS_TYPE type, const char* model_path, c onst char* callbacks_path);
/** /**
* @ingroup store * @ingroup store
* @brief Set validators (or disable validation) on the specified datastore
*
* @param[in] ds Datastore structure to be configured.
* @param[in] enable 1 to enable validation on the datastore according to t
he
* following parameters, 0 to disable validation (following parameters will
be
* ignored as well as automatically or previously set validators).
* @param[in] relaxng Path to the Relax NG schema for validation of the
* datastore content syntax. To generate it, use the lnctool(1) script. NUL
L
* if syntactic validation is not required.
* @param[in] schematron Path to the Schematron XSLT stylesheet for validat
ion of
* the datastore content semantics. To generate it, use the lnctool(1) scri
pt.
* NULL if semantic validation is not required.
* @return EXIT_SUCCESS or EXIT_FAILURE
*/
int ncds_set_validation(struct ncds_ds* ds, int enable, const char* relaxng
, const char* schematron);
/**
* @defgroup fileds File Datastore
* @ingroup store
* @brief Specific functions for NCDS_FILE_DS type of datastore implementat
ion.
*/
/**
* @ingroup fileds
* @brief Assign the path of the datastore file into the datastore structur e. * @brief Assign the path of the datastore file into the datastore structur e.
* *
* Checks if the file exist and is accessible for reading and writing. * Checks if the file exist and is accessible for reading and writing.
* If the file does not exist, it is created. The file is opened and the fi le * If the file does not exist, it is created. The file is opened and the fi le
* descriptor is stored in the structure. * descriptor is stored in the structure.
* *
* @param[in] datastore Datastore structure to be configured. * @param[in] datastore Datastore structure to be configured.
* @param[in] path File path to the file storing configuration datastores. * @param[in] path File path to the file storing configuration datastores.
* @return * @return
* - 0 on success * - 0 on success
skipping to change at line 181 skipping to change at line 356
* @return Positive integer with the datastore ID on success, negative valu e on * @return Positive integer with the datastore ID on success, negative valu e on
* error. * error.
* - -1 Invalid datastore * - -1 Invalid datastore
* - -2 Type-specific initialization failed * - -2 Type-specific initialization failed
* - -3 Unsupported datastore type * - -3 Unsupported datastore type
* - -4 Memory allocation problem * - -4 Memory allocation problem
*/ */
ncds_id ncds_init(struct ncds_ds* datastore); ncds_id ncds_init(struct ncds_ds* datastore);
/** /**
* @brief Initialize transAPI module(s) (if present) and copy startup confi * @brief Initialize transAPI module(s) (if present) and copy startup
guration to running * configuration to running.
* *
* @param id Pointer to ncds_id of device to initialize, if NULL all found * @param id Pointer to ncds_id of device to initialize, if NULL all found
transapi-capable devices will be initialized * transapi-capable devices will be initialized
* @param cpblts Server's NETCONF capabilities. If NULL, default capabiliti
es
* from libnetconf are used.
* @param force Force fresh configuration of device from STARTUP datastore.
* *
* @return EXIT_SUCCESS or EXIT_FAILURE * @return EXIT_SUCCESS or EXIT_FAILURE
*/ */
int ncds_device_init (ncds_id * id); int ncds_device_init (ncds_id * id, struct nc_cpblts* cpblts, int force);
/** /**
* @ingroup store * @ingroup store
* @brief Close the specified datastore and free all the resources. * @brief Close the specified datastore and free all the resources.
* *
* Equivalent function to ncds_free2(). * Equivalent function to ncds_free2().
* *
* @param[in] datastore Datastore to be closed. * @param[in] datastore Datastore to be closed.
*/ */
void ncds_free(struct ncds_ds* datastore); void ncds_free(struct ncds_ds* datastore);
skipping to change at line 248 skipping to change at line 428
* (ncds_id)(-1). The list is rewritten by any following call to * (ncds_id)(-1). The list is rewritten by any following call to
* ncds_apply_rpc2all(). * ncds_apply_rpc2all().
* @return NULL in case of a non-NC_RPC_DATASTORE_* operation type or inval id * @return NULL in case of a non-NC_RPC_DATASTORE_* operation type or inval id
* parameter session or rpc, else \<rpc-reply\> with \<ok\>, \<data\> or * parameter session or rpc, else \<rpc-reply\> with \<ok\>, \<data\> or
* \<rpc-error\> according to the type and the result of the requested * \<rpc-error\> according to the type and the result of the requested
* operation. When the requested operation is not applicable to any datasto re * operation. When the requested operation is not applicable to any datasto re
* (e.g. the namespace does not match no of the controlled datstores), * (e.g. the namespace does not match no of the controlled datstores),
* NCDS_RPC_NOT_APPLICABLE is returned. * NCDS_RPC_NOT_APPLICABLE is returned.
* *
*/ */
nc_reply* ncds_apply_rpc2all(const struct nc_session* session, const nc_rpc * rpc, ncds_id* ids[]); nc_reply* ncds_apply_rpc2all(struct nc_session* session, const nc_rpc* rpc, ncds_id* ids[]);
/** /**
* @ingroup store * @ingroup store
* @brief Undo the last change performed on the specified datastore. * @brief Undo the last change performed on the specified datastore.
* @param[in] id ID of the datastore where the rollback will be performed. * @param[in] id ID of the datastore where the rollback will be performed.
* @return 0 on success, non-zero on error. * @return 0 on success, non-zero on error.
*/ */
int ncds_rollback(ncds_id id); int ncds_rollback(ncds_id id);
/** /**
skipping to change at line 342 skipping to change at line 522
* @param[in] feature Name of the feature to be disabled. * @param[in] feature Name of the feature to be disabled.
* @return 0 on success, non-zero on error. * @return 0 on success, non-zero on error.
*/ */
int ncds_feature_disable(const char* module, const char* feature); int ncds_feature_disable(const char* module, const char* feature);
/** /**
* @ingroup store * @ingroup store
* @brief Enable usage of all features defined in the specified module. By * @brief Enable usage of all features defined in the specified module. By
* default, all features are disabled. To enable only the specific feature( s), * default, all features are disabled. To enable only the specific feature( s),
* use ncds_feature_enable(). * use ncds_feature_enable().
* @param[in] module Name of the module where the feature is defined. Modul e * @param[in] module Name of the module where the features are defined. Mod ule
* must be accessible - added via ncds_add_model() or present in a director y * must be accessible - added via ncds_add_model() or present in a director y
* specified via ncds_add_models_path() function. * specified via ncds_add_models_path() function.
* @return 0 on success, non-zero on error. * @return 0 on success, non-zero on error.
*/ */
int ncds_features_enableall(const char* module); int ncds_features_enableall(const char* module);
/** /**
* @ingroup store * @ingroup store
* @brief Disable usage of all features defined in the specified module. By * @brief Disable usage of all features defined in the specified module. By
* default, all features are disabled. To disable only the specific feature (s), * default, all features are disabled. To disable only the specific feature (s),
* use ncds_feature_disable(). * use ncds_feature_disable().
* @param[in] module Name of the module where the feature is defined. Modul e * @param[in] module Name of the module where the features are defined. Mod ule
* must be accessible - added via ncds_add_model() or present in a director y * must be accessible - added via ncds_add_model() or present in a director y
* specified via ncds_add_models_path() function. * specified via ncds_add_models_path() function.
* @return 0 on success, non-zero on error. * @return 0 on success, non-zero on error.
*/ */
int ncds_features_disableall(const char* module); int ncds_features_disableall(const char* module);
/** /**
* @ingroup store * @ingroup store
* @brief Check if the feature of the specified module is currently enabled or * @brief Check if the feature of the specified module is currently enabled or
* disabled. * disabled.
 End of changes. 12 change blocks. 
15 lines changed or deleted 236 lines changed or added


 error.h   error.h 
/** /**
* \file error.h * \file error.h
* \author Radek Krejci <rkrejci@cesnet.cz> * \author Radek Krejci <rkrejci@cesnet.cz>
* \brief NETCONF error handling functions. * \brief NETCONF error handling functions.
* *
* Copyright (C) 2012 CESNET, z.s.p.o. * Copyright (c) 2012-2014 CESNET, z.s.p.o.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
* 1. Redistributions of source code must retain the above copyright * 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in * notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the * the documentation and/or other materials provided with the
* distribution. * distribution.
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 libnetconf.h   libnetconf.h 
/** /**
* \file libnetconf.h * \file libnetconf.h
* \author Radek Krejci <rkrejci@cesnet.cz> * \author Radek Krejci <rkrejci@cesnet.cz>
* \brief libnetconf's main header. * \brief libnetconf's main header.
* *
* Copyright (C) 2012 CESNET, z.s.p.o. * Copyright (c) 2012-2014 CESNET, z.s.p.o.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
* 1. Redistributions of source code must retain the above copyright * 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in * notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the * the documentation and/or other materials provided with the
* distribution. * distribution.
skipping to change at line 44 skipping to change at line 44
* in contract, strict liability, or tort (including negligence or * in contract, strict liability, or tort (including negligence or
* otherwise) arising in any way out of the use of this software, even * otherwise) arising in any way out of the use of this software, even
* if advised of the possibility of such damage. * if advised of the possibility of such damage.
* *
*/ */
#ifndef LIBNETCONF_H_ #ifndef LIBNETCONF_H_
#define LIBNETCONF_H_ #define LIBNETCONF_H_
#include "libnetconf/notifications.h" #include "libnetconf/notifications.h"
#include "libnetconf/url.h"
#include "libnetconf/netconf.h" #include "libnetconf/netconf.h"
#include "libnetconf/callbacks.h" #include "libnetconf/callbacks.h"
#include "libnetconf/session.h" #include "libnetconf/session.h"
#include "libnetconf/messages.h" #include "libnetconf/messages.h"
#include "libnetconf/with_defaults.h" #include "libnetconf/with_defaults.h"
#include "libnetconf/error.h" #include "libnetconf/error.h"
#include "libnetconf/datastore.h" #include "libnetconf/datastore.h"
#include "libnetconf/transapi.h"
#endif /* LIBNETCONF_H_ */ #endif /* LIBNETCONF_H_ */
 End of changes. 3 change blocks. 
2 lines changed or deleted 2 lines changed or added


 libnetconf_ssh.h   libnetconf_ssh.h 
/** /**
* \file libnetconf_ssh.h * \file libnetconf_ssh.h
* \author Radek Krejci <rkrejci@cesnet.cz> * \author Radek Krejci <rkrejci@cesnet.cz>
* \brief libnetconf's header for control libssh2. * \brief libnetconf's header for control libssh2.
* *
* Copyright (C) 2012 CESNET, z.s.p.o. * Copyright (c) 2012-2014 CESNET, z.s.p.o.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
* 1. Redistributions of source code must retain the above copyright * 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in * notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the * the documentation and/or other materials provided with the
* distribution. * distribution.
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 libnetconf_xml.h   libnetconf_xml.h 
/** /**
* \file libnetconf_xml.h * \file libnetconf_xml.h
* \author Radek Krejci <rkrejci@cesnet.cz> * \author Radek Krejci <rkrejci@cesnet.cz>
* \brief libnetconf's main header for libxml2 variants of some functions. * \brief libnetconf's main header for libxml2 variants of some functions.
* *
* Copyright (C) 2012 CESNET, z.s.p.o. * Copyright (c) 2012-2014 CESNET, z.s.p.o.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
* 1. Redistributions of source code must retain the above copyright * 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in * notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the * the documentation and/or other materials provided with the
* distribution. * distribution.
skipping to change at line 45 skipping to change at line 45
* otherwise) arising in any way out of the use of this software, even * otherwise) arising in any way out of the use of this software, even
* if advised of the possibility of such damage. * if advised of the possibility of such damage.
* *
*/ */
#ifndef LIBNETCONF_XML_H_ #ifndef LIBNETCONF_XML_H_
#define LIBNETCONF_XML_H_ #define LIBNETCONF_XML_H_
#include "libnetconf/notifications_xml.h" #include "libnetconf/notifications_xml.h"
#include "libnetconf/messages_xml.h" #include "libnetconf/messages_xml.h"
#include "libnetconf/transapi_xml.h" #include "libnetconf/datastore_xml.h"
#include "libnetconf/transapi.h"
#include "libnetconf.h" #include "libnetconf.h"
#endif /* LIBNETCONF_XML_H_ */ #endif /* LIBNETCONF_XML_H_ */
 End of changes. 2 change blocks. 
2 lines changed or deleted 3 lines changed or added


 messages.h   messages.h 
/** /**
* \file messages.h * \file messages.h
* \author Radek Krejci <rkrejci@cesnet.cz> * \author Radek Krejci <rkrejci@cesnet.cz>
* \brief Functions to create NETCONF messages. * \brief Functions to create NETCONF messages.
* *
* Copyright (C) 2012 CESNET, z.s.p.o. * Copyright (c) 2012-2014 CESNET, z.s.p.o.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
* 1. Redistributions of source code must retain the above copyright * 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in * notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the * the documentation and/or other materials provided with the
* distribution. * distribution.
skipping to change at line 145 skipping to change at line 145
/** /**
* @ingroup rpc * @ingroup rpc
* @brief Get message-id of the given rpc. * @brief Get message-id of the given rpc.
* @param[in] rpc rpc message. * @param[in] rpc rpc message.
* @return message-id of the given rpc message. * @return message-id of the given rpc message.
*/ */
const nc_msgid nc_rpc_get_msgid(const nc_rpc *rpc); const nc_msgid nc_rpc_get_msgid(const nc_rpc *rpc);
/** /**
* @ingroup rpc * @ingroup rpc
* @brief Get user's rpc operation namespace
* @param rpc rpc message.
* @return Namespace URI.
*/
char *nc_rpc_get_ns(const nc_rpc *rpc);
/**
* @ingroup rpc
* @brief Get operation of the given rpc. * @brief Get operation of the given rpc.
* @param[in] rpc rpc message. * @param[in] rpc rpc message.
* @return Operation identification of the given rpc message. * @return Operation identification of the given rpc message.
*/ */
NC_OP nc_rpc_get_op(const nc_rpc *rpc); NC_OP nc_rpc_get_op(const nc_rpc *rpc);
/** /**
* @ingroup rpc * @ingroup rpc
* @brief Get operation name of the given rpc. * @brief Get operation name of the given rpc.
* @param[in] rpc rpc message. * @param[in] rpc rpc message.
* @return Name of operation in the given rpc message. Caller * @return Name of operation in the given rpc message. Caller
* is responsible for freeing the returned string with free(). * is responsible for freeing the returned string with free().
*/ */
char * nc_rpc_get_op_name (const nc_rpc* rpc); char * nc_rpc_get_op_name (const nc_rpc* rpc);
/** /**
* @ingroup rpc * @ingroup rpc
* @brief Get operation namespace of the given rpc.
* @param[in] rpc rpc message.
* @return Namespace of operation in the given rpc message. Caller
* is responsible for freeing the returned string with free().
*/
char * nc_rpc_get_op_namespace (const nc_rpc* rpc);
/**
* @ingroup rpc
* @brief Get content of the operation specification from the given rpc. * @brief Get content of the operation specification from the given rpc.
* @param[in] rpc rpc message. * @param[in] rpc rpc message.
* @return String in XML form starting with the operation name element. Cal ler * @return String in XML form starting with the operation name element. Cal ler
* is responsible for freeing the returned string with free(). * is responsible for freeing the returned string with free().
*/ */
char* nc_rpc_get_op_content(const nc_rpc *rpc); char* nc_rpc_get_op_content(const nc_rpc *rpc);
/** /**
* @ingroup rpc * @ingroup rpc
* @brief Get type of the rpc message. * @brief Get type of the rpc message.
skipping to change at line 309 skipping to change at line 326
* @ingroup reply * @ingroup reply
* @param[in] reply reply message to free. * @param[in] reply reply message to free.
*/ */
void nc_reply_free(nc_reply *reply); void nc_reply_free(nc_reply *reply);
/** /**
* @ingroup reply * @ingroup reply
* @brief Create \<ok\> rpc-reply response. * @brief Create \<ok\> rpc-reply response.
* @return Created \<rpc-reply\> message. * @return Created \<rpc-reply\> message.
*/ */
nc_reply *nc_reply_ok(); nc_reply *nc_reply_ok(void);
/** /**
* @ingroup reply * @ingroup reply
* @brief Create rpc-reply response with \<data\> content. * @brief Create rpc-reply response with \<data\> content.
* @param[in] data Serialized XML content of the \<data\> element for the * @param[in] data Serialized XML content of the \<data\> element for the
* \<rpc-reply\> message being created. * \<rpc-reply\> message being created.
* @return Created \<rpc-reply\> message. * @return Created \<rpc-reply\> message.
*/ */
nc_reply *nc_reply_data(const char* data); nc_reply *nc_reply_data(const char* data);
 End of changes. 4 change blocks. 
2 lines changed or deleted 19 lines changed or added


 messages_xml.h   messages_xml.h 
/** /**
* \file messages.h * \file messages.h
* \author Radek Krejci <rkrejci@cesnet.cz> * \author Radek Krejci <rkrejci@cesnet.cz>
* \brief Functions to create NETCONF messages. * \brief Functions to create NETCONF messages.
* *
* Copyright (C) 2012 CESNET, z.s.p.o. * Copyright (c) 2012-2014 CESNET, z.s.p.o.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
* 1. Redistributions of source code must retain the above copyright * 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in * notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the * the documentation and/or other materials provided with the
* distribution. * distribution.
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 netconf.h   netconf.h 
/** /**
* \file netconf.h * \file netconf.h
* \author Radek Krejci <rkrejci@cesnet.cz> * \author Radek Krejci <rkrejci@cesnet.cz>
* \brief libnetconf's general public functions and structures definitions. * \brief libnetconf's general public functions and structures definitions.
* *
* Copyright (C) 2012 CESNET, z.s.p.o. * Copyright (c) 2012-2014 CESNET, z.s.p.o.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
* 1. Redistributions of source code must retain the above copyright * 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in * notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the * the documentation and/or other materials provided with the
* distribution. * distribution.
skipping to change at line 119 skipping to change at line 119
NC_SESSION_STATUS_ERROR = -1, /**< undefined status or the error ret urn code */ NC_SESSION_STATUS_ERROR = -1, /**< undefined status or the error ret urn code */
NC_SESSION_STATUS_STARTUP = 0, /**< session is setting up */ NC_SESSION_STATUS_STARTUP = 0, /**< session is setting up */
NC_SESSION_STATUS_WORKING = 1, /**< session is established and ready to work */ NC_SESSION_STATUS_WORKING = 1, /**< session is established and ready to work */
NC_SESSION_STATUS_CLOSING = 2, /**< session is being closed */ NC_SESSION_STATUS_CLOSING = 2, /**< session is being closed */
NC_SESSION_STATUS_CLOSED = 3, /**< session was closed and could not be used for communication */ NC_SESSION_STATUS_CLOSED = 3, /**< session was closed and could not be used for communication */
NC_SESSION_STATUS_DUMMY = 4 /**< session is DUMMY, only holds inform ation, does not provide connection */ NC_SESSION_STATUS_DUMMY = 4 /**< session is DUMMY, only holds inform ation, does not provide connection */
} NC_SESSION_STATUS; } NC_SESSION_STATUS;
/** /**
* @ingroup session * @ingroup session
* @brief Enumeration of reasonf of the NETCONF session termination as defi ned * @brief Enumeration of reasons of the NETCONF session termination as defi ned
* in RFC 6470. * in RFC 6470.
*/ */
typedef enum NC_SESSION_TERM_REASON { typedef enum NC_SESSION_TERM_REASON {
NC_SESSION_TERM_CLOSED, /**< closed by client in a normal fashion */ NC_SESSION_TERM_CLOSED, /**< closed by client in a normal fashion */
NC_SESSION_TERM_KILLED, /**< session was terminated by \<kill-sessio n\> operation */ NC_SESSION_TERM_KILLED, /**< session was terminated by \<kill-sessio n\> operation */
NC_SESSION_TERM_DROPPED, /**< transport layer connection was unexpec tedly closed */ NC_SESSION_TERM_DROPPED, /**< transport layer connection was unexpec tedly closed */
NC_SESSION_TERM_TIMEOUT, /**< terminated because of inactivity */ NC_SESSION_TERM_TIMEOUT, /**< terminated because of inactivity */
NC_SESSION_TERM_BADHELLO, /**< \<hello\> message was invalid */ NC_SESSION_TERM_BADHELLO, /**< \<hello\> message was invalid */
NC_SESSION_TERM_OTHER /**< terminated for some other reason */ NC_SESSION_TERM_OTHER /**< terminated for some other reason */
} NC_SESSION_TERM_REASON; } NC_SESSION_TERM_REASON;
skipping to change at line 373 skipping to change at line 373
} NC_VERB_LEVEL; } NC_VERB_LEVEL;
/** /**
* @brief Set libnetconf's verbosity level. * @brief Set libnetconf's verbosity level.
* @param[in] level Enabled verbosity level (includes all the levels with h igher priority). * @param[in] level Enabled verbosity level (includes all the levels with h igher priority).
* @ingroup genAPI * @ingroup genAPI
*/ */
void nc_verbosity(NC_VERB_LEVEL level); void nc_verbosity(NC_VERB_LEVEL level);
/** /**
* @brief Function for logging error messages.
* @param[in] format printf's format string
* @param[in] ... list of arguments specified in format
* @ingroup genAPI
*/
void nc_verb_error(const char * format, ...);
/**
* @brief Function for logging warning messages.
* @param[in] format printf's format string
* @param[in] ... list of arguments specified in format
* @ingroup genAPI
*/
void nc_verb_warning(const char * format, ...);
/**
* @brief Function for logging verbose messages.
* @param[in] format printf's format string
* @param[in] ... list of arguments specified in format
* @ingroup genAPI
*/
void nc_verb_verbose(const char * format, ...);
/**
* @ingroup genAPI * @ingroup genAPI
* @brief Initialize libnetconf for system-wide usage. This initialization is * @brief Initialize libnetconf for system-wide usage. This initialization is
* shared across all the processes * shared across all the processes
* @param[in] flags ORed flags for libnetconf initialization. Accepted valu es * @param[in] flags ORed flags for libnetconf initialization. Accepted valu es
* include: * include:
* - *NC_INIT_ALL* Enable all available subsystems * - *NC_INIT_ALL* Enable all available subsystems
* - *NC_INIT_MONITORING* Enable ietf-netconf-monitoring module * - *NC_INIT_MONITORING* Enable ietf-netconf-monitoring module
* - *NC_INIT_WD* Enable With-default capability * - *NC_INIT_WD* Enable With-default capability
* - *NC_INIT_NOTIF* Enable Notification subsystem * - *NC_INIT_NOTIF* Enable Notification subsystem
* - *NC_INIT_NACM* Enable NETCONF Access Control subsystem * - *NC_INIT_NACM* Enable NETCONF Access Control subsystem
* @return -1 on fatal error\n 0 if this is the first init after previous * @return -1 on fatal error\n 0 if this is the first init after previous
* system-wide nc_close() or system reboot\n 1 when someone else already ca lled * system-wide nc_close() or system reboot\n 1 when someone else already ca lled
* nc_init() since last system-wide nc_close() or system reboot. * nc_init() since last system-wide nc_close() or system reboot.
*/ */
int nc_init(int flags); int nc_init(int flags);
#define NC_INIT_ALL 0xffffffff /**< nc_init()'s flag to enable all o ptional features/subsystems */ #define NC_INIT_ALL 0xffffffff /**< nc_init()'s flag to enable all o ptional features/subsystems */
#define NC_INIT_NOTIF 0x00000002 /**< nc_init()'s flag to enable Notif ication subsystem. */ #define NC_INIT_NOTIF 0x00000002 /**< nc_init()'s flag to enable Notif ication subsystem. */
#define NC_INIT_NACM 0x00000004 /**< nc_init()'s flag to enable Accce ss Control subsystem */ #define NC_INIT_NACM 0x00000004 /**< nc_init()'s flag to enable Accce ss Control subsystem */
#define NC_INIT_MONITORING 0x00000008 /**< nc_init()'s flag to enable ietf- netconf-monitoring module */ #define NC_INIT_MONITORING 0x00000008 /**< nc_init()'s flag to enable ietf- netconf-monitoring module */
#define NC_INIT_WD 0x00000010 /**< nc_init()'s flag to enable with- default capability */ #define NC_INIT_WD 0x00000010 /**< nc_init()'s flag to enable with- default capability */
#define NC_INIT_VALIDATE 0x00000020 /**< nc_init()'s flag to enable serve
r's validation capability */
#define NC_INIT_URL 0x00000040 /**< nc_init()'s flag to enable serve
r's URL capability */
/** /**
* @ingroup genAPI * @ingroup genAPI
* @param[in] system Flag if close should be applied as system-wide. * @param[in] system Flag if close should be applied as system-wide.
* System-wide nc_close() closes all the shared structures if no other libn etconf * System-wide nc_close() closes all the shared structures if no other libn etconf
* participant is currently running. Local release of the calling instance * participant is currently running. Local release of the calling instance
* from the shared structures is done in both cases. * from the shared structures is done in both cases.
* @return -1 on error\n 0 on success\n 1 in case of system-wide when there is * @return -1 on error\n 0 on success\n 1 in case of system-wide when there is
* another participant using shared structures and system-wide close cannot be * another participant using shared structures and system-wide close cannot be
* done. * done.
 End of changes. 4 change blocks. 
2 lines changed or deleted 30 lines changed or added


 notifications.h   notifications.h 
/** /**
* \file notifications.h * \file notifications.h
* \author Radek Krejci <rkrejci@cesnet.cz> * \author Radek Krejci <rkrejci@cesnet.cz>
* \brief Functions to handle NETCONF Notifications. * \brief Functions to handle NETCONF Notifications.
* *
* Copyright (C) 2012 CESNET, z.s.p.o. * Copyright (c) 2012-2014 CESNET, z.s.p.o.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
* 1. Redistributions of source code must retain the above copyright * 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in * notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the * the documentation and/or other materials provided with the
* distribution. * distribution.
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 notifications_xml.h   notifications_xml.h 
/** /**
* \file notifications_xml.h * \file notifications_xml.h
* \author Radek Krejci <rkrejci@cesnet.cz> * \author Radek Krejci <rkrejci@cesnet.cz>
* \brief NETCONF Notifications functions with libxml2 support. * \brief NETCONF Notifications functions with libxml2 support.
* *
* Copyright (C) 2012 CESNET, z.s.p.o. * Copyright (c) 2012-2014 CESNET, z.s.p.o.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
* 1. Redistributions of source code must retain the above copyright * 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in * notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the * the documentation and/or other materials provided with the
* distribution. * distribution.
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 session.h   session.h 
/** /**
* \file session.h * \file session.h
* \author Radek Krejci <rkrejci@cesnet.cz> * \author Radek Krejci <rkrejci@cesnet.cz>
* \brief Functions to handle NETCONF sessions. * \brief Functions to handle NETCONF sessions.
* *
* Copyright (C) 2012 CESNET, z.s.p.o. * Copyright (c) 2012-2014 CESNET, z.s.p.o.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
* 1. Redistributions of source code must retain the above copyright * 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in * notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the * the documentation and/or other materials provided with the
* distribution. * distribution.
skipping to change at line 83 skipping to change at line 83
* @ingroup session * @ingroup session
* @brief Add the session into the internal list of monitored sessions that are * @brief Add the session into the internal list of monitored sessions that are
* returned as part of netconf-state information defined in RFC 6022. * returned as part of netconf-state information defined in RFC 6022.
* @param session Session to be monitored; * @param session Session to be monitored;
* @return 0 on success, non-zero on error. * @return 0 on success, non-zero on error.
*/ */
int nc_session_monitor(struct nc_session* session); int nc_session_monitor(struct nc_session* session);
/** /**
* @ingroup session * @ingroup session
* @brief Close NETCONF connection with the server.
*
* Only nc_session_free() and nc_session_get_status() functions are allowed
* after this call.
*
* @param[in] session Session to close.
* @param[in] reason Type of the session termination reason.
*/
void nc_session_close (struct nc_session* session, NC_SESSION_TERM_REASON r
eason);
/**
* @ingroup session
* @brief Cleanup the session structure and free all the allocated resource s. * @brief Cleanup the session structure and free all the allocated resource s.
* *
* Do not use the given session structure after this call. * Do not use the given session structure after this call.
* *
* @param[in] session Session to free. * @param[in] session Session to free.
*/ */
void nc_session_free (struct nc_session* session); void nc_session_free (struct nc_session* session);
/** /**
* @ingroup session * @ingroup session
skipping to change at line 295 skipping to change at line 283
* @ingroup session * @ingroup session
* @brief Get NULL terminated list of the default capabilities supported by * @brief Get NULL terminated list of the default capabilities supported by
* libnetconf including the list of namespaces provided by the datastores * libnetconf including the list of namespaces provided by the datastores
* created with ncds_new() and initialized by ncds_init(). * created with ncds_new() and initialized by ncds_init().
* *
* The caller is supposed to free the returned structure with nc_cpblts_fre e(). * The caller is supposed to free the returned structure with nc_cpblts_fre e().
* *
* @return NETCONF capabilities structure containing capabilities supported by * @return NETCONF capabilities structure containing capabilities supported by
* libnetconf. * libnetconf.
*/ */
struct nc_cpblts *nc_session_get_cpblts_default(); struct nc_cpblts *nc_session_get_cpblts_default(void);
/** /**
* @ingroup rpc * @ingroup rpc
* @brief Send \<rpc\> request via specified NETCONF session. * @brief Send \<rpc\> request via specified NETCONF session.
* This function is supposed to be performed only by NETCONF clients. * This function is supposed to be performed only by NETCONF clients.
* *
* This function IS thread safe. * This function IS thread safe.
* *
* @param[in] session NETCONF session to use. * @param[in] session NETCONF session to use.
* @param[in] rpc \<rpc\> message to send. * @param[in] rpc \<rpc\> message to send.
skipping to change at line 398 skipping to change at line 386
* @ingroup rpc * @ingroup rpc
* @brief Send \<rpc\> and receive \<rpc-reply\> via the specified NETCONF session. * @brief Send \<rpc\> and receive \<rpc-reply\> via the specified NETCONF session.
* @param[in] session NETCONF session to use. * @param[in] session NETCONF session to use.
* @param[in] rpc RPC message to send. * @param[in] rpc RPC message to send.
* @param[out] reply Received \<rpc-reply\> * @param[out] reply Received \<rpc-reply\>
* @return Type of the received message. #NC_MSG_UNKNOWN means error, #NC_M SG_REPLY * @return Type of the received message. #NC_MSG_UNKNOWN means error, #NC_M SG_REPLY
* means that *reply points to the received \<rpc-reply\> message. * means that *reply points to the received \<rpc-reply\> message.
*/ */
NC_MSG_TYPE nc_session_send_recv (struct nc_session* session, nc_rpc *rpc, nc_reply** reply); NC_MSG_TYPE nc_session_send_recv (struct nc_session* session, nc_rpc *rpc, nc_reply** reply);
/**
* ingroup session
* @brief Get human-readable description to the specific type of the sessio
n
* termination reason.
* @param[in] reason Type of the session termination reason.
* @return String describing the given termination reason value.
*/
const char* nc_session_term_string(NC_SESSION_TERM_REASON reason);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* SESSION_H_ */ #endif /* SESSION_H_ */
 End of changes. 4 change blocks. 
25 lines changed or deleted 2 lines changed or added


 ssh.h   ssh.h 
/** /**
* \file ssh.h * \file ssh.h
* \author Radek Krejci <rkrejci@cesnet.cz> * \author Radek Krejci <rkrejci@cesnet.cz>
* \brief Functions to connect to NETCONF server via SSH2. * \brief Functions to connect to NETCONF server via SSH2.
* *
* Copyright (C) 2012 CESNET, z.s.p.o. * Copyright (c) 2012-2014 CESNET, z.s.p.o.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
* 1. Redistributions of source code must retain the above copyright * 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in * notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the * the documentation and/or other materials provided with the
* distribution. * distribution.
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 transapi.h   transapi.h 
#ifndef _TRANSAPI_H #ifndef _TRANSAPI_H
#define _TRANSAPI_H #define _TRANSAPI_H
#include <libxml/tree.h>
#include "../libnetconf.h" #include "../libnetconf.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/* Current transAPI version */
#define TRANSAPI_VERSION 3
/* maximal number of input arguments every defined RPC can have */ /* maximal number of input arguments every defined RPC can have */
#ifndef MAX_RPC_INPUT_ARGS #ifndef MAX_RPC_INPUT_ARGS
#define MAX_RPC_INPUT_ARGS 64 #define MAX_RPC_INPUT_ARGS 64
#endif #endif
/** /**
* @ingroup transapi * @ingroup transapi
* @brief Enum specifying states of node in document * @brief Enum specifying states of node in document
*/ */
typedef enum {XMLDIFF_ERR = -1, XMLDIFF_NONE = 0, XMLDIFF_ADD = 1, XMLDIFF_ typedef enum
REM = 2, XMLDIFF_MOD = 4, XMLDIFF_CHAIN = 8} XMLDIFF_OP; {
XMLDIFF_ERR = -1 /**< Error while creating XML difftree. */,
XMLDIFF_NONE = 0 /**< Last operation did not cause any change in con
figuration. */,
XMLDIFF_ADD = 1 /**< Element was added to configuration. */,
XMLDIFF_REM = 2 /**< Element was removed from configuration. */,
XMLDIFF_MOD = 4/**< Element was modified. */,
XMLDIFF_CHAIN = 8/**< Some of children of element was modified/added
/removed. */,
XMLDIFF_SIBLING = 16 /**< Some sibling nodes were added/removed/chan
ged position. Only for LEAF and LEAF-LIST. */,
XMLDIFF_REORDER = 32 /**< Some of the children nodes changed theirs
position. None was added/removed. Only for LEAF and LEAF-LIST. */,
} XMLDIFF_OP;
/** /**
* @ingroup transapi * @ingroup transapi
* @brief Structure binding location in configuration XML data and function callback applying changes. * @brief Same as transapi_data_callbacks. Using libxml2 structures for cal lbacks parameters.
*/ */
struct transapi_data_callbacks { struct transapi_data_callbacks {
int callbacks_count; int callbacks_count;
void * data; void * data;
struct { struct {
char * path; char * path;
int (*func)(XMLDIFF_OP, char *, void **); int (*func)(void**, XMLDIFF_OP, xmlNodePtr, struct nc_err**) ;
} callbacks[]; } callbacks[];
}; };
/** /**
* @ingroup transapi * @ingroup transapi
* @brief Structure binding location in configuration XML data and function callback processing RPC message. * @brief Same as transapi_rpc_callbacks. Using libxml2 structures for call backs parameters.
*/ */
struct transapi_rpc_callbacks { struct transapi_rpc_callbacks {
int callbacks_count; int callbacks_count;
struct { struct {
char * name; char * name;
int arg_count; int arg_count;
nc_reply * (*func)(char *[]); nc_reply * (*func)(xmlNodePtr []);
char * arg_order[MAX_RPC_INPUT_ARGS]; char * arg_order[MAX_RPC_INPUT_ARGS];
} callbacks[]; } callbacks[];
}; };
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif
 End of changes. 7 change blocks. 
12 lines changed or deleted 29 lines changed or added


 with_defaults.h   with_defaults.h 
/** /**
* \file with_defaults.h * \file with_defaults.h
* \author Radek Krejci <rkrejci@cesnet.cz> * \author Radek Krejci <rkrejci@cesnet.cz>
* \brief Implementation of NETCONF's with-defaults capability defined in R FC 6243 * \brief Implementation of NETCONF's with-defaults capability defined in R FC 6243
* *
* Copyright (C) 2012 CESNET, z.s.p.o. * Copyright (c) 2012-2014 CESNET, z.s.p.o.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
* 1. Redistributions of source code must retain the above copyright * 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in * notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the * the documentation and/or other materials provided with the
* distribution. * distribution.
skipping to change at line 82 skipping to change at line 82
* This is an alternative for ncdflt_set_basic_mode(NCDFLT_MODE_DISABLED). To enable * This is an alternative for ncdflt_set_basic_mode(NCDFLT_MODE_DISABLED). To enable
* the with-defaults capability, use ncdflt_set_basic_mode() to set the wit h-defaults' * the with-defaults capability, use ncdflt_set_basic_mode() to set the wit h-defaults'
* basic mode. * basic mode.
*/ */
#define NCDFLT_DISABLE ncdflt_set_basic_mode(NCWD_MODE_DISABLED) #define NCDFLT_DISABLE ncdflt_set_basic_mode(NCWD_MODE_DISABLED)
/** /**
* @ingroup withdefaults * @ingroup withdefaults
* @brief Get the current set basic mode of the with-defaults capability. * @brief Get the current set basic mode of the with-defaults capability.
* @return Current value of the with-defaults' basic mode. * @return Current value of the with-defaults' basic mode.
*/ */
NCWD_MODE ncdflt_get_basic_mode(); NCWD_MODE ncdflt_get_basic_mode(void);
/** /**
* @ingroup withdefaults * @ingroup withdefaults
* @brief Set with-defaults modes that are supported. * @brief Set with-defaults modes that are supported.
* *
* This function should be used before establishing a NETCONF session to se ttle * This function should be used before establishing a NETCONF session to se ttle
* on a common set of capabilities between a client and a server. On the cl ient side, * on a common set of capabilities between a client and a server. On the cl ient side,
* this function has no effect. * this function has no effect.
* *
* @param[in] modes ORed set of the supported NCDFLT_MODE modes. The basic mode * @param[in] modes ORed set of the supported NCDFLT_MODE modes. The basic mode
* is always supported automatically. * is always supported automatically.
*/ */
void ncdflt_set_supported(NCWD_MODE modes); void ncdflt_set_supported(NCWD_MODE modes);
/** /**
* @ingroup withdefaults * @ingroup withdefaults
* @brief Get ORed value containing the currently supported with-defaults m odes. * @brief Get ORed value containing the currently supported with-defaults m odes.
* @return ORed value containing the currently supported with-defaults mode s. * @return ORed value containing the currently supported with-defaults mode s.
*/ */
NCWD_MODE ncdflt_get_supported(); NCWD_MODE ncdflt_get_supported(void);
/**
* @ingroup withdefaults
* @brief Set the \<with-defaults\> parameter for the given NETCONF RPC mes
sage.
*
* Sending RPC message with the \<with-default\> parameter set via a sessio
n
* which does not support the specified value or the with-defaults capabili
ty
* will fail.
*
* @param[in] rpc RPC message where \<with-defaults\> will be added.
* @param[in] mode Value for the \<with-defaults\> parameter,
* NCDFLT_MODE_DISABLED has no effect.
* @return 0 on success, non-zero else.
*/
int ncdflt_rpc_withdefaults(nc_rpc* rpc, NCWD_MODE mode);
/** /**
* @ingroup withdefaults * @ingroup withdefaults
* @brief Get value of the \<with-defaults\> element from the rpc message. * @brief Get value of the \<with-defaults\> element from the rpc message.
* @param[in] rpc RPC message to be parsed. * @param[in] rpc RPC message to be parsed.
* @return with-defaults mode of the NETCONF rpc message. * @return with-defaults mode of the NETCONF rpc message.
*/ */
NCWD_MODE ncdflt_rpc_get_withdefaults(const nc_rpc* rpc); NCWD_MODE ncdflt_rpc_get_withdefaults(const nc_rpc* rpc);
#ifdef __cplusplus #ifdef __cplusplus
 End of changes. 3 change blocks. 
21 lines changed or deleted 3 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/