Added index tree node structs and functions, e.g. to be used for ARP table indexes.

This commit is contained in:
christiaans
2006-08-29 11:28:28 +00:00
parent 514ee867a6
commit 1485edf8e1
5 changed files with 574 additions and 55 deletions

View File

@@ -58,6 +58,10 @@ void snmp_set_syscontact(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);
/* 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 */
void snmp_add_ifinoctets(struct netif *ni, u32_t value);
void snmp_inc_ifinucastpkts(struct netif *ni);
@@ -173,6 +177,9 @@ void snmp_set_snmpenableauthentraps(u8_t *value);
#define snmp_inc_sysuptime()
#define snmp_get_sysuptime(value)
/* ARP */
#define snmp_insert_arpidx_tree(ni,ip)
#define snmp_delete_arpidx_tree(ni,ip)
/* network interface */
#define snmp_add_ifinoctets(ni,value)

View File

@@ -186,6 +186,41 @@ extern const struct mib_array_node internet;
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);
/** 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_iptooid(struct ip_addr *ip, s32_t *ident);
void snmp_ifindextonetif(s32_t ifindex, struct netif **netif);
void snmp_netiftoifindex(struct netif *netif, s32_t *ifidx);
struct idx_node* snmp_idx_node_alloc(s32_t id);
void snmp_idx_node_free(struct idx_node *in);
struct idx_root_node* snmp_idx_root_node_alloc(void);
void snmp_idx_root_node_free(struct idx_root_node *irn);
s8_t snmp_idx_node_insert(struct idx_root_node *rn, s32_t objid, struct idx_node **insn);
s8_t snmp_idx_node_find(struct idx_root_node *rn, s32_t objid, struct idx_node **fn);
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_expand_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snmp_obj_id *oidret);
u8_t snmp_iso_prefix_tst(u8_t ident_len, s32_t *ident);