Print this page
dccp: starting module template
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/inet/tunables.h
+++ new/usr/src/uts/common/inet/tunables.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
23 23 * Copyright (c) 1990 Mentat Inc.
24 24 */
25 25
26 26 #ifndef _INET_TUNABLES_H
27 27 #define _INET_TUNABLES_H
28 28
29 29 #include <sys/types.h>
30 30 #include <net/if.h>
31 31 #ifdef _KERNEL
32 32 #include <sys/netstack.h>
33 33 #endif
34 34
35 35 #ifdef __cplusplus
36 36 extern "C" {
37 37 #endif
38 38
39 39 #define MAXPROPNAMELEN 64
40 40
41 41 /*
42 42 * The `mod_ioc_prop_s' datastructure is used as an IOCTL argument for
43 43 * SIOCSETPROP and SIOCGETPROP ioctls. This datastructure identifies the
44 44 * protocol (`mpr_proto') property (`mpr_name'), which needs to be modified
45 45 * or retrieved (`mpr_valsize' and `mpr_val'). If the property applies to an
46 46 * interface then `mpr_ifname' contains the name of the interface.
47 47 */
48 48 typedef struct mod_ioc_prop_s {
49 49 uint_t mpr_version;
50 50 uint_t mpr_flags; /* see below */
51 51 /* name of the interface (ill) for which property will be applied */
52 52 char mpr_ifname[LIFNAMSIZ];
53 53 uint_t mpr_proto; /* see below */
54 54 char mpr_name[MAXPROPNAMELEN]; /* property name */
55 55 uint_t mpr_valsize; /* size of mpr_val */
56 56 char mpr_val[1];
57 57 } mod_ioc_prop_t;
58 58
59 59 #define MOD_PROP_VERSION 1
60 60
61 61 /* permission flags for properties */
62 62 #define MOD_PROP_PERM_READ 0x1
63 63 #define MOD_PROP_PERM_WRITE 0x2
64 64 #define MOD_PROP_PERM_RW (MOD_PROP_PERM_READ|MOD_PROP_PERM_WRITE)
65 65
66 66 /* mpr_flags values */
67 67 #define MOD_PROP_ACTIVE 0x01 /* current value of the property */
68 68 #define MOD_PROP_DEFAULT 0x02 /* default value of the property */
69 69 #define MOD_PROP_POSSIBLE 0x04 /* possible values for the property */
70 70 #define MOD_PROP_PERM 0x08 /* read/write permission for property */
71 71 #define MOD_PROP_APPEND 0x10 /* append to multi-valued property */
↓ open down ↓ |
71 lines elided |
↑ open up ↑ |
72 72 #define MOD_PROP_REMOVE 0x20 /* remove from multi-valued property */
73 73
74 74 /* mpr_proto values */
75 75 #define MOD_PROTO_NONE 0x00
76 76 #define MOD_PROTO_IPV4 0x01 /* property is applicable to IPV4 */
77 77 #define MOD_PROTO_IPV6 0x02 /* property is applicable to IPV6 */
78 78 #define MOD_PROTO_RAWIP 0x04 /* property is applicable to ICMP */
79 79 #define MOD_PROTO_TCP 0x08 /* property is applicable to TCP */
80 80 #define MOD_PROTO_UDP 0x10 /* property is applicable to UDP */
81 81 #define MOD_PROTO_SCTP 0x20 /* property is applicable to SCTP */
82 +#define MOD_PROTO_DCCP 0x40 /* property is applicable to DCCP */
82 83
83 84 /* property is applicable to both IPV[4|6] */
84 85 #define MOD_PROTO_IP (MOD_PROTO_IPV4|MOD_PROTO_IPV6)
85 86
86 87 #ifdef _KERNEL
87 88
88 89 typedef struct mod_prop_info_s mod_prop_info_t;
89 90
90 91 /* set/get property callback functions */
91 92 typedef int mod_prop_setf_t(void *, cred_t *, mod_prop_info_t *,
92 93 const char *, const void *, uint_t);
93 94 typedef int mod_prop_getf_t(void *, mod_prop_info_t *, const char *,
94 95 void *val, uint_t, uint_t);
95 96
96 97 typedef struct mod_propval_uint32_s {
97 98 uint32_t mod_propval_umin;
98 99 uint32_t mod_propval_umax;
99 100 uint32_t mod_propval_ucur;
100 101 } mod_propval_uint32_t;
101 102
102 103 /*
103 104 * protocol property information
104 105 */
105 106 struct mod_prop_info_s {
106 107 char *mpi_name; /* property name */
107 108 uint_t mpi_proto; /* property protocol */
108 109 mod_prop_setf_t *mpi_setf; /* sets the property value */
109 110 mod_prop_getf_t *mpi_getf; /* gets the property value */
110 111 /*
111 112 * Holds the current value of the property. Whenever applicable
112 113 * holds the min/max value too.
113 114 */
114 115 union {
115 116 mod_propval_uint32_t mpi_uval;
116 117 boolean_t mpi_bval;
117 118 uint64_t _pad[2];
118 119 } u;
119 120 /*
120 121 * Holds the default value of the property, that is value of
121 122 * the property at boot time.
122 123 */
123 124 union {
124 125 uint32_t mpi_def_uval;
125 126 boolean_t mpi_def_bval;
126 127 } u_def;
127 128 };
128 129
129 130 /* shortcuts to access current/default values */
130 131 #define prop_min_uval u.mpi_uval.mod_propval_umin
131 132 #define prop_max_uval u.mpi_uval.mod_propval_umax
132 133 #define prop_cur_uval u.mpi_uval.mod_propval_ucur
133 134 #define prop_cur_bval u.mpi_bval
134 135 #define prop_def_uval u_def.mpi_def_uval
135 136 #define prop_def_bval u_def.mpi_def_bval
136 137
137 138 #define MS 1L
138 139 #define SECONDS (1000 * MS)
139 140 #define MINUTES (60 * SECONDS)
140 141 #define HOURS (60 * MINUTES)
141 142 #define DAYS (24 * HOURS)
142 143
143 144 #define MB (1024 * 1024)
144 145
145 146 /* Largest TCP/UDP/SCTP port number */
146 147 #define ULP_MAX_PORT (64 * 1024 - 1)
147 148
148 149 /* extra privilege ports for upper layer protocols, tcp, sctp and udp */
149 150 #define ULP_DEF_EPRIV_PORT1 2049
150 151 #define ULP_DEF_EPRIV_PORT2 4045
151 152
152 153 /* generic function to set/get global module properties */
153 154 extern mod_prop_setf_t mod_set_boolean, mod_set_uint32,
154 155 mod_set_aligned, mod_set_extra_privports;
155 156
156 157 extern mod_prop_getf_t mod_get_boolean, mod_get_uint32,
157 158 mod_get_allprop, mod_get_extra_privports;
158 159
159 160 extern int mod_uint32_value(const void *, mod_prop_info_t *, uint_t,
160 161 unsigned long *);
161 162
162 163 #endif /* _KERNEL */
163 164
164 165 /*
165 166 * End-system model definitions that include the weak/strong end-system
166 167 * definitions in RFC 1122, Section 3.3.4.5. IP_WEAK_ES and IP_STRONG_ES
167 168 * conform to the corresponding RFC 1122 definitions. The IP_SRC_PRI_ES
168 169 * hostmodel is similar to IP_WEAK_ES with one additional enhancement: for
169 170 * a packet with source S2, destination D2, the route selection algorithm
170 171 * will first attempt to find a route for the destination that goes out
171 172 * through an interface where S2 is configured and marked UP. If such
172 173 * a route cannot be found, then the best-matching route for D2 will be
173 174 * selected, ignoring any mismatches between S2 and the interface addresses
174 175 * on the outgoing interface implied by the route.
175 176 */
176 177 typedef enum {
177 178 IP_WEAK_ES = 0,
178 179 IP_SRC_PRI_ES,
179 180 IP_STRONG_ES,
180 181 IP_MAXVAL_ES
181 182 } ip_hostmodel_t;
182 183
183 184 #ifdef __cplusplus
184 185 }
185 186 #endif
186 187
187 188 #endif /* _INET_TUNABLES_H */
↓ open down ↓ |
96 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX