]>
git.saurik.com Git - apple/xnu.git/blob - bsd/netinet/mp_pcb.h
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 _NETINET_MP_PCB_H_
30 #define _NETINET_MP_PCB_H_
32 #ifdef BSD_KERNEL_PRIVATE
33 #include <sys/types.h>
34 #include <sys/queue.h>
35 #include <kern/locks.h>
37 /* Keep in sync with bsd/dev/dtrace/scripts/mptcp.d */
38 typedef enum mppcb_state
{
39 MPPCB_STATE_INUSE
= 1,
44 * Multipath Protocol Control Block
47 TAILQ_ENTRY(mppcb
) mpp_entry
; /* glue to all PCBs */
48 decl_lck_mtx_data(, mpp_lock
); /* per PCB lock */
49 struct mppcbinfo
*mpp_pcbinfo
; /* PCB info */
50 void *mpp_pcbe
; /* ptr to per-protocol ext */
51 struct socket
*mpp_socket
; /* back pointer to socket */
52 uint32_t mpp_flags
; /* PCB flags */
53 mppcb_state_t mpp_state
; /* PCB state */
56 #define sotomppcb(so) ((struct mppcb *)((so)->so_pcb))
58 /* valid values for mpp_flags */
59 #define MPP_ATTACHED 0x1
60 #define MPP_DEFUNCT 0x2
63 * Multipath PCB Information
66 TAILQ_ENTRY(mppcbinfo
) mppi_entry
; /* glue to all PCB info */
67 TAILQ_HEAD(, mppcb
) mppi_pcbs
; /* list of PCBs */
68 uint32_t mppi_count
; /* # of PCBs in list */
69 struct zone
*mppi_zone
; /* zone for this PCB */
70 uint32_t mppi_size
; /* size of PCB structure */
71 lck_grp_t
*mppi_lock_grp
; /* lock grp */
72 lck_attr_t
*mppi_lock_attr
; /* lock attr */
73 lck_grp_attr_t
*mppi_lock_grp_attr
; /* lock grp attr */
74 decl_lck_mtx_data(, mppi_lock
); /* global PCB lock */
75 uint32_t (*mppi_gc
)(struct mppcbinfo
*); /* garbage collector func */
76 uint32_t (*mppi_timer
)(struct mppcbinfo
*); /* timer func */
77 /* Extended pcb create func */
78 void *(*mppi_pcbe_create
) (struct socket
*mp_so
, struct mppcb
*mpp
);
82 extern void mp_pcbinit(void);
83 extern void mp_pcbinfo_attach(struct mppcbinfo
*);
84 extern int mp_pcbinfo_detach(struct mppcbinfo
*);
85 extern int mp_pcballoc(struct socket
*, struct mppcbinfo
*);
86 extern void mp_pcbdetach(struct mppcb
*);
87 extern void mp_pcbdispose(struct mppcb
*);
88 extern void mp_gc_sched(void);
89 extern void mptcp_timer_sched(void);
92 #endif /* BSD_KERNEL_PRIVATE */
93 #endif /* !_NETINET_MP_PCB_H_ */