3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright 2015, Joyent, Inc.
24 */
25
26 #ifndef _UDP_IMPL_H
27 #define _UDP_IMPL_H
28
29 /*
30 * UDP implementation private declarations. These interfaces are
31 * used to build the IP module and are not meant to be accessed
32 * by any modules except IP itself. They are undocumented and are
33 * subject to change without notice.
34 */
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39
40 #ifdef _KERNEL
41
42 #include <sys/int_types.h>
43 #include <sys/netstack.h>
162
163 /* Internal udp control structure, one per open stream */
164 typedef struct udp_s {
165 /*
166 * The addresses and ports in the conn_t and udp_state are protected by
167 * conn_lock and the fanout lock i.e. uf_lock. Need both locks to change
168 * the fields, either lock is sufficient for reading the field.
169 * conn_lock also protects the content of udp_t.
170 */
171 uint32_t udp_state; /* TPI state */
172
173 ip_pkt_t udp_recv_ipp; /* Used for IPv4 options received */
174
175 /* Written to only once at the time of opening the endpoint */
176 conn_t *udp_connp;
177
178 uint32_t
179 udp_issocket : 1, /* socket mode; sockfs is on top */
180 udp_nat_t_endpoint : 1, /* UDP_NAT_T_ENDPOINT option */
181 udp_rcvhdr : 1, /* UDP_RCVHDR option */
182 udp_vxlanhash: 1, /* UDP_SRCPORT_HASH option */
183 /* Because there's only VXLAN, cheat */
184 /* and only use a single bit */
185 udp_snd_to_conn: 1, /* UDP_SND_TO_CONNECTED option */
186
187 udp_pad_to_bit_31 : 27;
188
189 /* Following 2 fields protected by the uf_lock */
190 struct udp_s *udp_bind_hash; /* Bind hash chain */
191 struct udp_s **udp_ptpbhn; /* Pointer to previous bind hash next. */
192
193 kmutex_t udp_recv_lock; /* recv lock */
194 size_t udp_rcv_disply_hiwat; /* user's view of rcvbuf */
195 size_t udp_rcv_hiwat; /* receive high watermark */
196
197 /* Set at open time and never changed */
198 udp_stack_t *udp_us; /* Stack instance for zone */
199
200 int udp_delayed_error;
201 mblk_t *udp_fallback_queue_head;
202 mblk_t *udp_fallback_queue_tail;
203 struct sockaddr_storage udp_delayed_addr;
204 } udp_t;
205
206 /* UDP Protocol header aligned */
207 typedef struct udpahdr_s {
|
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
23 */
24
25 #ifndef _UDP_IMPL_H
26 #define _UDP_IMPL_H
27
28 /*
29 * UDP implementation private declarations. These interfaces are
30 * used to build the IP module and are not meant to be accessed
31 * by any modules except IP itself. They are undocumented and are
32 * subject to change without notice.
33 */
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 #ifdef _KERNEL
40
41 #include <sys/int_types.h>
42 #include <sys/netstack.h>
161
162 /* Internal udp control structure, one per open stream */
163 typedef struct udp_s {
164 /*
165 * The addresses and ports in the conn_t and udp_state are protected by
166 * conn_lock and the fanout lock i.e. uf_lock. Need both locks to change
167 * the fields, either lock is sufficient for reading the field.
168 * conn_lock also protects the content of udp_t.
169 */
170 uint32_t udp_state; /* TPI state */
171
172 ip_pkt_t udp_recv_ipp; /* Used for IPv4 options received */
173
174 /* Written to only once at the time of opening the endpoint */
175 conn_t *udp_connp;
176
177 uint32_t
178 udp_issocket : 1, /* socket mode; sockfs is on top */
179 udp_nat_t_endpoint : 1, /* UDP_NAT_T_ENDPOINT option */
180 udp_rcvhdr : 1, /* UDP_RCVHDR option */
181 udp_snd_to_conn: 1, /* UDP_SND_TO_CONNECTED option */
182
183 udp_pad_to_bit_31 : 28;
184
185 /* Following 2 fields protected by the uf_lock */
186 struct udp_s *udp_bind_hash; /* Bind hash chain */
187 struct udp_s **udp_ptpbhn; /* Pointer to previous bind hash next. */
188
189 kmutex_t udp_recv_lock; /* recv lock */
190 size_t udp_rcv_disply_hiwat; /* user's view of rcvbuf */
191 size_t udp_rcv_hiwat; /* receive high watermark */
192
193 /* Set at open time and never changed */
194 udp_stack_t *udp_us; /* Stack instance for zone */
195
196 int udp_delayed_error;
197 mblk_t *udp_fallback_queue_head;
198 mblk_t *udp_fallback_queue_tail;
199 struct sockaddr_storage udp_delayed_addr;
200 } udp_t;
201
202 /* UDP Protocol header aligned */
203 typedef struct udpahdr_s {
|