1/*
2 * Copyright (c) 2012-2017 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
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.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
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.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28
29#ifndef __FLOW_DIVERT_PROTO_H__
30#define __FLOW_DIVERT_PROTO_H__
31
32#define FLOW_DIVERT_CONTROL_NAME "com.apple.flow-divert"
33
34#define FLOW_DIVERT_TLV_LENGTH_UINT32 1
35
36#define FLOW_DIVERT_PKT_CONNECT 1
37#define FLOW_DIVERT_PKT_CONNECT_RESULT 2
38#define FLOW_DIVERT_PKT_DATA 3
39#define FLOW_DIVERT_PKT_CLOSE 4
40#define FLOW_DIVERT_PKT_READ_NOTIFY 5
41#define FLOW_DIVERT_PKT_GROUP_INIT 6
42#define FLOW_DIVERT_PKT_PROPERTIES_UPDATE 7
43#define FLOW_DIVERT_PKT_APP_MAP_CREATE 9
44
45#define FLOW_DIVERT_TLV_NIL 0
46#define FLOW_DIVERT_TLV_ERROR_CODE 5
47#define FLOW_DIVERT_TLV_HOW 7
48#define FLOW_DIVERT_TLV_READ_COUNT 8
49#define FLOW_DIVERT_TLV_SPACE_AVAILABLE 9
50#define FLOW_DIVERT_TLV_CTL_UNIT 10
51#define FLOW_DIVERT_TLV_LOCAL_ADDR 11
52#define FLOW_DIVERT_TLV_REMOTE_ADDR 12
53#define FLOW_DIVERT_TLV_OUT_IF_INDEX 13
54#define FLOW_DIVERT_TLV_TRAFFIC_CLASS 14
55#define FLOW_DIVERT_TLV_NO_CELLULAR 15
56#define FLOW_DIVERT_TLV_FLOW_ID 16
57#define FLOW_DIVERT_TLV_TOKEN_KEY 17
58#define FLOW_DIVERT_TLV_HMAC 18
59#define FLOW_DIVERT_TLV_KEY_UNIT 19
60#define FLOW_DIVERT_TLV_LOG_LEVEL 20
61#define FLOW_DIVERT_TLV_TARGET_HOSTNAME 21
62#define FLOW_DIVERT_TLV_TARGET_ADDRESS 22
63#define FLOW_DIVERT_TLV_TARGET_PORT 23
64#define FLOW_DIVERT_TLV_CDHASH 24
65#define FLOW_DIVERT_TLV_SIGNING_ID 25
66#define FLOW_DIVERT_TLV_PID 26
67#define FLOW_DIVERT_TLV_UUID 27
68#define FLOW_DIVERT_TLV_PREFIX_COUNT 28
69#define FLOW_DIVERT_TLV_FLAGS 29
70#define FLOW_DIVERT_TLV_FLOW_TYPE 30
71#define FLOW_DIVERT_TLV_APP_DATA 31
72
73#define FLOW_DIVERT_FLOW_TYPE_TCP 1
74#define FLOW_DIVERT_FLOW_TYPE_UDP 3
75
76#define FLOW_DIVERT_CHUNK_SIZE 4096
77
78#define FLOW_DIVERT_TOKEN_GETOPT_MAX_SIZE 128
79
80#define FLOW_DIVERT_TOKEN_FLAG_VALIDATED 0x0000001
81#define FLOW_DIVERT_TOKEN_FLAG_TFO 0x0000002
82#define FLOW_DIVERT_TOKEN_FLAG_MPTCP 0x0000004
83
84#define FLOW_DIVERT_GROUP_FLAG_NO_APP_MAP 0x0000001
85
86struct flow_divert_packet_header {
87 uint8_t packet_type;
88 uint32_t conn_id;
89};
90
91#endif /* __FLOW_DIVERT_PROTO_H__ */
92