- Refactor yang patch code according to Clixon coding style

- Fixed all memory leaks
This commit is contained in:
Olof hagsand 2021-09-08 10:36:48 +02:00
parent e3d0566d3c
commit d1ed4ecd7d
8 changed files with 495 additions and 811 deletions

View file

@ -591,7 +591,7 @@ api_data_write(clicon_handle h,
* @param[in] data Stream input data
* @param[in] pretty Set to 1 for pretty-printed xml/json output
* @param[in] media_out Output media
* @param[in] ds 0 if "data" resource, 1 if rfc8527 "ds" resource
* @note restconf PUT is mapped to edit-config replace.
* @see RFC8040 Sec 4.5 PUT
* @see api_data_post
@ -645,6 +645,7 @@ api_data_put(clicon_handle h,
* @param[in] data Stream input data
* @param[in] pretty Set to 1 for pretty-printed xml/json output
* @param[in] media_out Output media
* @param[in] ds 0 if "data" resource, 1 if rfc8527 "ds" resource
* Netconf: <edit-config> (nc:operation="merge")
* See RFC8040 Sec 4.6.1
* Plain patch can be used to create or update, but not delete, a child
@ -678,7 +679,7 @@ api_data_patch(clicon_handle h,
case YANG_PATCH_XML:
#ifdef YANG_PATCH
ret = api_data_yang_patch(h, req, api_path0, pcvec, pi, qvec, data, pretty,
media_out, ds);
media_in, media_out, ds);
#else
ret = restconf_notimplemented(h, req, pretty, media_out);
#endif

View file

@ -318,6 +318,7 @@ api_data_get2(clicon_handle h,
* @param[in] qvec Vector of query string (QUERY_STRING)
* @param[in] pretty Set to 1 for pretty-printed xml/json output
* @param[in] media_out Output media
* @param[in] ds 0 if "data" resource, 1 if rfc8527 "ds" resource
*
* The HEAD method is sent by the client to retrieve just the header fields
* that would be returned for the comparable GET method, without the
@ -348,11 +349,10 @@ api_data_head(clicon_handle h,
* @param[in] qvec Vector of query string (QUERY_STRING)
* @param[in] pretty Set to 1 for pretty-printed xml/json output
* @param[in] media_out Output media
* @param[in] ds RFC8527 datastore
* @code
* curl -G http://localhost/restconf/data/interfaces/interface=eth0
* @endcode
* XXX: cant find a way to use Accept request field to choose Content-Type
* I would like to support both xml and json.
* Request may contain
* Accept: application/yang.data+json,application/yang.data+xml
* Response contains one of:

File diff suppressed because it is too large Load diff

View file

@ -4,6 +4,7 @@
Copyright (C) 2009-2019 Olof Hagsand
Copyright (C) 2020-2021 Olof Hagsand and Rubicon Communications, LLC(Netgate)
Copyright (C) 2021 Siklu Ltd (YANG patch code)
This file is part of CLIXON.
@ -32,7 +33,7 @@
***** END LICENSE BLOCK *****
* Restconf YANG PATCH implementation
* Restconf YANG PATCH implementation (RFC8072)
*/
@ -45,6 +46,7 @@
int api_data_yang_patch(clicon_handle h, void *req, char *api_path0,
cvec *pcvec, int pi,
cvec *qvec, char *data,
int pretty, restconf_media media_out, ietf_ds_t ds);
int pretty, restconf_media media_in, restconf_media media_out,
ietf_ds_t ds);
#endif /* _RESTCONF_METHODS_PATCH_H_ */

View file

@ -125,6 +125,7 @@ http_location_header(clicon_handle h,
* @param[in] data Stream input data
* @param[in] pretty Set to 1 for pretty-printed xml/json output
* @param[in] media_out Output media
* @param[in] ds 0 if "data" resource, 1 if rfc8527 "ds" resource
* @retval 0 OK
* @retval -1 Error
* restconf POST is mapped to edit-config create.