mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-03 21:32:08 +00:00
Pacified GCC warnings.
This commit is contained in:
parent
cdb7557d88
commit
c3f82acf7a
@ -35,9 +35,10 @@
|
||||
*/
|
||||
|
||||
#include "lwip/opt.h"
|
||||
#include "lwip/snmp_asn1.h"
|
||||
|
||||
#if LWIP_SNMP
|
||||
#include "lwip/snmp_asn1.h"
|
||||
|
||||
/**
|
||||
* Retrieves type field from incoming pbuf chain.
|
||||
*
|
||||
@ -644,4 +645,5 @@ snmp_asn1_dec_raw(struct pbuf *p, u16_t ofs, u16_t len, u16_t raw_len, u8_t *raw
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* LWIP_SNMP */
|
||||
#endif /* LWIP_SNMP */
|
||||
|
||||
|
@ -35,9 +35,10 @@
|
||||
*/
|
||||
|
||||
#include "lwip/opt.h"
|
||||
#include "lwip/snmp_asn1.h"
|
||||
|
||||
#if LWIP_SNMP
|
||||
#include "lwip/snmp_asn1.h"
|
||||
|
||||
/**
|
||||
* Returns octet count for length.
|
||||
*
|
||||
@ -482,6 +483,7 @@ snmp_asn1_enc_oid(struct pbuf *p, u16_t ofs, u8_t ident_len, s32_t *ident)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* @bug: allow empty varbinds for symmetry (we must decode them for getnext), allow partial compression?? */
|
||||
/* ident_len <= 1, at least we need zeroDotZero (0.0) (ident_len == 2) */
|
||||
return ERR_ARG;
|
||||
}
|
||||
|
@ -34,17 +34,17 @@
|
||||
|
||||
#include "arch/cc.h"
|
||||
#include "lwip/opt.h"
|
||||
|
||||
#if LWIP_SNMP
|
||||
#include "lwip/snmp.h"
|
||||
#include "lwip/netif.h"
|
||||
#include "netif/etharp.h"
|
||||
#include "lwip/ip.h"
|
||||
#include "lwip/ip_frag.h"
|
||||
#include "lwip/tcp.h"
|
||||
#include "lwip/udp.h"
|
||||
#include "lwip/snmp_asn1.h"
|
||||
#include "lwip/snmp_structs.h"
|
||||
|
||||
#if LWIP_SNMP
|
||||
|
||||
/**
|
||||
* IANA assigned enterprise ID for lwIP is 26381
|
||||
* @see http://www.iana.org/assignments/enterprise-numbers
|
||||
@ -66,6 +66,18 @@
|
||||
#define SNMP_SYSSERVICES ((1 << 6) | (1 << 3) | ((IP_FORWARD) << 2))
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @todo
|
||||
* table entry availability test in struct mib_node {},
|
||||
* also we need to be able to expand entry from a partial index
|
||||
* ifTable, use netif_cnt
|
||||
* atTable, use ?
|
||||
* ipAddrTable, use ?
|
||||
* ipRouteTable, use ?
|
||||
* ipNetToMediaTable, use ?
|
||||
* tcpConnTable, use ?
|
||||
* udpTable, use ?
|
||||
*/
|
||||
|
||||
static void system_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
|
||||
static void system_get_value(struct obj_def *od, u16_t len, void *value);
|
||||
@ -559,7 +571,6 @@ static u32_t tcpactiveopens = 0,
|
||||
tcppassiveopens = 0,
|
||||
tcpattemptfails = 0,
|
||||
tcpestabresets = 0,
|
||||
tcpcurrestab = 0,
|
||||
tcpinsegs = 0,
|
||||
tcpoutsegs = 0,
|
||||
tcpretranssegs = 0,
|
||||
@ -1001,11 +1012,6 @@ void snmp_inc_tcpattemptfails(void)
|
||||
void snmp_inc_tcpestabresets(void)
|
||||
{
|
||||
tcpestabresets++;
|
||||
}
|
||||
|
||||
void snmp_inc_tcpcurrestab(void)
|
||||
{
|
||||
tcpcurrestab++;
|
||||
}
|
||||
|
||||
void snmp_inc_tcpinsegs(void)
|
||||
@ -2604,11 +2610,129 @@ icmp_get_value(struct obj_def *od, u16_t len, void *value)
|
||||
static void
|
||||
tcp_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od)
|
||||
{
|
||||
u8_t id;
|
||||
|
||||
if ((ident_len == 2) && (ident[1] == 0))
|
||||
{
|
||||
od->id_inst_len = ident_len;
|
||||
od->id_inst_ptr = ident;
|
||||
|
||||
id = ident[0];
|
||||
LWIP_DEBUGF(SNMP_MIB_DEBUG,("get_object_def tcp.%"U16_F".0",(u16_t)id));
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case 1: /* tcpRtoAlgorithm */
|
||||
case 2: /* tcpRtoMin */
|
||||
case 3: /* tcpRtoMax */
|
||||
case 4: /* tcpMaxConn */
|
||||
od->instance = MIB_OBJECT_SCALAR;
|
||||
od->access = MIB_OBJECT_READ_ONLY;
|
||||
od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG);
|
||||
od->v_len = sizeof(s32_t);
|
||||
break;
|
||||
case 5: /* tcpActiveOpens */
|
||||
case 6: /* tcpPassiveOpens */
|
||||
case 7: /* tcpAttemptFails */
|
||||
case 8: /* tcpEstabResets */
|
||||
case 10: /* tcpInSegs */
|
||||
case 11: /* tcpOutSegs */
|
||||
case 12: /* tcpRetransSegs */
|
||||
case 14: /* tcpInErrs */
|
||||
case 15: /* tcpOutRsts */
|
||||
od->instance = MIB_OBJECT_SCALAR;
|
||||
od->access = MIB_OBJECT_READ_ONLY;
|
||||
od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_COUNTER);
|
||||
od->v_len = sizeof(u32_t);
|
||||
break;
|
||||
case 9: /* tcpCurrEstab */
|
||||
od->instance = MIB_OBJECT_TAB;
|
||||
od->access = MIB_OBJECT_READ_ONLY;
|
||||
od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_GAUGE);
|
||||
od->v_len = sizeof(u32_t);
|
||||
break;
|
||||
default:
|
||||
LWIP_DEBUGF(SNMP_MIB_DEBUG,("tcp_get_object_def: no such object"));
|
||||
od->instance = MIB_OBJECT_NONE;
|
||||
break;
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
LWIP_DEBUGF(SNMP_MIB_DEBUG,("tcp_get_object_def: no scalar"));
|
||||
od->instance = MIB_OBJECT_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
tcp_get_value(struct obj_def *od, u16_t len, void *value)
|
||||
{
|
||||
u32_t *uint_ptr = value;
|
||||
s32_t *sint_ptr = value;
|
||||
u8_t id;
|
||||
|
||||
if (len){}
|
||||
id = od->id_inst_ptr[0];
|
||||
switch (id)
|
||||
{
|
||||
case 1: /* tcpRtoAlgorithm, vanj(4) */
|
||||
*sint_ptr = 4;
|
||||
break;
|
||||
case 2: /* tcpRtoMin */
|
||||
/* @todo need value */
|
||||
*sint_ptr = 0;
|
||||
break;
|
||||
case 3: /* tcpRtoMax */
|
||||
/* @todo need value */
|
||||
*sint_ptr = 0;
|
||||
break;
|
||||
case 4: /* tcpMaxConn */
|
||||
*sint_ptr = MEMP_NUM_TCP_PCB_LISTEN;
|
||||
break;
|
||||
case 5: /* tcpActiveOpens */
|
||||
*uint_ptr = tcpactiveopens;
|
||||
break;
|
||||
case 6: /* tcpPassiveOpens */
|
||||
*uint_ptr = tcppassiveopens;
|
||||
break;
|
||||
case 7: /* tcpAttemptFails */
|
||||
*uint_ptr = tcpattemptfails;
|
||||
break;
|
||||
case 8: /* tcpEstabResets */
|
||||
*uint_ptr = tcpestabresets;
|
||||
break;
|
||||
case 9: /* tcpCurrEstab */
|
||||
{
|
||||
u16_t tcpcurrestab = 0;
|
||||
struct tcp_pcb *pcb = tcp_active_pcbs;
|
||||
while (pcb != NULL)
|
||||
{
|
||||
if ((pcb->state == ESTABLISHED) ||
|
||||
(pcb->state == CLOSE_WAIT))
|
||||
{
|
||||
tcpcurrestab++;
|
||||
}
|
||||
pcb = pcb->next;
|
||||
}
|
||||
*uint_ptr = tcpcurrestab;
|
||||
}
|
||||
break;
|
||||
case 10: /* tcpInSegs */
|
||||
*uint_ptr = tcpinsegs;
|
||||
break;
|
||||
case 11: /* tcpOutSegs */
|
||||
*uint_ptr = tcpoutsegs;
|
||||
break;
|
||||
case 12: /* tcpRetransSegs */
|
||||
*uint_ptr = tcpretranssegs;
|
||||
break;
|
||||
case 14: /* tcpInErrs */
|
||||
*uint_ptr = tcpinerrs;
|
||||
break;
|
||||
case 15: /* tcpOutRsts */
|
||||
*uint_ptr = tcpoutrsts;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2923,4 +3047,4 @@ snmp_get_value(struct obj_def *od, u16_t len, void *value)
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* LWIP_SNMP */
|
||||
#endif /* LWIP_SNMP */
|
||||
|
@ -42,8 +42,10 @@
|
||||
* Author: Christiaan Simons <christiaan.simons@axon.tv>
|
||||
*/
|
||||
|
||||
#include "arch/cc.h"
|
||||
#include "lwip/opt.h"
|
||||
|
||||
#if LWIP_SNMP
|
||||
#include "arch/cc.h"
|
||||
#include "lwip/udp.h"
|
||||
#include "lwip/netif.h"
|
||||
|
||||
@ -51,8 +53,6 @@
|
||||
#include "lwip/snmp_asn1.h"
|
||||
#include "lwip/snmp_msg.h"
|
||||
|
||||
#if LWIP_SNMP
|
||||
|
||||
/**
|
||||
* TRAP message structure
|
||||
* @todo turn this into an arg to snmp_create_trap ?
|
||||
@ -616,4 +616,4 @@ snmp_varbind_list_enc(struct snmp_varbind_root *root, struct pbuf *p, u16_t ofs)
|
||||
return ofs;
|
||||
}
|
||||
|
||||
#endif /* LWIP_SNMP */
|
||||
#endif /* LWIP_SNMP */
|
||||
|
@ -120,7 +120,6 @@ void snmp_inc_tcpactiveopens(void);
|
||||
void snmp_inc_tcppassiveopens(void);
|
||||
void snmp_inc_tcpattemptfails(void);
|
||||
void snmp_inc_tcpestabresets(void);
|
||||
void snmp_inc_tcpcurrestab(void);
|
||||
void snmp_inc_tcpinsegs(void);
|
||||
void snmp_inc_tcpoutsegs(void);
|
||||
void snmp_inc_tcpretranssegs(void);
|
||||
@ -236,7 +235,6 @@ void snmp_set_snmpenableauthentraps(u8_t *value);
|
||||
#define snmp_inc_tcppassiveopens()
|
||||
#define snmp_inc_tcpattemptfails()
|
||||
#define snmp_inc_tcpestabresets()
|
||||
#define snmp_inc_tcpcurrestab()
|
||||
#define snmp_inc_tcpinsegs()
|
||||
#define snmp_inc_tcpoutsegs()
|
||||
#define snmp_inc_tcpretranssegs()
|
||||
|
@ -38,6 +38,8 @@
|
||||
#define __LWIP_SNMP_STRUCTS_H__
|
||||
|
||||
#include "lwip/opt.h"
|
||||
#if LWIP_SNMP
|
||||
|
||||
#include "arch/cc.h"
|
||||
#include "lwip/snmp.h"
|
||||
|
||||
@ -104,8 +106,8 @@ struct mib_node
|
||||
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)(struct obj_def *od, u16_t len, void *value);
|
||||
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);
|
||||
const u8_t node_type;
|
||||
const u16_t maxlength;
|
||||
|
||||
@ -189,4 +191,5 @@ struct mib_node* snmp_expand_tree(struct mib_node *node, u8_t ident_len, s32_t *
|
||||
u8_t snmp_iso_prefix_tst(u8_t ident_len, s32_t *ident);
|
||||
u8_t snmp_iso_prefix_expand(u8_t ident_len, s32_t *ident, struct snmp_obj_id *oidret);
|
||||
|
||||
#endif /* LWIP_SNMP */
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user