mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-08-08 08:33:39 +08:00
MIB-2 object values near to completion, just committing for keeping the flame alive.
This commit is contained in:
@@ -49,19 +49,14 @@ struct snmp_obj_id
|
||||
};
|
||||
|
||||
/* system */
|
||||
void snmp_set_sysdesr(u8_t* str, u8_t strlen);
|
||||
void snmp_set_sysdesr(u8_t* str, u8_t* strlen);
|
||||
void snmp_set_sysobjid(struct snmp_obj_id *oid);
|
||||
void snmp_get_sysobjid_ptr(struct snmp_obj_id **oid);
|
||||
void snmp_inc_sysuptime(void);
|
||||
void snmp_get_sysuptime(u32_t *value);
|
||||
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);
|
||||
/** externally supplied system functions
|
||||
@see lwip/doc/snmp_agent.txt */
|
||||
void snmp_store_syscontact(u8_t* ocstr, u8_t ocstrlen);
|
||||
void snmp_store_sysname(u8_t* ocstr, u8_t ocstrlen);
|
||||
void snmp_store_syslocation(u8_t* ocstr, u8_t ocstrlen);
|
||||
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);
|
||||
|
||||
/* network interface */
|
||||
void snmp_add_ifinoctets(struct netif *ni, u32_t value);
|
||||
@@ -75,13 +70,22 @@ void snmp_inc_ifoutdiscards(struct netif *ni);
|
||||
|
||||
/* IP */
|
||||
void snmp_inc_ipinreceives(void);
|
||||
void snmp_inc_ipindelivers(void);
|
||||
void snmp_inc_ipindiscards(void);
|
||||
void snmp_inc_ipoutdiscards(void);
|
||||
void snmp_inc_ipoutrequests(void);
|
||||
void snmp_inc_ipunknownprotos(void);
|
||||
void snmp_inc_ipnoroutes(void);
|
||||
void snmp_inc_ipinhdrerrors(void);
|
||||
void snmp_inc_ipinaddrerrors(void);
|
||||
void snmp_inc_ipforwdatagrams(void);
|
||||
void snmp_inc_ipinunknownprotos(void);
|
||||
void snmp_inc_ipindiscards(void);
|
||||
void snmp_inc_ipindelivers(void);
|
||||
void snmp_inc_ipoutrequests(void);
|
||||
void snmp_inc_ipoutdiscards(void);
|
||||
void snmp_inc_ipoutnoroutes(void);
|
||||
void snmp_inc_ipreasmreqds(void);
|
||||
void snmp_inc_ipreasmoks(void);
|
||||
void snmp_inc_ipreasmfails(void);
|
||||
void snmp_inc_ipfragoks(void);
|
||||
void snmp_inc_ipfragfails(void);
|
||||
void snmp_inc_ipfragcreates(void);
|
||||
void snmp_inc_iproutingdiscards(void);
|
||||
|
||||
/* ICMP */
|
||||
void snmp_inc_icmpinmsgs(void);
|
||||
@@ -158,15 +162,18 @@ void snmp_inc_snmpoutsetrequests(void);
|
||||
void snmp_inc_snmpoutgetresponses(void);
|
||||
void snmp_inc_snmpouttraps(void);
|
||||
void snmp_get_snmpgrpid_ptr(struct snmp_obj_id **oid);
|
||||
void snmp_set_snmpenableauthentraps(u8_t *value);
|
||||
|
||||
/* LWIP_SNMP support not available */
|
||||
/* define everything to be empty */
|
||||
#else
|
||||
|
||||
/* system */
|
||||
#define snmp_set_sysdesr(str, strlen)
|
||||
#define snmp_get_sysobjid_ptr(oid)
|
||||
#define snmp_inc_sysuptime()
|
||||
#define snmp_get_sysuptime(value)
|
||||
#define snmp_get_sysobjid_ptr(oid)
|
||||
|
||||
|
||||
/* network interface */
|
||||
#define snmp_add_ifinoctets(ni,value)
|
||||
@@ -180,13 +187,22 @@ void snmp_get_snmpgrpid_ptr(struct snmp_obj_id **oid);
|
||||
|
||||
/* IP */
|
||||
#define snmp_inc_ipinreceives()
|
||||
#define snmp_inc_ipindelivers()
|
||||
#define snmp_inc_ipindiscards()
|
||||
#define snmp_inc_ipoutdiscards()
|
||||
#define snmp_inc_ipoutrequests()
|
||||
#define snmp_inc_ipunknownprotos()
|
||||
#define snmp_inc_ipnoroutes()
|
||||
#define snmp_inc_ipinhdrerrors()
|
||||
#define snmp_inc_ipinaddrerrors()
|
||||
#define snmp_inc_ipforwdatagrams()
|
||||
#define snmp_inc_ipinunknownprotos()
|
||||
#define snmp_inc_ipindiscards()
|
||||
#define snmp_inc_ipindelivers()
|
||||
#define snmp_inc_ipoutrequests()
|
||||
#define snmp_inc_ipoutdiscards()
|
||||
#define snmp_inc_ipoutnoroutes()
|
||||
#define snmp_inc_ipreasmreqds()
|
||||
#define snmp_inc_ipreasmoks()
|
||||
#define snmp_inc_ipreasmfails()
|
||||
#define snmp_inc_ipfragoks()
|
||||
#define snmp_inc_ipfragfails()
|
||||
#define snmp_inc_ipfragcreates()
|
||||
#define snmp_inc_iproutingdiscards()
|
||||
|
||||
/* ICMP */
|
||||
#define snmp_inc_icmpinmsgs()
|
||||
@@ -262,6 +278,7 @@ void snmp_get_snmpgrpid_ptr(struct snmp_obj_id **oid);
|
||||
#define snmp_inc_snmpoutgetresponses()
|
||||
#define snmp_inc_snmpouttraps()
|
||||
#define snmp_get_snmpgrpid_ptr(oid)
|
||||
#define snmp_set_snmpenableauthentraps(value)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -208,8 +208,12 @@ struct snmp_msg_pstat
|
||||
u8_t community[SNMP_COMMUNITY_STR_LEN + 1];
|
||||
/* community string length (exclusive zero term) */
|
||||
u8_t com_strlen;
|
||||
/* one out of MSG_EMPTY, MSG_DEMUX, MSG_MGMT, MSG_PRIVATE */
|
||||
/* one out of MSG_EMPTY, MSG_DEMUX, MSG_INTERNAL, MSG_EXTERNAL */
|
||||
u8_t state;
|
||||
/* index into input variable binding list */
|
||||
u8_t vb_idx;
|
||||
/* ptr into input variable binding list */
|
||||
struct snmp_varbind *vb_ptr;
|
||||
/* list of variable bindings from input */
|
||||
struct snmp_varbind_root invb;
|
||||
/* list of variable bindings to output */
|
||||
@@ -260,7 +264,8 @@ extern struct snmp_msg_trap trap_msg;
|
||||
|
||||
/** Agent setup, start listening to port 161. */
|
||||
void snmp_init(void);
|
||||
|
||||
/** Handles internal/external events. */
|
||||
void snmp_msg_event(struct snmp_msg_pstat *msg_ps);
|
||||
err_t snmp_send_response(struct snmp_msg_pstat *m_stat);
|
||||
err_t snmp_send_trap(struct ip_addr *dst, s8_t generic_trap, s32_t specific_trap);
|
||||
|
||||
|
||||
@@ -70,6 +70,8 @@ struct obj_def
|
||||
u8_t id_inst_len;
|
||||
/* instance part of supplied object identifier */
|
||||
s32_t *id_inst_ptr;
|
||||
/* optional value address hint */
|
||||
void *addr;
|
||||
};
|
||||
|
||||
/** MIB const array node */
|
||||
@@ -88,7 +90,7 @@ struct mib_node
|
||||
void (*get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od);
|
||||
/** returns object value for the given object identifier,
|
||||
@note the caller must allocate at least len bytes for the value */
|
||||
void (*get_value)(u8_t ident_len, s32_t *ident, u16_t len, void *value);
|
||||
void (*get_value)(struct obj_def *od, u16_t len, void *value);
|
||||
/** @todo set_value() */
|
||||
/** One out of MIB_NODE_AR, MIB_NODE_LR or MIB_NODE_EX */
|
||||
const u8_t node_type;
|
||||
@@ -102,7 +104,7 @@ struct mib_array_node
|
||||
{
|
||||
/* inherited "base class" */
|
||||
const void (*get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od);
|
||||
const void (*get_value)(u8_t ident_len, s32_t *ident, u16_t len, void *value);
|
||||
const void (*get_value)(struct obj_def *od, u16_t len, void *value);
|
||||
const u8_t node_type;
|
||||
const u16_t maxlength;
|
||||
|
||||
@@ -117,7 +119,7 @@ struct mib_ram_array_node
|
||||
{
|
||||
/* inherited "base class" */
|
||||
void (*get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od);
|
||||
void (*get_value)(u8_t ident_len, s32_t *ident, u16_t len, void *value);
|
||||
void (*get_value)(struct obj_def *od, u16_t len, void *value);
|
||||
u8_t node_type;
|
||||
u16_t maxlength;
|
||||
|
||||
@@ -140,7 +142,7 @@ struct mib_list_rootnode
|
||||
{
|
||||
/* inherited "base class" */
|
||||
void (*get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od);
|
||||
void (*get_value)(u8_t ident_len, s32_t *ident, u16_t len, void *value);
|
||||
void (*get_value)(struct obj_def *od, u16_t len, void *value);
|
||||
u8_t node_type;
|
||||
u16_t maxlength;
|
||||
|
||||
@@ -157,13 +159,13 @@ struct mib_external_node
|
||||
{
|
||||
/* inherited "base class" */
|
||||
void (*get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od);
|
||||
void (*get_value)(u8_t ident_len, s32_t *ident, u16_t len, void *value);
|
||||
void (*get_value)(struct obj_def *od, u16_t len, void *value);
|
||||
u8_t node_type;
|
||||
u16_t maxlength;
|
||||
|
||||
/* aditional struct members */
|
||||
void (*req_object_def)(u8_t ident_len, s32_t *ident);
|
||||
void (*getreq_value)(u8_t ident_len, s32_t *ident);
|
||||
void (*getreq_value)(struct obj_def *od);
|
||||
|
||||
/** compares object sub identifier with externally available id
|
||||
return zero when equal, nonzero when unequal */
|
||||
@@ -174,6 +176,10 @@ struct mib_external_node
|
||||
u16_t count;
|
||||
};
|
||||
|
||||
/** export MIB tree from mib2.c */
|
||||
extern const struct mib_array_node internet;
|
||||
|
||||
struct mib_node* snmp_search_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct obj_def *object_def);
|
||||
u8_t snmp_iso_prefix_tst(u8_t ident_len, s32_t *ident);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user