SNMP frontend, restructure files

Split snmp_mib_yang.c into: snmp_register.[ch] and snmp_handler.[ch]
This commit is contained in:
Olof hagsand 2022-05-19 16:01:25 +02:00
parent f905f66efa
commit ef604be610
8 changed files with 463 additions and 87 deletions

View file

@ -40,6 +40,21 @@ extern "C" {
#ifndef _SNMP_LIB_H_
#define _SNMP_LIB_H_
/*
* Types
*/
/* Userdata to pass around in netsmp callbacks
*/
struct clixon_snmp_handle {
clicon_handle sh_h;
yang_stmt *sh_ys;
oid sh_oid[MAX_OID_LEN]; /* OID for debug, may be removed? */
size_t sh_oidlen;
char *sh_default; /* MIB default value leaf only */
netsnmp_table_data_set *sh_table; /* table struct, table only */
};
typedef struct clixon_snmp_handle clixon_snmp_handle;
/*
* Prototypes
*/
@ -50,6 +65,7 @@ int type_yang2snmp(char *valstr, enum cv_type cvtype,
netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests,
u_char **snmpval, size_t *snmplen);
int yang2xpath(yang_stmt *ys, char **xpath);
int clixon_table_create(netsnmp_table_data_set *table, yang_stmt *ys, clicon_handle h);
#endif /* _SNMP_LIB_H_ */