mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-05-14 20:26:49 +08:00
Added SNMP statistics to struct netif and changed SNMP macro glue.
This commit is contained in:
@@ -105,18 +105,35 @@ struct netif {
|
||||
u16_t mtu;
|
||||
/** flags (see NETIF_FLAG_ above) */
|
||||
u8_t flags;
|
||||
/** link type */
|
||||
u8_t link_type;
|
||||
/** descriptive abbreviation */
|
||||
char name[2];
|
||||
/** number of this interface */
|
||||
u8_t num;
|
||||
#if LWIP_SNMP
|
||||
/** link type (ifType values per RFC1213) */
|
||||
u8_t link_type;
|
||||
/** (estimate) link speed */
|
||||
u32_t link_speed;
|
||||
/** timestamp at last change made (up/down) */
|
||||
u32_t ts;
|
||||
/** counters */
|
||||
u32_t ifinoctets;
|
||||
u32_t ifinucastpkts;
|
||||
u32_t ifinnucastpkts;
|
||||
u32_t ifindiscards;
|
||||
u32_t ifoutoctets;
|
||||
u32_t ifoutucastpkts;
|
||||
u32_t ifoutnucastpkts;
|
||||
u32_t ifoutdiscards;
|
||||
#endif
|
||||
};
|
||||
|
||||
/** The list of network interfaces. */
|
||||
extern struct netif *netif_list;
|
||||
/** The default network interface. */
|
||||
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. */
|
||||
void netif_init(void);
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define __LWIP_SNMP_H__
|
||||
|
||||
#include "lwip/opt.h"
|
||||
#include "lwip/netif.h"
|
||||
|
||||
/* SNMP support available? */
|
||||
#if defined(LWIP_SNMP) && (LWIP_SNMP > 0)
|
||||
@@ -48,19 +49,29 @@ struct snmp_obj_id
|
||||
};
|
||||
|
||||
/* system */
|
||||
void snmp_set_sysdesr(char* 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_get_sysobjid(const struct snmp_obj_id **oid);
|
||||
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);
|
||||
|
||||
/* network interface */
|
||||
void snmp_add_ifinoctets(u32_t value);
|
||||
void snmp_inc_ifinucastpkts(void);
|
||||
void snmp_inc_ifinnucastpkts(void);
|
||||
void snmp_inc_ifindiscards(void);
|
||||
void snmp_add_ifoutoctets(u32_t value);
|
||||
void snmp_inc_ifoutucastpkts(void);
|
||||
void snmp_inc_ifoutnucastpkts(void);
|
||||
void snmp_inc_ifoutdiscards(void);
|
||||
void snmp_add_ifinoctets(struct netif *ni, u32_t value);
|
||||
void snmp_inc_ifinucastpkts(struct netif *ni);
|
||||
void snmp_inc_ifinnucastpkts(struct netif *ni);
|
||||
void snmp_inc_ifindiscards(struct netif *ni);
|
||||
void snmp_add_ifoutoctets(struct netif *ni, u32_t value);
|
||||
void snmp_inc_ifoutucastpkts(struct netif *ni);
|
||||
void snmp_inc_ifoutnucastpkts(struct netif *ni);
|
||||
void snmp_inc_ifoutdiscards(struct netif *ni);
|
||||
|
||||
/* IP */
|
||||
void snmp_inc_ipinreceives(void);
|
||||
@@ -146,7 +157,7 @@ void snmp_inc_snmpoutgetnexts(void);
|
||||
void snmp_inc_snmpoutsetrequests(void);
|
||||
void snmp_inc_snmpoutgetresponses(void);
|
||||
void snmp_inc_snmpouttraps(void);
|
||||
void snmp_get_snmpgrpid(const struct snmp_obj_id **oid);
|
||||
void snmp_get_snmpgrpid_ptr(struct snmp_obj_id **oid);
|
||||
|
||||
/* LWIP_SNMP support not available */
|
||||
/* define everything to be empty */
|
||||
@@ -155,17 +166,17 @@ void snmp_get_snmpgrpid(const struct snmp_obj_id **oid);
|
||||
/* system */
|
||||
#define snmp_inc_sysuptime()
|
||||
#define snmp_get_sysuptime(value)
|
||||
#define snmp_get_sysobjid(oid)
|
||||
#define snmp_get_sysobjid_ptr(oid)
|
||||
|
||||
/* network interface */
|
||||
#define snmp_add_ifinoctets(value)
|
||||
#define snmp_inc_ifinucastpkts()
|
||||
#define snmp_inc_ifinnucastpkts()
|
||||
#define snmp_inc_ifindiscards()
|
||||
#define snmp_add_ifoutoctets(value)
|
||||
#define snmp_inc_ifoutucastpkts()
|
||||
#define snmp_inc_ifoutnucastpkts()
|
||||
#define snmp_inc_ifoutdiscards()
|
||||
#define snmp_add_ifinoctets(ni,value)
|
||||
#define snmp_inc_ifinucastpkts(ni)
|
||||
#define snmp_inc_ifinnucastpkts(ni)
|
||||
#define snmp_inc_ifindiscards(ni)
|
||||
#define snmp_add_ifoutoctets(ni,value)
|
||||
#define snmp_inc_ifoutucastpkts(ni)
|
||||
#define snmp_inc_ifoutnucastpkts(ni)
|
||||
#define snmp_inc_ifoutdiscards(ni)
|
||||
|
||||
/* IP */
|
||||
#define snmp_inc_ipinreceives()
|
||||
@@ -250,7 +261,7 @@ void snmp_get_snmpgrpid(const struct snmp_obj_id **oid);
|
||||
#define snmp_inc_snmpoutsetrequests()
|
||||
#define snmp_inc_snmpoutgetresponses()
|
||||
#define snmp_inc_snmpouttraps()
|
||||
#define snmp_get_snmpgrpid()
|
||||
#define snmp_get_snmpgrpid_ptr(oid)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user