* added 0.99 linux version
[mascara-docs.git] / i386 / linux / linux-2.3.21 / net / ipv6 / proc.c
blob09845703b4edf4fb963a588fd6d2c63f7c2cb592
1 /*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
6 * This file implements the various access functions for the
7 * PROC file system. This is very similar to the IPv4 version,
8 * except it reports the sockets in the INET6 address family.
10 * Version: $Id: proc.c,v 1.11 1999/07/02 11:26:45 davem Exp $
12 * Authors: David S. Miller (davem@caip.rutgers.edu)
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version
17 * 2 of the License, or (at your option) any later version.
19 #include <linux/sched.h>
20 #include <linux/socket.h>
21 #include <linux/net.h>
22 #include <linux/in6.h>
23 #include <linux/stddef.h>
24 #include <net/sock.h>
25 #include <net/tcp.h>
26 #include <net/transp_v6.h>
27 #include <net/ipv6.h>
29 int afinet6_get_info(char *buffer, char **start, off_t offset, int length, int dummy)
31 int len = 0;
32 len += sprintf(buffer+len, "TCP6: inuse %d highest %d\n",
33 tcpv6_prot.inuse, tcpv6_prot.highestinuse);
34 len += sprintf(buffer+len, "UDP6: inuse %d highest %d\n",
35 udpv6_prot.inuse, udpv6_prot.highestinuse);
36 len += sprintf(buffer+len, "RAW6: inuse %d highest %d\n",
37 rawv6_prot.inuse, rawv6_prot.highestinuse);
38 *start = buffer + offset;
39 len -= offset;
40 if(len > length)
41 len = length;
42 return len;
46 struct snmp6_item
48 char *name;
49 unsigned long *ptr;
50 } snmp6_list[] = {
51 /* ipv6 mib according to draft-ietf-ipngwg-ipv6-mib-04 */
52 #define SNMP6_GEN(x) { #x , &ipv6_statistics.x }
53 SNMP6_GEN(Ip6InReceives),
54 SNMP6_GEN(Ip6InHdrErrors),
55 SNMP6_GEN(Ip6InTooBigErrors),
56 SNMP6_GEN(Ip6InNoRoutes),
57 SNMP6_GEN(Ip6InAddrErrors),
58 SNMP6_GEN(Ip6InUnknownProtos),
59 SNMP6_GEN(Ip6InTruncatedPkts),
60 SNMP6_GEN(Ip6InDiscards),
61 SNMP6_GEN(Ip6InDelivers),
62 SNMP6_GEN(Ip6OutForwDatagrams),
63 SNMP6_GEN(Ip6OutRequests),
64 SNMP6_GEN(Ip6OutDiscards),
65 SNMP6_GEN(Ip6OutNoRoutes),
66 SNMP6_GEN(Ip6ReasmTimeout),
67 SNMP6_GEN(Ip6ReasmReqds),
68 SNMP6_GEN(Ip6ReasmOKs),
69 SNMP6_GEN(Ip6ReasmFails),
70 SNMP6_GEN(Ip6FragOKs),
71 SNMP6_GEN(Ip6FragFails),
72 SNMP6_GEN(Ip6FragCreates),
73 SNMP6_GEN(Ip6InMcastPkts),
74 SNMP6_GEN(Ip6OutMcastPkts),
75 #undef SNMP6_GEN
76 /* icmpv6 mib according to draft-ietf-ipngwg-ipv6-icmp-mib-02
78 Exceptions: {In|Out}AdminProhibs are removed, because I see
79 no good reasons to account them separately
80 of another dest.unreachs.
81 OutErrs is zero identically.
82 OutEchos too.
83 OutRouterAdvertisements too.
84 OutGroupMembQueries too.
86 #define SNMP6_GEN(x) { #x , &icmpv6_statistics.x }
87 SNMP6_GEN(Icmp6InMsgs),
88 SNMP6_GEN(Icmp6InErrors),
89 SNMP6_GEN(Icmp6InDestUnreachs),
90 SNMP6_GEN(Icmp6InPktTooBigs),
91 SNMP6_GEN(Icmp6InTimeExcds),
92 SNMP6_GEN(Icmp6InParmProblems),
93 SNMP6_GEN(Icmp6InEchos),
94 SNMP6_GEN(Icmp6InEchoReplies),
95 SNMP6_GEN(Icmp6InGroupMembQueries),
96 SNMP6_GEN(Icmp6InGroupMembResponses),
97 SNMP6_GEN(Icmp6InGroupMembReductions),
98 SNMP6_GEN(Icmp6InRouterSolicits),
99 SNMP6_GEN(Icmp6InRouterAdvertisements),
100 SNMP6_GEN(Icmp6InNeighborSolicits),
101 SNMP6_GEN(Icmp6InNeighborAdvertisements),
102 SNMP6_GEN(Icmp6InRedirects),
103 SNMP6_GEN(Icmp6OutMsgs),
104 SNMP6_GEN(Icmp6OutDestUnreachs),
105 SNMP6_GEN(Icmp6OutPktTooBigs),
106 SNMP6_GEN(Icmp6OutTimeExcds),
107 SNMP6_GEN(Icmp6OutParmProblems),
108 SNMP6_GEN(Icmp6OutEchoReplies),
109 SNMP6_GEN(Icmp6OutRouterSolicits),
110 SNMP6_GEN(Icmp6OutNeighborSolicits),
111 SNMP6_GEN(Icmp6OutNeighborAdvertisements),
112 SNMP6_GEN(Icmp6OutRedirects),
113 SNMP6_GEN(Icmp6OutGroupMembResponses),
114 SNMP6_GEN(Icmp6OutGroupMembReductions),
115 #undef SNMP6_GEN
116 #define SNMP6_GEN(x) { "Udp6" #x , &udp_stats_in6.Udp##x }
117 SNMP6_GEN(InDatagrams),
118 SNMP6_GEN(NoPorts),
119 SNMP6_GEN(InErrors),
120 SNMP6_GEN(OutDatagrams)
121 #undef SNMP6_GEN
125 int afinet6_get_snmp(char *buffer, char **start, off_t offset, int length,
126 int dummy)
128 int len = 0;
129 int i;
131 for (i=0; i<sizeof(snmp6_list)/sizeof(snmp6_list[0]); i++)
132 len += sprintf(buffer+len, "%-32s\t%ld\n", snmp6_list[i].name,
133 *(snmp6_list[i].ptr));
135 len -= offset;
137 if (len > length)
138 len = length;
139 if(len < 0)
140 len = 0;
142 *start = buffer + offset;
144 return len;