Add enum snmp_ifType in snmp.h, and use it in network interfaces for NETIF_INIT_SNMP

This commit is contained in:
fbernon 2007-08-31 10:14:09 +00:00
parent fca25479ad
commit 85fef90c94
5 changed files with 46 additions and 9 deletions

View File

@ -140,7 +140,7 @@ struct netif {
/** number of this interface */
u8_t num;
#if LWIP_SNMP
/** link type (ifType values per RFC1213) */
/** link type (from "snmp_ifType" enum from snmp.h) */
u8_t link_type;
/** (estimate) link speed */
u32_t link_speed;
@ -167,7 +167,7 @@ struct netif {
#if LWIP_SNMP
#define NETIF_INIT_SNMP(netif, type, speed) \
/* ifType ethernetCsmacd(6) @see RFC1213 */ \
/* use "snmp_ifType" enum from snmp.h for "type", snmp_ifType_ethernet_csmacd by example */ \
netif->link_type = type; \
/* your link speed here */ \
netif->link_speed = speed; \

View File

@ -41,6 +41,44 @@
extern "C" {
#endif
/**
* @see RFC1213, "MIB-II, 6. Definitions"
*/
enum snmp_ifType {
snmp_ifType_other=1, /* none of the following */
snmp_ifType_regular1822,
snmp_ifType_hdh1822,
snmp_ifType_ddn_x25,
snmp_ifType_rfc877_x25,
snmp_ifType_ethernet_csmacd,
snmp_ifType_iso88023_csmacd,
snmp_ifType_iso88024_tokenBus,
snmp_ifType_iso88025_tokenRing,
snmp_ifType_iso88026_man,
snmp_ifType_starLan,
snmp_ifType_proteon_10Mbit,
snmp_ifType_proteon_80Mbit,
snmp_ifType_hyperchannel,
snmp_ifType_fddi,
snmp_ifType_lapb,
snmp_ifType_sdlc,
snmp_ifType_ds1, /* T-1 */
snmp_ifType_e1, /* european equiv. of T-1 */
snmp_ifType_basicISDN,
snmp_ifType_primaryISDN, /* proprietary serial */
snmp_ifType_propPointToPointSerial,
snmp_ifType_ppp,
snmp_ifType_softwareLoopback,
snmp_ifType_eon, /* CLNP over IP [11] */
snmp_ifType_ethernet_3Mbit,
snmp_ifType_nsip, /* XNS over IP */
snmp_ifType_slip, /* generic SLIP */
snmp_ifType_ultra, /* ULTRA technologies */
snmp_ifType_ds3, /* T-3 */
snmp_ifType_sip, /* SMDS */
snmp_ifType_frame_relay
};
/* SNMP support available? */
#if defined(LWIP_SNMP) && (LWIP_SNMP > 0)

View File

@ -49,7 +49,7 @@
#include "lwip/pbuf.h"
#include "lwip/sys.h"
#include <lwip/stats.h>
#include <lwip/snmp.h>
#include "netif/etharp.h"
#include "netif/ppp_oe.h"
@ -289,8 +289,7 @@ ethernetif_init(struct netif *netif)
#endif /* LWIP_NETIF_HOSTNAME */
/* initialize the snmp variables and counters inside the struct netif */
/* ifType ethernetCsmacd(6) @see RFC1213 */
NETIF_INIT_SNMP(netif, 6, ???);
NETIF_INIT_SNMP(netif, snmp_ifType_ethernet_csmacd, ???);
netif->state = ethernetif;
netif->name[0] = IFNAME0;

View File

@ -41,6 +41,7 @@
#include "netif/loopif.h"
#include "lwip/pbuf.h"
#include "lwip/snmp.h"
#include <string.h>
@ -203,10 +204,9 @@ loopif_init(struct netif *netif)
#endif /* LWIP_LOOPIF_MULTITHREADING */
/* initialize the snmp variables and counters inside the struct netif
* ifType: softwareLoopback(24) @see RFC1213
* ifSpeed: no assumption can be made!
*/
NETIF_INIT_SNMP(netif, 24, 0);
NETIF_INIT_SNMP(netif, snmp_ifType_softwareLoopback, 0);
netif->name[0] = 'l';
netif->name[1] = 'o';

View File

@ -48,6 +48,7 @@
#include "lwip/pbuf.h"
#include "lwip/sys.h"
#include "lwip/stats.h"
#include "lwip/snmp.h"
#include "lwip/sio.h"
#define SLIP_END 0300
@ -260,11 +261,10 @@ slipif_init(struct netif *netif)
}
/* initialize the snmp variables and counters inside the struct netif
* ifType: we're using propPointToPointSerial(22) @see RFC1213
* ifSpeed: no assumption can be made without knowing more about the
* serial line!
*/
NETIF_INIT_SNMP(netif, 22, 0);
NETIF_INIT_SNMP(netif, snmp_ifType_slip, 0);
/* Create a thread to poll the serial line. */
sys_thread_new(slipif_loop, netif, SLIPIF_THREAD_PRIO);