* RESTCONF "content" query parameter supported

* New clixon-lib@2019-08-13.yang revision
* Bugfix: If `ietf-netconf.yang` was imported from any yang module, client/backend communication stops working.
This commit is contained in:
Olof hagsand 2019-08-13 13:21:11 +02:00
parent 48022e57b9
commit 8b7b7b0f60
20 changed files with 507 additions and 62 deletions

View file

@ -143,6 +143,7 @@ static const map_str2int http_reason_phrase_map[] = {
};
/* See RFC 8040
* @see restconf_media_str2int
*/
static const map_str2int http_media_map[] = {
{"application/yang-data+xml", YANG_DATA_XML},
@ -152,6 +153,16 @@ static const map_str2int http_media_map[] = {
{NULL, -1}
};
/* See RFC 8040 4.8.1
* @see query_content_str2int
*/
static const map_str2int query_content_map[] = {
{"config", CONTENT_CONFIG},
{"nonconfig", CONTENT_NONCONFIG},
{"all", CONTENT_ALL},
{NULL, -1}
};
int
restconf_err2code(char *tag)
{
@ -176,6 +187,18 @@ restconf_media_int2str(restconf_media media)
return clicon_int2str(http_media_map, media);
}
const query_content
query_content_str2int(char *str)
{
return clicon_str2int(query_content_map, str);
}
const char *
query_content_int2str(query_content nr)
{
return clicon_int2str(query_content_map, nr);
}
/*! Return media_in from Content-Type, -1 if not found or unrecognized
* @note media-type syntax does not support parameters
* @see RFC7231 Sec 3.1.1.1 for media-type syntax type: