]> git.saurik.com Git - apple/xnu.git/blame - bsd/netinet/in_tclass.h
xnu-4570.51.1.tar.gz
[apple/xnu.git] / bsd / netinet / in_tclass.h
CommitLineData
39037602 1/*
5ba3f43e 2 * Copyright (c) 2015-2017 Apple Inc. All rights reserved.
39037602
A
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 __NETINET_IN_TCLASS_H__
30#define __NETINET_IN_TCLASS_H__
31
32#ifdef PRIVATE
33
34#include <sys/types.h>
35#include <sys/socket.h>
36#include <sys/socketvar.h>
37#include <sys/mbuf.h>
38#include <net/if.h>
39#include <net/if_var.h>
40
41#define SO_TCDBG_PID 0x01 /* Set/get traffic class policy for PID */
42#define SO_TCDBG_PNAME 0x02 /* Set/get traffic class policy for processes of that name */
43#define SO_TCDBG_PURGE 0x04 /* Purge entries for unused PIDs */
44#define SO_TCDBG_FLUSH 0x08 /* Flush all entries */
45#define SO_TCDBG_COUNT 0x10 /* Get count of entries */
46#define SO_TCDBG_LIST 0x20 /* List entries */
47#define SO_TCDBG_DELETE 0x40 /* Delete a process entry */
48#define SO_TCDBG_TCFLUSH_PID 0x80 /* Flush traffic class for PID */
49
50struct so_tcdbg {
51 u_int32_t so_tcdbg_cmd;
52 int32_t so_tcdbg_tclass;
53 int32_t so_tcdbg_netsvctype;
54 u_int32_t so_tcdbg_count;
55 pid_t so_tcdbg_pid;
56 u_int32_t so_tcbbg_qos_mode;
57 char so_tcdbg_pname[(2 * MAXCOMLEN) + 1];
58};
59#define QOS_MODE_MARKING_POLICY_DEFAULT 0
60#define QOS_MODE_MARKING_POLICY_ENABLE 1
61#define QOS_MODE_MARKING_POLICY_DISABLE 2
62
63#define NET_QOS_MARKING_POLICY_DEFAULT QOS_MODE_MARKING_POLICY_DEFAULT /* obsolete, to be removed */
64#define NET_QOS_MARKING_POLICY_ENABLE QOS_MODE_MARKING_POLICY_ENABLE /* obsolete, to be removed */
65#define NET_QOS_MARKING_POLICY_DISABLE QOS_MODE_MARKING_POLICY_DISABLE /* obsolete, to be removed */
66
5ba3f43e
A
67struct net_qos_param {
68 u_int64_t nq_transfer_size; /* transfer size in bytes */
69 u_int32_t nq_use_expensive:1, /* allowed = 1 otherwise 0 */
70 nq_uplink:1; /* uplink = 1 otherwise 0 */
71 u_int32_t nq_unused; /* for future expansion */
72};
73
74#ifndef KERNEL
75
76/*
77 * Returns whether a large upload or download transfer should be marked as
78 * BK service type for network activity. This is a system level
79 * hint/suggestion to classify application traffic based on statistics
80 * collected from the current network attachment
81 *
82 * @param param transfer parameters
83 * @param param_len parameter length
84 * @return returns 1 for BK and 0 for default
85 */
86extern int net_qos_guideline(struct net_qos_param *param, size_t param_len);
87
88#endif /* !KERNEL */
89
39037602
A
90#ifdef BSD_KERNEL_PRIVATE
91
92extern int net_qos_policy_restricted;
93extern int net_qos_policy_wifi_enabled;
94extern int net_qos_policy_capable_enabled;
95
96extern void net_qos_map_init(void);
97extern errno_t set_packet_qos(struct mbuf *, struct ifnet *, boolean_t, int,
98 int, u_int8_t *);
99extern int so_get_netsvc_marking_level(struct socket *);
100
101#endif /* BSD_KERNEL_PRIVATE */
102
103#endif /* PRIVATE */
104
105#endif /* __NETINET_IN_TCLASS_H__ */