This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: SNMP data available in 1.0b1 stack?



Grant Edwards <grante@visi.com> writes:
> I've read somewhere that the current version of the TCP/IP
> stack includes optional SNMP support.  While I do not currently
> need to support SNMP, I do need to provide a significant subset
> of the same data via a web page.
> 
> Is that data tucked away somewhere in the 1.0b1 stack, or will
> I need to update to a newer version of the stack?

I would go with whatever is the latest - Jifl?  What's anoncvs status?

For clarification about SNMP, the SNMP agent and library packages are
distributed in a separate EPK, that you add to the repository along with
the net+logical ether driver EPK.

The data is indeed tucked away somewhere in the network stack, in fact the
OpenBSD sources are already "SNMP friendly" to coin a phrase, in that the
various protocol or layer handlers support statistics structures that are
just what you want.  For example, from the TCP MIB support code as
collected straight from UCD, if I remember correctly:

    case TCPACTIVEOPENS:
        long_ret = tcpstat.tcps_connattempt;
        return (unsigned char *) &long_ret;

    case TCPPASSIVEOPENS:
        long_ret = tcpstat.tcps_accepts;
        return (unsigned char *) &long_ret;

    case TCPATTEMPTFAILS:
        long_ret = tcpstat.tcps_conndrops;
        return (unsigned char *) &long_ret;

    case TCPESTABRESETS:
        long_ret = tcpstat.tcps_drops;
        return (unsigned char *) &long_ret;

So you should be able to just pull out these stats in any app linked with
the net stack.  (This code is compiled with _KERNEL defined to cause the
network headers to expose these in-kernel data structures)

So you should be able to find these kinds of structs in your network
headers somewhere...  ah yes, a quick few greps reveal these:

./include/net/if_pppvar.h:      struct  pppstat sc_stats;
./include/netinet/icmp_var.h:struct     icmpstat {
./include/netinet/icmp_var.h:struct     icmpstat icmpstat;
./include/netinet/igmp_var.h:struct igmpstat {
./include/netinet/igmp_var.h:struct igmpstat igmpstat;
./include/netinet/ip_var.h:struct       ipstat {
./include/netinet/ip_var.h:struct         ipstat ipstat;
./include/netinet/tcp_var.h:struct      tcpstat {
./include/netinet/tcp_var.h:struct      tcpstat tcpstat;
./include/netinet/udp_var.h:struct      udpstat {
./include/netinet/udp_var.h:struct      udpstat udpstat;

HTH,
	- Huge

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]