19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
24 */
25
26 #include <sys/types.h>
27 #include <sys/tihdr.h>
28 #include <sys/policy.h>
29 #include <sys/tsol/tnet.h>
30
31 #include <inet/common.h>
32 #include <inet/ip.h>
33 #include <inet/tcp.h>
34 #include <inet/tcp_impl.h>
35 #include <inet/tcp_stats.h>
36 #include <inet/kstatcom.h>
37 #include <inet/snmpcom.h>
38
39 static int tcp_kstat_update(kstat_t *kp, int rw);
40 static int tcp_kstat2_update(kstat_t *kp, int rw);
41 static void tcp_sum_mib(tcp_stack_t *, mib2_tcp_t *);
42
43 static void tcp_add_mib(mib2_tcp_t *, mib2_tcp_t *);
44 static void tcp_add_stats(tcp_stat_counter_t *, tcp_stat_t *);
45 static void tcp_clr_stats(tcp_stat_t *);
46
47 tcp_g_stat_t tcp_g_statistics;
48 kstat_t *tcp_g_kstat;
49
50 /* Translate TCP state to MIB2 TCP state. */
51 static int
52 tcp_snmp_state(tcp_t *tcp)
53 {
54 if (tcp == NULL)
55 return (0);
56
57 switch (tcp->tcp_state) {
58 case TCPS_CLOSED:
59 case TCPS_IDLE: /* RFC1213 doesn't have analogue for IDLE & BOUND */
60 case TCPS_BOUND:
|
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
24 */
25
26 #include <sys/types.h>
27 #include <sys/tihdr.h>
28 #include <sys/policy.h>
29 #include <sys/tsol/tnet.h>
30
31 #include <inet/common.h>
32 #include <inet/ip.h>
33 #include <inet/tcp.h>
34 #include <inet/tcp_impl.h>
35 #include <inet/tcp_stats.h>
36 #include <inet/kstatcom.h>
37 #include <inet/snmpcom.h>
38
39 static int tcp_snmp_state(tcp_t *);
40 static int tcp_kstat_update(kstat_t *, int);
41 static int tcp_kstat2_update(kstat_t *, int);
42 static void tcp_sum_mib(tcp_stack_t *, mib2_tcp_t *);
43
44 static void tcp_add_mib(mib2_tcp_t *, mib2_tcp_t *);
45 static void tcp_add_stats(tcp_stat_counter_t *, tcp_stat_t *);
46 static void tcp_clr_stats(tcp_stat_t *);
47
48 tcp_g_stat_t tcp_g_statistics;
49 kstat_t *tcp_g_kstat;
50
51 /* Translate TCP state to MIB2 TCP state. */
52 static int
53 tcp_snmp_state(tcp_t *tcp)
54 {
55 if (tcp == NULL)
56 return (0);
57
58 switch (tcp->tcp_state) {
59 case TCPS_CLOSED:
60 case TCPS_IDLE: /* RFC1213 doesn't have analogue for IDLE & BOUND */
61 case TCPS_BOUND:
|