2 * Copyright (c) 2015-2017 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_IN_TCLASS_H__
30 #define __NETINET_IN_TCLASS_H__
34 #include <sys/types.h>
35 #include <sys/socket.h>
36 #include <sys/socketvar.h>
39 #include <net/if_var.h>
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 */
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
;
56 u_int32_t so_tcbbg_qos_mode
;
57 char so_tcdbg_pname
[(2 * MAXCOMLEN
) + 1];
59 #define QOS_MODE_MARKING_POLICY_DEFAULT 0
60 #define QOS_MODE_MARKING_POLICY_ENABLE 1
61 #define QOS_MODE_MARKING_POLICY_DISABLE 2
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 */
67 struct 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 */
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
82 * @param param transfer parameters
83 * @param param_len parameter length
84 * @return returns 1 for BK and 0 for default
86 extern int net_qos_guideline(struct net_qos_param
*param
, size_t param_len
);
90 #ifdef BSD_KERNEL_PRIVATE
92 extern int net_qos_policy_restricted
;
93 extern int net_qos_policy_wifi_enabled
;
94 extern int net_qos_policy_capable_enabled
;
96 extern void net_qos_map_init(void);
97 extern errno_t
set_packet_qos(struct mbuf
*, struct ifnet
*, boolean_t
, int,
99 extern int so_get_netsvc_marking_level(struct socket
*);
101 #endif /* BSD_KERNEL_PRIVATE */
105 #endif /* __NETINET_IN_TCLASS_H__ */