Changed index structs to mib_list_node structs to place the table index trees directly in the mib tree.

This commit is contained in:
christiaans 2006-09-01 07:14:50 +00:00
parent 1485edf8e1
commit 130d39cc03
7 changed files with 746 additions and 240 deletions

View File

@ -48,7 +48,6 @@
struct netif *netif_list = NULL; struct netif *netif_list = NULL;
struct netif *netif_default = NULL; struct netif *netif_default = NULL;
u16_t netif_cnt = 0;
/** /**
* Add a network interface to the list of lwIP netifs. * Add a network interface to the list of lwIP netifs.
@ -92,7 +91,8 @@ netif_add(struct netif *netif, struct ip_addr *ipaddr, struct ip_addr *netmask,
/* add this netif to the list */ /* add this netif to the list */
netif->next = netif_list; netif->next = netif_list;
netif_list = netif; netif_list = netif;
netif_cnt++; snmp_inc_iflist();
LWIP_DEBUGF(NETIF_DEBUG, ("netif: added interface %c%c IP addr ", LWIP_DEBUGF(NETIF_DEBUG, ("netif: added interface %c%c IP addr ",
netif->name[0], netif->name[1])); netif->name[0], netif->name[1]));
ip_addr_debug_print(NETIF_DEBUG, ipaddr); ip_addr_debug_print(NETIF_DEBUG, ipaddr);
@ -117,10 +117,12 @@ void netif_remove(struct netif * netif)
{ {
if ( netif == NULL ) return; if ( netif == NULL ) return;
snmp_delete_ipaddridx_tree(netif);
/* is it the first netif? */ /* is it the first netif? */
if (netif_list == netif) { if (netif_list == netif) {
netif_list = netif->next; netif_list = netif->next;
netif_cnt--; snmp_dec_iflist();
} }
else { else {
/* look for netif further down the list */ /* look for netif further down the list */
@ -128,7 +130,7 @@ void netif_remove(struct netif * netif)
for (tmpNetif = netif_list; tmpNetif != NULL; tmpNetif = tmpNetif->next) { for (tmpNetif = netif_list; tmpNetif != NULL; tmpNetif = tmpNetif->next) {
if (tmpNetif->next == netif) { if (tmpNetif->next == netif) {
tmpNetif->next = netif->next; tmpNetif->next = netif->next;
netif_cnt--; snmp_dec_iflist();
break; break;
} }
} }
@ -203,7 +205,13 @@ netif_set_ipaddr(struct netif *netif, struct ip_addr *ipaddr)
} }
} }
#endif #endif
snmp_delete_ipaddridx_tree(netif);
snmp_delete_iprteidx_tree(0,netif);
/* set new IP address to netif */
ip_addr_set(&(netif->ip_addr), ipaddr); ip_addr_set(&(netif->ip_addr), ipaddr);
snmp_insert_ipaddridx_tree(netif);
snmp_insert_iprteidx_tree(0,netif);
#if 0 /* only allowed for Ethernet interfaces TODO: how can we check? */ #if 0 /* only allowed for Ethernet interfaces TODO: how can we check? */
/** For Ethernet network interfaces, we would like to send a /** For Ethernet network interfaces, we would like to send a
* "gratuitous ARP"; this is an ARP packet sent by a node in order * "gratuitous ARP"; this is an ARP packet sent by a node in order
@ -235,7 +243,10 @@ netif_set_gw(struct netif *netif, struct ip_addr *gw)
void void
netif_set_netmask(struct netif *netif, struct ip_addr *netmask) netif_set_netmask(struct netif *netif, struct ip_addr *netmask)
{ {
snmp_delete_iprteidx_tree(0, netif);
/* set new netmask to netif */
ip_addr_set(&(netif->netmask), netmask); ip_addr_set(&(netif->netmask), netmask);
snmp_insert_iprteidx_tree(0, netif);
LWIP_DEBUGF(NETIF_DEBUG | DBG_TRACE | DBG_STATE | 3, ("netif: netmask of interface %c%c set to %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n", LWIP_DEBUGF(NETIF_DEBUG | DBG_TRACE | DBG_STATE | 3, ("netif: netmask of interface %c%c set to %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n",
netif->name[0], netif->name[1], netif->name[0], netif->name[1],
ip4_addr1(&netif->netmask), ip4_addr1(&netif->netmask),
@ -247,6 +258,16 @@ netif_set_netmask(struct netif *netif, struct ip_addr *netmask)
void void
netif_set_default(struct netif *netif) netif_set_default(struct netif *netif)
{ {
if (netif == NULL)
{
/* remove default route */
snmp_delete_iprteidx_tree(1, netif);
}
else
{
/* install default route */
snmp_insert_iprteidx_tree(1, netif);
}
netif_default = netif; netif_default = netif;
LWIP_DEBUGF(NETIF_DEBUG, ("netif: setting default interface %c%c\n", LWIP_DEBUGF(NETIF_DEBUG, ("netif: setting default interface %c%c\n",
netif ? netif->name[0] : '\'', netif ? netif->name[1] : '\'')); netif ? netif->name[0] : '\'', netif ? netif->name[1] : '\''));
@ -297,6 +318,5 @@ void
netif_init(void) netif_init(void)
{ {
netif_list = netif_default = NULL; netif_list = netif_default = NULL;
netif_cnt = 0;
} }

File diff suppressed because it is too large Load Diff

View File

@ -158,47 +158,51 @@ snmp_iptooid(struct ip_addr *ip, s32_t *ident)
ident[3] = trnc & 0xff; ident[3] = trnc & 0xff;
} }
struct idx_node * struct mib_list_node *
snmp_idx_node_alloc(s32_t id) snmp_mib_ln_alloc(s32_t id)
{ {
struct idx_node *in; struct mib_list_node *ln;
in = (struct idx_node*)mem_malloc(sizeof(struct idx_node)); ln = (struct mib_list_node *)mem_malloc(sizeof(struct mib_list_node));
if (in != NULL) if (ln != NULL)
{ {
in->next = NULL; ln->prev = NULL;
in->prev = NULL; ln->next = NULL;
in->objid = id; ln->objid = id;
in->nptr = NULL; ln->nptr = NULL;
} }
return in; return ln;
} }
void void
snmp_idx_node_free(struct idx_node *in) snmp_mib_ln_free(struct mib_list_node *ln)
{ {
mem_free(in); mem_free(ln);
} }
struct idx_root_node * struct mib_list_rootnode *
snmp_idx_root_node_alloc(void) snmp_mib_lrn_alloc(void)
{ {
struct idx_root_node *irn; struct mib_list_rootnode *lrn;
irn = (struct idx_root_node*)mem_malloc(sizeof(struct idx_root_node)); lrn = (struct mib_list_rootnode*)mem_malloc(sizeof(struct mib_list_rootnode));
if (irn != NULL) if (lrn != NULL)
{ {
irn->head = NULL; lrn->get_object_def = noleafs_get_object_def;
irn->tail = NULL; lrn->get_value = noleafs_get_value;
irn->count = 0; lrn->node_type = MIB_NODE_LR;
lrn->maxlength = 0;
lrn->head = NULL;
lrn->tail = NULL;
lrn->count = 0;
} }
return irn; return lrn;
} }
void void
snmp_idx_root_node_free(struct idx_root_node *irn) snmp_mib_lrn_free(struct mib_list_rootnode *lrn)
{ {
mem_free(irn); mem_free(lrn);
} }
/** /**
@ -213,9 +217,9 @@ snmp_idx_root_node_free(struct idx_root_node *irn)
* @return -1 if failed, 1 if success. * @return -1 if failed, 1 if success.
*/ */
s8_t s8_t
snmp_idx_node_insert(struct idx_root_node *rn, s32_t objid, struct idx_node **insn) snmp_mib_node_insert(struct mib_list_rootnode *rn, s32_t objid, struct mib_list_node **insn)
{ {
struct idx_node *nn; struct mib_list_node *nn;
s8_t insert; s8_t insert;
LWIP_ASSERT("rn != NULL",rn != NULL); LWIP_ASSERT("rn != NULL",rn != NULL);
@ -226,7 +230,7 @@ snmp_idx_node_insert(struct idx_root_node *rn, s32_t objid, struct idx_node **in
{ {
/* empty list, add first node */ /* empty list, add first node */
LWIP_DEBUGF(SNMP_MIB_DEBUG,("alloc empty list objid==%"S32_F"\n",objid)); LWIP_DEBUGF(SNMP_MIB_DEBUG,("alloc empty list objid==%"S32_F"\n",objid));
nn = snmp_idx_node_alloc(objid); nn = snmp_mib_ln_alloc(objid);
if (nn != NULL) if (nn != NULL)
{ {
rn->head = nn; rn->head = nn;
@ -241,7 +245,7 @@ snmp_idx_node_insert(struct idx_root_node *rn, s32_t objid, struct idx_node **in
} }
else else
{ {
struct idx_node *n; struct mib_list_node *n;
/* at least one node is present */ /* at least one node is present */
n = rn->head; n = rn->head;
while ((n != NULL) && (insert == 0)) while ((n != NULL) && (insert == 0))
@ -259,7 +263,7 @@ snmp_idx_node_insert(struct idx_root_node *rn, s32_t objid, struct idx_node **in
{ {
/* alloc and insert at the tail */ /* alloc and insert at the tail */
LWIP_DEBUGF(SNMP_MIB_DEBUG,("alloc ins tail objid==%"S32_F"\n",objid)); LWIP_DEBUGF(SNMP_MIB_DEBUG,("alloc ins tail objid==%"S32_F"\n",objid));
nn = snmp_idx_node_alloc(objid); nn = snmp_mib_ln_alloc(objid);
if (nn != NULL) if (nn != NULL)
{ {
nn->next = NULL; nn->next = NULL;
@ -287,7 +291,7 @@ snmp_idx_node_insert(struct idx_root_node *rn, s32_t objid, struct idx_node **in
/* n->objid > objid */ /* n->objid > objid */
/* alloc and insert between n->prev and n */ /* alloc and insert between n->prev and n */
LWIP_DEBUGF(SNMP_MIB_DEBUG,("alloc ins n->prev, objid==%"S32_F", n\n",objid)); LWIP_DEBUGF(SNMP_MIB_DEBUG,("alloc ins n->prev, objid==%"S32_F", n\n",objid));
nn = snmp_idx_node_alloc(objid); nn = snmp_mib_ln_alloc(objid);
if (nn != NULL) if (nn != NULL)
{ {
if (n->prev == NULL) if (n->prev == NULL)
@ -332,13 +336,13 @@ snmp_idx_node_insert(struct idx_root_node *rn, s32_t objid, struct idx_node **in
* @param objid is the object sub identifier * @param objid is the object sub identifier
* @param fn returns pointer to found node * @param fn returns pointer to found node
* @return 0 if not found, 1 if deletable, * @return 0 if not found, 1 if deletable,
* 2 can't delete (2 or more children) * 2 can't delete (2 or more children), 3 not a list_node
*/ */
s8_t s8_t
snmp_idx_node_find(struct idx_root_node *rn, s32_t objid, struct idx_node **fn) snmp_mib_node_find(struct mib_list_rootnode *rn, s32_t objid, struct mib_list_node **fn)
{ {
s8_t fc; s8_t fc;
struct idx_node *n; struct mib_list_node *n;
LWIP_ASSERT("rn != NULL",rn != NULL); LWIP_ASSERT("rn != NULL",rn != NULL);
n = rn->head; n = rn->head;
@ -355,15 +359,29 @@ snmp_idx_node_find(struct idx_root_node *rn, s32_t objid, struct idx_node **fn)
/* leaf, can delete node */ /* leaf, can delete node */
fc = 1; fc = 1;
} }
else if (n->nptr->count > 1)
{
/* can't delete node */
fc = 2;
}
else else
{ {
/* count <= 1, can delete node */ struct mib_list_rootnode *rn;
fc = 1;
if (n->nptr->node_type == MIB_NODE_LR)
{
rn = (struct mib_list_rootnode *)n->nptr;
if (rn->count > 1)
{
/* can't delete node */
fc = 2;
}
else
{
/* count <= 1, can delete node */
fc = 1;
}
}
else
{
/* other node type */
fc = 3;
}
} }
*fn = n; *fn = n;
return fc; return fc;
@ -377,16 +395,16 @@ snmp_idx_node_find(struct idx_root_node *rn, s32_t objid, struct idx_node **fn)
* @param n points to the node to delete * @param n points to the node to delete
* @return the nptr to be freed by caller * @return the nptr to be freed by caller
*/ */
struct idx_root_node * struct mib_list_rootnode *
snmp_idx_node_delete(struct idx_root_node *rn, struct idx_node *n) snmp_mib_node_delete(struct mib_list_rootnode *rn, struct mib_list_node *n)
{ {
struct idx_root_node *next; struct mib_list_rootnode *next;
LWIP_ASSERT("rn != NULL",rn != NULL); LWIP_ASSERT("rn != NULL",rn != NULL);
LWIP_ASSERT("n != NULL",n != NULL); LWIP_ASSERT("n != NULL",n != NULL);
/* caller must remove this sub-tree */ /* caller must remove this sub-tree */
next = n->nptr; next = (struct mib_list_rootnode*)(n->nptr);
rn->count -= 1; rn->count -= 1;
if (n == rn->head) if (n == rn->head)
@ -414,7 +432,7 @@ snmp_idx_node_delete(struct idx_root_node *rn, struct idx_node *n)
n->next->prev = n->prev; n->next->prev = n->prev;
} }
LWIP_DEBUGF(SNMP_MIB_DEBUG,("free list objid==%"S32_F"\n",n->objid)); LWIP_DEBUGF(SNMP_MIB_DEBUG,("free list objid==%"S32_F"\n",n->objid));
snmp_idx_node_free(n); snmp_mib_ln_free(n);
return next; return next;
} }
@ -754,6 +772,10 @@ snmp_expand_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snm
} }
} }
} }
else if(node_type == MIB_NODE_LR)
{
/** @todo need this for indexing tables */
}
else else
{ {
/* unknown/unhandled node_type */ /* unknown/unhandled node_type */

View File

@ -489,6 +489,7 @@ udp_bind(struct udp_pcb *pcb, struct ip_addr *ipaddr, u16_t port)
} }
} }
pcb->local_port = port; pcb->local_port = port;
snmp_insert_udpidx_tree(pcb);
/* pcb not active yet? */ /* pcb not active yet? */
if (rebind == 0) { if (rebind == 0) {
/* place the PCB on the active list if not already there */ /* place the PCB on the active list if not already there */
@ -602,6 +603,8 @@ void
udp_remove(struct udp_pcb *pcb) udp_remove(struct udp_pcb *pcb)
{ {
struct udp_pcb *pcb2; struct udp_pcb *pcb2;
snmp_delete_udpidx_tree(pcb);
/* pcb to be removed is first in list? */ /* pcb to be removed is first in list? */
if (udp_pcbs == pcb) { if (udp_pcbs == pcb) {
/* make list start at 2nd pcb */ /* make list start at 2nd pcb */

View File

@ -132,8 +132,6 @@ struct netif {
extern struct netif *netif_list; extern struct netif *netif_list;
/** The default network interface. */ /** The default network interface. */
extern struct netif *netif_default; extern struct netif *netif_default;
/** Count of network interfaces currently in the netif_list. */
extern u16_t netif_cnt;
/* netif_init() must be called first. */ /* netif_init() must be called first. */
void netif_init(void); void netif_init(void);

View File

@ -35,6 +35,7 @@
#include "lwip/opt.h" #include "lwip/opt.h"
#include "lwip/netif.h" #include "lwip/netif.h"
#include "lwip/udp.h"
/* SNMP support available? */ /* SNMP support available? */
#if defined(LWIP_SNMP) && (LWIP_SNMP > 0) #if defined(LWIP_SNMP) && (LWIP_SNMP > 0)
@ -58,10 +59,6 @@ void snmp_set_syscontact(u8_t *ocstr, u8_t *ocstrlen);
void snmp_set_sysname(u8_t *ocstr, u8_t *ocstrlen); void snmp_set_sysname(u8_t *ocstr, u8_t *ocstrlen);
void snmp_set_syslocation(u8_t *ocstr, u8_t *ocstrlen); void snmp_set_syslocation(u8_t *ocstr, u8_t *ocstrlen);
/* ARP */
void snmp_insert_arpidx_tree(struct netif *ni, struct ip_addr *ip);
void snmp_delete_arpidx_tree(struct netif *ni, struct ip_addr *ip);
/* network interface */ /* network interface */
void snmp_add_ifinoctets(struct netif *ni, u32_t value); void snmp_add_ifinoctets(struct netif *ni, u32_t value);
void snmp_inc_ifinucastpkts(struct netif *ni); void snmp_inc_ifinucastpkts(struct netif *ni);
@ -71,6 +68,12 @@ void snmp_add_ifoutoctets(struct netif *ni, u32_t value);
void snmp_inc_ifoutucastpkts(struct netif *ni); void snmp_inc_ifoutucastpkts(struct netif *ni);
void snmp_inc_ifoutnucastpkts(struct netif *ni); void snmp_inc_ifoutnucastpkts(struct netif *ni);
void snmp_inc_ifoutdiscards(struct netif *ni); void snmp_inc_ifoutdiscards(struct netif *ni);
void snmp_inc_iflist(void);
void snmp_dec_iflist(void);
/* ARP (for atTable and ipNetToMediaTable) */
void snmp_insert_arpidx_tree(struct netif *ni, struct ip_addr *ip);
void snmp_delete_arpidx_tree(struct netif *ni, struct ip_addr *ip);
/* IP */ /* IP */
void snmp_inc_ipinreceives(void); void snmp_inc_ipinreceives(void);
@ -90,6 +93,10 @@ void snmp_inc_ipfragoks(void);
void snmp_inc_ipfragfails(void); void snmp_inc_ipfragfails(void);
void snmp_inc_ipfragcreates(void); void snmp_inc_ipfragcreates(void);
void snmp_inc_iproutingdiscards(void); void snmp_inc_iproutingdiscards(void);
void snmp_insert_ipaddridx_tree(struct netif *ni);
void snmp_delete_ipaddridx_tree(struct netif *ni);
void snmp_insert_iprteidx_tree(u8_t dflt, struct netif *ni);
void snmp_delete_iprteidx_tree(u8_t dflt, struct netif *ni);
/* ICMP */ /* ICMP */
void snmp_inc_icmpinmsgs(void); void snmp_inc_icmpinmsgs(void);
@ -135,6 +142,8 @@ void snmp_inc_udpindatagrams(void);
void snmp_inc_udpnoports(void); void snmp_inc_udpnoports(void);
void snmp_inc_udpinerrors(void); void snmp_inc_udpinerrors(void);
void snmp_inc_udpoutdatagrams(void); void snmp_inc_udpoutdatagrams(void);
void snmp_insert_udpidx_tree(struct udp_pcb *pcb);
void snmp_delete_udpidx_tree(struct udp_pcb *pcb);
/* SNMP */ /* SNMP */
void snmp_inc_snmpinpkts(void); void snmp_inc_snmpinpkts(void);
@ -177,10 +186,6 @@ void snmp_set_snmpenableauthentraps(u8_t *value);
#define snmp_inc_sysuptime() #define snmp_inc_sysuptime()
#define snmp_get_sysuptime(value) #define snmp_get_sysuptime(value)
/* ARP */
#define snmp_insert_arpidx_tree(ni,ip)
#define snmp_delete_arpidx_tree(ni,ip)
/* network interface */ /* network interface */
#define snmp_add_ifinoctets(ni,value) #define snmp_add_ifinoctets(ni,value)
#define snmp_inc_ifinucastpkts(ni) #define snmp_inc_ifinucastpkts(ni)
@ -190,6 +195,12 @@ void snmp_set_snmpenableauthentraps(u8_t *value);
#define snmp_inc_ifoutucastpkts(ni) #define snmp_inc_ifoutucastpkts(ni)
#define snmp_inc_ifoutnucastpkts(ni) #define snmp_inc_ifoutnucastpkts(ni)
#define snmp_inc_ifoutdiscards(ni) #define snmp_inc_ifoutdiscards(ni)
#define snmp_inc_iflist()
#define snmp_dec_iflist()
/* ARP */
#define snmp_insert_arpidx_tree(ni,ip)
#define snmp_delete_arpidx_tree(ni,ip)
/* IP */ /* IP */
#define snmp_inc_ipinreceives() #define snmp_inc_ipinreceives()
@ -209,6 +220,10 @@ void snmp_set_snmpenableauthentraps(u8_t *value);
#define snmp_inc_ipfragfails() #define snmp_inc_ipfragfails()
#define snmp_inc_ipfragcreates() #define snmp_inc_ipfragcreates()
#define snmp_inc_iproutingdiscards() #define snmp_inc_iproutingdiscards()
#define snmp_insert_ipaddridx_tree(ni)
#define snmp_delete_ipaddridx_tree(ni)
#define snmp_insert_iprteidx_tree(ni)
#define snmp_delete_iprteidx_tree(ni)
/* ICMP */ /* ICMP */
#define snmp_inc_icmpinmsgs() #define snmp_inc_icmpinmsgs()
@ -253,6 +268,8 @@ void snmp_set_snmpenableauthentraps(u8_t *value);
#define snmp_inc_udpnoports() #define snmp_inc_udpnoports()
#define snmp_inc_udpinerrors() #define snmp_inc_udpinerrors()
#define snmp_inc_udpoutdatagrams() #define snmp_inc_udpoutdatagrams()
#define snmp_insert_udpidx_tree(pcb)
#define snmp_delete_udpidx_tree(pcb)
/* SNMP */ /* SNMP */
#define snmp_inc_snmpinpkts() #define snmp_inc_snmpinpkts()

View File

@ -105,9 +105,10 @@ struct mib_node
of sub-identifiers plus a 'child' pointer */ of sub-identifiers plus a 'child' pointer */
struct mib_array_node struct mib_array_node
{ {
/* inherited "base class" */ /* inherited "base class" members */
void (* const get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od); void (* const get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od);
void (* const get_value)(struct obj_def *od, u16_t len, void *value); void (* const get_value)(struct obj_def *od, u16_t len, void *value);
const u8_t node_type; const u8_t node_type;
const u16_t maxlength; const u16_t maxlength;
@ -120,9 +121,10 @@ struct mib_array_node
of sub-identifiers plus a 'child' pointer */ of sub-identifiers plus a 'child' pointer */
struct mib_ram_array_node struct mib_ram_array_node
{ {
/* inherited "base class" */ /* inherited "base class" members */
void (*get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od); void (*get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od);
void (*get_value)(struct obj_def *od, u16_t len, void *value); void (*get_value)(struct obj_def *od, u16_t len, void *value);
u8_t node_type; u8_t node_type;
u16_t maxlength; u16_t maxlength;
@ -143,9 +145,10 @@ struct mib_list_node
of sub-identifiers plus a 'child' pointer */ of sub-identifiers plus a 'child' pointer */
struct mib_list_rootnode struct mib_list_rootnode
{ {
/* inherited "base class" */ /* inherited "base class" members */
void (*get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od); void (*get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od);
void (*get_value)(struct obj_def *od, u16_t len, void *value); void (*get_value)(struct obj_def *od, u16_t len, void *value);
u8_t node_type; u8_t node_type;
u16_t maxlength; u16_t maxlength;
@ -160,9 +163,10 @@ struct mib_list_rootnode
using index ('idx'), with a range 0 .. (count - 1) to address these objects */ using index ('idx'), with a range 0 .. (count - 1) to address these objects */
struct mib_external_node struct mib_external_node
{ {
/* inherited "base class" */ /* inherited "base class" members */
void (*get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od); void (*get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od);
void (*get_value)(struct obj_def *od, u16_t len, void *value); void (*get_value)(struct obj_def *od, u16_t len, void *value);
u8_t node_type; u8_t node_type;
u16_t maxlength; u16_t maxlength;
@ -182,44 +186,23 @@ struct mib_external_node
/** export MIB tree from mib2.c */ /** export MIB tree from mib2.c */
extern const struct mib_array_node internet; extern const struct mib_array_node internet;
/** export for use in private mib */ /** dummy function pointers for non-leaf MIB nodes from mib2.c */
void noleafs_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od); void noleafs_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
void noleafs_get_value(struct obj_def *od, u16_t len, void *value); void noleafs_get_value(struct obj_def *od, u16_t len, void *value);
/** forward decl */
struct idx_root_node;
/** "index" tree node */
struct idx_node
{
struct idx_node* next;
struct idx_node* prev;
/* child id */
s32_t objid;
/* tree child pointer */
struct idx_root_node *nptr;
};
/** "index" tree root node */
struct idx_root_node
{
struct idx_node *head;
struct idx_node *tail;
u16_t count;
};
void snmp_oidtoip(s32_t *ident, struct ip_addr *ip); void snmp_oidtoip(s32_t *ident, struct ip_addr *ip);
void snmp_iptooid(struct ip_addr *ip, s32_t *ident); void snmp_iptooid(struct ip_addr *ip, s32_t *ident);
void snmp_ifindextonetif(s32_t ifindex, struct netif **netif); void snmp_ifindextonetif(s32_t ifindex, struct netif **netif);
void snmp_netiftoifindex(struct netif *netif, s32_t *ifidx); void snmp_netiftoifindex(struct netif *netif, s32_t *ifidx);
struct idx_node* snmp_idx_node_alloc(s32_t id); struct mib_list_node* snmp_mib_ln_alloc(s32_t id);
void snmp_idx_node_free(struct idx_node *in); void snmp_mib_ln_free(struct mib_list_node *ln);
struct idx_root_node* snmp_idx_root_node_alloc(void); struct mib_list_rootnode* snmp_mib_lrn_alloc(void);
void snmp_idx_root_node_free(struct idx_root_node *irn); void snmp_mib_lrn_free(struct mib_list_rootnode *lrn);
s8_t snmp_mib_node_insert(struct mib_list_rootnode *rn, s32_t objid, struct mib_list_node **insn);
s8_t snmp_idx_node_insert(struct idx_root_node *rn, s32_t objid, struct idx_node **insn); s8_t snmp_mib_node_find(struct mib_list_rootnode *rn, s32_t objid, struct mib_list_node **fn);
s8_t snmp_idx_node_find(struct idx_root_node *rn, s32_t objid, struct idx_node **fn); struct mib_list_rootnode *snmp_mib_node_delete(struct mib_list_rootnode *rn, struct mib_list_node *n);
struct idx_root_node *snmp_idx_node_delete(struct idx_root_node *rn, struct idx_node *n);
struct mib_node* snmp_search_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct obj_def *object_def); struct mib_node* snmp_search_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct obj_def *object_def);
struct mib_node* snmp_expand_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snmp_obj_id *oidret); struct mib_node* snmp_expand_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snmp_obj_id *oidret);