Add helper functions for bits data type

This commit is contained in:
Mico Micic 2024-03-03 19:12:18 +01:00 committed by Olof Hagsand
parent e07fdb3089
commit 4f306056ea
2 changed files with 231 additions and 0 deletions

View file

@ -40,6 +40,15 @@
#ifndef _CLIXON_XML_MAP_H_
#define _CLIXON_XML_MAP_H_
/*
* Maximum number of supported bit pisitions in YANG "bits" data
* type. As defined in RFC7950 (section 9.7.4.2.) the position
* value must be in the range 0 to 4294967295. But who needs
* that much bit positions? (To set bit 4'294'967'295 it would be
* necessary to tranfer 4294967295/8 = 536'870'911 bytes!)
*/
#define CLIXON_BITS_POS_MAX 1024
/*
* Types
*/
@ -68,6 +77,8 @@ int assign_namespace_element(cxobj *x0, cxobj *x1, cxobj *x1p);
int assign_namespace_body(cxobj *x0, cxobj *x1);
int xml_merge(cxobj *x0, cxobj *x1, yang_stmt *yspec, char **reason);
int yang_valstr2enum(yang_stmt *ytype, char *valstr, char **enumstr);
int yang_bitsstr2val(yang_stmt *ytype, char *bitsstr, unsigned char **snmpval, size_t *snmplen);
int yang_val2bitsstr(yang_stmt *ytype, unsigned char *snmpval, size_t snmplen, cbuf *cb);
int yang_enum2valstr(yang_stmt *ytype, char *enumstr, char **valstr);
int yang_enum2int(yang_stmt *ytype, char *enumstr, int32_t *val);
int yang_enum_int_value(cxobj *node, int32_t *val);