]>
git.saurik.com Git - apple/xnu.git/blob - bsd/netinet/flow_divert.h
0d1f6255b6afd5a20946c6cb3da3c8d011b3c199
2 * Copyright (c) 2012-2013 Apple Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
29 #ifndef __FLOW_DIVERT_H__
30 #define __FLOW_DIVERT_H__
34 struct flow_divert_group
;
36 struct flow_divert_pcb
{
37 decl_lck_mtx_data(, mtx
);
39 RB_ENTRY(flow_divert_pcb
) rb_link
;
42 struct sockaddr
*local_address
;
43 struct sockaddr
*remote_address
;
47 struct flow_divert_group
*group
;
48 uint32_t control_group_unit
;
50 uint32_t bytes_written_by_app
;
51 uint32_t bytes_read_by_app
;
53 uint32_t bytes_received
;
55 SLIST_ENTRY(flow_divert_pcb
) tmp_list_entry
;
58 RB_HEAD(fd_pcb_tree
, flow_divert_pcb
);
60 struct flow_divert_group
{
61 decl_lck_rw_data(, lck
);
62 struct fd_pcb_tree pcb_tree
;
65 MBUFQ_HEAD(send_queue_head
) send_queue
;
67 size_t token_key_size
;
70 void flow_divert_init(void);
71 void flow_divert_detach(struct socket
*so
);
72 errno_t
flow_divert_token_set(struct socket
*so
, struct sockopt
*sopt
);
73 errno_t
flow_divert_token_get(struct socket
*so
, struct sockopt
*sopt
);
74 errno_t
flow_divert_pcb_init(struct socket
*so
, uint32_t ctl_unit
);
75 errno_t
flow_divert_connect_out(struct socket
*so
, struct sockaddr
*to
, proc_t p
);
77 #endif /* __FLOW_DIVERT_H__ */