2 * Copyright (c) 2011-2012 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@
30 * Copyright (c) 2002 Luigi Rizzo, Universita` di Pisa
32 * Redistribution and use in source and binary forms, with or without
33 * modification, are permitted provided that the following conditions
35 * 1. Redistributions of source code must retain the above copyright
36 * notice, this list of conditions and the following disclaimer.
37 * 2. Redistributions in binary form must reproduce the above copyright
38 * notice, this list of conditions and the following disclaimer in the
39 * documentation and/or other materials provided with the distribution.
41 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
55 #ifndef __IP_FLOWID_H__
56 #define __IP_FLOWID_H__
58 #include <sys/types.h>
59 #include <netinet/in.h>
62 * This structure is used as a flow mask and a flow id for various
71 u_int8_t flags
; /* protocol-specific flags */
72 u_int8_t addr_type
; /* 4 = ipv4, 6 = ipv6, 1=ether ? */
73 struct in6_addr dst_ip6
; /* could also store MAC addr! */
74 struct in6_addr src_ip6
;
79 #define IS_IP6_FLOW_ID(id) ((id)->addr_type == 6)
81 #ifdef BSD_KERNEL_PRIVATE
88 * Arguments for calling ipfw_chk() and dummynet_io(). We put them
89 * all into a structure because this way it is easier and more
90 * efficient to pass variables around and extend the interface.
93 struct mbuf
*fwa_m
; /* the mbuf chain */
94 struct ifnet
*fwa_oif
; /* output interface */
95 struct sockaddr_in
*fwa_next_hop
; /* forward address */
96 struct ip_fw
*fwa_ipfw_rule
; /* matching IPFW rule */
97 struct pf_rule
*fwa_pf_rule
; /* matching PF rule */
98 struct ether_header
*fwa_eh
; /* for bridged packets */
99 int fwa_flags
; /* for dummynet */
100 int fwa_oflags
; /* for dummynet */
102 struct ip_out_args
*_fwa_ipoa
; /* for dummynet */
103 struct ip6_out_args
*_fwa_ip6oa
; /* for dummynet */
106 struct route
*_fwa_ro
; /* for dummynet */
107 struct route_in6
*_fwa_ro6
; /* for dummynet */
110 struct sockaddr_in
*_fwa_dst
; /* for dummynet */
111 struct sockaddr_in6
*_fwa_dst6
; /* for IPv6 dummynet */
113 struct route_in6
*fwa_ro6_pmtu
; /* for IPv6 output */
114 struct ifnet
*fwa_origifp
; /* for IPv6 output */
115 u_int32_t fwa_mtu
; /* for IPv6 output */
116 u_int32_t fwa_unfragpartlen
; /* for IPv6 output */
117 struct ip6_exthdrs
*fwa_exthdrs
; /* for IPv6 output */
118 struct ip_flow_id fwa_id
; /* grabbed from IP header */
119 u_int16_t fwa_divert_rule
;/* divert cookie */
120 u_int32_t fwa_cookie
;
122 #define fwa_ipoa fwa_ipoa_._fwa_ipoa
123 #define fwa_ip6oa fwa_ipoa_._fwa_ip6oa
124 #define fwa_ro fwa_ro_._fwa_ro
125 #define fwa_ro6 fwa_ro_._fwa_ro6
126 #define fwa_dst fwa_dst_._fwa_dst
127 #define fwa_dst6 fwa_dst_._fwa_dst6
129 /* Allocate a separate structure for inputs args to save space and bzero time */
130 struct ip_fw_in_args
{
131 struct sockaddr_in
*fwai_next_hop
; /* forward address */
132 struct ip_fw
*fwai_ipfw_rule
;/* matching IPFW rule */
133 struct pf_rule
*fwai_pf_rule
; /* matching PF rule */
134 u_int16_t fwai_divert_rule
;/* divert cookie */
137 #endif /* BSD_KERNEL_PRIVATE */
139 #endif /* __IP_FLOWID_H__ */