Unnamed: 0
int64 0
0
| repo_id
stringlengths 5
186
| file_path
stringlengths 15
223
| content
stringlengths 1
32.8M
⌀ |
---|---|---|---|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/architecture | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/architecture/i386/desc.h | /*
* Copyright (c) 2000-2019 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Copyright (c) 1992 NeXT Computer, Inc.
*
* Intel386 Family: Segment descriptors.
*
* HISTORY
*
* 29 March 1992 ? at NeXT
* Created.
*/
/*
* Code segment descriptor.
*/
typedef struct code_desc {
unsigned short limit00;
unsigned short base00;
unsigned char base16;
unsigned char type :5,
#define DESC_CODE_EXEC 0x18
#define DESC_CODE_READ 0x1a
dpl :2,
present :1;
unsigned char limit16 :4,
:1,
Lflag :1,
opsz :1,
#define DESC_CODE_16B 0
#define DESC_CODE_32B 1
granular:1;
#define DESC_GRAN_BYTE 0
#define DESC_GRAN_PAGE 1
unsigned char base24;
} code_desc_t;
/*
* Data segment descriptor.
*/
typedef struct data_desc {
unsigned short limit00;
unsigned short base00;
unsigned char base16;
unsigned char type :5,
#define DESC_DATA_RONLY 0x10
#define DESC_DATA_WRITE 0x12
dpl :2,
present :1;
unsigned char limit16 :4,
:2,
stksz :1,
#define DESC_DATA_16B 0
#define DESC_DATA_32B 1
granular:1;
unsigned char base24;
} data_desc_t;
/*
* LDT segment descriptor.
*/
typedef struct ldt_desc {
unsigned short limit00;
unsigned short base00;
unsigned char base16;
unsigned char type :5,
#define DESC_LDT 0x02
:2,
present :1;
unsigned char limit16 :4,
:3,
granular:1;
unsigned char base24;
} ldt_desc_t;
#include <architecture/i386/sel.h>
/*
* Call gate descriptor.
*/
typedef struct call_gate {
unsigned short offset00;
sel_t seg;
unsigned int argcnt :5,
:3,
type :5,
#define DESC_CALL_GATE 0x0c
dpl :2,
present :1,
offset16:16;
} call_gate_t;
/*
* Trap gate descriptor.
*/
typedef struct trap_gate {
unsigned short offset00;
sel_t seg;
unsigned int :8,
type :5,
#define DESC_TRAP_GATE 0x0f
dpl :2,
present :1,
offset16:16;
} trap_gate_t;
/*
* Interrupt gate descriptor.
*/
typedef struct intr_gate {
unsigned short offset00;
sel_t seg;
unsigned int :8,
type :5,
#define DESC_INTR_GATE 0x0e
dpl :2,
present :1,
offset16:16;
} intr_gate_t;
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKitUser/OSArray.h | #include <DriverKit/OSArray.h>
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKitUser/OSObject.h | #include <DriverKit/OSObject.h>
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKitUser/OSCollection.h | #include <DriverKit/OSCollection.h>
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKitUser/IOMemoryMap.h | #include <DriverKit/IOMemoryMap.h>
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKitUser/OSString.h | #include <DriverKit/OSString.h>
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKitUser/IOBlockStorageDevice.h | #include <DriverKit/IOBlockStorageDevice.h>
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKitUser/IOMemoryDescriptor.h | #include <DriverKit/IOMemoryDescriptor.h>
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKitUser/IODispatchSource.h | #include <DriverKit/IODispatchSource.h>
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKitUser/OSAction.h | #include <DriverKit/OSAction.h>
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKitUser/OSDictionary.h | #include <DriverKit/OSDictionary.h>
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKitUser/IODataQueueDispatchSource.h | #include <DriverKit/IODataQueueDispatchSource.h>
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKitUser/OSData.h | #include <DriverKit/OSData.h>
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKitUser/OSSerialization.h | #include <DriverKit/OSSerialization.h>
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKitUser/IOBufferMemoryDescriptor.h | #include <DriverKit/IOBufferMemoryDescriptor.h>
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKitUser/IOUserServer.h | #include <DriverKit/IOUserServer.h>
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKitUser/IOTimerDispatchSource.h | #include <DriverKit/IOTimerDispatchSource.h>
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKitUser/IOService.h | #include <DriverKit/IOService.h>
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKitUser/OSBoolean.h | #include <DriverKit/OSBoolean.h>
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKitUser/IODispatchQueue.h | #include <DriverKit/IODispatchQueue.h>
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKitUser/OSNumber.h | #include <DriverKit/OSNumber.h>
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKitUser/IOInterruptDispatchSource.h | #include <DriverKit/IOInterruptDispatchSource.h>
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKitUser/OSContainer.h | #include <DriverKit/OSContainer.h>
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/net/if_ether.h | /*
* Copyright (c) 2004-2012 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _NET_IF_ETHER_H
#define _NET_IF_ETHER_H
#include <net/kpi_interface.h>
__BEGIN_DECLS
/* Not exported */
extern int ether_family_init(void);
/*
* These functions may be used for an interface emulating an ethernet
* interface and not using IOKit. If you use IOKit and the IOKit
* Ethernet Family, these functions will be set for you. Use these
* functions when filling out the ifnet_init_params structure.
*/
errno_t ether_demux(ifnet_t interface, mbuf_t packet, char* header,
protocol_family_t *protocol);
errno_t ether_add_proto(ifnet_t interface, protocol_family_t protocol,
const struct ifnet_demux_desc *demux_list, u_int32_t demux_count);
errno_t ether_del_proto(ifnet_t interface, protocol_family_t protocol);
#if KPI_INTERFACE_EMBEDDED
errno_t ether_frameout(ifnet_t interface, mbuf_t *packet,
const struct sockaddr *dest, const char *dest_lladdr,
const char *frame_type, u_int32_t *prepend_len, u_int32_t *postpend_len);
#else /* !KPI_INTERFACE_EMBEDDED */
errno_t ether_frameout(ifnet_t interface, mbuf_t *packet,
const struct sockaddr *dest, const char *dest_lladdr,
const char *frame_type);
#endif /* !KPI_INTERFACE_EMBEDDED */
errno_t ether_ioctl(ifnet_t interface, u_int32_t command, void* data);
errno_t ether_check_multi(ifnet_t ifp, const struct sockaddr *multicast);
__END_DECLS
#endif /* _NET_IF_ETHER_H */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/net/route.h | /*
* Copyright (c) 2000-2017 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Copyright (c) 1980, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)route.h 8.3 (Berkeley) 4/19/94
* $FreeBSD: src/sys/net/route.h,v 1.36.2.1 2000/08/16 06:14:23 jayanth Exp $
*/
#ifndef _NET_ROUTE_H_
#define _NET_ROUTE_H_
#include <sys/appleapiopts.h>
#include <stdint.h>
#include <sys/types.h>
#include <sys/socket.h>
/*
* These numbers are used by reliable protocols for determining
* retransmission behavior and are included in the routing structure.
*/
struct rt_metrics {
u_int32_t rmx_locks; /* Kernel leaves these values alone */
u_int32_t rmx_mtu; /* MTU for this path */
u_int32_t rmx_hopcount; /* max hops expected */
int32_t rmx_expire; /* lifetime for route, e.g. redirect */
u_int32_t rmx_recvpipe; /* inbound delay-bandwidth product */
u_int32_t rmx_sendpipe; /* outbound delay-bandwidth product */
u_int32_t rmx_ssthresh; /* outbound gateway buffer limit */
u_int32_t rmx_rtt; /* estimated round trip time */
u_int32_t rmx_rttvar; /* estimated rtt variance */
u_int32_t rmx_pksent; /* packets sent using this route */
u_int32_t rmx_state; /* route state */
u_int32_t rmx_filler[3]; /* will be used for TCP's peer-MSS cache */
};
/*
* rmx_rtt and rmx_rttvar are stored as microseconds;
*/
#define RTM_RTTUNIT 1000000 /* units for rtt, rttvar, as units per sec */
#define RTF_UP 0x1 /* route usable */
#define RTF_GATEWAY 0x2 /* destination is a gateway */
#define RTF_HOST 0x4 /* host entry (net otherwise) */
#define RTF_REJECT 0x8 /* host or net unreachable */
#define RTF_DYNAMIC 0x10 /* created dynamically (by redirect) */
#define RTF_MODIFIED 0x20 /* modified dynamically (by redirect) */
#define RTF_DONE 0x40 /* message confirmed */
#define RTF_DELCLONE 0x80 /* delete cloned route */
#define RTF_CLONING 0x100 /* generate new routes on use */
#define RTF_XRESOLVE 0x200 /* external daemon resolves name */
#define RTF_LLINFO 0x400 /* DEPRECATED - exists ONLY for backward
* compatibility */
#define RTF_LLDATA 0x400 /* used by apps to add/del L2 entries */
#define RTF_STATIC 0x800 /* manually added */
#define RTF_BLACKHOLE 0x1000 /* just discard pkts (during updates) */
#define RTF_NOIFREF 0x2000 /* not eligible for RTF_IFREF */
#define RTF_PROTO2 0x4000 /* protocol specific routing flag */
#define RTF_PROTO1 0x8000 /* protocol specific routing flag */
#define RTF_PRCLONING 0x10000 /* protocol requires cloning */
#define RTF_WASCLONED 0x20000 /* route generated through cloning */
#define RTF_PROTO3 0x40000 /* protocol specific routing flag */
/* 0x80000 unused */
#define RTF_PINNED 0x100000 /* future use */
#define RTF_LOCAL 0x200000 /* route represents a local address */
#define RTF_BROADCAST 0x400000 /* route represents a bcast address */
#define RTF_MULTICAST 0x800000 /* route represents a mcast address */
#define RTF_IFSCOPE 0x1000000 /* has valid interface scope */
#define RTF_CONDEMNED 0x2000000 /* defunct; no longer modifiable */
#define RTF_IFREF 0x4000000 /* route holds a ref to interface */
#define RTF_PROXY 0x8000000 /* proxying, no interface scope */
#define RTF_ROUTER 0x10000000 /* host is a router */
#define RTF_DEAD 0x20000000 /* Route entry is being freed */
#define RTF_GLOBAL 0x40000000 /* route to destination of the global internet */
/* 0x80000000 unassigned */
#define RTPRF_OURS RTF_PROTO3 /* set on routes we manage */
#define RTF_BITS \
"\020\1UP\2GATEWAY\3HOST\4REJECT\5DYNAMIC\6MODIFIED\7DONE" \
"\10DELCLONE\11CLONING\12XRESOLVE\13LLINFO\14STATIC\15BLACKHOLE" \
"\16NOIFREF\17PROTO2\20PROTO1\21PRCLONING\22WASCLONED\23PROTO3" \
"\25PINNED\26LOCAL\27BROADCAST\30MULTICAST\31IFSCOPE\32CONDEMNED" \
"\33IFREF\34PROXY\35ROUTER\37GLOBAL"
#define IS_DIRECT_HOSTROUTE(rt) \
(((rt)->rt_flags & (RTF_HOST | RTF_GATEWAY)) == RTF_HOST)
/*
* Routing statistics.
*/
struct rtstat {
short rts_badredirect; /* bogus redirect calls */
short rts_dynamic; /* routes created by redirects */
short rts_newgateway; /* routes modified by redirects */
short rts_unreach; /* lookups which failed */
short rts_wildcard; /* lookups satisfied by a wildcard */
short rts_badrtgwroute; /* route to gateway is not direct */
};
/*
* Structures for routing messages.
*/
struct rt_msghdr {
u_short rtm_msglen; /* to skip over non-understood messages */
u_char rtm_version; /* future binary compatibility */
u_char rtm_type; /* message type */
u_short rtm_index; /* index for associated ifp */
int rtm_flags; /* flags, incl. kern & message, e.g. DONE */
int rtm_addrs; /* bitmask identifying sockaddrs in msg */
pid_t rtm_pid; /* identify sender */
int rtm_seq; /* for sender to identify action */
int rtm_errno; /* why failed */
int rtm_use; /* from rtentry */
u_int32_t rtm_inits; /* which metrics we are initializing */
struct rt_metrics rtm_rmx; /* metrics themselves */
};
struct rt_msghdr2 {
u_short rtm_msglen; /* to skip over non-understood messages */
u_char rtm_version; /* future binary compatibility */
u_char rtm_type; /* message type */
u_short rtm_index; /* index for associated ifp */
int rtm_flags; /* flags, incl. kern & message, e.g. DONE */
int rtm_addrs; /* bitmask identifying sockaddrs in msg */
int32_t rtm_refcnt; /* reference count */
int rtm_parentflags; /* flags of the parent route */
int rtm_reserved; /* reserved field set to 0 */
int rtm_use; /* from rtentry */
u_int32_t rtm_inits; /* which metrics we are initializing */
struct rt_metrics rtm_rmx; /* metrics themselves */
};
#define RTM_VERSION 5 /* Up the ante and ignore older versions */
/*
* Message types.
*/
#define RTM_ADD 0x1 /* Add Route */
#define RTM_DELETE 0x2 /* Delete Route */
#define RTM_CHANGE 0x3 /* Change Metrics or flags */
#define RTM_GET 0x4 /* Report Metrics */
#define RTM_LOSING 0x5 /* RTM_LOSING is no longer generated by xnu
* and is deprecated */
#define RTM_REDIRECT 0x6 /* Told to use different route */
#define RTM_MISS 0x7 /* Lookup failed on this address */
#define RTM_LOCK 0x8 /* fix specified metrics */
#define RTM_OLDADD 0x9 /* caused by SIOCADDRT */
#define RTM_OLDDEL 0xa /* caused by SIOCDELRT */
#define RTM_RESOLVE 0xb /* req to resolve dst to LL addr */
#define RTM_NEWADDR 0xc /* address being added to iface */
#define RTM_DELADDR 0xd /* address being removed from iface */
#define RTM_IFINFO 0xe /* iface going up/down etc. */
#define RTM_NEWMADDR 0xf /* mcast group membership being added to if */
#define RTM_DELMADDR 0x10 /* mcast group membership being deleted */
#define RTM_IFINFO2 0x12 /* */
#define RTM_NEWMADDR2 0x13 /* */
#define RTM_GET2 0x14 /* */
/*
* Bitmask values for rtm_inits and rmx_locks.
*/
#define RTV_MTU 0x1 /* init or lock _mtu */
#define RTV_HOPCOUNT 0x2 /* init or lock _hopcount */
#define RTV_EXPIRE 0x4 /* init or lock _expire */
#define RTV_RPIPE 0x8 /* init or lock _recvpipe */
#define RTV_SPIPE 0x10 /* init or lock _sendpipe */
#define RTV_SSTHRESH 0x20 /* init or lock _ssthresh */
#define RTV_RTT 0x40 /* init or lock _rtt */
#define RTV_RTTVAR 0x80 /* init or lock _rttvar */
/*
* Bitmask values for rtm_addrs.
*/
#define RTA_DST 0x1 /* destination sockaddr present */
#define RTA_GATEWAY 0x2 /* gateway sockaddr present */
#define RTA_NETMASK 0x4 /* netmask sockaddr present */
#define RTA_GENMASK 0x8 /* cloning mask sockaddr present */
#define RTA_IFP 0x10 /* interface name sockaddr present */
#define RTA_IFA 0x20 /* interface addr sockaddr present */
#define RTA_AUTHOR 0x40 /* sockaddr for author of redirect */
#define RTA_BRD 0x80 /* for NEWADDR, broadcast or p-p dest addr */
/*
* Index offsets for sockaddr array for alternate internal encoding.
*/
#define RTAX_DST 0 /* destination sockaddr present */
#define RTAX_GATEWAY 1 /* gateway sockaddr present */
#define RTAX_NETMASK 2 /* netmask sockaddr present */
#define RTAX_GENMASK 3 /* cloning mask sockaddr present */
#define RTAX_IFP 4 /* interface name sockaddr present */
#define RTAX_IFA 5 /* interface addr sockaddr present */
#define RTAX_AUTHOR 6 /* sockaddr for author of redirect */
#define RTAX_BRD 7 /* for NEWADDR, broadcast or p-p dest addr */
#define RTAX_MAX 8 /* size of array to allocate */
struct rt_addrinfo {
int rti_addrs;
struct sockaddr *rti_info[RTAX_MAX];
};
#endif /* _NET_ROUTE_H_ */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/net/pfkeyv2.h | /*
* Copyright (c) 2000-2011 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/* $KAME: pfkeyv2.h,v 1.10 2000/03/22 07:04:20 sakane Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* This file has been derived rfc 2367,
* And added some flags of SADB_KEY_FLAGS_ as SADB_X_EXT_.
* [email protected]
*/
#ifndef _NET_PFKEYV2_H_
#define _NET_PFKEYV2_H_
#include <sys/appleapiopts.h>
#include <net/if.h>
/*
* This file defines structures and symbols for the PF_KEY Version 2
* key management interface. It was written at the U.S. Naval Research
* Laboratory. This file is in the public domain. The authors ask that
* you leave this credit intact on any copies of this file.
*/
#ifndef __PFKEY_V2_H
#define __PFKEY_V2_H 1
#define PF_KEY_V2 2
#define PFKEYV2_REVISION 199806L
#define SADB_RESERVED 0
#define SADB_GETSPI 1
#define SADB_UPDATE 2
#define SADB_ADD 3
#define SADB_DELETE 4
#define SADB_GET 5
#define SADB_ACQUIRE 6
#define SADB_REGISTER 7
#define SADB_EXPIRE 8
#define SADB_FLUSH 9
#define SADB_DUMP 10
#define SADB_X_PROMISC 11
#define SADB_X_PCHANGE 12
#define SADB_X_SPDUPDATE 13
#define SADB_X_SPDADD 14
#define SADB_X_SPDDELETE 15 /* by policy index */
#define SADB_X_SPDGET 16
#define SADB_X_SPDACQUIRE 17
#define SADB_X_SPDDUMP 18
#define SADB_X_SPDFLUSH 19
#define SADB_X_SPDSETIDX 20
#define SADB_X_SPDEXPIRE 21
#define SADB_X_SPDDELETE2 22 /* by policy id */
#define SADB_GETSASTAT 23
#define SADB_X_SPDENABLE 24 /* by policy id */
#define SADB_X_SPDDISABLE 25 /* by policy id */
#define SADB_MIGRATE 26
#define SADB_MAX 26
struct sadb_msg {
u_int8_t sadb_msg_version;
u_int8_t sadb_msg_type;
u_int8_t sadb_msg_errno;
u_int8_t sadb_msg_satype;
u_int16_t sadb_msg_len;
u_int16_t sadb_msg_reserved;
u_int32_t sadb_msg_seq;
u_int32_t sadb_msg_pid;
};
struct sadb_ext {
u_int16_t sadb_ext_len;
u_int16_t sadb_ext_type;
};
struct sadb_sa {
u_int16_t sadb_sa_len;
u_int16_t sadb_sa_exttype;
u_int32_t sadb_sa_spi;
u_int8_t sadb_sa_replay;
u_int8_t sadb_sa_state;
u_int8_t sadb_sa_auth;
u_int8_t sadb_sa_encrypt;
u_int32_t sadb_sa_flags;
};
struct sadb_lifetime {
u_int16_t sadb_lifetime_len;
u_int16_t sadb_lifetime_exttype;
u_int32_t sadb_lifetime_allocations;
u_int64_t sadb_lifetime_bytes;
u_int64_t sadb_lifetime_addtime;
u_int64_t sadb_lifetime_usetime;
};
struct sadb_address {
u_int16_t sadb_address_len;
u_int16_t sadb_address_exttype;
u_int8_t sadb_address_proto;
u_int8_t sadb_address_prefixlen;
u_int16_t sadb_address_reserved;
};
struct sadb_key {
u_int16_t sadb_key_len;
u_int16_t sadb_key_exttype;
u_int16_t sadb_key_bits;
u_int16_t sadb_key_reserved;
};
struct sadb_ident {
u_int16_t sadb_ident_len;
u_int16_t sadb_ident_exttype;
u_int16_t sadb_ident_type;
u_int16_t sadb_ident_reserved;
u_int64_t sadb_ident_id;
};
struct sadb_sens {
u_int16_t sadb_sens_len;
u_int16_t sadb_sens_exttype;
u_int32_t sadb_sens_dpd;
u_int8_t sadb_sens_sens_level;
u_int8_t sadb_sens_sens_len;
u_int8_t sadb_sens_integ_level;
u_int8_t sadb_sens_integ_len;
u_int32_t sadb_sens_reserved;
};
struct sadb_prop {
u_int16_t sadb_prop_len;
u_int16_t sadb_prop_exttype;
u_int8_t sadb_prop_replay;
u_int8_t sadb_prop_reserved[3];
};
struct sadb_comb {
u_int8_t sadb_comb_auth;
u_int8_t sadb_comb_encrypt;
u_int16_t sadb_comb_flags;
u_int16_t sadb_comb_auth_minbits;
u_int16_t sadb_comb_auth_maxbits;
u_int16_t sadb_comb_encrypt_minbits;
u_int16_t sadb_comb_encrypt_maxbits;
u_int32_t sadb_comb_reserved;
u_int32_t sadb_comb_soft_allocations;
u_int32_t sadb_comb_hard_allocations;
u_int64_t sadb_comb_soft_bytes;
u_int64_t sadb_comb_hard_bytes;
u_int64_t sadb_comb_soft_addtime;
u_int64_t sadb_comb_hard_addtime;
u_int64_t sadb_comb_soft_usetime;
u_int64_t sadb_comb_hard_usetime;
};
struct sadb_supported {
u_int16_t sadb_supported_len;
u_int16_t sadb_supported_exttype;
u_int32_t sadb_supported_reserved;
};
struct sadb_alg {
u_int8_t sadb_alg_id;
u_int8_t sadb_alg_ivlen;
u_int16_t sadb_alg_minbits;
u_int16_t sadb_alg_maxbits;
u_int16_t sadb_alg_reserved;
};
struct sadb_spirange {
u_int16_t sadb_spirange_len;
u_int16_t sadb_spirange_exttype;
u_int32_t sadb_spirange_min;
u_int32_t sadb_spirange_max;
u_int32_t sadb_spirange_reserved;
};
struct sadb_x_kmprivate {
u_int16_t sadb_x_kmprivate_len;
u_int16_t sadb_x_kmprivate_exttype;
u_int32_t sadb_x_kmprivate_reserved;
};
/*
* XXX Additional SA Extension.
* mode: tunnel or transport
* reqid: to make SA unique nevertheless the address pair of SA are same.
* Mainly it's for VPN.
*/
struct sadb_x_sa2 {
u_int16_t sadb_x_sa2_len;
u_int16_t sadb_x_sa2_exttype;
u_int8_t sadb_x_sa2_mode;
union {
u_int8_t sadb_x_sa2_reserved1;
};
union {
u_int16_t sadb_x_sa2_reserved2;
};
u_int32_t sadb_x_sa2_sequence;
u_int32_t sadb_x_sa2_reqid;
};
/* XXX Policy Extension */
/* sizeof(struct sadb_x_policy) == 16 */
struct sadb_x_policy {
u_int16_t sadb_x_policy_len;
u_int16_t sadb_x_policy_exttype;
u_int16_t sadb_x_policy_type; /* See policy type of ipsec.h */
u_int8_t sadb_x_policy_dir; /* direction, see ipsec.h */
u_int8_t sadb_x_policy_reserved;
u_int32_t sadb_x_policy_id;
u_int32_t sadb_x_policy_reserved2;
};
/*
* When policy_type == IPSEC, it is followed by some of
* the ipsec policy request.
* [total length of ipsec policy requests]
* = (sadb_x_policy_len * sizeof(uint64_t) - sizeof(struct sadb_x_policy))
*/
/* XXX IPsec Policy Request Extension */
/*
* This structure is aligned 8 bytes.
*/
struct sadb_x_ipsecrequest {
u_int16_t sadb_x_ipsecrequest_len; /* structure length aligned to 8 bytes.
* This value is true length of bytes.
* Not in units of 64 bits. */
u_int16_t sadb_x_ipsecrequest_proto; /* See ipsec.h */
u_int8_t sadb_x_ipsecrequest_mode; /* See IPSEC_MODE_XX in ipsec.h. */
u_int8_t sadb_x_ipsecrequest_level; /* See IPSEC_LEVEL_XX in ipsec.h */
u_int16_t sadb_x_ipsecrequest_reqid; /* See ipsec.h */
/*
* followed by source IP address of SA, and immediately followed by
* destination IP address of SA. These encoded into two of sockaddr
* structure without any padding. Must set each sa_len exactly.
* Each of length of the sockaddr structure are not aligned to 64bits,
* but sum of x_request and addresses is aligned to 64bits.
*/
};
struct sadb_session_id {
u_int16_t sadb_session_id_len;
u_int16_t sadb_session_id_exttype;
/* [0] is an arbitrary handle that means something only for requester
* [1] is a global session id for lookups in the kernel and racoon.
*/
u_int64_t sadb_session_id_v[2];
} __attribute__ ((aligned(8)));
struct sastat {
u_int32_t spi; /* SPI Value, network byte order */
u_int32_t created; /* for lifetime */
struct sadb_lifetime lft_c; /* CURRENT lifetime. */
}; // no need to align
struct sadb_sastat {
u_int16_t sadb_sastat_len;
u_int16_t sadb_sastat_exttype;
u_int32_t sadb_sastat_dir;
u_int32_t sadb_sastat_reserved;
u_int32_t sadb_sastat_list_len;
/* list of struct sastat comes after */
} __attribute__ ((aligned(8)));
#define SADB_EXT_RESERVED 0
#define SADB_EXT_SA 1
#define SADB_EXT_LIFETIME_CURRENT 2
#define SADB_EXT_LIFETIME_HARD 3
#define SADB_EXT_LIFETIME_SOFT 4
#define SADB_EXT_ADDRESS_SRC 5
#define SADB_EXT_ADDRESS_DST 6
#define SADB_EXT_ADDRESS_PROXY 7
#define SADB_EXT_KEY_AUTH 8
#define SADB_EXT_KEY_ENCRYPT 9
#define SADB_EXT_IDENTITY_SRC 10
#define SADB_EXT_IDENTITY_DST 11
#define SADB_EXT_SENSITIVITY 12
#define SADB_EXT_PROPOSAL 13
#define SADB_EXT_SUPPORTED_AUTH 14
#define SADB_EXT_SUPPORTED_ENCRYPT 15
#define SADB_EXT_SPIRANGE 16
#define SADB_X_EXT_KMPRIVATE 17
#define SADB_X_EXT_POLICY 18
#define SADB_X_EXT_SA2 19
#define SADB_EXT_SESSION_ID 20
#define SADB_EXT_SASTAT 21
#define SADB_X_EXT_IPSECIF 22
#define SADB_X_EXT_ADDR_RANGE_SRC_START 23
#define SADB_X_EXT_ADDR_RANGE_SRC_END 24
#define SADB_X_EXT_ADDR_RANGE_DST_START 25
#define SADB_X_EXT_ADDR_RANGE_DST_END 26
#define SADB_EXT_MIGRATE_ADDRESS_SRC 27
#define SADB_EXT_MIGRATE_ADDRESS_DST 28
#define SADB_X_EXT_MIGRATE_IPSECIF 29
#define SADB_EXT_MAX 29
#define SADB_SATYPE_UNSPEC 0
#define SADB_SATYPE_AH 2
#define SADB_SATYPE_ESP 3
#define SADB_SATYPE_RSVP 5
#define SADB_SATYPE_OSPFV2 6
#define SADB_SATYPE_RIPV2 7
#define SADB_SATYPE_MIP 8
#define SADB_X_SATYPE_IPCOMP 9
#define SADB_X_SATYPE_POLICY 10
#define SADB_SATYPE_MAX 11
#define SADB_SASTATE_LARVAL 0
#define SADB_SASTATE_MATURE 1
#define SADB_SASTATE_DYING 2
#define SADB_SASTATE_DEAD 3
#define SADB_SASTATE_MAX 3
#define SADB_SAFLAGS_PFS 1
/* RFC2367 numbers - meets RFC2407 */
#define SADB_AALG_NONE 0
#define SADB_AALG_MD5HMAC 1 /*2*/
#define SADB_AALG_SHA1HMAC 2 /*3*/
#define SADB_AALG_MAX 8
/* private allocations - based on RFC2407/IANA assignment */
#define SADB_X_AALG_SHA2_256 6 /*5*/
#define SADB_X_AALG_SHA2_384 7 /*6*/
#define SADB_X_AALG_SHA2_512 8 /*7*/
/* private allocations should use 249-255 (RFC2407) */
#define SADB_X_AALG_MD5 3 /*249*/ /* Keyed MD5 */
#define SADB_X_AALG_SHA 4 /*250*/ /* Keyed SHA */
#define SADB_X_AALG_NULL 5 /*251*/ /* null authentication */
/* RFC2367 numbers - meets RFC2407 */
#define SADB_EALG_NONE 0
#define SADB_EALG_DESCBC 1 /*2*/
#define SADB_EALG_3DESCBC 2 /*3*/
#define SADB_EALG_NULL 3 /*11*/
#define SADB_EALG_MAX 12
/* private allocations - based on RFC2407/IANA assignment */
#define SADB_X_EALG_CAST128CBC 5 /*6*/
#define SADB_X_EALG_BLOWFISHCBC 4 /*7*/
#define SADB_X_EALG_RIJNDAELCBC 12
#define SADB_X_EALG_AESCBC 12
#define SADB_X_EALG_AES 12
#define SADB_X_EALG_AES_GCM 13
#define SADB_X_EALG_CHACHA20POLY1305 14
/* private allocations should use 249-255 (RFC2407) */
#if 1 /*nonstandard */
#define SADB_X_CALG_NONE 0
#define SADB_X_CALG_OUI 1
#define SADB_X_CALG_DEFLATE 2
#define SADB_X_CALG_LZS 3
#define SADB_X_CALG_MAX 4
#endif
#define SADB_IDENTTYPE_RESERVED 0
#define SADB_IDENTTYPE_PREFIX 1
#define SADB_IDENTTYPE_FQDN 2
#define SADB_IDENTTYPE_USERFQDN 3
#define SADB_X_IDENTTYPE_ADDR 4
#define SADB_IDENTTYPE_MAX 4
/* `flags' in sadb_sa structure holds followings */
#define SADB_X_EXT_NONE 0x0000 /* i.e. new format. */
#define SADB_X_EXT_OLD 0x0001 /* old format. */
#define SADB_X_EXT_IV4B 0x0010 /* IV length of 4 bytes in use */
#define SADB_X_EXT_DERIV 0x0020 /* DES derived */
#define SADB_X_EXT_CYCSEQ 0x0040 /* allowing to cyclic sequence. */
/* three of followings are exclusive flags each them */
#define SADB_X_EXT_PSEQ 0x0000 /* sequencial padding for ESP */
#define SADB_X_EXT_PRAND 0x0100 /* random padding for ESP */
#define SADB_X_EXT_PZERO 0x0200 /* zero padding for ESP */
#define SADB_X_EXT_PMASK 0x0300 /* mask for padding flag */
#define SADB_X_EXT_IIV 0x0400 /* Implicit IV */
#if 1
#define SADB_X_EXT_RAWCPI 0x0080 /* use well known CPI (IPComp) */
#endif
#define SADB_KEY_FLAGS_MAX 0x7fff
/* SPI size for PF_KEYv2 */
#define PFKEY_SPI_SIZE sizeof(u_int32_t)
/* Identifier for menber of lifetime structure */
#define SADB_X_LIFETIME_ALLOCATIONS 0
#define SADB_X_LIFETIME_BYTES 1
#define SADB_X_LIFETIME_ADDTIME 2
#define SADB_X_LIFETIME_USETIME 3
/* The rate for SOFT lifetime against HARD one. */
#define PFKEY_SOFT_LIFETIME_RATE 80
/* Utilities */
#define PFKEY_ALIGN8(a) (1 + (((a) - 1) | (8 - 1)))
#define PFKEY_EXTLEN(msg) \
PFKEY_UNUNIT64(((struct sadb_ext *)(msg))->sadb_ext_len)
#define PFKEY_ADDR_PREFIX(ext) \
(((struct sadb_address *)(ext))->sadb_address_prefixlen)
#define PFKEY_ADDR_PROTO(ext) \
(((struct sadb_address *)(ext))->sadb_address_proto)
#define PFKEY_ADDR_SADDR(ext) \
((struct sockaddr *)((caddr_t)(ext) + sizeof(struct sadb_address)))
/* in 64bits */
#define PFKEY_UNUNIT64(a) ((a) << 3)
#define PFKEY_UNIT64(a) ((a) >> 3)
#endif /* __PFKEY_V2_H */
#endif /* _NET_PFKEYV2_H_ */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/net/radix.h | /*
* Copyright (c) 2000-2008 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Copyright (c) 1988, 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)radix.h 8.2 (Berkeley) 10/31/94
* $FreeBSD: src/sys/net/radix.h,v 1.16.2.1 2000/05/03 19:17:11 wollman Exp $
*/
#ifndef _RADIX_H_
#define _RADIX_H_
#include <sys/appleapiopts.h>
#endif /* _RADIX_H_ */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/net/ethernet.h | /*
* Copyright (c) 2000-2017 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Fundamental constants relating to ethernet.
*
*/
#ifndef _NET_ETHERNET_H_
#define _NET_ETHERNET_H_
#include <sys/appleapiopts.h>
#include <sys/types.h> /* u_ types */
/*
* The number of bytes in an ethernet (MAC) address.
*/
#define ETHER_ADDR_LEN 6
/*
* The number of bytes in the type field.
*/
#define ETHER_TYPE_LEN 2
/*
* The number of bytes in the trailing CRC field.
*/
#define ETHER_CRC_LEN 4
/*
* The length of the combined header.
*/
#define ETHER_HDR_LEN (ETHER_ADDR_LEN*2+ETHER_TYPE_LEN)
/*
* The minimum packet length.
*/
#define ETHER_MIN_LEN 64
/*
* The maximum packet length.
*/
#define ETHER_MAX_LEN 1518
/*
* Mbuf adjust factor to force 32-bit alignment of IP header.
* Drivers should do m_adj(m, ETHER_ALIGN) when setting up a
* receive so the upper layers get the IP header properly aligned
* past the 14-byte Ethernet header.
*/
#define ETHER_ALIGN 2 /* driver adjust for IP hdr alignment */
/*
* A macro to validate a length with
*/
#define ETHER_IS_VALID_LEN(foo) \
((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN)
/*
* Structure of a 10Mb/s Ethernet header.
*/
typedef struct ether_header {
u_char ether_dhost[ETHER_ADDR_LEN];
u_char ether_shost[ETHER_ADDR_LEN];
u_short ether_type;
} ether_header_t;
/*
* Structure of a 48-bit Ethernet address.
*/
typedef struct ether_addr {
u_char octet[ETHER_ADDR_LEN];
} ether_addr_t;
#define ether_addr_octet octet
#define ETHERTYPE_PUP 0x0200 /* PUP protocol */
#define ETHERTYPE_IP 0x0800 /* IP protocol */
#define ETHERTYPE_ARP 0x0806 /* Addr. resolution protocol */
#define ETHERTYPE_REVARP 0x8035 /* reverse Addr. resolution protocol */
#define ETHERTYPE_VLAN 0x8100 /* IEEE 802.1Q VLAN tagging */
#define ETHERTYPE_IPV6 0x86dd /* IPv6 */
#define ETHERTYPE_PAE 0x888e /* EAPOL PAE/802.1x */
#define ETHERTYPE_RSN_PREAUTH 0x88c7 /* 802.11i / RSN Pre-Authentication */
#define ETHERTYPE_PTP 0x88f7 /* IEEE 1588 Precision Time Protocol */
#define ETHERTYPE_LOOPBACK 0x9000 /* used to test interfaces */
/* XXX - add more useful types here */
#define ETHERTYPE_IEEE802154 0x0809 /* 802.15.4 */
/*
* The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have
* (type-ETHERTYPE_TRAIL)*512 bytes of data followed
* by an ETHER type (as given above) and then the (variable-length) header.
*/
#define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */
#define ETHERTYPE_NTRAILER 16
#define ETHERMTU (ETHER_MAX_LEN-ETHER_HDR_LEN-ETHER_CRC_LEN)
#define ETHERMIN (ETHER_MIN_LEN-ETHER_HDR_LEN-ETHER_CRC_LEN)
#endif /* !_NET_ETHERNET_H_ */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/net/if_types.h | /*
* Copyright (c) 2000-2017 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Copyright (c) 1989, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)if_types.h 8.2 (Berkeley) 4/20/94
* $FreeBSD: src/sys/net/if_types.h,v 1.8.2.3 2001/07/03 11:01:41 ume Exp $
*/
#ifndef _NET_IF_TYPES_H_
#define _NET_IF_TYPES_H_
#include <sys/appleapiopts.h>
/*
* Interface types for benefit of parsing media address headers.
* This list is derived from the SNMP list of ifTypes, currently
* documented in RFC1573.
* The current list of assignments is maintained at:
* http://www.iana.org/assignments/smi-numbers
*/
#define IFT_OTHER 0x1 /* none of the following */
#define IFT_1822 0x2 /* old-style arpanet imp */
#define IFT_HDH1822 0x3 /* HDH arpanet imp */
#define IFT_X25DDN 0x4 /* x25 to imp */
#define IFT_X25 0x5 /* PDN X25 interface (RFC877) */
#define IFT_ETHER 0x6 /* Ethernet CSMACD */
#define IFT_ISO88023 0x7 /* CMSA CD */
#define IFT_ISO88024 0x8 /* Token Bus */
#define IFT_ISO88025 0x9 /* Token Ring */
#define IFT_ISO88026 0xa /* MAN */
#define IFT_STARLAN 0xb
#define IFT_P10 0xc /* Proteon 10MBit ring */
#define IFT_P80 0xd /* Proteon 80MBit ring */
#define IFT_HY 0xe /* Hyperchannel */
#define IFT_FDDI 0xf
#define IFT_LAPB 0x10
#define IFT_SDLC 0x11
#define IFT_T1 0x12
#define IFT_CEPT 0x13 /* E1 - european T1 */
#define IFT_ISDNBASIC 0x14
#define IFT_ISDNPRIMARY 0x15
#define IFT_PTPSERIAL 0x16 /* Proprietary PTP serial */
#define IFT_PPP 0x17 /* RFC 1331 */
#define IFT_LOOP 0x18 /* loopback */
#define IFT_EON 0x19 /* ISO over IP */
#define IFT_XETHER 0x1a /* obsolete 3MB experimental ethernet */
#define IFT_NSIP 0x1b /* XNS over IP */
#define IFT_SLIP 0x1c /* IP over generic TTY */
#define IFT_ULTRA 0x1d /* Ultra Technologies */
#define IFT_DS3 0x1e /* Generic T3 */
#define IFT_SIP 0x1f /* SMDS */
#define IFT_FRELAY 0x20 /* Frame Relay DTE only */
#define IFT_RS232 0x21
#define IFT_PARA 0x22 /* parallel-port */
#define IFT_ARCNET 0x23
#define IFT_ARCNETPLUS 0x24
#define IFT_ATM 0x25 /* ATM cells */
#define IFT_MIOX25 0x26
#define IFT_SONET 0x27 /* SONET or SDH */
#define IFT_X25PLE 0x28
#define IFT_ISO88022LLC 0x29
#define IFT_LOCALTALK 0x2a
#define IFT_SMDSDXI 0x2b
#define IFT_FRELAYDCE 0x2c /* Frame Relay DCE */
#define IFT_V35 0x2d
#define IFT_HSSI 0x2e
#define IFT_HIPPI 0x2f
#define IFT_MODEM 0x30 /* Generic Modem */
#define IFT_AAL5 0x31 /* AAL5 over ATM */
#define IFT_SONETPATH 0x32
#define IFT_SONETVT 0x33
#define IFT_SMDSICIP 0x34 /* SMDS InterCarrier Interface */
#define IFT_PROPVIRTUAL 0x35 /* Proprietary Virtual/internal */
#define IFT_PROPMUX 0x36 /* Proprietary Multiplexing */
/*
* IFT_GIF, IFT_FAITH and IFT_6LOWPAN are not based on IANA assignments.
* Note: IFT_STF has a defined ifType: 0xd7 (215), but we use 0x39.
*/
#define IFT_GIF 0x37 /*0xf0*/
#define IFT_FAITH 0x38 /*0xf2*/
#define IFT_STF 0x39 /*0xf3*/
#define IFT_6LOWPAN 0x40 /* IETF RFC 6282 */
#define IFT_L2VLAN 0x87 /* Layer 2 Virtual LAN using 802.1Q */
#define IFT_IEEE8023ADLAG 0x88 /* IEEE802.3ad Link Aggregate */
#define IFT_IEEE1394 0x90 /* IEEE1394 High Performance SerialBus*/
#define IFT_BRIDGE 0xd1 /* Transparent bridge interface */
#define IFT_ENC 0xf4 /* Encapsulation */
#define IFT_PFLOG 0xf5 /* Packet filter logging */
#define IFT_PFSYNC 0xf6 /* Packet filter state syncing */
#define IFT_CARP 0xf8 /* Common Address Redundancy Protocol */
#define IFT_PKTAP 0xfe /* Packet tap pseudo interface */
#define IFT_CELLULAR 0xff /* Packet Data over Cellular */
#define IFT_PDP IFT_CELLULAR /* deprecated; use IFT_CELLULAR */
#endif
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/net/if.h | /*
* Copyright (c) 2000-2020 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Copyright (c) 1982, 1986, 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)if.h 8.1 (Berkeley) 6/10/93
*/
#ifndef _NET_IF_H_
#define _NET_IF_H_
#define IF_NAMESIZE 16
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
#include <sys/cdefs.h>
#include <sys/appleapiopts.h>
#ifdef __APPLE__
#include <net/if_var.h>
#include <net/net_kev.h>
#include <sys/types.h>
#include <sys/socket.h>
#endif
#ifndef IFNAMSIZ
#define IFNAMSIZ IF_NAMESIZE
#endif
struct if_clonereq {
int ifcr_total; /* total cloners (out) */
int ifcr_count; /* room for this many in user buffer */
char *ifcr_buffer; /* buffer for cloner names */
};
#define IFF_UP 0x1 /* interface is up */
#define IFF_BROADCAST 0x2 /* broadcast address valid */
#define IFF_DEBUG 0x4 /* turn on debugging */
#define IFF_LOOPBACK 0x8 /* is a loopback net */
#define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */
#define IFF_NOTRAILERS 0x20 /* obsolete: avoid use of trailers */
#define IFF_RUNNING 0x40 /* resources allocated */
#define IFF_NOARP 0x80 /* no address resolution protocol */
#define IFF_PROMISC 0x100 /* receive all packets */
#define IFF_ALLMULTI 0x200 /* receive all multicast packets */
#define IFF_OACTIVE 0x400 /* transmission in progress */
#define IFF_SIMPLEX 0x800 /* can't hear own transmissions */
#define IFF_LINK0 0x1000 /* per link layer defined bit */
#define IFF_LINK1 0x2000 /* per link layer defined bit */
#define IFF_LINK2 0x4000 /* per link layer defined bit */
#define IFF_ALTPHYS IFF_LINK2 /* use alternate physical connection */
#define IFF_MULTICAST 0x8000 /* supports multicast */
/*
* Capabilities that interfaces can advertise.
*
* struct ifnet.if_capabilities
* contains the optional features & capabilities a particular interface
* supports (not only the driver but also the detected hw revision).
* Capabilities are defined by IFCAP_* below.
* struct ifnet.if_capenable
* contains the enabled (either by default or through ifconfig) optional
* features & capabilities on this interface.
* Capabilities are defined by IFCAP_* below.
* struct if_data.ifi_hwassist in IFNET_* form, defined in net/kpi_interface.h,
* contains the enabled optional features & capabilites that can be used
* individually per packet and are specified in the mbuf pkthdr.csum_flags
* field. IFCAP_* and IFNET_* do not match one to one and IFNET_* may be
* more detailed or differentiated than IFCAP_*.
* IFNET_* hwassist flags have corresponding CSUM_* in sys/mbuf.h
*/
#define IFCAP_RXCSUM 0x00001 /* can offload checksum on RX */
#define IFCAP_TXCSUM 0x00002 /* can offload checksum on TX */
#define IFCAP_VLAN_MTU 0x00004 /* VLAN-compatible MTU */
#define IFCAP_VLAN_HWTAGGING 0x00008 /* hardware VLAN tag support */
#define IFCAP_JUMBO_MTU 0x00010 /* 9000 byte MTU supported */
#define IFCAP_TSO4 0x00020 /* can do TCP Segmentation Offload */
#define IFCAP_TSO6 0x00040 /* can do TCP6 Segmentation Offload */
#define IFCAP_LRO 0x00080 /* can do Large Receive Offload */
#define IFCAP_AV 0x00100 /* can do 802.1 AV Bridging */
#define IFCAP_TXSTATUS 0x00200 /* can return linklevel xmit status */
#define IFCAP_SKYWALK 0x00400 /* Skywalk mode supported/enabled */
#define IFCAP_HW_TIMESTAMP 0x00800 /* Time stamping in hardware */
#define IFCAP_SW_TIMESTAMP 0x01000 /* Time stamping in software */
#define IFCAP_CSUM_PARTIAL 0x02000 /* can offload partial checksum */
#define IFCAP_CSUM_ZERO_INVERT 0x04000 /* can invert 0 to -0 (0xffff) */
#define IFCAP_HWCSUM (IFCAP_RXCSUM | IFCAP_TXCSUM)
#define IFCAP_TSO (IFCAP_TSO4 | IFCAP_TSO6)
#define IFCAP_VALID (IFCAP_HWCSUM | IFCAP_TSO | IFCAP_LRO | IFCAP_VLAN_MTU | \
IFCAP_VLAN_HWTAGGING | IFCAP_JUMBO_MTU | IFCAP_AV | IFCAP_TXSTATUS | \
IFCAP_SKYWALK | IFCAP_SW_TIMESTAMP | IFCAP_HW_TIMESTAMP | \
IFCAP_CSUM_PARTIAL | IFCAP_CSUM_ZERO_INVERT)
#define IFQ_MAXLEN 128
#define IFNET_SLOWHZ 1 /* granularity is 1 second */
#define IFQ_TARGET_DELAY (10ULL * 1000 * 1000) /* 10 ms */
#define IFQ_UPDATE_INTERVAL (100ULL * 1000 * 1000) /* 100 ms */
/*
* Message format for use in obtaining information about interfaces
* from sysctl and the routing socket
*/
struct if_msghdr {
unsigned short ifm_msglen; /* to skip non-understood messages */
unsigned char ifm_version; /* future binary compatability */
unsigned char ifm_type; /* message type */
int ifm_addrs; /* like rtm_addrs */
int ifm_flags; /* value of if_flags */
unsigned short ifm_index; /* index for associated ifp */
struct if_data ifm_data; /* statistics and other data about if */
};
/*
* Message format for use in obtaining information about interface addresses
* from sysctl and the routing socket
*/
struct ifa_msghdr {
unsigned short ifam_msglen; /* to skip non-understood messages */
unsigned char ifam_version; /* future binary compatability */
unsigned char ifam_type; /* message type */
int ifam_addrs; /* like rtm_addrs */
int ifam_flags; /* value of ifa_flags */
unsigned short ifam_index; /* index for associated ifp */
int ifam_metric; /* value of ifa_metric */
};
/*
* Message format for use in obtaining information about multicast addresses
* from the routing socket
*/
struct ifma_msghdr {
unsigned short ifmam_msglen; /* to skip non-understood messages */
unsigned char ifmam_version; /* future binary compatability */
unsigned char ifmam_type; /* message type */
int ifmam_addrs; /* like rtm_addrs */
int ifmam_flags; /* value of ifa_flags */
unsigned short ifmam_index; /* index for associated ifp */
};
/*
* Message format for use in obtaining information about interfaces
* from sysctl
*/
struct if_msghdr2 {
u_short ifm_msglen; /* to skip over non-understood messages */
u_char ifm_version; /* future binary compatability */
u_char ifm_type; /* message type */
int ifm_addrs; /* like rtm_addrs */
int ifm_flags; /* value of if_flags */
u_short ifm_index; /* index for associated ifp */
int ifm_snd_len; /* instantaneous length of send queue */
int ifm_snd_maxlen; /* maximum length of send queue */
int ifm_snd_drops; /* number of drops in send queue */
int ifm_timer; /* time until if_watchdog called */
struct if_data64 ifm_data; /* statistics and other data */
};
/*
* Message format for use in obtaining information about multicast addresses
* from sysctl
*/
struct ifma_msghdr2 {
u_short ifmam_msglen; /* to skip over non-understood messages */
u_char ifmam_version; /* future binary compatability */
u_char ifmam_type; /* message type */
int ifmam_addrs; /* like rtm_addrs */
int ifmam_flags; /* value of ifa_flags */
u_short ifmam_index; /* index for associated ifp */
int32_t ifmam_refcount;
};
/*
* ifdevmtu: interface device mtu
* Used with SIOCGIFDEVMTU to get the current mtu in use by the device,
* as well as the minimum and maximum mtu allowed by the device.
*/
struct ifdevmtu {
int ifdm_current;
int ifdm_min;
int ifdm_max;
};
#pragma pack(4)
/*
* ifkpi: interface kpi ioctl
* Used with SIOCSIFKPI and SIOCGIFKPI.
*
* ifk_module_id - From in the kernel, a value from kev_vendor_code_find. From
* user space, a value from SIOCGKEVVENDOR ioctl on a kernel event socket.
* ifk_type - The type. Types are specific to each module id.
* ifk_data - The data. ifk_ptr may be a 64bit pointer for 64 bit processes.
*
* Copying data between user space and kernel space is done using copyin
* and copyout. A process may be running in 64bit mode. In such a case,
* the pointer will be a 64bit pointer, not a 32bit pointer. The following
* sample is a safe way to copy the data in to the kernel from either a
* 32bit or 64bit process:
*
* user_addr_t tmp_ptr;
* if (IS_64BIT_PROCESS(current_proc())) {
* tmp_ptr = CAST_USER_ADDR_T(ifkpi.ifk_data.ifk_ptr64);
* }
* else {
* tmp_ptr = CAST_USER_ADDR_T(ifkpi.ifk_data.ifk_ptr);
* }
* error = copyin(tmp_ptr, allocated_dst_buffer, size of allocated_dst_buffer);
*/
struct ifkpi {
unsigned int ifk_module_id;
unsigned int ifk_type;
union {
void *ifk_ptr;
int ifk_value;
u_int64_t ifk_ptr64;
} ifk_data;
};
/* Wake capabilities of a interface */
#define IF_WAKE_ON_MAGIC_PACKET 0x01
#pragma pack()
/*
* Interface request structure used for socket
* ioctl's. All interface ioctl's must have parameter
* definitions which begin with ifr_name. The
* remainder may be interface specific.
*/
struct ifreq {
char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */
union {
struct sockaddr ifru_addr;
struct sockaddr ifru_dstaddr;
struct sockaddr ifru_broadaddr;
short ifru_flags;
int ifru_metric;
int ifru_mtu;
int ifru_phys;
int ifru_media;
int ifru_intval;
caddr_t ifru_data;
struct ifdevmtu ifru_devmtu;
struct ifkpi ifru_kpi;
u_int32_t ifru_wake_flags;
u_int32_t ifru_route_refcnt;
int ifru_cap[2];
u_int32_t ifru_functional_type;
#define IFRTYPE_FUNCTIONAL_UNKNOWN 0
#define IFRTYPE_FUNCTIONAL_LOOPBACK 1
#define IFRTYPE_FUNCTIONAL_WIRED 2
#define IFRTYPE_FUNCTIONAL_WIFI_INFRA 3
#define IFRTYPE_FUNCTIONAL_WIFI_AWDL 4
#define IFRTYPE_FUNCTIONAL_CELLULAR 5
#define IFRTYPE_FUNCTIONAL_INTCOPROC 6
#define IFRTYPE_FUNCTIONAL_COMPANIONLINK 7
#define IFRTYPE_FUNCTIONAL_LAST 7
} ifr_ifru;
#define ifr_addr ifr_ifru.ifru_addr /* address */
#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */
#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
#ifdef __APPLE__
#define ifr_flags ifr_ifru.ifru_flags /* flags */
#else
#define ifr_flags ifr_ifru.ifru_flags[0] /* flags */
#define ifr_prevflags ifr_ifru.ifru_flags[1] /* flags */
#endif /* __APPLE__ */
#define ifr_metric ifr_ifru.ifru_metric /* metric */
#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */
#define ifr_phys ifr_ifru.ifru_phys /* physical wire */
#define ifr_media ifr_ifru.ifru_media /* physical media */
#define ifr_data ifr_ifru.ifru_data /* for use by interface */
#define ifr_devmtu ifr_ifru.ifru_devmtu
#define ifr_intval ifr_ifru.ifru_intval /* integer value */
#define ifr_kpi ifr_ifru.ifru_kpi
#define ifr_wake_flags ifr_ifru.ifru_wake_flags /* wake capabilities */
#define ifr_route_refcnt ifr_ifru.ifru_route_refcnt /* route references count */
#define ifr_reqcap ifr_ifru.ifru_cap[0] /* requested capabilities */
#define ifr_curcap ifr_ifru.ifru_cap[1] /* current capabilities */
};
#define _SIZEOF_ADDR_IFREQ(ifr) \
((ifr).ifr_addr.sa_len > sizeof (struct sockaddr) ? \
(sizeof (struct ifreq) - sizeof (struct sockaddr) + \
(ifr).ifr_addr.sa_len) : sizeof (struct ifreq))
struct ifaliasreq {
char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */
struct sockaddr ifra_addr;
struct sockaddr ifra_broadaddr;
struct sockaddr ifra_mask;
};
struct rslvmulti_req {
struct sockaddr *sa;
struct sockaddr **llsa;
};
#pragma pack(4)
struct ifdrv {
char ifd_name[IFNAMSIZ]; /* if name, e.g. "en0" */
unsigned long ifd_cmd;
size_t ifd_len; /* length of ifd_data buffer */
void *ifd_data;
};
#pragma pack()
/*
* Structure used to retrieve aux status data from interfaces.
* Kernel suppliers to this interface should respect the formatting
* needed by ifconfig(8): each line starts with a TAB and ends with
* a newline.
*/
#define IFSTATMAX 800 /* 10 lines of text */
struct ifstat {
char ifs_name[IFNAMSIZ]; /* if name, e.g. "en0" */
char ascii[IFSTATMAX + 1];
};
/*
* DLIL KEV_DL_PROTO_ATTACHED/DETACHED structure
*/
struct kev_dl_proto_data {
struct net_event_data link_data;
u_int32_t proto_family;
u_int32_t proto_remaining_count;
};
#ifdef MALLOC_DECLARE
MALLOC_DECLARE(M_IFADDR);
MALLOC_DECLARE(M_IFMADDR);
#endif
#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
#include <net/kpi_interface.h>
#endif /* !_NET_IF_H_ */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/net/net_kev.h | /*
* Copyright (c) 2016-2018 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _NET_NETKEV_H_
#define _NET_NETKEV_H_
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
/* Kernel event subclass identifiers for KEV_NETWORK_CLASS */
#define KEV_INET_SUBCLASS 1 /* inet subclass */
/* KEV_INET_SUBCLASS event codes */
#define KEV_INET_NEW_ADDR 1 /* Userland configured IP address */
#define KEV_INET_CHANGED_ADDR 2 /* Address changed event */
#define KEV_INET_ADDR_DELETED 3 /* IPv6 address was deleted */
#define KEV_INET_SIFDSTADDR 4 /* Dest. address was set */
#define KEV_INET_SIFBRDADDR 5 /* Broadcast address was set */
#define KEV_INET_SIFNETMASK 6 /* Netmask was set */
#define KEV_INET_ARPCOLLISION 7 /* ARP collision detected */
#ifdef __APPLE_API_PRIVATE
#define KEV_INET_PORTINUSE 8 /* use ken_in_portinuse */
#endif
#define KEV_INET_ARPRTRFAILURE 9 /* ARP resolution failed for router */
#define KEV_INET_ARPRTRALIVE 10 /* ARP resolution succeeded for router */
#define KEV_DL_SUBCLASS 2 /* Data Link subclass */
/*
* Define Data-Link event subclass, and associated
* events.
*/
#define KEV_DL_SIFFLAGS 1
#define KEV_DL_SIFMETRICS 2
#define KEV_DL_SIFMTU 3
#define KEV_DL_SIFPHYS 4
#define KEV_DL_SIFMEDIA 5
#define KEV_DL_SIFGENERIC 6
#define KEV_DL_ADDMULTI 7
#define KEV_DL_DELMULTI 8
#define KEV_DL_IF_ATTACHED 9
#define KEV_DL_IF_DETACHING 10
#define KEV_DL_IF_DETACHED 11
#define KEV_DL_LINK_OFF 12
#define KEV_DL_LINK_ON 13
#define KEV_DL_PROTO_ATTACHED 14
#define KEV_DL_PROTO_DETACHED 15
#define KEV_DL_LINK_ADDRESS_CHANGED 16
#define KEV_DL_WAKEFLAGS_CHANGED 17
#define KEV_DL_IF_IDLE_ROUTE_REFCNT 18
#define KEV_DL_IFCAP_CHANGED 19
#define KEV_DL_LINK_QUALITY_METRIC_CHANGED 20
#define KEV_DL_NODE_PRESENCE 21
#define KEV_DL_NODE_ABSENCE 22
#define KEV_DL_PRIMARY_ELECTED 23
#define KEV_DL_ISSUES 24
#define KEV_DL_IFDELEGATE_CHANGED 25
#define KEV_DL_AWDL_RESTRICTED 26
#define KEV_DL_AWDL_UNRESTRICTED 27
#define KEV_DL_RRC_STATE_CHANGED 28
#define KEV_DL_QOS_MODE_CHANGED 29
#define KEV_DL_LOW_POWER_MODE_CHANGED 30
#define KEV_DL_MASTER_ELECTED (_Pragma("gcc warn Use KEV_DL_PRIMARY_ELECTED instead") KEV_DL_PRIMARY_ELECTED)
#define KEV_INET6_SUBCLASS 6 /* inet6 subclass */
/* KEV_INET6_SUBCLASS event codes */
#define KEV_INET6_NEW_USER_ADDR 1 /* Userland configured IPv6 address */
#define KEV_INET6_CHANGED_ADDR 2 /* Address changed event (future) */
#define KEV_INET6_ADDR_DELETED 3 /* IPv6 address was deleted */
#define KEV_INET6_NEW_LL_ADDR 4 /* Autoconf LL address appeared */
#define KEV_INET6_NEW_RTADV_ADDR 5 /* Autoconf address has appeared */
#define KEV_INET6_DEFROUTER 6 /* Default router detected */
#define KEV_INET6_REQUEST_NAT64_PREFIX 7 /* Asking for the NAT64-prefix */
#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
#endif /* _NET_NETKEV_H_ */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/net/kpi_interfacefilter.h | /*
* Copyright (c) 2003,2008,2017 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*!
* @header kpi_interfacefilter.h
* This header defines an API to attach interface filters. Interface
* filters may be attached to a specific interface. The filters can
* intercept all packets in to and out of the specific interface. In
* addition, the filters may intercept interface specific events and
* ioctls.
*/
#ifndef __KPI_INTERFACEFILTER__
#define __KPI_INTERFACEFILTER__
#include <sys/kernel_types.h>
#include <net/kpi_interface.h>
#include <Availability.h>
#define __NKE_API_DEPRECATED __API_DEPRECATED("Network Kernel Extension KPI is deprecated", macos(10.4, 10.15.4))
struct kev_msg;
__BEGIN_DECLS
/*!
* @typedef iff_input_func
*
* @discussion iff_input_func is used to filter incoming packets. The
* interface is only valid for the duration of the filter call. If
* you need to keep a reference to the interface, be sure to call
* ifnet_reference and ifnet_release. The packets passed to the
* inbound filter are different from those passed to the outbound
* filter. Packets to the inbound filter have the frame header
* passed in separately from the rest of the packet. The outbound
* data filters is passed the whole packet including the frame
* header.
*
* The frame header usually preceeds the data in the mbuf. This
* ensures that the frame header will be a valid pointer as long as
* the mbuf is not freed. If you need to change the frame header to
* point somewhere else, the recommended method is to prepend a new
* frame header to the mbuf chain (mbuf_prepend), set the header to
* point to that data, then call mbuf_adj to move the mbuf data
* pointer back to the start of the packet payload.
* @param cookie The cookie specified when this filter was attached.
* @param interface The interface the packet was recieved on.
* @param protocol The protocol of this packet. If you specified a
* protocol when attaching your filter, the protocol will only ever
* be the protocol you specified.
* @param data The inbound packet, after the frame header as determined
* by the interface.
* @param frame_ptr A pointer to the pointer to the frame header. The
* frame header length can be found by inspecting the interface's
* frame header length (ifnet_hdrlen).
* @result Return:
* 0 - The caller will continue with normal processing of the
* packet.
* EJUSTRETURN - The caller will stop processing the packet,
* the packet will not be freed.
* Anything Else - The caller will free the packet and stop
* processing.
*/
typedef errno_t (*iff_input_func)(void *cookie, ifnet_t interface,
protocol_family_t protocol, mbuf_t *data, char **frame_ptr);
/*!
* @typedef iff_output_func
*
* @discussion iff_output_func is used to filter fully formed outbound
* packets. The interface is only valid for the duration of the
* filter call. If you need to keep a reference to the interface,
* be sure to call ifnet_reference and ifnet_release.
* @param cookie The cookie specified when this filter was attached.
* @param interface The interface the packet is being transmitted on.
* @param data The fully formed outbound packet in a chain of mbufs.
* The frame header is already included. The filter function may
* modify the packet or return a different mbuf chain.
* @result Return:
* 0 - The caller will continue with normal processing of the
* packet.
* EJUSTRETURN - The caller will stop processing the packet,
* the packet will not be freed.
* Anything Else - The caller will free the packet and stop
* processing.
*/
typedef errno_t (*iff_output_func)(void *cookie, ifnet_t interface,
protocol_family_t protocol, mbuf_t *data);
/*!
* @typedef iff_event_func
*
* @discussion iff_event_func is used to filter interface specific
* events. The interface is only valid for the duration of the
* filter call. If you need to keep a reference to the interface,
* be sure to call ifnet_reference and ifnet_release.
* @param cookie The cookie specified when this filter was attached.
* @param interface The interface the packet is being transmitted on.
* @param event_msg The kernel event, may not be changed.
*/
typedef void (*iff_event_func)(void *cookie, ifnet_t interface,
protocol_family_t protocol, const struct kev_msg *event_msg);
/*!
* @typedef iff_ioctl_func
*
* @discussion iff_ioctl_func is used to filter ioctls sent to an
* interface. The interface is only valid for the duration of the
* filter call. If you need to keep a reference to the interface,
* be sure to call ifnet_reference and ifnet_release.
*
* All undefined ioctls are reserved for future use by Apple. If
* you need to communicate with your kext using an ioctl, please
* use SIOCSIFKPI and SIOCGIFKPI.
* @param cookie The cookie specified when this filter was attached.
* @param interface The interface the packet is being transmitted on.
* @param ioctl_cmd The ioctl command.
* @param ioctl_arg A pointer to the ioctl argument.
* @result Return:
* 0 - This filter function handled the ioctl.
* EOPNOTSUPP - This filter function does not understand/did not
* handle this ioctl.
* EJUSTRETURN - This filter function handled the ioctl,
* processing should stop.
* Anything Else - Processing will stop, the error will be
* returned.
*/
typedef errno_t (*iff_ioctl_func)(void *cookie, ifnet_t interface,
protocol_family_t protocol, unsigned long ioctl_cmd, void *ioctl_arg);
/*!
* @typedef iff_detached_func
*
* @discussion iff_detached_func is called to notify the filter that it
* has been detached from an interface. This is the last call to
* the filter that will be made. A filter may be detached if the
* interface is detached or the detach filter function is called.
* In the case that the interface is being detached, your filter's
* event function will be called with the interface detaching event
* before the your detached function will be called.
* @param cookie The cookie specified when this filter was attached.
* @param interface The interface this filter was detached from.
*/
typedef void (*iff_detached_func)(void *cookie, ifnet_t interface);
/*!
* @struct iff_filter
* @discussion This structure is used to define an interface filter for
* use with the iflt_attach function.
* @field iff_cookie A kext defined cookie that will be passed to all
* filter functions.
* @field iff_name A filter name used for debugging purposes.
* @field iff_protocol The protocol of the packets this filter is
* interested in. If you specify zero, packets from all protocols
* will be passed to the filter.
* @field iff_input The filter function to handle inbound packets, may
* be NULL.
* @field iff_output The filter function to handle outbound packets,
* may be NULL.
* @field iff_event The filter function to handle interface events, may
* be null.
* @field iff_ioctl The filter function to handle interface ioctls, may
* be null.
* @field iff_detached The filter function used to notify the filter that
* it has been detached.
*/
struct iff_filter {
void *iff_cookie;
const char *iff_name;
protocol_family_t iff_protocol;
iff_input_func iff_input;
iff_output_func iff_output;
iff_event_func iff_event;
iff_ioctl_func iff_ioctl;
iff_detached_func iff_detached;
};
/*!
* @function iflt_attach
* @discussion Attaches an interface filter to an interface.
* @param interface The interface the filter should be attached to.
* @param filter A structure defining the filter.
* @param filter_ref A reference to the filter used to detach.
* @result 0 on success otherwise the errno error.
*/
extern errno_t iflt_attach(ifnet_t interface, const struct iff_filter *filter,
interface_filter_t *filter_ref)
__NKE_API_DEPRECATED;
/*!
* @function iflt_detach
* @discussion Detaches an interface filter from an interface.
* @param filter_ref The reference to the filter from iflt_attach.
*/
extern void iflt_detach(interface_filter_t filter_ref)
__NKE_API_DEPRECATED;
__END_DECLS
#undef __NKE_API_DEPRECATED
#endif /* __KPI_INTERFACEFILTER__ */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/net/kext_net.h | /*
* Copyright (c) 1999-2013 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Support for socket filter kernel extensions
*/
#ifndef NET_KEXT_NET_H
#define NET_KEXT_NET_H
#include <sys/appleapiopts.h>
#include <sys/queue.h>
#include <sys/cdefs.h>
#include <sys/types.h>
#define NFF_BEFORE 0x01
#define NFF_AFTER 0x02
#define NKE_OK 0
#define NKE_REMOVE (-1)
/*
* Interface structure for inserting an installed socket NKE into an
* existing socket.
* 'handle' is the NKE to be inserted, 'where' is an insertion point,
* and flags dictate the position of the to-be-inserted NKE relative to
* the 'where' NKE. If the latter is NULL, the flags indicate "first"
* or "last"
*/
#pragma pack(4)
struct so_nke {
unsigned int nke_handle;
unsigned int nke_where;
int nke_flags; /* NFF_BEFORE, NFF_AFTER: net/kext_net.h */
u_int32_t reserved[4]; /* for future use */
};
#pragma pack()
#endif /* NET_KEXT_NET_H */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/net/ndrv.h | /*
* Copyright (c) 2008 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/* Copyright (c) 1997, 1998 Apple Computer, Inc. All Rights Reserved */
/*
* @(#)ndrv.h 1.1 (MacOSX) 6/10/43
* Justin Walker - 970604
*/
#include <net/dlil.h>
#ifndef _NET_NDRV_H
#define _NET_NDRV_H
#include <net/if_var.h>
#include <sys/appleapiopts.h>
#include <sys/types.h>
struct sockaddr_ndrv {
unsigned char snd_len;
unsigned char snd_family;
unsigned char snd_name[IFNAMSIZ]; /* from if.h */
};
/*
* Support for user-mode protocol handlers
*/
#define NDRV_DEMUXTYPE_ETHERTYPE 4
#define NDRV_DEMUXTYPE_SAP 5
#define NDRV_DEMUXTYPE_SNAP 6
#define NDRVPROTO_NDRV 0
/*
* Struct: ndrv_demux_desc
* Purpose:
* To uniquely identify a packet based on its low-level framing information.
*
* Fields:
* type : type of protocol in data field, must be understood by
* the interface family of the interface the socket is bound to
* length : length of protocol data in "data" field
* data : union of framing-specific data, in network byte order
* ether_type : ethernet type in network byte order, assuming
* ethernet type II framing
* sap : first 3 bytes of sap header, network byte order
* snap : first 5 bytes of snap header, network byte order
* other : up to 28 bytes of protocol data for different protocol type
*
* Examples:
* 1) 802.1x uses ether_type 0x888e, so the descriptor would be set as:
* struct ndrv_demux_desc desc;
* desc.type = NDRV_DEMUXTYPE_ETHERTYPE
* desc.length = sizeof(unsigned short);
* desc.ether_type = htons(0x888e);
* 2) AppleTalk uses SNAP 0x080007809B
* struct ndrv_demux_desc desc;
* desc.type = NDRV_DEMUXTYPE_SNAP;
* desc.length = 5;
* desc.data.snap[0] = 08;
* desc.data.snap[1] = 00;
* desc.data.snap[2] = 07;
* desc.data.snap[3] = 80;
* desc.data.snap[4] = 9B;
*/
struct ndrv_demux_desc {
u_int16_t type;
u_int16_t length;
union{
u_int16_t ether_type;
u_int8_t sap[3];
u_int8_t snap[5];
u_int8_t other[28];
} data;
};
#define NDRV_PROTOCOL_DESC_VERS 1
/*
* Struct: ndrv_protocol_desc
* Purpose:
* Used to "bind" an NDRV socket so that packets that match
* given protocol demux descriptions can be received:
* Field:
* version : must be NDRV_PROTOCOL_DESC_VERS
* protocol_family : unique identifier for this protocol
* demux_count : number of demux_list descriptors in demux_list; maximum of 10
* demux_list : pointer to array of demux descriptors
*/
struct ndrv_protocol_desc {
u_int32_t version;
u_int32_t protocol_family;
u_int32_t demux_count;
struct ndrv_demux_desc *demux_list;
};
#define SOL_NDRVPROTO NDRVPROTO_NDRV /* Use this socket level */
#define NDRV_DELDMXSPEC 0x02 /* Delete the registered protocol */
#define NDRV_SETDMXSPEC 0x04 /* Set the protocol spec */
#define NDRV_ADDMULTICAST 0x05 /* Add a physical multicast address */
#define NDRV_DELMULTICAST 0x06 /* Delete a phyiscal multicast */
/*
* SOL_NDRVPROTO - use this for the socket level when calling setsocketopt
* NDRV_DELDMXSPEC - removes the registered protocol and all related demuxes
* NDRV_SETDMXSPEC - set the protocol to receive, use struct ndrv_protocol_desc
* as the parameter.
* NDRV_ADDMULTICAST - Enable reception of a phyiscal multicast address, use
* a sockaddr of the appropriate type for the media in use.
* NDRV_DELMULTICAST - Disable reception of a phyiscal multicast address, use
* a sockaddr of the appropriate type for the media in use.
*
* When adding multicasts, the multicasts are ref counted. If the multicast is
* already registered in the kernel, the count will be bumped. When deleting
* the multicast, the count is decremented. If the count reaches zero the
* multicast is removed. If your process is killed, PF_NDRV will unregister
* the mulitcasts you've added. You can only delete multicasts you've added
* on the same socket.
*
* If the interface goes away while your socket is open, your protocol is
* immediately detached and sending/receiving is disabled on the socket.
* If you need a chance to do something, please file a bug and we can give
* you a second or two.
*/
/* Max number of descriptions allowed by default */
#define NDRV_DMUX_MAX_DESCR 1024
/*
* sysctl MIB tags at the kern.ipc.nrdv level
*/
#define NRDV_MULTICAST_ADDRS_PER_SOCK 1 /* to toggle NDRV_DMUX_MAX_DESCR value */
#endif /* _NET_NDRV_H */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/net/if_utun.h | /*
* Copyright (c) 2008-2019 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _NET_IF_UTUN_H_
#define _NET_IF_UTUN_H_
#include <sys/types.h>
/*
* Name registered by the utun kernel control
*/
#define UTUN_CONTROL_NAME "com.apple.net.utun_control"
/*
* Socket option names to manage utun
*/
#define UTUN_OPT_FLAGS 1
#define UTUN_OPT_IFNAME 2
#define UTUN_OPT_EXT_IFDATA_STATS 3 /* get|set (type int) */
#define UTUN_OPT_INC_IFDATA_STATS_IN 4 /* set to increment stat counters (type struct utun_stats_param) */
#define UTUN_OPT_INC_IFDATA_STATS_OUT 5 /* set to increment stat counters (type struct utun_stats_param) */
#define UTUN_OPT_SET_DELEGATE_INTERFACE 15 /* set the delegate interface (char[]) */
#define UTUN_OPT_MAX_PENDING_PACKETS 16 /* the number of packets that can be waiting to be read
* from the control socket at a time */
#define UTUN_OPT_ENABLE_CHANNEL 17
#define UTUN_OPT_GET_CHANNEL_UUID 18
#define UTUN_OPT_ENABLE_FLOWSWITCH 19
#define UTUN_OPT_ENABLE_NETIF 20 /* Must be set before connecting */
#define UTUN_OPT_SLOT_SIZE 21 /* Must be set before connecting */
#define UTUN_OPT_NETIF_RING_SIZE 22 /* Must be set before connecting */
#define UTUN_OPT_TX_FSW_RING_SIZE 23 /* Must be set before connecting */
#define UTUN_OPT_RX_FSW_RING_SIZE 24 /* Must be set before connecting */
#define UTUN_OPT_KPIPE_TX_RING_SIZE 25 /* Must be set before connecting */
#define UTUN_OPT_KPIPE_RX_RING_SIZE 26 /* Must be set before connecting */
#define UTUN_OPT_ATTACH_FLOWSWITCH 27 /* Must be set before connecting */
/*
* Flags for by UTUN_OPT_FLAGS
*/
#define UTUN_FLAGS_NO_OUTPUT 0x0001
#define UTUN_FLAGS_NO_INPUT 0x0002
#define UTUN_FLAGS_ENABLE_PROC_UUID 0x0004
/*
* utun stats parameter structure
*/
struct utun_stats_param {
u_int64_t utsp_packets;
u_int64_t utsp_bytes;
u_int64_t utsp_errors;
};
#endif
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/net/dlil.h | /*
* Copyright (c) 1999-2021 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef DLIL_H
#define DLIL_H
#include <sys/kernel_types.h>
#include <net/kpi_interface.h>
enum {
BPF_TAP_DISABLE,
BPF_TAP_INPUT,
BPF_TAP_OUTPUT,
BPF_TAP_INPUT_OUTPUT
};
/*
* DLIL_DESC_ETYPE2 - native_type must point to 2 byte ethernet raw protocol,
* variants.native_type_length must be set to 2
* DLIL_DESC_SAP - native_type must point to 3 byte SAP protocol
* variants.native_type_length must be set to 3
* DLIL_DESC_SNAP - native_type must point to 5 byte SNAP protocol
* variants.native_type_length must be set to 5
*
* All protocols must be in Network byte order.
*
* Future interface families may define more protocol types they know about.
* The type implies the offset and context of the protocol data at native_type.
* The length of the protocol data specified at native_type must be set in
* variants.native_type_length.
*/
/* Ethernet specific types */
#define DLIL_DESC_ETYPE2 4
#define DLIL_DESC_SAP 5
#define DLIL_DESC_SNAP 6
#endif /* DLIL_H */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/net/if_dl.h | /*
* Copyright (c) 2000-2011 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)if_dl.h 8.1 (Berkeley) 6/10/93
* $FreeBSD: src/sys/net/if_dl.h,v 1.10 2000/03/01 02:46:25 archie Exp $
*/
#ifndef _NET_IF_DL_H_
#define _NET_IF_DL_H_
#include <sys/appleapiopts.h>
#include <sys/types.h>
/*
* A Link-Level Sockaddr may specify the interface in one of two
* ways: either by means of a system-provided index number (computed
* anew and possibly differently on every reboot), or by a human-readable
* string such as "il0" (for managerial convenience).
*
* Census taking actions, such as something akin to SIOCGCONF would return
* both the index and the human name.
*
* High volume transactions (such as giving a link-level ``from'' address
* in a recvfrom or recvmsg call) may be likely only to provide the indexed
* form, (which requires fewer copy operations and less space).
*
* The form and interpretation of the link-level address is purely a matter
* of convention between the device driver and its consumers; however, it is
* expected that all drivers for an interface of a given if_type will agree.
*/
/*
* Structure of a Link-Level sockaddr:
*/
struct sockaddr_dl {
u_char sdl_len; /* Total length of sockaddr */
u_char sdl_family; /* AF_LINK */
u_short sdl_index; /* if != 0, system given index for interface */
u_char sdl_type; /* interface type */
u_char sdl_nlen; /* interface name length, no trailing 0 reqd. */
u_char sdl_alen; /* link level address length */
u_char sdl_slen; /* link layer selector length */
char sdl_data[12]; /* minimum work area, can be larger;
* contains both if name and ll address */
#ifndef __APPLE__
/* For TokenRing */
u_short sdl_rcf; /* source routing control */
u_short sdl_route[16]; /* source routing information */
#endif
};
#define LLADDR(s) ((caddr_t)((s)->sdl_data + (s)->sdl_nlen))
#endif
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/net/if_mib.h | /*
* Copyright (c) 2000-2019 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Copyright 1996 Massachusetts Institute of Technology
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose and without fee is hereby
* granted, provided that both the above copyright notice and this
* permission notice appear in all copies, that both the above
* copyright notice and this permission notice appear in all
* supporting documentation, and that the name of M.I.T. not be used
* in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission. M.I.T. makes
* no representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied
* warranty.
*
* THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
* ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
* SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: src/sys/net/if_mib.h,v 1.6 1999/08/28 00:48:19 peter Exp $
*/
#ifndef _NET_IF_MIB_H
#define _NET_IF_MIB_H 1
#include <net/if_var.h>
#include <sys/appleapiopts.h>
#include <sys/types.h>
struct ifmibdata {
char ifmd_name[IFNAMSIZ]; /* name of interface */
unsigned int ifmd_pcount; /* number of promiscuous listeners */
unsigned int ifmd_flags; /* interface flags */
unsigned int ifmd_snd_len; /* instantaneous length of send queue */
unsigned int ifmd_snd_maxlen; /* maximum length of send queue */
unsigned int ifmd_snd_drops; /* number of drops in send queue */
unsigned int ifmd_filler[4]; /* for future expansion */
struct if_data64 ifmd_data; /* generic information and statistics */
};
/*
* sysctl MIB tags at the net.link.generic level
*/
#define IFMIB_SYSTEM 1 /* non-interface-specific */
#define IFMIB_IFDATA 2 /* per-interface data table */
#define IFMIB_IFALLDATA 3 /* all interfaces data at once */
/*
* MIB tags for the various net.link.generic.ifdata tables
*/
#define IFDATA_GENERAL 1 /* generic stats for all kinds of ifaces */
#define IFDATA_LINKSPECIFIC 2 /* specific to the type of interface */
#define IFDATA_ADDRS 3 /* addresses assigned to interface */
#define IFDATA_MULTIADDRS 4 /* multicast addresses assigned to interface */
/*
* MIB tags at the net.link.generic.system level
*/
#define IFMIB_IFCOUNT 1 /* number of interfaces configured */
/*
* MIB tags as the net.link level
* All of the other values are IFT_* names defined in if_types.h.
*/
#define NETLINK_GENERIC 0 /* functions not specific to a type of iface */
/*
* The reason why the IFDATA_LINKSPECIFIC stuff is not under the
* net.link.<iftype> branches is twofold:
* 1) It's easier to code this way, and doesn't require duplication.
* 2) The fourth level under net.link.<iftype> is <pf>; that is to say,
* the net.link.<iftype> tree instruments the adaptation layers between
* <iftype> and a particular protocol family (e.g., net.link.ether.inet
* instruments ARP). This does not really leave room for anything else
* that needs to have a well-known number.
*/
/*
* Link-specific MIB structures for various link types.
*/
/* For IFT_ETHER, IFT_ISO88023, and IFT_STARLAN, as used by RFC 1650 */
struct ifs_iso_8802_3 {
u_int32_t dot3StatsAlignmentErrors;
u_int32_t dot3StatsFCSErrors;
u_int32_t dot3StatsSingleCollisionFrames;
u_int32_t dot3StatsMultipleCollisionFrames;
u_int32_t dot3StatsSQETestErrors;
u_int32_t dot3StatsDeferredTransmissions;
u_int32_t dot3StatsLateCollisions;
u_int32_t dot3StatsExcessiveCollisions;
u_int32_t dot3StatsInternalMacTransmitErrors;
u_int32_t dot3StatsCarrierSenseErrors;
u_int32_t dot3StatsFrameTooLongs;
u_int32_t dot3StatsInternalMacReceiveErrors;
u_int32_t dot3StatsEtherChipSet;
/* Matt Thomas wants this one, not included in RFC 1650: */
u_int32_t dot3StatsMissedFrames;
u_int32_t dot3StatsCollFrequencies[16]; /* NB: index origin */
u_int32_t dot3Compliance;
#define DOT3COMPLIANCE_STATS 1
#define DOT3COMPLIANCE_COLLS 2
};
/*
* Chipset identifiers are normally part of the vendor's enterprise MIB.
* However, we don't want to be trying to represent arbitrary-length
* OBJECT IDENTIFIERs here (ick!), and the right value is not necessarily
* obvious to the driver implementor. So, we define our own identification
* mechanism here, and let the agent writer deal with the translation.
*/
#define DOT3CHIPSET_VENDOR(x) ((x) >> 16)
#define DOT3CHIPSET_PART(x) ((x) & 0xffff)
#define DOT3CHIPSET(v, p) (((v) << 16) + ((p) & 0xffff))
/* Driver writers! Add your vendors here! */
enum dot3Vendors {
dot3VendorAMD = 1,
dot3VendorIntel = 2,
dot3VendorNational = 4,
dot3VendorFujitsu = 5,
dot3VendorDigital = 6,
dot3VendorWesternDigital = 7
};
/* Driver writers! Add your chipsets here! */
enum {
dot3ChipSetAMD7990 = 1,
dot3ChipSetAMD79900 = 2,
dot3ChipSetAMD79C940 = 3
};
enum {
dot3ChipSetIntel82586 = 1,
dot3ChipSetIntel82596 = 2,
dot3ChipSetIntel82557 = 3
};
enum {
dot3ChipSetNational8390 = 1,
dot3ChipSetNationalSonic = 2
};
enum {
dot3ChipSetFujitsu86950 = 1
};
enum {
dot3ChipSetDigitalDC21040 = 1,
dot3ChipSetDigitalDC21140 = 2,
dot3ChipSetDigitalDC21041 = 3,
dot3ChipSetDigitalDC21140A = 4,
dot3ChipSetDigitalDC21142 = 5
};
enum {
dot3ChipSetWesternDigital83C690 = 1,
dot3ChipSetWesternDigital83C790 = 2
};
/* END of Ethernet-link MIB stuff */
/*
* Put other types of interface MIBs here, or in interface-specific
* header files if convenient ones already exist.
*/
/*
* Structure for interface family ID table
*/
struct if_family_id {
u_int32_t iffmid_len;
u_int32_t iffmid_id;
char iffmid_str[1]; /* variable length string */
};
#endif /* _NET_IF_MIB_H */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/net/kpi_interface.h | /*
* Copyright (c) 2004-2020 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*!
* @header kpi_interface.h
* This header defines an API to interact with network interfaces in
* the kernel. The network interface KPI may be used to implement
* network interfaces or to attach protocols to existing interfaces.
*/
#ifndef __KPI_INTERFACE__
#define __KPI_INTERFACE__
#include <TargetConditionals.h>
#include <sys/kernel_types.h>
#include <sys/_types/_sa_family_t.h>
#include <Availability.h>
#define __NKE_API_DEPRECATED __API_DEPRECATED("Network Kernel Extension KPI is deprecated", macos(10.4, 10.15.4))
#if (TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR)
#define KPI_INTERFACE_EMBEDDED 1
#else
#define KPI_INTERFACE_EMBEDDED 0
#endif
struct timeval;
struct sockaddr;
struct sockaddr_dl;
struct kern_event_msg;
struct kev_msg;
struct ifnet_demux_desc;
/*!
* @enum Interface Families
* @abstract Constants defining interface families.
* @constant IFNET_FAMILY_ANY Match interface of any family type.
* @constant IFNET_FAMILY_LOOPBACK A software loopback interface.
* @constant IFNET_FAMILY_ETHERNET An Ethernet interface.
* @constant IFNET_FAMILY_SLIP A SLIP interface.
* @constant IFNET_FAMILY_TUN A tunnel interface.
* @constant IFNET_FAMILY_VLAN A virtual LAN interface.
* @constant IFNET_FAMILY_PPP A PPP interface.
* @constant IFNET_FAMILY_PVC A PVC interface.
* @constant IFNET_FAMILY_DISC A DISC interface.
* @constant IFNET_FAMILY_MDECAP A MDECAP interface.
* @constant IFNET_FAMILY_GIF A generic tunnel interface.
* @constant IFNET_FAMILY_FAITH A FAITH [IPv4/IPv6 translation] interface.
* @constant IFNET_FAMILY_STF A 6to4 interface.
* @constant IFNET_FAMILY_FIREWIRE An IEEE 1394 [Firewire] interface.
* @constant IFNET_FAMILY_BOND A virtual bonded interface.
* @constant IFNET_FAMILY_CELLULAR A cellular interface.
* @constant IFNET_FAMILY_6LOWPAN A 6LoWPAN interface.
* @constant IFNET_FAMILY_UTUN A utun interface.
* @constant IFNET_FAMILY_IPSEC An IPsec interface.
*/
enum {
IFNET_FAMILY_ANY = 0,
IFNET_FAMILY_LOOPBACK = 1,
IFNET_FAMILY_ETHERNET = 2,
IFNET_FAMILY_SLIP = 3,
IFNET_FAMILY_TUN = 4,
IFNET_FAMILY_VLAN = 5,
IFNET_FAMILY_PPP = 6,
IFNET_FAMILY_PVC = 7,
IFNET_FAMILY_DISC = 8,
IFNET_FAMILY_MDECAP = 9,
IFNET_FAMILY_GIF = 10,
IFNET_FAMILY_FAITH = 11, /* deprecated */
IFNET_FAMILY_STF = 12,
IFNET_FAMILY_FIREWIRE = 13,
IFNET_FAMILY_BOND = 14,
IFNET_FAMILY_CELLULAR = 15,
IFNET_FAMILY_6LOWPAN = 16,
IFNET_FAMILY_UTUN = 17,
IFNET_FAMILY_IPSEC = 18
};
/*!
* @typedef ifnet_family_t
* @abstract Storage type for the interface family.
*/
typedef u_int32_t ifnet_family_t;
#ifndef BPF_TAP_MODE_T
#define BPF_TAP_MODE_T
/*!
* @enum BPF tap mode
* @abstract Constants defining interface families.
* @constant BPF_MODE_DISABLED Disable bpf.
* @constant BPF_MODE_INPUT Enable input only.
* @constant BPF_MODE_OUTPUT Enable output only.
* @constant BPF_MODE_INPUT_OUTPUT Enable input and output.
*/
enum {
BPF_MODE_DISABLED = 0,
BPF_MODE_INPUT = 1,
BPF_MODE_OUTPUT = 2,
BPF_MODE_INPUT_OUTPUT = 3
};
/*!
* @typedef bpf_tap_mode
* @abstract Mode for tapping. BPF_MODE_DISABLED/BPF_MODE_INPUT_OUTPUT etc.
*/
typedef u_int32_t bpf_tap_mode;
#endif /* !BPF_TAP_MODE_T */
/*!
* @typedef protocol_family_t
* @abstract Storage type for the protocol family.
*/
typedef u_int32_t protocol_family_t;
/*!
* @enum Interface Abilities
* @abstract Constants defining interface offload support.
* @constant IFNET_CSUM_IP Hardware will calculate IPv4 checksums.
* @constant IFNET_CSUM_TCP Hardware will calculate TCP checksums.
* @constant IFNET_CSUM_UDP Hardware will calculate UDP checksums.
* @constant IFNET_CSUM_FRAGMENT Hardware will checksum IP fragments.
* @constant IFNET_IP_FRAGMENT Hardware will fragment IP packets.
* @constant IFNET_CSUM_TCPIPV6 Hardware will calculate TCP IPv6 checksums.
* @constant IFNET_CSUM_UDPIPV6 Hardware will calculate UDP IPv6 checksums.
* @constant IFNET_IPV6_FRAGMENT Hardware will fragment IPv6 packets.
* @constant IFNET_VLAN_TAGGING Hardware will generate VLAN headers.
* @constant IFNET_VLAN_MTU Hardware supports VLAN MTU.
* @constant IFNET_MULTIPAGES Driver is capable of handling packets
* coming down from the network stack that reside in virtually,
* but not in physically contiguous span of the external mbuf
* clusters. In this case, the data area of a packet in the
* external mbuf cluster might cross one or more physical
* pages that are disjoint, depending on the interface MTU
* and the packet size. Such a use of larger than system page
* size clusters by the network stack is done for better system
* efficiency. Drivers that utilize the IOMbufNaturalMemoryCursor
* with the getPhysicalSegmentsWithCoalesce interfaces and
* enumerate the list of vectors should set this flag for
* possible gain in performance during bulk data transfer.
* @constant IFNET_TSO_IPV4 Hardware supports IPv4 TCP Segment Offloading.
* If the Interface driver sets this flag, TCP will send larger frames (up to 64KB) as one
* frame to the adapter which will perform the final packetization. The maximum TSO segment
* supported by the interface can be set with "ifnet_set_tso_mtu". To retrieve the real MTU
* for the TCP connection the function "mbuf_get_tso_requested" is used by the driver. Note
* that if TSO is active, all the packets will be flagged for TSO, not just large packets.
* @constant IFNET_TSO_IPV6 Hardware supports IPv6 TCP Segment Offloading.
* If the Interface driver sets this flag, TCP IPv6 will send larger frames (up to 64KB) as one
* frame to the adapter which will perform the final packetization. The maximum TSO segment
* supported by the interface can be set with "ifnet_set_tso_mtu". To retrieve the real MTU
* for the TCP IPv6 connection the function "mbuf_get_tso_requested" is used by the driver.
* Note that if TSO is active, all the packets will be flagged for TSO, not just large packets.
* @constant IFNET_TX_STATUS Driver supports returning a per packet
* transmission status (pass, fail or other errors) of whether
* the packet was successfully transmitted on the link, or the
* transmission was aborted, or transmission failed.
*
*/
enum {
IFNET_CSUM_IP = 0x00000001,
IFNET_CSUM_TCP = 0x00000002,
IFNET_CSUM_UDP = 0x00000004,
IFNET_CSUM_FRAGMENT = 0x00000008,
IFNET_IP_FRAGMENT = 0x00000010,
IFNET_CSUM_TCPIPV6 = 0x00000020,
IFNET_CSUM_UDPIPV6 = 0x00000040,
IFNET_IPV6_FRAGMENT = 0x00000080,
IFNET_VLAN_TAGGING = 0x00010000,
IFNET_VLAN_MTU = 0x00020000,
IFNET_MULTIPAGES = 0x00100000,
IFNET_TSO_IPV4 = 0x00200000,
IFNET_TSO_IPV6 = 0x00400000,
IFNET_TX_STATUS = 0x00800000,
IFNET_HW_TIMESTAMP = 0x01000000,
IFNET_SW_TIMESTAMP = 0x02000000
};
/*!
* @typedef ifnet_offload_t
* @abstract Flags indicating the offload support of the interface.
*/
typedef u_int32_t ifnet_offload_t;
/*
* Callbacks
*
* These are function pointers you supply to the kernel in the interface.
*/
/*!
* @typedef bpf_packet_func
*
* @discussion bpf_packet_func The bpf_packet_func is used to intercept
* inbound and outbound packets. The tap function will never free
* the mbuf. The tap function will only copy the mbuf in to various
* bpf file descriptors tapping this interface.
* @param interface The interface being sent or received on.
* @param data The packet to be transmitted or received.
* @result An errno value or zero upon success.
*/
/* Fast path - do not block or spend excessive amounts of time */
typedef errno_t (*bpf_packet_func)(ifnet_t interface, mbuf_t data);
/*!
* @typedef ifnet_output_func
*
* @discussion ifnet_output_func is used to transmit packets. The stack
* will pass fully formed packets, including frame header, to the
* ifnet_output function for an interface. The driver is
* responsible for freeing the mbuf.
* @param interface The interface being sent on.
* @param data The packet to be sent.
*/
/* Fast path - do not block or spend excessive amounts of time */
typedef errno_t (*ifnet_output_func)(ifnet_t interface, mbuf_t data);
/*!
* @typedef ifnet_ioctl_func
* @discussion ifnet_ioctl_func is used to communicate ioctls from the
* stack to the driver.
*
* All undefined ioctls are reserved for future use by Apple. If
* you need to communicate with your kext using an ioctl, please
* use SIOCSIFKPI and SIOCGIFKPI.
* @param interface The interface the ioctl is being sent to.
* @param cmd The ioctl command.
* @param data A pointer to any data related to the ioctl.
*/
typedef errno_t (*ifnet_ioctl_func)(ifnet_t interface, unsigned long cmd,
void *data);
/*!
* @typedef ifnet_set_bpf_tap
* @discussion Deprecated. Specify NULL. Call bpf_tap_in/bpf_tap_out
* for all packets.
*/
typedef errno_t (*ifnet_set_bpf_tap)(ifnet_t interface, bpf_tap_mode mode,
bpf_packet_func callback);
/*!
* @typedef ifnet_detached_func
* @discussion ifnet_detached_func is called an interface is detached
* from the list of interfaces. When ifnet_detach is called, it may
* not detach the interface immediately if protocols are attached.
* ifnet_detached_func is used to notify the interface that it has
* been detached from the networking stack. This is the last
* function that will be called on an interface. Until this
* function returns, you must not unload a kext supplying function
* pointers to this interface, even if ifnet_detacah has been
* called. Your detach function may be called during your call to
* ifnet_detach.
* @param interface The interface that has been detached.
* event.
*/
typedef void (*ifnet_detached_func)(ifnet_t interface);
/*!
* @typedef ifnet_demux_func
* @discussion ifnet_demux_func is called for each inbound packet to
* determine which protocol family the packet belongs to. This
* information is then used by the stack to determine which
* protocol to pass the packet to. This function may return
* protocol families for protocols that are not attached. If the
* protocol family has not been attached to the interface, the
* packet will be discarded.
* @param interface The interface the packet was received on.
* @param packet The mbuf containing the packet.
* @param frame_header A pointer to the frame header.
* @param protocol_family Upon return, the protocol family matching the
* packet should be stored here.
* @result
* If the result is zero, processing will continue normally.
* If the result is EJUSTRETURN, processing will stop but the
* packet will not be freed.
* If the result is anything else, the processing will stop and
* the packet will be freed.
*/
typedef errno_t (*ifnet_demux_func)(ifnet_t interface, mbuf_t packet,
char *frame_header, protocol_family_t *protocol_family);
/*!
* @typedef ifnet_event_func
* @discussion ifnet_event_func is called when an event occurs on a
* specific interface.
* @param interface The interface the event occurred on.
*/
typedef void (*ifnet_event_func)(ifnet_t interface, const struct kev_msg *msg);
/*!
* @typedef ifnet_framer_func
* @discussion ifnet_framer_func is called for each outbound packet to
* give the interface an opportunity to prepend interface specific
* headers.
* @param interface The interface the packet is being sent on.
* @param packet Pointer to the mbuf containing the packet, caller may
* set this to a different mbuf upon return. This can happen if the
* frameout function needs to prepend another mbuf to the chain to
* have enough space for the header.
* @param dest The higher layer protocol destination (i.e. IP address).
* @param dest_linkaddr The link layer address as determined by the
* protocol's pre-output function.
* @param frame_type The frame type as determined by the protocol's
* pre-output function.
* @discussion prepend_len The length of prepended bytes to the mbuf.
* (ONLY used if KPI_INTERFACE_EMBEDDED is defined to 1)
* @discussion postpend_len The length of the postpended bytes to the mbuf.
* (ONLY used if KPI_INTERFACE_EMBEDDED is defined to 1)
* @result
* If the result is zero, processing will continue normally.
* If the result is EJUSTRETURN, processing will stop but the
* packet will not be freed.
* If the result is anything else, the processing will stop and
* the packet will be freed.
*/
typedef errno_t (*ifnet_framer_func)(ifnet_t interface, mbuf_t *packet,
const struct sockaddr *dest, const char *dest_linkaddr,
const char *frame_type
#if KPI_INTERFACE_EMBEDDED
, u_int32_t *prepend_len, u_int32_t *postpend_len
#endif /* KPI_INTERFACE_EMBEDDED */
);
/*!
* @typedef ifnet_add_proto_func
* @discussion if_add_proto_func is called by the stack when a protocol
* is attached to an interface. This gives the interface an
* opportunity to get a list of protocol description structures
* for demuxing packets to this protocol (demux descriptors).
* @param interface The interface the protocol will be attached to.
* @param protocol_family The family of the protocol being attached.
* @param demux_array An array of demux descriptors that describe
* the interface specific ways of identifying packets belonging
* to this protocol family.
* @param demux_count The number of demux descriptors in the array.
* @result
* If the result is zero, processing will continue normally.
* If the result is anything else, the add protocol will be
* aborted.
*/
typedef errno_t (*ifnet_add_proto_func)(ifnet_t interface,
protocol_family_t protocol_family,
const struct ifnet_demux_desc *demux_array, u_int32_t demux_count);
/*!
* @typedef if_del_proto_func
* @discussion if_del_proto_func is called by the stack when a protocol
* is being detached from an interface. This gives the interface an
* opportunity to free any storage related to this specific
* protocol being attached to this interface.
* @param interface The interface the protocol will be detached from.
* @param protocol_family The family of the protocol being detached.
* @result
* If the result is zero, processing will continue normally.
* If the result is anything else, the detach will continue
* and the error will be returned to the caller.
*/
typedef errno_t (*ifnet_del_proto_func)(ifnet_t interface,
protocol_family_t protocol_family);
/*!
* @typedef ifnet_check_multi
* @discussion ifnet_check_multi is called for each multicast address
* added to an interface. This gives the interface an opportunity
* to reject invalid multicast addresses before they are attached
* to the interface.
*
* To prevent an address from being added to your multicast list,
* return EADDRNOTAVAIL. If you don't know how to parse/translate
* the address, return EOPNOTSUPP.
* @param interface The interface.
* @param mcast The multicast address.
* @result
* Zero upon success, EADDRNOTAVAIL on invalid multicast,
* EOPNOTSUPP for addresses the interface does not understand.
*/
typedef errno_t (*ifnet_check_multi)(ifnet_t interface,
const struct sockaddr *mcast);
/*!
* @typedef proto_media_input
* @discussion proto_media_input is called for all inbound packets for
* a specific protocol on a specific interface. This function is
* registered on an interface using ifnet_attach_protocol.
* @param ifp The interface the packet was received on.
* @param protocol The protocol of the packet received.
* @param packet The packet being input.
* @param header The frame header.
* @result
* If the result is zero, the caller will assume the packet was
* passed to the protocol.
* If the result is non-zero and not EJUSTRETURN, the caller will
* free the packet.
*/
typedef errno_t (*proto_media_input)(ifnet_t ifp, protocol_family_t protocol,
mbuf_t packet, char *header);
/*!
* @typedef proto_media_input_v2
* @discussion proto_media_input_v2 is called for all inbound packets for
* a specific protocol on a specific interface. This function is
* registered on an interface using ifnet_attach_protocolv2.
* proto_media_input_v2 differs from proto_media_input in that it
* will be called for a list of packets instead of once for each
* individual packet. The frame header can be retrieved using
* mbuf_pkthdr_header.
* @param ifp The interface the packet was received on.
* @param protocol The protocol of the packet received.
* @param packet The packet being input.
* @result
* If the result is zero, the caller will assume the packets were
* passed to the protocol.
* If the result is non-zero and not EJUSTRETURN, the caller will
* free the packets.
*/
typedef errno_t (*proto_media_input_v2)(ifnet_t ifp, protocol_family_t protocol,
mbuf_t packet);
/*!
* @typedef proto_media_preout
* @discussion proto_media_preout is called just before the packet
* is transmitted. This gives the proto_media_preout function an
* opportunity to specify the media specific frame type and
* destination.
* @param ifp The interface the packet will be sent on.
* @param protocol The protocol of the packet being sent
* (PF_INET/etc...).
* @param packet The packet being sent.
* @param dest The protocol level destination address.
* @param route A pointer to the routing structure for the packet.
* @param frame_type The media specific frame type.
* @param link_layer_dest The media specific destination.
* @result
* If the result is zero, processing will continue normally. If the
* result is non-zero, processing will stop. If the result is
* non-zero and not EJUSTRETURN, the packet will be freed by the
* caller.
*/
typedef errno_t (*proto_media_preout)(ifnet_t ifp, protocol_family_t protocol,
mbuf_t *packet, const struct sockaddr *dest, void *route, char *frame_type,
char *link_layer_dest);
/*!
* @typedef proto_media_event
* @discussion proto_media_event is called to notify this layer of
* interface specific events.
* @param ifp The interface.
* @param protocol The protocol family.
* @param event The event.
*/
typedef void (*proto_media_event)(ifnet_t ifp, protocol_family_t protocol,
const struct kev_msg *event);
/*!
* @typedef proto_media_ioctl
* @discussion proto_media_event allows this layer to handle ioctls.
* When an ioctl is handled, it is passed to the interface filters,
* protocol filters, protocol, and interface. If you do not support
* this ioctl, return EOPNOTSUPP. If you successfully handle the
* ioctl, return zero. If you return any error other than
* EOPNOTSUPP, other parts of the stack may not get an opportunity
* to process the ioctl. If you return EJUSTRETURN, processing will
* stop and a result of zero will be returned to the caller.
*
* All undefined ioctls are reserved for future use by Apple. If
* you need to communicate with your kext using an ioctl, please
* use SIOCSIFKPI and SIOCGIFKPI.
* @param ifp The interface.
* @param protocol The protocol family.
* @param command The ioctl command.
* @param argument The argument to the ioctl.
* @result
* See the discussion.
*/
typedef errno_t (*proto_media_ioctl)(ifnet_t ifp, protocol_family_t protocol,
unsigned long command, void *argument);
/*!
* @typedef proto_media_detached
* @discussion proto_media_detached notifies you that your protocol
* has been detached.
* @param ifp The interface.
* @param protocol The protocol family.
* @result
* See the discussion.
*/
typedef errno_t (*proto_media_detached)(ifnet_t ifp, protocol_family_t protocol);
/*!
* @typedef proto_media_resolve_multi
* @discussion proto_media_resolve_multi is called to resolve a
* protocol layer mulitcast address to a link layer multicast
* address.
* @param ifp The interface.
* @param proto_addr The protocol address.
* @param out_ll A sockaddr_dl to copy the link layer multicast in to.
* @param ll_len The length of data allocated for out_ll.
* @result Return zero on success or an errno error value on failure.
*/
typedef errno_t (*proto_media_resolve_multi)(ifnet_t ifp,
const struct sockaddr *proto_addr, struct sockaddr_dl *out_ll,
size_t ll_len);
/*!
* @typedef proto_media_send_arp
* @discussion proto_media_send_arp is called by the stack to generate
* an ARP packet. This field is currently only used with IP. This
* function should inspect the parameters and transmit an arp
* packet using the information passed in.
* @param ifp The interface the arp packet should be sent on.
* @param arpop The arp operation (usually ARPOP_REQUEST or
* ARPOP_REPLY).
* @param sender_hw The value to use for the sender hardware
* address field. If this is NULL, use the hardware address
* of the interface.
* @param sender_proto The value to use for the sender protocol
* address field. This will not be NULL.
* @param target_hw The value to use for the target hardware address.
* If this is NULL, the target hardware address in the ARP packet
* should be NULL and the link-layer destination for the back
* should be a broadcast. If this is not NULL, this value should be
* used for both the link-layer destination and the target hardware
* address.
* @param target_proto The target protocol address. This will not be
* NULL.
* @result Return zero on success or an errno error value on failure.
*/
typedef errno_t (*proto_media_send_arp)(ifnet_t ifp, u_short arpop,
const struct sockaddr_dl *sender_hw, const struct sockaddr *sender_proto,
const struct sockaddr_dl *target_hw, const struct sockaddr *target_proto);
/*!
* @struct ifnet_stat_increment_param
* @discussion This structure is used increment the counters on a
* network interface.
* @field packets_in The number of packets received.
* @field bytes_in The number of bytes received.
* @field errors_in The number of receive errors.
* @field packets_out The number of packets transmitted.
* @field bytes_out The number of bytes transmitted.
* @field errors_out The number of transmission errors.
* @field collisions The number of collisions seen by this interface.
* @field dropped The number of packets dropped.
*/
struct ifnet_stat_increment_param {
u_int32_t packets_in;
u_int32_t bytes_in;
u_int32_t errors_in;
u_int32_t packets_out;
u_int32_t bytes_out;
u_int32_t errors_out;
u_int32_t collisions;
u_int32_t dropped;
};
/*!
* @struct ifnet_init_params
* @discussion This structure is used to define various properties of
* the interface when calling ifnet_allocate. A copy of these
* values will be stored in the ifnet and cannot be modified
* while the interface is attached.
* @field uniqueid An identifier unique to this instance of the
* interface.
* @field uniqueid_len The length, in bytes, of the uniqueid.
* @field name The interface name (i.e. en).
* @field unit The interface unit number (en0's unit number is 0).
* @field family The interface family.
* @field type The interface type (see sys/if_types.h). Must be less
* than 256. For new types, use IFT_OTHER.
* @field output The output function for the interface. Every packet the
* stack attempts to send through this interface will go out
* through this function.
* @field demux The function used to determine the protocol family of an
* incoming packet.
* @field add_proto The function used to attach a protocol to this
* interface.
* @field del_proto The function used to remove a protocol from this
* interface.
* @field framer The function used to frame outbound packets, may be NULL.
* @field softc Driver specific storage. This value can be retrieved from
* the ifnet using the ifnet_softc function.
* @field ioctl The function used to handle ioctls.
* @field set_bpf_tap The function used to set the bpf_tap function.
* @field detach The function called to let the driver know the interface
* has been detached.
* @field event The function to notify the interface of various interface
* specific kernel events.
* @field broadcast_addr The link-layer broadcast address for this
* interface.
* @field broadcast_len The length of the link-layer broadcast address.
*/
struct ifnet_init_params {
/* used to match recycled interface */
const void *uniqueid; /* optional */
u_int32_t uniqueid_len; /* optional */
/* used to fill out initial values for interface */
const char *name; /* required */
u_int32_t unit; /* required */
ifnet_family_t family; /* required */
u_int32_t type; /* required */
ifnet_output_func output; /* required */
ifnet_demux_func demux; /* required */
ifnet_add_proto_func add_proto; /* required */
ifnet_del_proto_func del_proto; /* required */
ifnet_check_multi check_multi; /* required for non point-to-point interfaces */
ifnet_framer_func framer; /* optional */
void *softc; /* optional */
ifnet_ioctl_func ioctl; /* optional */
ifnet_set_bpf_tap set_bpf_tap; /* deprecated */
ifnet_detached_func detach; /* optional */
ifnet_event_func event; /* optional */
const void *broadcast_addr; /* required for non point-to-point interfaces */
u_int32_t broadcast_len; /* required for non point-to-point interfaces */
};
/*!
* @struct ifnet_stats_param
* @discussion This structure is used get and set the interface
* statistics.
* @field packets_in The number of packets received.
* @field bytes_in The number of bytes received.
* @field errors_in The number of receive errors.
* @field packets_out The number of packets transmitted.
* @field bytes_out The number of bytes transmitted.
* @field errors_out The number of transmission errors.
* @field collisions The number of collisions seen by this interface.
* @field dropped The number of packets dropped.
*/
struct ifnet_stats_param {
u_int64_t packets_in;
u_int64_t bytes_in;
u_int64_t multicasts_in;
u_int64_t errors_in;
u_int64_t packets_out;
u_int64_t bytes_out;
u_int64_t multicasts_out;
u_int64_t errors_out;
u_int64_t collisions;
u_int64_t dropped;
u_int64_t no_protocol;
};
/*!
* @struct ifnet_demux_desc
* @discussion This structure is to identify packets that belong to a
* specific protocol. The types supported are interface specific.
* Ethernet supports ETHER_DESC_ETYPE2, ETHER_DESC_SAP, and
* ETHER_DESC_SNAP. The type defines the offset in the packet where
* the data will be matched as well as context. For example, if
* ETHER_DESC_SNAP is specified, the only valid datalen is 5 and
* only in the 5 bytes will only be matched when the packet header
* indicates that the packet is a SNAP packet.
* @field type The type of identifier data (i.e. ETHER_DESC_ETYPE2)
* @field data A pointer to an entry of type (i.e. pointer to 0x0800).
* @field datalen The number of bytes of data used to describe the
* packet.
*/
struct ifnet_demux_desc {
u_int32_t type;
void *data;
u_int32_t datalen;
};
/*!
* @struct ifnet_attach_proto_param
* @discussion This structure is used to attach a protocol to an
* interface. This structure provides the various functions for
* handling operations related to the protocol on the interface as
* well as information for how to demux packets for this protocol.
* @field demux_array An array of ifnet_demux_desc structures
* describing the protocol.
* @field demux_count The number of entries in the demux_array array.
* @field input The function to be called for inbound packets.
* @field pre_output The function to be called for outbound packets.
* @field event The function to be called for interface events.
* @field ioctl The function to be called for ioctls.
* @field detached The function to be called for handling the detach.
*/
struct ifnet_attach_proto_param {
struct ifnet_demux_desc *demux_array; /* interface may/may not require */
u_int32_t demux_count; /* interface may/may not require */
proto_media_input input; /* required */
proto_media_preout pre_output; /* required */
proto_media_event event; /* optional */
proto_media_ioctl ioctl; /* optional */
proto_media_detached detached; /* optional */
proto_media_resolve_multi resolve; /* optional */
proto_media_send_arp send_arp; /* optional */
};
struct ifnet_attach_proto_param_v2 {
struct ifnet_demux_desc *demux_array; /* interface may/may not require */
u_int32_t demux_count; /* interface may/may not require */
proto_media_input_v2 input; /* required */
proto_media_preout pre_output; /* required */
proto_media_event event; /* optional */
proto_media_ioctl ioctl; /* optional */
proto_media_detached detached; /* optional */
proto_media_resolve_multi resolve; /* optional */
proto_media_send_arp send_arp; /* optional */
};
__BEGIN_DECLS
/*
* Ifnet creation and reference counting
*/
/*!
* @function ifnet_allocate
* @discussion Allocate an ifnet_t with an initial refcount of 1. Many
* parts of the stack do not properly refcount the ifnet_t. In
* order to avoid freeing the ifnet_t while some parts of the stack
* may contain a reference to it, the ifnet_ts are only recycled,
* never freed. A unique id is used to try and recycle the same
* ifnet_t when allocating an interface. For example, for an
* ethernet interface, the hardware address of the ethernet card is
* usually used for the uniqueid. If a PC Card is removed and
* inserted again, if the ethernet address of the PC card is used,
* the same ifnet_t will be used for the card the second time it is
* inserted. In the future, when the ifnet_t is correctly
* refcounted by all of the stack, the interfaces may be freed and
* the unique ids ignored.
* @param init The initial values for the interface. These values can
* not be changed after the interface has been allocated.
* @param interface The interface allocated upon success.
* @result May return ENOMEM if there is insufficient memory or EEXIST
* if an interface with the same uniqueid and family has already
* been allocated and is in use.
*/
extern errno_t ifnet_allocate(const struct ifnet_init_params *init,
ifnet_t *interface)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_reference
* @discussion Increment the reference count of the ifnet to assure
* that it will not go away. The interface must already have at
* least one reference.
* @param interface The interface to increment the reference count of.
* @result May return EINVAL if the interface is not valid.
*/
extern errno_t ifnet_reference(ifnet_t interface)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_release
* @discussion Release a reference of the ifnet, this may trigger a
* free if the reference count reaches 0.
* @param interface The interface to decrement the reference count of
* and possibly free.
* @result May return EINVAL if the interface is not valid.
*/
extern errno_t ifnet_release(ifnet_t interface)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_attach
* @discussion Attaches an interface to the global interface list. The
* interface must be setup properly before calling attach. The
* stack will take a reference on the interface and hold it until
* ifnet_detach is called.
*
* This function is intended to be called by the driver. A kext
* must not call this function on an interface the kext does not
* own.
* @param interface The interface to attach.
* @param ll_addr The link layer address of the interface. This is used
* to fill out the first ifaddr in the list of addresses for the
* interface. This parameter is not required for interfaces such as
* PPP that have no link-layer address.
* @result Will return an error if there is anything wrong with the
* interface.
*/
extern errno_t ifnet_attach(ifnet_t interface,
const struct sockaddr_dl *ll_addr)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_detach
* @discussion Detaches the interface.
*
* Call this to indicate this interface is no longer valid (i.e. PC
* Card was removed). This function will begin the process of
* removing knowledge of this interface from the stack.
*
* The function will return before the interface is detached. The
* functions you supplied in to the interface may continue to be
* called. When the detach has been completed, your detached
* function will be called. Your kext must not unload until the
* detached function has been called. The interface will be
* properly freed when the reference count reaches zero.
*
* An interface may not be attached again. You must call
* ifnet_allocate to create a new interface to attach.
*
* This function is intended to be called by the driver. A kext
* must not call this function on an interface the kext does not
* own.
* @param interface The interface to detach.
* @result 0 on success, otherwise errno error.
*/
extern errno_t ifnet_detach(ifnet_t interface)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_interface_family_find
* @discussion Look up the interface family identifier for a string.
* If there is no interface family identifier assigned for this string
* a new interface family identifier is created and assigned.
* It is recommended to use the bundle id of the KEXT as the string
* to avoid collisions with other KEXTs.
* The lookup operation is not optimized so a module should call this
* function once during startup and cache the interface family identifier.
* The interface family identifier for a string will not be re-assigned until
* the system reboots.
* @param module_string A unique string identifying your interface family
* @param family_id Upon return, a unique interface family identifier for use with
* ifnet_* functions. This identifier is valid until the system
* is rebooted.
* @result 0 on success, otherwise errno error.
*/
extern errno_t ifnet_interface_family_find(const char *module_string, ifnet_family_t *family_id)
__NKE_API_DEPRECATED;
/*
* Interface manipulation.
*/
/*!
* @function ifnet_softc
* @discussion Returns the driver's private storage on the interface.
* @param interface Interface to retrieve the storage from.
* @result Driver's private storage.
*/
extern void *ifnet_softc(ifnet_t interface)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_name
* @discussion Returns a pointer to the name of the interface.
* @param interface Interface to retrieve the name from.
* @result Pointer to the name.
*/
extern const char *ifnet_name(ifnet_t interface)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_family
* @discussion Returns the family of the interface.
* @param interface Interface to retrieve the family from.
* @result Interface family type.
*/
extern ifnet_family_t ifnet_family(ifnet_t interface)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_unit
* @discussion Returns the unit number of the interface.
* @param interface Interface to retrieve the unit number from.
* @result Unit number.
*/
extern u_int32_t ifnet_unit(ifnet_t interface)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_index
* @discussion Returns the index of the interface. This index value
* will match the index you would find in a sockaddr_dl or using
* if_nametoindex or if_indextoname in user space. The value of the
* interface index is undefined for an interface that is not
* currently attached.
* @param interface Interface to retrieve the index of.
* @result Index.
*/
extern u_int32_t ifnet_index(ifnet_t interface)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_set_flags
* @discussion Sets the interface flags to match new_flags.
* @discussion Sets the interface flags to new_flags. This function
* lets you specify which flags you want to change using the mask.
* The kernel will effectively take the lock, then set the
* interface's flags to (if_flags & ~mask) | (new_flags & mask).
* @param interface Interface to set the flags on.
* @param new_flags The new set of flags that should be set. These
* flags are defined in net/if.h
* @result 0 on success otherwise the errno error.
*/
extern errno_t ifnet_set_flags(ifnet_t interface, u_int16_t new_flags,
u_int16_t mask)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_flags
* @discussion Returns the interface flags that are set.
* @param interface Interface to retrieve the flags from.
* @result Flags. These flags are defined in net/if.h
*/
extern u_int16_t ifnet_flags(ifnet_t interface)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_set_capabilities_supported
* @discussion Specify the capabilities supported by the interface.
* @discussion This function lets you specify which capabilities are supported
* by the interface. Typically this function is called by the driver when
* the interface gets attached to the system.
* The mask allows to control which capability to set or unset.
* The kernel will effectively take the lock, then set the
* interface's flags to (if_capabilities & ~mask) | (new_caps & mask).
*
* This function is intended to be called by the driver. A kext
* must not call this function on an interface the kext does not
* own.
* @param interface Interface to set the capabilities on.
* @param new_caps The value of the capabilities that should be set or unset. These
* flags are defined in net/if.h
* @param mask Which capabilities that should be affected. These
* flags are defined in net/if.h
* @result 0 on success otherwise the errno error.
*/
extern errno_t ifnet_set_capabilities_supported(ifnet_t interface, u_int32_t new_caps,
u_int32_t mask)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_capabilities_supported
* @discussion Retrieve the interface capabilities supported by the interface.
* @param interface Interface to retrieve the capabilities from.
* @result Flags. Capabilities flags are defined in net/if.h
*/
extern u_int32_t ifnet_capabilities_supported(ifnet_t interface)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_set_capabilities_enabled
* @discussion Enable and/or disable the interface capabilities to match new_caps.
* @discussion Sets the interface capabilities to new_caps. This function
* lets you specify which capabilities you want to change using the mask.
* The kernel will effectively take the lock, then set the
* interface's flags to (if_capenable & ~mask) | (new_caps & mask).
*
* This function is intended to be called by the driver. A kext
* must not call this function on an interface the kext does not
* own.
*
* Typically this function is called by the driver when the interface is
* created to specify which of the supported capabilities are enabled by
* default. This function is also meant to be called when the driver handles
* the interface ioctl SIOCSIFCAP.
*
* The driver should call ifnet_set_offlad() to indicate the corresponding
* hardware offload bits that will be used by the networking stack.
*
* It is an error to enable a capability that is not marked as
* supported by the interface.
* @param interface Interface to set the capabilities on.
* @param new_caps The value of the capabilities that should be set or unset. These
* flags are defined in net/if.h
* @param mask Which capabilities that should be affected. These
* flags are defined in net/if.h
* @result 0 on success otherwise the errno error.
*/
extern errno_t ifnet_set_capabilities_enabled(ifnet_t interface, u_int32_t new_caps,
u_int32_t mask)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_capabilities_enabled
* @discussion Retrieve the interface capabilities enabled on the interface.
* @param interface Interface to retrieve the capabilities from.
* @result Flags. Capabilities flags are defined in net/if.h
*/
extern u_int32_t ifnet_capabilities_enabled(ifnet_t interface)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_set_offload
* @discussion Sets a bitfield to indicate special hardware offload
* support provided by the interface such as hardware checksums and
* VLAN. This replaces the if_hwassist flags field. Any flags
* unrecognized by the stack will not be set.
*
* Note the system will automatically set the interface capabilities
* that correspond to the offload flags modified -- i.e. the driver
* does not have to call ifnet_set_capabilities_enabled() and
* ifnet_set_capabilities_supported().
* @param interface The interface.
* @param offload The new set of flags indicating which offload options
* the device supports.
* @result 0 on success otherwise the errno error.
*/
extern errno_t ifnet_set_offload(ifnet_t interface, ifnet_offload_t offload)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_offload
* @discussion Returns flags indicating which operations can be
* offloaded to the interface.
* @param interface Interface to retrieve the offload from.
* @result Abilities flags, see ifnet_offload_t.
*/
extern ifnet_offload_t ifnet_offload(ifnet_t interface)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_set_tso_mtu
* @discussion Sets maximum TCP Segmentation Offload segment size for
* the interface
* @param interface The interface.
* @param family The family for which the offload MTU is provided for
* (AF_INET or AF_INET6)
* @param mtuLen Maximum segment size supported by the interface
* @result 0 on success otherwise the errno error.
*/
extern errno_t ifnet_set_tso_mtu(ifnet_t interface, sa_family_t family,
u_int32_t mtuLen)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_get_tso_mtu
* @discussion Returns maximum TCP Segmentation Offload segment size for
* the interface
* @param interface The interface.
* @param family The family for which the offload MTU is provided for
* (AF_INET or AF_INET6)
* @param mtuLen Value of the maximum MTU supported for the interface
* and family provided.
* @result 0 on success otherwise the errno error.
*/
extern errno_t ifnet_get_tso_mtu(ifnet_t interface, sa_family_t family,
u_int32_t *mtuLen)
__NKE_API_DEPRECATED;
/*!
* @enum Interface wake properties
* @abstract Constants defining Interface wake properties.
* @constant IFNET_WAKE_ON_MAGIC_PACKET Wake on Magic Packet.
*/
enum {
IFNET_WAKE_ON_MAGIC_PACKET = 0x01
};
/*!
* @function ifnet_set_wake_flags
* @discussion Sets the wake properties of the underlying hardware. These are
* typically set by the driver.
* @param interface The interface.
* @param properties Properties to set or unset.
* @param mask Mask of the properties to set of unset.
* @result 0 on success otherwise the errno error.
*/
extern errno_t ifnet_set_wake_flags(ifnet_t interface, u_int32_t properties, u_int32_t mask)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_get_wake_flags
* @discussion Returns the wake properties set on the interface.
* @param interface The interface.
* @result The wake properties
*/
extern u_int32_t ifnet_get_wake_flags(ifnet_t interface)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_set_link_mib_data
* @discussion Sets the mib link data. The ifnet_t will store the
* pointer you supply and copy mibLen bytes from the pointer
* whenever the sysctl for getting interface specific MIB data is
* used. Since the ifnet_t stores a pointer to your data instead of
* a copy, you may update the data at the address at any time.
*
* This function is intended to be called by the driver. A kext
* must not call this function on an interface the kext does not
* own.
* @param interface Interface to set the unit number of.
* @param mibData A pointer to the data.
* @param mibLen Length of data pointed to.
* @result 0 on success otherwise the errno error.
*/
extern errno_t ifnet_set_link_mib_data(ifnet_t interface, void *mibData,
u_int32_t mibLen)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_get_link_mib_data
* @discussion Copies the link MIB data in to mibData, up to mibLen
* bytes. Returns error if the buffer is too small to hold all of
* the MIB data.
* @param interface The interface.
* @param mibData A pointer to space for the mibData to be copied in
* to.
* @param mibLen When calling, this should be the size of the buffer
* passed in mibData. Upon return, this will be the size of data
* copied in to mibData.
* @result Returns an error if the buffer size is too small or there is
* no data.
*/
extern errno_t ifnet_get_link_mib_data(ifnet_t interface, void *mibData,
u_int32_t *mibLen)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_get_link_mib_data_length
* @discussion Retrieve the size of the mib data.
* @param interface The interface.
* @result Returns the number of bytes of mib data associated with the
* interface.
*/
extern u_int32_t ifnet_get_link_mib_data_length(ifnet_t interface)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_attach_protocol
* @discussion Attaches a protocol to an interface.
* @param interface The interface.
* @param protocol_family The protocol family being attached
* (PF_INET/PF_INET6/etc...).
* @param proto_details Details of the protocol being attached.
* @result 0 on success otherwise the errno error.
*/
extern errno_t ifnet_attach_protocol(ifnet_t interface,
protocol_family_t protocol_family,
const struct ifnet_attach_proto_param *proto_details)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_attach_protocol_v2
* @discussion Attaches a protocol to an interface using the newer
* version 2 style interface. So far the only difference is support
* for packet chains which improve performance.
* @param interface The interface.
* @param protocol_family The protocol family being attached
* (PF_INET/PF_INET6/etc...).
* @param proto_details Details of the protocol being attached.
* @result 0 on success otherwise the errno error.
*/
extern errno_t ifnet_attach_protocol_v2(ifnet_t interface,
protocol_family_t protocol_family,
const struct ifnet_attach_proto_param_v2 *proto_details)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_detach_protocol
* @discussion Detaches a protocol from an interface.
* @param interface The interface.
* @param protocol_family The protocol family of the protocol to
* detach.
* @result 0 on success otherwise the errno error.
*/
extern errno_t ifnet_detach_protocol(ifnet_t interface,
protocol_family_t protocol_family)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_output
* @discussion Handles an outbound packet on the interface by calling
* any filters, a protocol preoutput function, the interface framer
* function, and finally the interface's output function. The
* protocol_family will be used to apply protocol filters and
* determine which preoutput function to call. The route and dest
* parameters will be passed to the preoutput function defined for
* the attachment of the specified protocol to the specified
* interface. ifnet_output will always free the mbuf chain.
* @param interface The interface.
* @param protocol_family The family of the protocol generating this
* packet (i.e. AF_INET).
* @param packet The packet to be transmitted.
* @param route A pointer to a routing structure for this packet. The
* preoutput function determines whether this value may be NULL or
* not.
* @param dest The destination address of protocol_family type. This
* will be passed to the preoutput function. If the preoutput
* function does not require this value, you may pass NULL.
* @result 0 on success otherwise the errno error.
*/
extern errno_t ifnet_output(ifnet_t interface,
protocol_family_t protocol_family, mbuf_t packet, void *route,
const struct sockaddr *dest)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_output_raw
* @discussion Handles and outbond raw packet on the interface by
* calling any filters followed by the interface's output function.
* protocol_family may be zero. If the packet is from a specific
* protocol the protocol_family will be used to apply protocol
* filters. All interface filters will be applied to the outgoing
* packet. Processing, such as calling the protocol preoutput and
* interface framer functions will be bypassed. The packet will
* pass through the filters and be sent on the interface as is.
* ifnet_output_raw will always free the packet chain.
* @param interface The interface.
* @param protocol_family The family of the protocol generating this
* packet (i.e. AF_INET).
* @param packet The fully formed packet to be transmitted.
* @result 0 on success otherwise the errno error.
*/
extern errno_t ifnet_output_raw(ifnet_t interface,
protocol_family_t protocol_family, mbuf_t packet)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_input
* @discussion Inputs packets from the interface. The interface's demux
* will be called to determine the protocol. Once the protocol is
* determined, the interface filters and protocol filters will be
* called. From there, the packet will be passed to the registered
* protocol. If there is an error, the mbuf chain will be freed.
* @param interface The interface.
* @param first_packet The first packet in a chain of packets.
* @param stats Counts to be integrated in to the stats. The interface
* statistics will be incremented by the amounts specified in
* stats. This parameter may be NULL.
* @result 0 on success otherwise the errno error.
*/
extern errno_t ifnet_input(ifnet_t interface, mbuf_t first_packet,
const struct ifnet_stat_increment_param *stats)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_ioctl
* @discussion Calls the interface's ioctl function with the parameters
* passed.
*
* All undefined ioctls are reserved for future use by Apple. If
* you need to communicate with your kext using an ioctl, please
* use SIOCSIFKPI and SIOCGIFKPI.
* @param interface The interface.
* @param protocol The protocol family of the protocol to send the
* ioctl to (may be zero). Some ioctls apply to a protocol while
* other ioctls apply to just an interface.
* @param ioctl_code The ioctl to perform.
* @param ioctl_arg Any parameters to the ioctl.
* @result 0 on success otherwise the errno error.
*/
extern errno_t ifnet_ioctl(ifnet_t interface, protocol_family_t protocol,
unsigned long ioctl_code, void *ioctl_arg)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_event
* @discussion Calls the interface's event function.
* @param interface The interface.
* @param event_ptr Pointer to an kern_event structure describing the
* event.
* @result 0 on success otherwise the errno error.
*/
extern errno_t ifnet_event(ifnet_t interface, struct kern_event_msg *event_ptr)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_set_mtu
* @discussion Sets the value of the MTU in the interface structure.
* Calling this function will not notify the driver that the MTU
* should be changed. Use the appropriate ioctl.
*
* This function is intended to be called by the driver. A kext
* must not call this function on an interface the kext does not
* own.
* @param interface The interface.
* @param mtu The new MTU.
* @result 0 on success otherwise the errno error.
*/
extern errno_t ifnet_set_mtu(ifnet_t interface, u_int32_t mtu)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_mtu
* @param interface The interface.
* @result The MTU.
*/
extern u_int32_t ifnet_mtu(ifnet_t interface)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_type
* @param interface The interface.
* @result The type. See net/if_types.h.
*/
extern u_int8_t ifnet_type(ifnet_t interface)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_set_addrlen
* @discussion
* This function is intended to be called by the driver. A kext
* must not call this function on an interface the kext does not
* own.
* @param interface The interface.
* @param addrlen The new address length.
* @result 0 on success otherwise the errno error.
*/
extern errno_t ifnet_set_addrlen(ifnet_t interface, u_int8_t addrlen)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_addrlen
* @param interface The interface.
* @result The address length.
*/
extern u_int8_t ifnet_addrlen(ifnet_t interface)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_set_hdrlen
* @discussion
* This function is intended to be called by the driver. A kext
* must not call this function on an interface the kext does not
* own.
* @param interface The interface.
* @param hdrlen The new header length.
* @result 0 on success otherwise the errno error.
*/
extern errno_t ifnet_set_hdrlen(ifnet_t interface, u_int8_t hdrlen)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_hdrlen
* @param interface The interface.
* @result The header length.
*/
extern u_int8_t ifnet_hdrlen(ifnet_t interface)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_set_metric
* @discussion
* This function is intended to be called by the driver. A kext
* must not call this function on an interface the kext does not
* own.
* @param interface The interface.
* @param metric The new metric.
* @result 0 on success otherwise the errno error.
*/
extern errno_t ifnet_set_metric(ifnet_t interface, u_int32_t metric)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_metric
* @param interface The interface.
* @result The metric.
*/
extern u_int32_t ifnet_metric(ifnet_t interface)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_set_baudrate
* @discussion
* This function is intended to be called by the driver. A kext
* must not call this function on an interface the kext does not
* own.
* @param interface The interface.
* @param baudrate The new baudrate.
* @result 0 on success otherwise the errno error.
*/
extern errno_t ifnet_set_baudrate(ifnet_t interface, u_int64_t baudrate)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_baudrate
* @param interface The interface.
* @result The baudrate.
*/
extern u_int64_t ifnet_baudrate(ifnet_t interface)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_stat_increment
* @discussion
* This function is intended to be called by the driver. A kext
* must not call this function on an interface the kext does not
* own.
* @param interface The interface.
* @param counts A pointer to a structure containing the amount to
* increment each counter by. Any counts not appearing in the
* ifnet_counter_increment structure are handled in the stack.
* @result 0 on success otherwise the errno error.
*/
extern errno_t ifnet_stat_increment(ifnet_t interface,
const struct ifnet_stat_increment_param *counts)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_stat_increment_in
* @discussion
* This function is intended to be called by the driver. This
* function allows a driver to update the inbound interface counts.
* The most efficient time to update these counts is when calling
* ifnet_input.
*
* A lock protects the counts, this makes the increment functions
* expensive. The increment function will update the lastchanged
* value.
* @param interface The interface.
* @param packets_in The number of additional packets received.
* @param bytes_in The number of additional bytes received.
* @param errors_in The number of additional receive errors.
* @result 0 on success otherwise the errno error.
*/
extern errno_t ifnet_stat_increment_in(ifnet_t interface,
u_int32_t packets_in, u_int32_t bytes_in, u_int32_t errors_in)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_stat_increment_out
* @discussion
* This function is intended to be called by the driver. This
* function allows a driver to update the outbound interface
* counts.
*
* A lock protects the counts, this makes the increment functions
* expensive. The increment function will update the lastchanged
* value.
* @param interface The interface.
* @param packets_out The number of additional packets sent.
* @param bytes_out The number of additional bytes sent.
* @param errors_out The number of additional send errors.
* @result 0 on success otherwise the errno error.
*/
extern errno_t ifnet_stat_increment_out(ifnet_t interface,
u_int32_t packets_out, u_int32_t bytes_out, u_int32_t errors_out)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_set_stat
* @discussion
* This function is intended to be called by the driver. A kext
* must not call this function on an interface the kext does not
* own.
*
* The one exception would be the case where a kext wants to zero
* all of the counters.
* @param interface The interface.
* @param stats The new stats values.
* @result 0 on success otherwise the errno error.
*/
extern errno_t ifnet_set_stat(ifnet_t interface,
const struct ifnet_stats_param *stats)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_stat
* @param interface The interface.
* @param out_stats Storage for the values.
* @result 0 on success otherwise the errno error.
*/
extern errno_t ifnet_stat(ifnet_t interface,
struct ifnet_stats_param *out_stats)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_set_promiscuous
* @discussion Enable or disable promiscuous mode on the interface. The
* interface keeps an internal count of the number of times
* promiscuous mode has been enabled. Promiscuous mode is only
* disabled when this count reaches zero. Be sure to disable
* promiscuous mode only once for every time you enable it.
* @param interface The interface to toggle promiscuous mode on.
* @param on If set, the number of promicuous on requests will be
* incremented. If this is the first request, promiscuous mode
* will be enabled. If this is not set, the number of promiscous
* clients will be decremented. If this causes the number to reach
* zero, promiscuous mode will be disabled.
* @result 0 on success otherwise the errno error.
*/
extern errno_t ifnet_set_promiscuous(ifnet_t interface, int on)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_touch_lastchange
* @discussion Updates the lastchange value to now.
* @param interface The interface.
* @result 0 on success otherwise the errno error.
*/
extern errno_t ifnet_touch_lastchange(ifnet_t interface)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_lastchange
* @param interface The interface.
* @param last_change A timeval struct to copy the last time changed in
* to.
*/
extern errno_t ifnet_lastchange(ifnet_t interface, struct timeval *last_change)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_get_address_list
* @discussion Get a list of addresses on the interface. Passing NULL
* for the interface will return a list of all addresses. The
* addresses will have their reference count bumped so they will
* not go away. Calling ifnet_free_address_list will decrement the
* refcount and free the array. If you wish to hold on to a
* reference to an ifaddr_t, be sure to bump the reference count
* before calling ifnet_free_address_list.
* @param interface The interface.
* @param addresses A pointer to a NULL terminated array of ifaddr_ts.
* @result 0 on success otherwise the errno error.
*/
extern errno_t ifnet_get_address_list(ifnet_t interface, ifaddr_t **addresses)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_get_address_list_family
* @discussion Get a list of addresses on the interface. Passing NULL
* for the interface will return a list of all addresses. The
* addresses will have their reference count bumped so they will
* not go away. Calling ifnet_free_address_list will decrement the
* refcount and free the array. If you wish to hold on to a
* reference to an ifaddr_t, be sure to bump the reference count
* before calling ifnet_free_address_list. Unlike
* ifnet_get_address_list, this function lets the caller specify
* the address family to get a list of only a specific address type.
* @param interface The interface.
* @param addresses A pointer to a NULL terminated array of ifaddr_ts.
* @result 0 on success otherwise the errno error.
*/
extern errno_t ifnet_get_address_list_family(ifnet_t interface,
ifaddr_t **addresses, sa_family_t family)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_free_address_list
* @discussion Free a list of addresses returned from
* ifnet_get_address_list. Decrements the refcounts and frees the
* memory used for the array of references.
* @param addresses An array of ifaddr_ts.
*/
extern void ifnet_free_address_list(ifaddr_t *addresses)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_set_lladdr
* @discussion Sets the link-layer address for this interface.
* @param interface The interface the link layer address is being
* changed on.
* @param lladdr A pointer to the raw link layer address (pointer to
* the 6 byte ethernet address for ethernet).
* @param lladdr_len The length, in bytes, of the link layer address.
*/
extern errno_t ifnet_set_lladdr(ifnet_t interface, const void *lladdr,
size_t lladdr_len)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_lladdr_copy_bytes
* @discussion Copies the bytes of the link-layer address into the
* specified buffer.
* @param interface The interface to copy the link-layer address from.
* @param lladdr The buffer to copy the link-layer address in to.
* @param length The length of the buffer. This value must match the
* length of the link-layer address.
*/
extern errno_t ifnet_lladdr_copy_bytes(ifnet_t interface, void *lladdr,
size_t length)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_llbroadcast_copy_bytes
* @discussion Retrieves the link-layer broadcast address for this
* interface.
* @param interface The interface.
* @param addr A buffer to copy the broadcast address in to.
* @param bufferlen The length of the buffer at addr.
* @param out_len On return, the length of the broadcast address.
*/
extern errno_t ifnet_llbroadcast_copy_bytes(ifnet_t interface, void *addr,
size_t bufferlen, size_t *out_len)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_resolve_multicast
* @discussion Resolves a multicast address for an attached protocol to
* a link-layer address. If a link-layer address is passed in, the
* interface will verify that it is a valid multicast address.
* @param ifp The interface.
* @param proto_addr A protocol address to be converted to a link-layer
* address.
* @param ll_addr Storage for the resulting link-layer address.
* @param ll_len Length of the storage for the link-layer address.
* @result 0 on success. EOPNOTSUPP indicates the multicast address was
* not supported or could not be translated. Other errors may
* indicate other failures.
*/
extern errno_t ifnet_resolve_multicast(ifnet_t ifp,
const struct sockaddr *proto_addr, struct sockaddr *ll_addr, size_t ll_len)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_add_multicast
* @discussion Joins a multicast and returns an ifmultiaddr_t with the
* reference count incremented for you. You are responsible for
* decrementing the reference count after calling
* ifnet_remove_multicast and making sure you no longer have any
* references to the multicast.
* @param interface The interface.
* @param maddr The multicast address (AF_UNSPEC/AF_LINK) to join. Either
* a physical address or logical address to be translated to a
* physical address.
* @param multicast The resulting ifmultiaddr_t multicast address.
* @result 0 on success otherwise the errno error.
*/
extern errno_t ifnet_add_multicast(ifnet_t interface,
const struct sockaddr *maddr, ifmultiaddr_t *multicast)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_remove_multicast
* @discussion Causes the interface to leave the multicast group. The
* stack keeps track of how many times ifnet_add_multicast has been
* called for a given multicast address. The multicast will only be
* removed when the number of times ifnet_remove_multicast has been
* called matches the number of times ifnet_add_multicast has been
* called.
*
* The memory for the multicast address is not actually freed until
* the separate reference count has reached zero. Some parts of the
* stack may keep a pointer to the multicast even after that
* multicast has been removed from the interface.
*
* When an interface is detached, all of the multicasts are
* removed. If the interface of the multicast passed in is no
* longer attached, this function will gracefully return,
* performing no work.
*
* It is the callers responsibility to release the multicast
* address after calling this function.
* @param multicast The multicast to be removed.
* @result 0 on success otherwise the errno error.
*/
extern errno_t ifnet_remove_multicast(ifmultiaddr_t multicast)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_get_multicast_list
* @discussion Retrieves a list of multicast address the interface is
* set to receive. This function allocates and returns an array of
* references to the various multicast addresses. The multicasts
* have their reference counts bumped on your behalf. Calling
* ifnet_free_multicast_list will decrement the reference counts
* and free the array.
* @param interface The interface.
* @param addresses A pointer to a NULL terminated array of references
* to the multicast addresses.
* @result 0 on success otherwise the errno error.
*/
extern errno_t ifnet_get_multicast_list(ifnet_t interface,
ifmultiaddr_t **addresses)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_free_multicast_list
* @discussion Frees a list of multicasts returned by
* ifnet_get_multicast_list. Decrements the refcount on each
* multicast address and frees the array.
* @param multicasts An array of references to the multicast addresses.
*/
extern void ifnet_free_multicast_list(ifmultiaddr_t *multicasts)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_find_by_name
* @discussion Find an interface by the name including the unit number.
* Caller must call ifnet_release on any non-null interface return
* value.
* @param ifname The name of the interface, including any unit number
* (i.e. "en0").
* @param interface A pointer to an interface reference. This will be
* filled in if a matching interface is found.
* @result 0 on success otherwise the errno error.
*/
extern errno_t ifnet_find_by_name(const char *ifname, ifnet_t *interface)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_list_get
* @discussion Get a list of attached interfaces. List will be set to
* point to an array allocated by ifnet_list_get. The interfaces
* are refcounted and the counts will be incremented before the
* function returns. The list of interfaces must be freed using
* ifnet_list_free.
* @param family The interface family (i.e. IFNET_FAMILY_ETHERNET). To
* find interfaces of all families, use IFNET_FAMILY_ANY.
* @param interfaces A pointer to an array of interface references.
* @param count A pointer that will be filled in with the number of
* matching interfaces in the array.
* @result 0 on success otherwise the errno error.
*/
extern errno_t ifnet_list_get(ifnet_family_t family, ifnet_t **interfaces,
u_int32_t *count)
__NKE_API_DEPRECATED;
/*!
* @function ifnet_list_free
* @discussion Free a list of interfaces returned by ifnet_list_get.
* Decrements the reference count on each interface and frees the
* array of references. If you keep a reference to an interface, be
* sure to increment the reference count before calling
* ifnet_list_free.
* @param interfaces An array of interface references from ifnet_list_get.
*/
extern void ifnet_list_free(ifnet_t *interfaces)
__NKE_API_DEPRECATED;
/******************************************************************************/
/* ifaddr_t accessors */
/******************************************************************************/
/*!
* @function ifaddr_reference
* @discussion Increment the reference count of an address tied to an
* interface.
* @param ifaddr The interface address.
* @result 0 upon success
*/
extern errno_t ifaddr_reference(ifaddr_t ifaddr)
__NKE_API_DEPRECATED;
/*!
* @function ifaddr_release
* @discussion Decrements the reference count of and possibly frees an
* address tied to an interface.
* @param ifaddr The interface address.
* @result 0 upon success
*/
extern errno_t ifaddr_release(ifaddr_t ifaddr)
__NKE_API_DEPRECATED;
/*!
* @function ifaddr_address
* @discussion Copies the address out of the ifaddr.
* @param ifaddr The interface address.
* @param out_addr The sockaddr storage for the address.
* @param addr_size The size of the storage for the address.
* @result 0 upon success
*/
extern errno_t ifaddr_address(ifaddr_t ifaddr, struct sockaddr *out_addr,
u_int32_t addr_size)
__NKE_API_DEPRECATED;
/*!
* @function ifaddr_address
* @discussion Returns the address family of the address.
* @param ifaddr The interface address.
* @result 0 on failure, address family on success.
*/
extern sa_family_t ifaddr_address_family(ifaddr_t ifaddr)
__NKE_API_DEPRECATED;
/*!
* @function ifaddr_dstaddress
* @discussion Copies the destination address out of the ifaddr.
* @param ifaddr The interface address.
* @param out_dstaddr The sockaddr storage for the destination address.
* @param dstaddr_size The size of the storage for the destination address.
* @result 0 upon success
*/
extern errno_t ifaddr_dstaddress(ifaddr_t ifaddr, struct sockaddr *out_dstaddr,
u_int32_t dstaddr_size)
__NKE_API_DEPRECATED;
/*!
* @function ifaddr_netmask
* @discussion Copies the netmask out of the ifaddr.
* @param ifaddr The interface address.
* @param out_netmask The sockaddr storage for the netmask.
* @param netmask_size The size of the storage for the netmask.
* @result 0 upon success
*/
extern errno_t ifaddr_netmask(ifaddr_t ifaddr, struct sockaddr *out_netmask,
u_int32_t netmask_size)
__NKE_API_DEPRECATED;
/*!
* @function ifaddr_ifnet
* @discussion Returns the interface the address is attached to. The
* reference is only valid until the ifaddr is released. If you
* need to hold a reference to the ifnet for longer than you hold a
* reference to the ifaddr, increment the reference using
* ifnet_reference.
* @param ifaddr The interface address.
* @result A reference to the interface the address is attached to.
*/
extern ifnet_t ifaddr_ifnet(ifaddr_t ifaddr)
__NKE_API_DEPRECATED;
/*!
* @function ifaddr_withaddr
* @discussion Returns an interface address with the address specified.
* Increments the reference count on the ifaddr before returning to
* the caller. Caller is responsible for calling ifaddr_release.
* @param address The address to search for.
* @result A reference to the interface address.
*/
extern ifaddr_t ifaddr_withaddr(const struct sockaddr *address)
__NKE_API_DEPRECATED;
/*!
* @function ifaddr_withdstaddr
* @discussion Returns an interface address for the interface address
* that matches the destination when the netmask is applied.
* Increments the reference count on the ifaddr before returning to
* the caller. Caller is responsible for calling ifaddr_release.
* @param destination The destination to search for.
* @result A reference to the interface address.
*/
extern ifaddr_t ifaddr_withdstaddr(const struct sockaddr *destination)
__NKE_API_DEPRECATED;
/*!
* @function ifaddr_withnet
* @discussion Returns an interface address for the interface with the
* network described by net. Increments the reference count on the
* ifaddr before returning to the caller. Caller is responsible for
* calling ifaddr_release.
* @param net The network to search for.
* @result A reference to the interface address.
*/
extern ifaddr_t ifaddr_withnet(const struct sockaddr *net)
__NKE_API_DEPRECATED;
/*!
* @function ifaddr_withroute
* @discussion Returns an interface address given a destination and
* gateway. Increments the reference count on the ifaddr before
* returning to the caller. Caller is responsible for calling
* ifaddr_release.
* @param flags Routing flags. See net/route.h, RTF_GATEWAY etc.
* @param destination The destination to search for.
* @param gateway A gateway to search for.
* @result A reference to the interface address.
*/
extern ifaddr_t ifaddr_withroute(int flags, const struct sockaddr *destination,
const struct sockaddr *gateway)
__NKE_API_DEPRECATED;
/*!
* @function ifaddr_findbestforaddr
* @discussion Finds the best local address assigned to a specific
* interface to use when communicating with another address.
* Increments the reference count on the ifaddr before returning to
* the caller. Caller is responsible for calling ifaddr_release.
* @param addr The remote address.
* @param interface The local interface.
* @result A reference to the interface address.
*/
extern ifaddr_t ifaddr_findbestforaddr(const struct sockaddr *addr,
ifnet_t interface)
__NKE_API_DEPRECATED;
/******************************************************************************/
/* ifmultiaddr_t accessors */
/******************************************************************************/
/*!
* @function ifmaddr_reference
* @discussion Increment the reference count of an interface multicast
* address.
* @param ifmaddr The interface multicast address.
* @result 0 on success. Only error will be EINVAL if ifmaddr is not valid.
*/
extern errno_t ifmaddr_reference(ifmultiaddr_t ifmaddr)
__NKE_API_DEPRECATED;
/*!
* @function ifmaddr_release
* @discussion Decrement the reference count of an interface multicast
* address. If the reference count reaches zero, the ifmultiaddr
* will be removed from the interface and the ifmultiaddr will be
* freed.
* @param ifmaddr The interface multicast address.
* @result 0 on success. Only error will be EINVAL if ifmaddr is not valid.
*/
extern errno_t ifmaddr_release(ifmultiaddr_t ifmaddr)
__NKE_API_DEPRECATED;
/*!
* @function ifmaddr_address
* @discussion Copies the multicast address to out_multicast.
* @param out_multicast Storage for a sockaddr.
* @param addr_size Size of the storage.
* @result 0 on success.
*/
extern errno_t ifmaddr_address(ifmultiaddr_t ifmaddr,
struct sockaddr *out_multicast, u_int32_t addr_size)
__NKE_API_DEPRECATED;
/*!
* @function ifmaddr_lladdress
* @discussion Copies the link layer multicast address to
* out_link_layer_multicast.
* @param out_link_layer_multicast Storage for a sockaddr.
* @param addr_size Size of the storage.
* @result 0 on success.
*/
extern errno_t ifmaddr_lladdress(ifmultiaddr_t ifmaddr,
struct sockaddr *out_link_layer_multicast, u_int32_t addr_size)
__NKE_API_DEPRECATED;
/*!
* @function ifmaddr_ifnet
* @discussion Returns the interface this multicast address is attached
* to. The interface reference count is not bumped by this
* function. The interface is only valid as long as you don't
* release the refernece to the multiast address. If you need to
* maintain your pointer to the ifnet, call ifnet_reference
* followed by ifnet_release when you're finished.
* @param ifmaddr The interface multicast address.
* @result A reference to the interface.
*/
extern ifnet_t ifmaddr_ifnet(ifmultiaddr_t ifmaddr)
__NKE_API_DEPRECATED;
__END_DECLS
#undef __NKE_API_DEPRECATED
#endif /* __KPI_INTERFACE__ */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/net/init.h | /*
* Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*!
* @header init.h
* This header defines an API to register a function that will be called when
* the network stack is being initialized. This gives a kernel extensions an
* opportunity to install filters before sockets are created and network
* operations occur.
*/
#ifndef _NET_INIT_H_
#define _NET_INIT_H_
#include <sys/kernel_types.h>
/*!
* @typedef net_init_func_ptr
* @discussion net_init_func_ptr will be called once the networking stack
* initialized and before network operations occur.
*/
typedef void (*net_init_func_ptr)(void);
/*!
* @function net_init_add
* @discussion Add a function to be called during network initialization. Your
* kext must not unload until the function you register is called if
* net_init_add returns success.
* @param init_func A pointer to a function to be called when the stack is
* initialized.
* @result EINVAL - the init_func value was NULL.
* EALREADY - the network has already been initialized
* ENOMEM - there was not enough memory to perform this operation
* 0 - success
*/
errno_t net_init_add(net_init_func_ptr init_func);
#endif /* _NET_INIT_H_ */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/net/if_llc.h | /*
* Copyright (c) 2000,2009 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)if_llc.h 8.1 (Berkeley) 6/10/93
*/
#ifndef _NET_IF_LLC_H_
#define _NET_IF_LLC_H_
#include <sys/appleapiopts.h>
#include <sys/types.h>
/*
* IEEE 802.2 Link Level Control headers, for use in conjunction with
* 802.{3,4,5} media access control methods.
*
* Headers here do not use bit fields due to shortcomings in many
* compilers.
*/
struct llc {
u_int8_t llc_dsap;
u_int8_t llc_ssap;
union {
struct {
u_int8_t control;
u_int8_t format_id;
u_int8_t class_id;
u_int8_t window_x2;
} type_u;
struct {
u_int8_t num_snd_x2;
u_int8_t num_rcv_x2;
} type_i;
struct {
u_int8_t control;
u_int8_t num_rcv_x2;
} type_s;
struct {
u_int8_t control;
/*
* We cannot put the following fields in a structure because
* the structure rounding might cause padding.
*/
u_int8_t frmr_rej_pdu0;
u_int8_t frmr_rej_pdu1;
u_int8_t frmr_control;
u_int8_t frmr_control_ext;
u_int8_t frmr_cause;
} type_frmr;
struct {
u_int8_t control;
u_int8_t org_code[3];
u_int16_t ether_type;
} type_snap __attribute__((__packed__));
struct {
u_int8_t control;
u_int8_t control_ext;
} type_raw;
} llc_un;
} __attribute__((__packed__));
struct frmrinfo {
u_int8_t frmr_rej_pdu0;
u_int8_t frmr_rej_pdu1;
u_int8_t frmr_control;
u_int8_t frmr_control_ext;
u_int8_t frmr_cause;
} __attribute__((__packed__));
#define llc_control llc_un.type_u.control
#define llc_control_ext llc_un.type_raw.control_ext
#define llc_fid llc_un.type_u.format_id
#define llc_class llc_un.type_u.class
#define llc_window llc_un.type_u.window_x2
#define llc_frmrinfo llc_un.type_frmr.frmr_rej_pdu0
#define llc_frmr_pdu0 llc_un.type_frmr.frmr_rej_pdu0
#define llc_frmr_pdu1 llc_un.type_frmr.frmr_rej_pdu1
#define llc_frmr_control llc_un.type_frmr.frmr_control
#define llc_frmr_control_ext llc_un.type_frmr.frmr_control_ext
#define llc_frmr_cause llc_un.type_frmr.frmr_cause
#define llc_snap llc_un.type_snap
/*
* Don't use sizeof(struct llc_un) for LLC header sizes
*/
#define LLC_ISFRAMELEN 4
#define LLC_UFRAMELEN 3
#define LLC_FRMRLEN 7
#define LLC_SNAPFRAMELEN 8
/*
* Unnumbered LLC format commands
*/
#define LLC_UI 0x3
#define LLC_UI_P 0x13
#define LLC_DISC 0x43
#define LLC_DISC_P 0x53
#define LLC_UA 0x63
#define LLC_UA_P 0x73
#define LLC_TEST 0xe3
#define LLC_TEST_P 0xf3
#define LLC_FRMR 0x87
#define LLC_FRMR_P 0x97
#define LLC_DM 0x0f
#define LLC_DM_P 0x1f
#define LLC_XID 0xaf
#define LLC_XID_P 0xbf
#define LLC_SABME 0x6f
#define LLC_SABME_P 0x7f
/*
* Supervisory LLC commands
*/
#define LLC_RR 0x01
#define LLC_RNR 0x05
#define LLC_REJ 0x09
/*
* Info format - dummy only
*/
#define LLC_INFO 0x00
/*
* ISO PDTR 10178 contains among others
*/
#define LLC_8021D_LSAP 0x42
#define LLC_X25_LSAP 0x7e
#define LLC_SNAP_LSAP 0xaa
#define LLC_ISO_LSAP 0xfe
/*
* LLC XID definitions from 802.2, as needed
*/
#define LLC_XID_FORMAT_BASIC 0x81
#define LLC_XID_BASIC_MINLEN (LLC_UFRAMELEN + 3)
#define LLC_XID_CLASS_I 0x1
#define LLC_XID_CLASS_II 0x3
#define LLC_XID_CLASS_III 0x5
#define LLC_XID_CLASS_IV 0x7
#endif /* !_NET_IF_LLC_H_ */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/net/kpi_protocol.h | /*
* Copyright (c) 2008-2016 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*!
* @header kpi_protocol.h
* This header defines an API to interact with protocols in the kernel.
* The KPIs in this header file can be used to interact with protocols
* that already exist in the stack. These KPIs can be used to support
* existing protocols over media types that are not natively supported
* in the kernel, such as ATM.
*/
#ifndef __KPI_PROTOCOL__
#define __KPI_PROTOCOL__
#include <sys/kernel_types.h>
#include <net/kpi_interface.h>
#include <Availability.h>
#define __NKE_API_DEPRECATED __API_DEPRECATED("Network Kernel Extension KPI is deprecated", macos(10.4, 10.15.4))
__BEGIN_DECLS
/******************************************************************************/
/* Protocol input/inject */
/******************************************************************************/
/*!
* @function proto_input
* @discussion Inputs a packet on the specified protocol from the input
* path.
* @param protocol The protocol of the packet.
* @param packet The first packet in a chain of packets to be input.
* @result A errno error on failure. Unless proto_input returns zero,
* the caller is responsible for freeing the mbuf.
*/
extern errno_t proto_input(protocol_family_t protocol, mbuf_t packet)
__NKE_API_DEPRECATED;
/*!
* @function proto_inject
* @discussion Injects a packet on the specified protocol from
* anywhere. To avoid recursion, the protocol may need to queue the
* packet to be handled later.
* @param protocol The protocol of the packet.
* @param packet The first packet in a chain of packets to be injected.
* @result A errno error on failure. Unless proto_inject returns zero,
* the caller is responsible for freeing the mbuf.
*/
extern errno_t proto_inject(protocol_family_t protocol, mbuf_t packet)
__NKE_API_DEPRECATED;
/******************************************************************************/
/* Protocol plumbing */
/******************************************************************************/
/*!
* @typedef proto_plumb_handler
* @discussion proto_plumb_handler is called to attach a protocol to an
* interface. A typical protocol plumb function would fill out an
* ifnet_attach_proto_param and call ifnet_attach_protocol.
* @param ifp The interface the protocol should be attached to.
* @param protocol The protocol that should be attached to the
* interface.
* @result
* A non-zero value of the attach failed.
*/
typedef errno_t (*proto_plumb_handler)(ifnet_t ifp, protocol_family_t protocol);
/*!
* @typedef proto_unplumb_handler
* @discussion proto_unplumb_handler is called to detach a protocol
* from an interface. A typical unplumb function would call
* ifnet_detach_protocol and perform any necessary cleanup.
* @param ifp The interface the protocol should be detached from.
* @param protocol The protocol that should be detached from the
* interface.
*/
typedef void (*proto_unplumb_handler)(ifnet_t ifp, protocol_family_t protocol);
/*!
* @function proto_register_plumber
* @discussion Allows the caller to specify the functions called when a
* protocol is attached to an interface belonging to the specified
* family and when that protocol is detached.
* @param proto_fam The protocol family these plumbing functions will
* handle.
* @param if_fam The interface family these plumbing functions will
* handle.
* @param plumb The function to call to attach the protocol to an
* interface.
* @param unplumb The function to call to detach the protocol to an
* interface, may be NULL in which case ifnet_detach_protocol will
* be used to detach the protocol.
* @result A non-zero value of the attach failed.
*/
extern errno_t proto_register_plumber(protocol_family_t proto_fam,
ifnet_family_t if_fam, proto_plumb_handler plumb,
proto_unplumb_handler unplumb)
__NKE_API_DEPRECATED;
/*!
* @function proto_unregister_plumber
* @discussion Unregisters a previously registered plumbing function.
* @param proto_fam The protocol family these plumbing functions
* handle.
* @param if_fam The interface family these plumbing functions handle.
*/
extern void proto_unregister_plumber(protocol_family_t proto_fam,
ifnet_family_t if_fam)
__NKE_API_DEPRECATED;
__END_DECLS
#undef __NKE_API_DEPRECATED
#endif /* __KPI_PROTOCOL__ */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/net/if_media.h | /*
* Copyright (c) 2000-2019 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/* $NetBSD: if_media.h,v 1.3 1997/03/26 01:19:27 thorpej Exp $ */
/* $FreeBSD: src/sys/net/if_media.h,v 1.9.2.1 2001/07/04 00:12:38 brooks Exp $ */
/*
* Copyright (c) 1997
* Jonathan Stone and Jason R. Thorpe. All rights reserved.
*
* This software is derived from information provided by Matt Thomas.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Jonathan Stone
* and Jason R. Thorpe for the NetBSD Project.
* 4. The names of the authors may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _NET_IF_MEDIA_H_
#define _NET_IF_MEDIA_H_
#include <sys/appleapiopts.h>
/*
* Prototypes and definitions for BSD/OS-compatible network interface
* media selection.
*
* Where it is safe to do so, this code strays slightly from the BSD/OS
* design. Software which uses the API (device drivers, basically)
* shouldn't notice any difference.
*
* Many thanks to Matt Thomas for providing the information necessary
* to implement this interface.
*/
/*
* if_media Options word:
* Bits Use
* ---- -------
* 0-4 Media variant
* 5-7 Media type
* 8-15 Type specific options
* 16-19 Extended media variant bits
* 20-27 Shared (global) options
* 28-31 Instance
*/
/*
* Ethernet
*
* In order to use more than 31 subtypes, Ethernet uses the extended media
* variant bits
*
* The extended media variant bits are not backward compatible so they
* must not be used by kernel extensions like ifnet and drivers that
* are to be deployed on older system versions
*/
#define IFM_X(x) IFM_X_SUBTYPE(x) /* internal shorthand */
#define IFM_ETHER 0x00000020
#define IFM_10_T 3 /* 10BaseT - RJ45 */
#define IFM_10_2 4 /* 10Base2 - Thinnet */
#define IFM_10_5 5 /* 10Base5 - AUI */
#define IFM_100_TX 6 /* 100BaseTX - RJ45 */
#define IFM_100_FX 7 /* 100BaseFX - Fiber */
#define IFM_100_T4 8 /* 100BaseT4 - 4 pair cat 3 */
#define IFM_100_VG 9 /* 100VG-AnyLAN */
#define IFM_100_T2 10 /* 100BaseT2 */
#define IFM_1000_SX 11 /* 1000BaseSX - multi-mode fiber */
#define IFM_10_STP 12 /* 10BaseT over shielded TP */
#define IFM_10_FL 13 /* 10baseFL - Fiber */
#define IFM_1000_LX 14 /* 1000baseLX - single-mode fiber */
#define IFM_1000_CX 15 /* 1000baseCX - 150ohm STP */
#define IFM_1000_T 16 /* 1000baseT - 4 pair cat 5 */
#define IFM_HPNA_1 17 /* HomePNA 1.0 (1Mb/s) */
#define IFM_10G_SR 18 /* 10GbaseSR - multi-mode fiber */
#define IFM_10G_LR 19 /* 10GbaseLR - single-mode fiber */
#define IFM_10G_CX4 20 /* 10GbaseCX4 - copper */
#define IFM_10G_T 21 /* 10GbaseT - 4 pair cat 6 */
#define IFM_2500_T 22 /* 2500baseT - 4 pair cat 5 */
#define IFM_5000_T 23 /* 5000baseT - 4 pair cat 5 */
#define IFM_1000_CX_SGMII 24 /* 1000Base-CX-SGMII */
#define IFM_1000_KX 25 /* 1000Base-KX backplane */
#define IFM_10G_KX4 26 /* 10GBase-KX4 backplane */
#define IFM_10G_KR 27 /* 10GBase-KR backplane */
#define IFM_10G_CR1 28 /* 10GBase-CR1 Twinax splitter */
#define IFM_10G_ER 29 /* 10GBase-ER */
#define IFM_20G_KR2 30 /* 20GBase-KR2 backplane */
#define IFM_OTHER 31 /* Other: one of the following */
/* following types are not visible to old binaries using the low bits of IFM_TMASK */
#define IFM_2500_SX IFM_X(32) /* 2500BaseSX - multi-mode fiber */
#define IFM_10G_TWINAX IFM_X(33) /* 10GBase Twinax copper */
#define IFM_10G_TWINAX_LONG IFM_X(34) /* 10GBase Twinax Long copper */
#define IFM_10G_LRM IFM_X(35) /* 10GBase-LRM 850nm Multi-mode */
#define IFM_2500_KX IFM_X(36) /* 2500Base-KX backplane */
#define IFM_40G_CR4 IFM_X(37) /* 40GBase-CR4 */
#define IFM_40G_SR4 IFM_X(38) /* 40GBase-SR4 */
#define IFM_50G_PCIE IFM_X(39) /* 50G Ethernet over PCIE */
#define IFM_25G_PCIE IFM_X(40) /* 25G Ethernet over PCIE */
#define IFM_1000_SGMII IFM_X(41) /* 1G media interface */
#define IFM_10G_SFI IFM_X(42) /* 10G media interface */
#define IFM_40G_XLPPI IFM_X(43) /* 40G media interface */
#define IFM_40G_LR4 IFM_X(44) /* 40GBase-LR4 */
#define IFM_40G_KR4 IFM_X(45) /* 40GBase-KR4 */
#define IFM_100G_CR4 IFM_X(47) /* 100GBase-CR4 */
#define IFM_100G_SR4 IFM_X(48) /* 100GBase-SR4 */
#define IFM_100G_KR4 IFM_X(49) /* 100GBase-KR4 */
#define IFM_100G_LR4 IFM_X(50) /* 100GBase-LR4 */
#define IFM_56G_R4 IFM_X(51) /* 56GBase-R4 */
#define IFM_100_T IFM_X(52) /* 100BaseT - RJ45 */
#define IFM_25G_CR IFM_X(53) /* 25GBase-CR */
#define IFM_25G_KR IFM_X(54) /* 25GBase-KR */
#define IFM_25G_SR IFM_X(55) /* 25GBase-SR */
#define IFM_50G_CR2 IFM_X(56) /* 50GBase-CR2 */
#define IFM_50G_KR2 IFM_X(57) /* 50GBase-KR2 */
#define IFM_25G_LR IFM_X(58) /* 25GBase-LR */
#define IFM_10G_AOC IFM_X(59) /* 10G active optical cable */
#define IFM_25G_ACC IFM_X(60) /* 25G active copper cable */
#define IFM_25G_AOC IFM_X(61) /* 25G active optical cable */
#define IFM_100_SGMII IFM_X(62) /* 100M media interface */
#define IFM_2500_X IFM_X(63) /* 2500BaseX */
#define IFM_5000_KR IFM_X(64) /* 5GBase-KR backplane */
#define IFM_25G_T IFM_X(65) /* 25GBase-T - RJ45 */
#define IFM_25G_CR_S IFM_X(66) /* 25GBase-CR (short) */
#define IFM_25G_CR1 IFM_X(67) /* 25GBase-CR1 DA cable */
#define IFM_25G_KR_S IFM_X(68) /* 25GBase-KR (short) */
#define IFM_5000_KR_S IFM_X(69) /* 5GBase-KR backplane (short) */
#define IFM_5000_KR1 IFM_X(70) /* 5GBase-KR backplane */
#define IFM_25G_AUI IFM_X(71) /* 25G-AUI-C2C (chip to chip) */
#define IFM_40G_XLAUI IFM_X(72) /* 40G-XLAUI */
#define IFM_40G_XLAUI_AC IFM_X(73) /* 40G active copper/optical */
#define IFM_40G_ER4 IFM_X(74) /* 40GBase-ER4 */
#define IFM_50G_SR2 IFM_X(75) /* 50GBase-SR2 */
#define IFM_50G_LR2 IFM_X(76) /* 50GBase-LR2 */
#define IFM_50G_LAUI2_AC IFM_X(77) /* 50G active copper/optical */
#define IFM_50G_LAUI2 IFM_X(78) /* 50G-LAUI2 */
#define IFM_50G_AUI2_AC IFM_X(79) /* 50G active copper/optical */
#define IFM_50G_AUI2 IFM_X(80) /* 50G-AUI2 */
#define IFM_50G_CP IFM_X(81) /* 50GBase-CP */
#define IFM_50G_SR IFM_X(82) /* 50GBase-SR */
#define IFM_50G_LR IFM_X(83) /* 50GBase-LR */
#define IFM_50G_FR IFM_X(84) /* 50GBase-FR */
#define IFM_50G_KR_PAM4 IFM_X(85) /* 50GBase-KR PAM4 */
#define IFM_25G_KR1 IFM_X(86) /* 25GBase-KR1 */
#define IFM_50G_AUI1_AC IFM_X(87) /* 50G active copper/optical */
#define IFM_50G_AUI1 IFM_X(88) /* 50G-AUI1 */
#define IFM_100G_CAUI4_AC IFM_X(89) /* 100G-CAUI4 active copper/optical */
#define IFM_100G_CAUI4 IFM_X(90) /* 100G-CAUI4 */
#define IFM_100G_AUI4_AC IFM_X(91) /* 100G-AUI4 active copper/optical */
#define IFM_100G_AUI4 IFM_X(92) /* 100G-AUI4 */
#define IFM_100G_CR_PAM4 IFM_X(93) /* 100GBase-CR PAM4 */
#define IFM_100G_KR_PAM4 IFM_X(94) /* 100GBase-CR PAM4 */
#define IFM_100G_CP2 IFM_X(95) /* 100GBase-CP2 */
#define IFM_100G_SR2 IFM_X(96) /* 100GBase-SR2 */
#define IFM_100G_DR IFM_X(97) /* 100GBase-DR */
#define IFM_100G_KR2_PAM4 IFM_X(98) /* 100GBase-KR2 PAM4 */
#define IFM_100G_CAUI2_AC IFM_X(99) /* 100G-CAUI2 active copper/optical */
#define IFM_100G_CAUI2 IFM_X(100) /* 100G-CAUI2 */
#define IFM_100G_AUI2_AC IFM_X(101) /* 100G-AUI2 active copper/optical */
#define IFM_100G_AUI2 IFM_X(102) /* 100G-AUI2 */
#define IFM_200G_CR4_PAM4 IFM_X(103) /* 200GBase-CR4 PAM4 */
#define IFM_200G_SR4 IFM_X(104) /* 200GBase-SR4 */
#define IFM_200G_FR4 IFM_X(105) /* 200GBase-FR4 */
#define IFM_200G_LR4 IFM_X(106) /* 200GBase-LR4 */
#define IFM_200G_DR4 IFM_X(107) /* 200GBase-DR4 */
#define IFM_200G_KR4_PAM4 IFM_X(108) /* 200GBase-KR4 PAM4 */
#define IFM_200G_AUI4_AC IFM_X(109) /* 200G-AUI4 active copper/optical */
#define IFM_200G_AUI4 IFM_X(110) /* 200G-AUI4 */
#define IFM_200G_AUI8_AC IFM_X(111) /* 200G-AUI8 active copper/optical */
#define IFM_200G_AUI8 IFM_X(112) /* 200G-AUI8 */
#define IFM_400G_FR8 IFM_X(113) /* 400GBase-FR8 */
#define IFM_400G_LR8 IFM_X(114) /* 400GBase-LR8 */
#define IFM_400G_DR4 IFM_X(115) /* 400GBase-DR4 */
#define IFM_400G_AUI8_AC IFM_X(116) /* 400G-AUI8 active copper/optical */
#define IFM_400G_AUI8 IFM_X(117) /* 400G-AUI8 */
/*
* Token ring
*/
#define IFM_TOKEN 0x00000040
#define IFM_TOK_STP4 3 /* Shielded twisted pair 4m - DB9 */
#define IFM_TOK_STP16 4 /* Shielded twisted pair 16m - DB9 */
#define IFM_TOK_UTP4 5 /* Unshielded twisted pair 4m - RJ45 */
#define IFM_TOK_UTP16 6 /* Unshielded twisted pair 16m - RJ45 */
#define IFM_TOK_STP100 7 /* Shielded twisted pair 100m - DB9 */
#define IFM_TOK_UTP100 8 /* Unshielded twisted pair 100m - RJ45 */
#define IFM_TOK_ETR 0x00000200 /* Early token release */
#define IFM_TOK_SRCRT 0x00000400 /* Enable source routing features */
#define IFM_TOK_ALLR 0x00000800 /* All routes / Single route bcast */
#define IFM_TOK_DTR 0x00002000 /* Dedicated token ring */
#define IFM_TOK_CLASSIC 0x00004000 /* Classic token ring */
#define IFM_TOK_AUTO 0x00008000 /* Automatic Dedicate/Classic token ring */
/*
* FDDI
*/
#define IFM_FDDI 0x00000060
#define IFM_FDDI_SMF 3 /* Single-mode fiber */
#define IFM_FDDI_MMF 4 /* Multi-mode fiber */
#define IFM_FDDI_UTP 5 /* CDDI / UTP */
#define IFM_FDDI_DA 0x00000100 /* Dual attach / single attach */
/*
* IEEE 802.11 Wireless
*/
#define IFM_IEEE80211 0x00000080
#define IFM_IEEE80211_FH1 3 /* Frequency Hopping 1Mbps */
#define IFM_IEEE80211_FH2 4 /* Frequency Hopping 2Mbps */
#define IFM_IEEE80211_DS2 5 /* Direct Sequence 2Mbps */
#define IFM_IEEE80211_DS5 6 /* Direct Sequence 5Mbps*/
#define IFM_IEEE80211_DS11 7 /* Direct Sequence 11Mbps*/
#define IFM_IEEE80211_DS1 8 /* Direct Sequence 1Mbps */
#define IFM_IEEE80211_DS22 9 /* Direct Sequence 22Mbps */
#define IFM_IEEE80211_ADHOC 0x00000100 /* Operate in Adhoc mode */
/*
* Shared media sub-types
*/
#define IFM_AUTO 0 /* Autoselect best media */
#define IFM_MANUAL 1 /* Jumper/dipswitch selects media */
#define IFM_NONE 2 /* Deselect all media */
/*
* Shared options
*/
#define IFM_FDX 0x00100000 /* Force full duplex */
#define IFM_HDX 0x00200000 /* Force half duplex */
#define IFM_FLOW 0x00400000 /* enable hardware flow control */
#define IFM_EEE 0x00800000 /* Support energy efficient ethernet */
#define IFM_FLAG0 0x01000000 /* Driver defined flag */
#define IFM_FLAG1 0x02000000 /* Driver defined flag */
#define IFM_FLAG2 0x04000000 /* Driver defined flag */
#define IFM_LOOP 0x08000000 /* Put hardware in loopback */
/*
* Macros to access bits of extended media sub-types (media variants)
*/
#define IFM_TMASK_COMPAT 0x0000001f /* Lower bits of media sub-type */
#define IFM_TMASK_EXT 0x000f0000 /* For extended media sub-type */
#define IFM_TMASK_EXT_SHIFT 11 /* to extract high bits */
#define IFM_X_SUBTYPE(x) (((x) & IFM_TMASK_COMPAT) | \
(((x) & (IFM_TMASK_EXT >> IFM_TMASK_EXT_SHIFT)) << IFM_TMASK_EXT_SHIFT))
/*
* Masks
*/
#define IFM_NMASK 0x000000e0 /* Network type */
#define IFM_TMASK (IFM_TMASK_COMPAT|IFM_TMASK_EXT) /* Media sub-type */
#define IFM_IMASK 0xf0000000 /* Instance */
#define IFM_ISHIFT 28 /* Instance shift */
#define IFM_OMASK 0x0000ff00 /* Type specific options */
#define IFM_GMASK 0x0ff00000 /* Global options */
/*
* Status bits
*/
#define IFM_AVALID 0x00000001 /* Active bit valid */
#define IFM_ACTIVE 0x00000002 /* Interface attached to working net */
#define IFM_WAKESAMENET 0x00000004 /* No link transition while asleep */
/*
* Macros to extract various bits of information from the media word.
*/
#define IFM_TYPE(x) ((x) & IFM_NMASK)
#define IFM_SUBTYPE(x) ((x) & IFM_TMASK)
#define IFM_TYPE_OPTIONS(x) ((x) & IFM_OMASK)
#define IFM_INST(x) (((x) & IFM_IMASK) >> IFM_ISHIFT)
#define IFM_OPTIONS(x) ((x) & (IFM_OMASK|IFM_GMASK))
#define IFM_INST_MAX IFM_INST(IFM_IMASK)
/*
* Macro to create a media word.
*/
#define IFM_MAKEWORD(type, subtype, options, instance) \
((type) | (subtype) | (options) | ((instance) << IFM_ISHIFT))
/*
* NetBSD extension not defined in the BSDI API. This is used in various
* places to get the canonical description for a given type/subtype.
*
* NOTE: all but the top-level type descriptions must contain NO whitespace!
* Otherwise, parsing these in ifconfig(8) would be a nightmare.
*/
struct ifmedia_description {
int ifmt_word; /* word value; may be masked */
const char *ifmt_string; /* description */
};
#define IFM_TYPE_DESCRIPTIONS { \
{ IFM_ETHER, "Ethernet" }, \
{ IFM_TOKEN, "Token ring" }, \
{ IFM_FDDI, "FDDI" }, \
{ IFM_IEEE80211, "IEEE802.11" }, \
{ 0, NULL }, \
}
#define IFM_SUBTYPE_ETHERNET_DESCRIPTIONS { \
{ IFM_10_T, "10baseT/UTP" }, \
{ IFM_10_2, "10base2/BNC" }, \
{ IFM_10_5, "10base5/AUI" }, \
{ IFM_100_TX, "100baseTX" }, \
{ IFM_100_FX, "100baseFX" }, \
{ IFM_100_T4, "100baseT4" }, \
{ IFM_100_VG, "100baseVG" }, \
{ IFM_100_T2, "100baseT2" }, \
{ IFM_10_STP, "10baseSTP" }, \
{ IFM_10_FL, "10baseFL" }, \
{ IFM_1000_SX, "1000baseSX" }, \
{ IFM_1000_LX, "1000baseLX" }, \
{ IFM_1000_CX, "1000baseCX" }, \
{ IFM_1000_T, "1000baseT" }, \
{ IFM_HPNA_1, "homePNA" }, \
{ IFM_10G_LR, "10Gbase-LR" }, \
{ IFM_10G_SR, "10Gbase-SR" }, \
{ IFM_10G_CX4, "10Gbase-CX4" }, \
{ IFM_2500_SX, "2500BaseSX" }, \
{ IFM_10G_LRM, "10Gbase-LRM" }, \
{ IFM_10G_TWINAX, "10Gbase-Twinax" }, \
{ IFM_10G_TWINAX_LONG, "10Gbase-Twinax-Long" }, \
{ IFM_10G_T, "10Gbase-T" }, \
{ IFM_40G_CR4, "40Gbase-CR4" }, \
{ IFM_40G_SR4, "40Gbase-SR4" }, \
{ IFM_40G_LR4, "40Gbase-LR4" }, \
{ IFM_1000_KX, "1000Base-KX" }, \
{ IFM_OTHER, "Other" }, \
{ IFM_10G_KX4, "10GBase-KX4" }, \
{ IFM_10G_KR, "10GBase-KR" }, \
{ IFM_10G_CR1, "10GBase-CR1" }, \
{ IFM_20G_KR2, "20GBase-KR2" }, \
{ IFM_2500_KX, "2500Base-KX" }, \
{ IFM_2500_T, "2500Base-T" }, \
{ IFM_5000_T, "5000Base-T" }, \
{ IFM_50G_PCIE, "PCIExpress-50G" }, \
{ IFM_25G_PCIE, "PCIExpress-25G" }, \
{ IFM_1000_SGMII, "1000Base-SGMII" }, \
{ IFM_10G_SFI, "10GBase-SFI" }, \
{ IFM_40G_XLPPI, "40GBase-XLPPI" }, \
{ IFM_1000_CX_SGMII, "1000Base-CX-SGMII" }, \
{ IFM_40G_KR4, "40GBase-KR4" }, \
{ IFM_10G_ER, "10GBase-ER" }, \
{ IFM_100G_CR4, "100GBase-CR4" }, \
{ IFM_100G_SR4, "100GBase-SR4" }, \
{ IFM_100G_KR4, "100GBase-KR4" }, \
{ IFM_100G_LR4, "100GBase-LR4" }, \
{ IFM_56G_R4, "56GBase-R4" }, \
{ IFM_100_T, "100BaseT" }, \
{ IFM_25G_CR, "25GBase-CR" }, \
{ IFM_25G_KR, "25GBase-KR" }, \
{ IFM_25G_SR, "25GBase-SR" }, \
{ IFM_50G_CR2, "50GBase-CR2" }, \
{ IFM_50G_KR2, "50GBase-KR2" }, \
{ IFM_25G_LR, "25GBase-LR" }, \
{ IFM_10G_AOC, "10GBase-AOC" }, \
{ IFM_25G_ACC, "25GBase-ACC" }, \
{ IFM_25G_AOC, "25GBase-AOC" }, \
{ IFM_100_SGMII, "100M-SGMII" }, \
{ IFM_2500_X, "2500Base-X" }, \
{ IFM_5000_KR, "5000Base-KR" }, \
{ IFM_25G_T, "25GBase-T" }, \
{ IFM_25G_CR_S, "25GBase-CR-S" }, \
{ IFM_25G_CR1, "25GBase-CR1" }, \
{ IFM_25G_KR_S, "25GBase-KR-S" }, \
{ IFM_5000_KR_S, "5000Base-KR-S" }, \
{ IFM_5000_KR1, "5000Base-KR1" }, \
{ IFM_25G_AUI, "25G-AUI" }, \
{ IFM_40G_XLAUI, "40G-XLAUI" }, \
{ IFM_40G_XLAUI_AC, "40G-XLAUI-AC" }, \
{ IFM_40G_ER4, "40GBase-ER4" }, \
{ IFM_50G_SR2, "50GBase-SR2" }, \
{ IFM_50G_LR2, "50GBase-LR2" }, \
{ IFM_50G_LAUI2_AC, "50G-LAUI2-AC" }, \
{ IFM_50G_LAUI2, "50G-LAUI2" }, \
{ IFM_50G_AUI2_AC, "50G-AUI2-AC" }, \
{ IFM_50G_AUI2, "50G-AUI2" }, \
{ IFM_50G_CP, "50GBase-CP" }, \
{ IFM_50G_SR, "50GBase-SR" }, \
{ IFM_50G_LR, "50GBase-LR" }, \
{ IFM_50G_FR, "50GBase-FR" }, \
{ IFM_50G_KR_PAM4, "50GBase-KR-PAM4" }, \
{ IFM_25G_KR1, "25GBase-KR1" }, \
{ IFM_50G_AUI1_AC, "50G-AUI1-AC" }, \
{ IFM_50G_AUI1, "50G-AUI1" }, \
{ IFM_100G_CAUI4_AC, "100G-CAUI4-AC" }, \
{ IFM_100G_CAUI4, "100G-CAUI4" }, \
{ IFM_100G_AUI4_AC, "100G-AUI4-AC" }, \
{ IFM_100G_AUI4, "100G-AUI4" }, \
{ IFM_100G_CR_PAM4, "100GBase-CR-PAM4" }, \
{ IFM_100G_KR_PAM4, "100GBase-KR-PAM4" }, \
{ IFM_100G_CP2, "100GBase-CP2" }, \
{ IFM_100G_SR2, "100GBase-SR2" }, \
{ IFM_100G_DR, "100GBase-DR" }, \
{ IFM_100G_KR2_PAM4, "100GBase-KR2-PAM4" }, \
{ IFM_100G_CAUI2_AC, "100G-CAUI2-AC" }, \
{ IFM_100G_CAUI2, "100G-CAUI2" }, \
{ IFM_100G_AUI2_AC, "100G-AUI2-AC" }, \
{ IFM_100G_AUI2, "100G-AUI2" }, \
{ IFM_200G_CR4_PAM4, "200GBase-CR4-PAM4" }, \
{ IFM_200G_SR4, "200GBase-SR4" }, \
{ IFM_200G_FR4, "200GBase-FR4" }, \
{ IFM_200G_LR4, "200GBase-LR4" }, \
{ IFM_200G_DR4, "200GBase-DR4" }, \
{ IFM_200G_KR4_PAM4, "200GBase-KR4-PAM4" }, \
{ IFM_200G_AUI4_AC, "200G-AUI4-AC" }, \
{ IFM_200G_AUI4, "200G-AUI4" }, \
{ IFM_200G_AUI8_AC, "200G-AUI8-AC" }, \
{ IFM_200G_AUI8, "200G-AUI8" }, \
{ IFM_400G_FR8, "400GBase-FR8" }, \
{ IFM_400G_LR8, "400GBase-LR8" }, \
{ IFM_400G_DR4, "400GBase-DR4" }, \
{ IFM_400G_AUI8_AC, "400G-AUI8-AC" }, \
{ IFM_400G_AUI8, "400G-AUI8" }, \
{ 0, NULL }, \
}
#define IFM_SUBTYPE_ETHERNET_ALIASES { \
{ IFM_10_T, "UTP" }, \
{ IFM_10_T, "10UTP" }, \
{ IFM_10_2, "BNC" }, \
{ IFM_10_2, "10BNC" }, \
{ IFM_10_5, "AUI" }, \
{ IFM_10_5, "10AUI" }, \
{ IFM_100_TX, "100TX" }, \
{ IFM_100_FX, "100FX" }, \
{ IFM_100_T4, "100T4" }, \
{ IFM_100_VG, "100VG" }, \
{ IFM_100_T2, "100T2" }, \
{ IFM_1000_SX, "1000SX" }, \
{ IFM_10_STP, "STP" }, \
{ IFM_10_STP, "10STP" }, \
{ IFM_10_FL, "FL" }, \
{ IFM_10_FL, "10FL" }, \
{ IFM_1000_LX, "1000LX" }, \
{ IFM_1000_CX, "1000CX" }, \
{ IFM_1000_T, "1000T" }, \
{ IFM_HPNA_1, "HPNA1" }, \
{ IFM_10G_SR, "10GSR" }, \
{ IFM_10G_LR, "10GLR" }, \
{ IFM_10G_CX4, "10GCX4" }, \
{ IFM_10G_T, "10GT" }, \
{ 0, NULL }, \
}
#define IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS { \
{ 0, NULL }, \
}
#define IFM_SUBTYPE_TOKENRING_DESCRIPTIONS { \
{ IFM_TOK_STP4, "DB9/4Mbit" }, \
{ IFM_TOK_STP16, "DB9/16Mbit" }, \
{ IFM_TOK_UTP4, "UTP/4Mbit" }, \
{ IFM_TOK_UTP16, "UTP/16Mbit" }, \
{ 0, NULL }, \
}
#define IFM_SUBTYPE_TOKENRING_ALIASES { \
{ IFM_TOK_STP4, "4STP" }, \
{ IFM_TOK_STP16, "16STP" }, \
{ IFM_TOK_UTP4, "4UTP" }, \
{ IFM_TOK_UTP16, "16UTP" }, \
{ 0, NULL }, \
}
#define IFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS { \
{ IFM_TOK_ETR, "EarlyTokenRelease" }, \
{ IFM_TOK_SRCRT, "SourceRouting" }, \
{ IFM_TOK_ALLR, "AllRoutes" }, \
{ 0, NULL }, \
}
#define IFM_SUBTYPE_FDDI_DESCRIPTIONS { \
{ IFM_FDDI_SMF, "Single-mode" }, \
{ IFM_FDDI_MMF, "Multi-mode" }, \
{ IFM_FDDI_UTP, "UTP" }, \
{ 0, NULL }, \
}
#define IFM_SUBTYPE_FDDI_ALIASES { \
{ IFM_FDDI_SMF, "SMF" }, \
{ IFM_FDDI_MMF, "MMF" }, \
{ IFM_FDDI_UTP, "CDDI" }, \
{ 0, NULL }, \
}
#define IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS { \
{ IFM_FDDI_DA, "Dual-attach" }, \
{ 0, NULL }, \
}
#define IFM_SUBTYPE_IEEE80211_DESCRIPTIONS { \
{ IFM_IEEE80211_FH1, "FH1" }, \
{ IFM_IEEE80211_FH2, "FH2" }, \
{ IFM_IEEE80211_DS1, "DS1" }, \
{ IFM_IEEE80211_DS2, "DS2" }, \
{ IFM_IEEE80211_DS5, "DS5" }, \
{ IFM_IEEE80211_DS11, "DS11" }, \
{ IFM_IEEE80211_DS22, "DS22" }, \
{ 0, NULL }, \
}
#define IFM_SUBTYPE_IEEE80211_OPTION_DESCRIPTIONS { \
{ IFM_IEEE80211_ADHOC, "adhoc" }, \
{ 0, NULL }, \
}
#define IFM_SUBTYPE_SHARED_DESCRIPTIONS { \
{ IFM_AUTO, "autoselect" }, \
{ IFM_MANUAL, "manual" }, \
{ IFM_NONE, "none" }, \
{ 0, NULL }, \
}
#define IFM_SUBTYPE_SHARED_ALIASES { \
{ IFM_AUTO, "auto" }, \
{ 0, NULL }, \
}
#define IFM_SHARED_OPTION_DESCRIPTIONS { \
{ IFM_FDX, "full-duplex" }, \
{ IFM_HDX, "half-duplex" }, \
{ IFM_FLOW, "flow-control" }, \
{ IFM_EEE, "energy-efficient-ethernet" }, \
{ IFM_FLAG0, "flag0" }, \
{ IFM_FLAG1, "flag1" }, \
{ IFM_FLAG2, "flag2" }, \
{ IFM_LOOP, "hw-loopback" }, \
{ 0, NULL }, \
}
#endif /* _NET_IF_MEDIA_H_ */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/net/if_arp.h | /*
* Copyright (c) 2000-2016 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Copyright (c) 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)if_arp.h 8.1 (Berkeley) 6/10/93
* $FreeBSD: src/sys/net/if_arp.h,v 1.14.2.1 2000/07/11 20:46:55 archie Exp $
*/
#ifndef _NET_IF_ARP_H_
#define _NET_IF_ARP_H_
#include <stdint.h>
#include <sys/appleapiopts.h>
#include <netinet/in.h>
/*
* Address Resolution Protocol.
*
* See RFC 826 for protocol description. ARP packets are variable
* in size; the arphdr structure defines the fixed-length portion.
* Protocol type values are the same as those for 10 Mb/s Ethernet.
* It is followed by the variable-sized fields ar_sha, arp_spa,
* arp_tha and arp_tpa in that order, according to the lengths
* specified. Field names used correspond to RFC 826.
*/
struct arphdr {
u_short ar_hrd; /* format of hardware address */
#define ARPHRD_ETHER 1 /* ethernet hardware format */
#define ARPHRD_IEEE802 6 /* token-ring hardware format */
#define ARPHRD_FRELAY 15 /* frame relay hardware format */
#define ARPHRD_IEEE1394 24 /* IEEE1394 hardware address */
#define ARPHRD_IEEE1394_EUI64 27 /* IEEE1394 EUI-64 */
u_short ar_pro; /* format of protocol address */
u_char ar_hln; /* length of hardware address */
u_char ar_pln; /* length of protocol address */
u_short ar_op; /* one of: */
#define ARPOP_REQUEST 1 /* request to resolve address */
#define ARPOP_REPLY 2 /* response to previous request */
#define ARPOP_REVREQUEST 3 /* request protocol address given hardware */
#define ARPOP_REVREPLY 4 /* response giving protocol address */
#define ARPOP_INVREQUEST 8 /* request to identify peer */
#define ARPOP_INVREPLY 9 /* response identifying peer */
/*
* The remaining fields are variable in size,
* according to the sizes above.
*/
#ifdef COMMENT_ONLY
u_char ar_sha[]; /* sender hardware address */
u_char ar_spa[]; /* sender protocol address */
u_char ar_tha[]; /* target hardware address */
u_char ar_tpa[]; /* target protocol address */
#endif
};
/*
* ARP ioctl request
*/
struct arpreq {
struct sockaddr arp_pa; /* protocol address */
struct sockaddr arp_ha; /* hardware address */
int arp_flags; /* flags */
};
/* arp_flags and at_flags field values */
#define ATF_INUSE 0x01 /* entry in use */
#define ATF_COM 0x02 /* completed entry (enaddr valid) */
#define ATF_PERM 0x04 /* permanent entry */
#define ATF_PUBL 0x08 /* publish entry (respond for other host) */
#define ATF_USETRAILERS 0x10 /* has requested trailers */
struct arpstat {
/* Normal things that happen: */
uint32_t txrequests; /* # of ARP requests sent by this host. */
uint32_t txreplies; /* # of ARP replies sent by this host. */
uint32_t txannounces; /* # of ARP announcements sent by this host. */
uint32_t rxrequests; /* # of ARP requests received by this host. */
uint32_t rxreplies; /* # of ARP replies received by this host. */
uint32_t received; /* # of ARP packets received by this host. */
/* Abnormal event and error counting: */
uint32_t txconflicts; /* # of ARP conflict probes sent */
uint32_t invalidreqs; /* # of invalid ARP resolve requests */
uint32_t reqnobufs; /* # of failed requests due to no memory */
uint32_t dropped; /* # of packets dropped waiting for a reply. */
uint32_t purged; /* # of packets purged while removing entries */
uint32_t timeouts; /* # of times with entries removed */
/* due to timeout. */
uint32_t dupips; /* # of duplicate IPs detected. */
/* General statistics */
uint32_t inuse; /* # of ARP entries in routing table */
uint32_t txurequests; /* # of ARP requests sent (unicast) */
uint32_t held; /* # of packets held waiting for a reply */
};
#endif /* !_NET_IF_ARP_H_ */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/net/if_var.h | /*
* Copyright (c) 2000-2021 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Copyright (c) 1982, 1986, 1989, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* From: @(#)if.h 8.1 (Berkeley) 6/10/93
* $FreeBSD: src/sys/net/if_var.h,v 1.18.2.7 2001/07/24 19:10:18 brooks Exp $
*/
#ifndef _NET_IF_VAR_H_
#define _NET_IF_VAR_H_
#include <sys/appleapiopts.h>
#include <stdint.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/queue.h> /* get TAILQ macros */
#ifdef BSD_KERN_PRIVATE
#include <net/pktsched/pktsched.h>
#include <sys/eventhandler.h>
#endif
#include <net/kpi_interface.h>
#ifdef __APPLE__
#define APPLE_IF_FAM_LOOPBACK 1
#define APPLE_IF_FAM_ETHERNET 2
#define APPLE_IF_FAM_SLIP 3
#define APPLE_IF_FAM_TUN 4
#define APPLE_IF_FAM_VLAN 5
#define APPLE_IF_FAM_PPP 6
#define APPLE_IF_FAM_PVC 7
#define APPLE_IF_FAM_DISC 8
#define APPLE_IF_FAM_MDECAP 9
#define APPLE_IF_FAM_GIF 10
#define APPLE_IF_FAM_FAITH 11 /* deprecated */
#define APPLE_IF_FAM_STF 12
#define APPLE_IF_FAM_FIREWIRE 13
#define APPLE_IF_FAM_BOND 14
#define APPLE_IF_FAM_CELLULAR 15
#define APPLE_IF_FAM_6LOWPAN 16
#define APPLE_IF_FAM_UTUN 17
#define APPLE_IF_FAM_IPSEC 18
#endif /* __APPLE__ */
/*
* 72 was chosen below because it is the size of a TCP/IP
* header (40) + the minimum mss (32).
*/
#define IF_MINMTU 72
#define IF_MAXMTU 65535
/*
* Structures defining a network interface, providing a packet
* transport mechanism (ala level 0 of the PUP protocols).
*
* Each interface accepts output datagrams of a specified maximum
* length, and provides higher level routines with input datagrams
* received from its medium.
*
* Output occurs when the routine if_output is called, with three parameters:
* (*ifp->if_output)(ifp, m, dst, rt)
* Here m is the mbuf chain to be sent and dst is the destination address.
* The output routine encapsulates the supplied datagram if necessary,
* and then transmits it on its medium.
*
* On input, each interface unwraps the data received by it, and either
* places it on the input queue of a internetwork datagram routine
* and posts the associated software interrupt, or passes the datagram to a raw
* packet input routine.
*
* Routines exist for locating interfaces by their addresses
* or for locating a interface on a certain network, as well as more general
* routing and gateway routines maintaining information used to locate
* interfaces. These routines live in the files if.c and route.c
*/
#define IFNAMSIZ 16
/* This belongs up in socket.h or socketvar.h, depending on how far the
* event bubbles up.
*/
struct net_event_data {
u_int32_t if_family;
u_int32_t if_unit;
char if_name[IFNAMSIZ];
};
#if defined(__LP64__)
#include <sys/_types/_timeval32.h>
#define IF_DATA_TIMEVAL timeval32
#else
#define IF_DATA_TIMEVAL timeval
#endif
#pragma pack(4)
/*
* Structure describing information about an interface
* which may be of interest to management entities.
*/
struct if_data {
/* generic interface information */
u_char ifi_type; /* ethernet, tokenring, etc */
u_char ifi_typelen; /* Length of frame type id */
u_char ifi_physical; /* e.g., AUI, Thinnet, 10base-T, etc */
u_char ifi_addrlen; /* media address length */
u_char ifi_hdrlen; /* media header length */
u_char ifi_recvquota; /* polling quota for receive intrs */
u_char ifi_xmitquota; /* polling quota for xmit intrs */
u_char ifi_unused1; /* for future use */
u_int32_t ifi_mtu; /* maximum transmission unit */
u_int32_t ifi_metric; /* routing metric (external only) */
u_int32_t ifi_baudrate; /* linespeed */
/* volatile statistics */
u_int32_t ifi_ipackets; /* packets received on interface */
u_int32_t ifi_ierrors; /* input errors on interface */
u_int32_t ifi_opackets; /* packets sent on interface */
u_int32_t ifi_oerrors; /* output errors on interface */
u_int32_t ifi_collisions; /* collisions on csma interfaces */
u_int32_t ifi_ibytes; /* total number of octets received */
u_int32_t ifi_obytes; /* total number of octets sent */
u_int32_t ifi_imcasts; /* packets received via multicast */
u_int32_t ifi_omcasts; /* packets sent via multicast */
u_int32_t ifi_iqdrops; /* dropped on input, this interface */
u_int32_t ifi_noproto; /* destined for unsupported protocol */
u_int32_t ifi_recvtiming; /* usec spent receiving when timing */
u_int32_t ifi_xmittiming; /* usec spent xmitting when timing */
struct IF_DATA_TIMEVAL ifi_lastchange; /* time of last administrative change */
u_int32_t ifi_unused2; /* used to be the default_proto */
u_int32_t ifi_hwassist; /* HW offload capabilities */
u_int32_t ifi_reserved1; /* for future use */
u_int32_t ifi_reserved2; /* for future use */
};
/*
* Structure describing information about an interface
* which may be of interest to management entities.
*/
struct if_data64 {
/* generic interface information */
u_char ifi_type; /* ethernet, tokenring, etc */
u_char ifi_typelen; /* Length of frame type id */
u_char ifi_physical; /* e.g., AUI, Thinnet, 10base-T, etc */
u_char ifi_addrlen; /* media address length */
u_char ifi_hdrlen; /* media header length */
u_char ifi_recvquota; /* polling quota for receive intrs */
u_char ifi_xmitquota; /* polling quota for xmit intrs */
u_char ifi_unused1; /* for future use */
u_int32_t ifi_mtu; /* maximum transmission unit */
u_int32_t ifi_metric; /* routing metric (external only) */
u_int64_t ifi_baudrate; /* linespeed */
/* volatile statistics */
u_int64_t ifi_ipackets; /* packets received on interface */
u_int64_t ifi_ierrors; /* input errors on interface */
u_int64_t ifi_opackets; /* packets sent on interface */
u_int64_t ifi_oerrors; /* output errors on interface */
u_int64_t ifi_collisions; /* collisions on csma interfaces */
u_int64_t ifi_ibytes; /* total number of octets received */
u_int64_t ifi_obytes; /* total number of octets sent */
u_int64_t ifi_imcasts; /* packets received via multicast */
u_int64_t ifi_omcasts; /* packets sent via multicast */
u_int64_t ifi_iqdrops; /* dropped on input, this interface */
u_int64_t ifi_noproto; /* destined for unsupported protocol */
u_int32_t ifi_recvtiming; /* usec spent receiving when timing */
u_int32_t ifi_xmittiming; /* usec spent xmitting when timing */
struct IF_DATA_TIMEVAL ifi_lastchange; /* time of last administrative change */
};
#if defined (PRIVATE) || defined (DRIVERKIT_PRIVATE)
/*
* This structure is used to define the parameters for advisory notifications
* on an interface.
*/
#pragma pack(push, 1)
struct ifnet_interface_advisory {
/* The current structure version */
uint8_t version;
#define IF_INTERFACE_ADVISORY_VERSION_1 0x1
#define IF_INTERFACE_ADVISORY_VERSION_CURRENT IF_INTERFACE_ADVISORY_VERSION_1
/* Specifies if the advisory is for transmit or receive path */
uint8_t direction;
#define IF_INTERFACE_ADVISORY_DIRECTION_TX 0x1
#define IF_INTERFACE_ADVISORY_DIRECTION_RX 0x2
/* reserved for future use */
uint16_t _reserved;
/*
* suggestion for data rate change to keep the latency low.
* unit: bits per second (bps)
* NOTE: if the interface cannot provide suggestions in terms of bps,
* it should use the following values:
* INT32_MAX : ramp up
* INT32_MIN : ramp down
* 0 : neutral
*/
#define IF_INTERFACE_ADVISORY_RATE_SUGGESTION_RAMP_UP INT32_MAX
#define IF_INTERFACE_ADVISORY_RATE_SUGGESTION_RAMP_DOWN INT32_MIN
#define IF_INTERFACE_ADVISORY_RATE_SUGGESTION_RAMP_NEUTRAL 0
int32_t rate_trend_suggestion;
/*
* Time of the issue of advisory.
* Timestamp should be in the host domain.
* unit: mach absolute time
*/
uint64_t timestamp;
/*
* Maximum theoretical bandwidth of the interface.
* unit: bits per second (bps)
*/
uint64_t max_bandwidth;
/*
* Total bytes sent or received on the interface.
* wrap around possible and the application should account for that.
* unit: byte
*/
uint64_t total_byte_count;
/*
* average throughput observed at the driver stack.
* unit: bits per second (bps)
*/
uint64_t average_throughput;
/*
* flushable queue size at the driver.
* should be set to UINT32_MAX if not available.
* unit: byte
*/
uint32_t flushable_queue_size;
/*
* non flushable queue size at the driver.
* should be set to UINT32_MAX if not available.
* unit: byte
*/
uint32_t non_flushable_queue_size;
/*
* average delay observed at the interface.
* unit: milliseconds (ms)
*/
uint32_t average_delay;
/*
* Current frequency band (enumeration).
*/
#define IF_INTERFACE_ADVISORY_FREQ_BAND_NOT_AVAIL 0
#define IF_INTERFACE_ADVISORY_FREQ_BAND_WIFI_24GHZ 1
#define IF_INTERFACE_ADVISORY_FREQ_BAND_WIFI_5GHZ 2
#define IF_INTERFACE_ADVISORY_FREQ_BAND_WIFI_6GHZ 3
uint8_t frequency_band;
/*
* Intermittent WiFi state [true(1)/false(0)]
*/
uint8_t intermittent_state;
/*
* Estimated period for which intermittent state is expected to last.
* 1 tick -> 1 ms UNDEF => UINT16_MAX
*/
uint16_t estimated_intermittent_period;
/*
* Expected wifi outage period during intermittent state
* 1 tick -> 1 ms UNDEF => UINT16_MAX
*/
uint16_t single_outage_period;
/*
* WiFi-BT coexistence, 1-ON, 0-OFF
*/
uint8_t bt_coex;
/*
* on scale of 1 to 5
*/
uint8_t quality_score_delay;
/*
* on scale of 1 to 5
*/
uint8_t quality_score_loss;
/*
* on scale of 1 to 5
*/
uint8_t quality_score_channel;
} __attribute__((aligned(sizeof(uint64_t))));
#pragma pack(pop)
#else
struct ifnet_interface_advisory;
#endif /* defined (PRIVATE) || defined (DRIVERKIT_PRIVATE) */
#pragma pack()
/*
* Structure defining a queue for a network interface.
*/
struct ifqueue {
void *ifq_head;
void *ifq_tail;
int ifq_len;
int ifq_maxlen;
int ifq_drops;
};
#endif /* !_NET_IF_VAR_H_ */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/net/bpf.h | /*
* Copyright (c) 2000-2020 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Copyright (c) 1990, 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from the Stanford/CMU enet packet filter,
* (net/enet.c) distributed as part of 4.3BSD, and code contributed
* to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
* Berkeley Laboratory.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)bpf.h 8.1 (Berkeley) 6/10/93
* @(#)bpf.h 1.34 (LBL) 6/16/96
*
* $FreeBSD: src/sys/net/bpf.h,v 1.21.2.3 2001/08/01 00:23:13 fenner Exp $
*/
/*
* NOTICE: This file was modified by SPARTA, Inc. in 2006 to introduce
* support for mandatory and extensible security protections. This notice
* is included in support of clause 2.2 (b) of the Apple Public License,
* Version 2.0.
*/
#ifndef _NET_BPF_H_
#define _NET_BPF_H_
#include <stdint.h>
#include <sys/param.h>
#include <sys/appleapiopts.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/cdefs.h>
#include <sys/kernel_types.h>
#if !defined(__i386__) && !defined(__x86_64__)
#define BPF_ALIGN 1
#else /* defined(__i386__) || defined(__x86_64__) */
#define BPF_ALIGN 0
#endif /* defined(__i386__) || defined(__x86_64__) */
#if !BPF_ALIGN
#define EXTRACT_SHORT(p) ((u_int16_t)ntohs(*(u_int16_t *)(void *)p))
#define EXTRACT_LONG(p) (ntohl(*(u_int32_t *)(void *)p))
#else
#define EXTRACT_SHORT(p) \
((u_int16_t)\
((u_int16_t)*((u_char *)p+0)<<8|\
(u_int16_t)*((u_char *)p+1)<<0))
#define EXTRACT_LONG(p) \
((u_int32_t)*((u_char *)p+0)<<24|\
(u_int32_t)*((u_char *)p+1)<<16|\
(u_int32_t)*((u_char *)p+2)<<8|\
(u_int32_t)*((u_char *)p+3)<<0)
#endif
/* BSD style release date */
#define BPF_RELEASE 199606
typedef int32_t bpf_int32;
typedef u_int32_t bpf_u_int32;
/*
* Alignment macros. BPF_WORDALIGN rounds up to the next
* even multiple of BPF_ALIGNMENT.
*/
#define BPF_ALIGNMENT sizeof(int32_t)
#define BPF_WORDALIGN(x) (((x)+(BPF_ALIGNMENT-1))&~(BPF_ALIGNMENT-1))
#define BPF_MAXINSNS 512
#define BPF_MAXBUFSIZE 0x80000
#define BPF_MINBUFSIZE 32
/*
* Structure for BIOCSETF.
*/
struct bpf_program {
u_int bf_len;
struct bpf_insn *bf_insns;
};
/*
* Struct returned by BIOCGSTATS.
*/
struct bpf_stat {
u_int bs_recv; /* number of packets received */
u_int bs_drop; /* number of packets dropped */
};
/*
* Struct return by BIOCVERSION. This represents the version number of
* the filter language described by the instruction encodings below.
* bpf understands a program iff kernel_major == filter_major &&
* kernel_minor >= filter_minor, that is, if the value returned by the
* running kernel has the same major number and a minor number equal
* equal to or less than the filter being downloaded. Otherwise, the
* results are undefined, meaning an error may be returned or packets
* may be accepted haphazardly.
* It has nothing to do with the source code version.
*/
struct bpf_version {
u_short bv_major;
u_short bv_minor;
};
#if defined(__LP64__)
#include <sys/_types/_timeval32.h>
#define BPF_TIMEVAL timeval32
#else
#define BPF_TIMEVAL timeval
#endif /* __LP64__ */
/* Current version number of filter architecture. */
#define BPF_MAJOR_VERSION 1
#define BPF_MINOR_VERSION 1
#define BIOCGBLEN _IOR('B',102, u_int)
#define BIOCSBLEN _IOWR('B',102, u_int)
#define BIOCSETF _IOW('B',103, struct bpf_program)
#define BIOCFLUSH _IO('B',104)
#define BIOCPROMISC _IO('B',105)
#define BIOCGDLT _IOR('B',106, u_int)
#define BIOCGETIF _IOR('B',107, struct ifreq)
#define BIOCSETIF _IOW('B',108, struct ifreq)
#define BIOCSRTIMEOUT _IOW('B',109, struct timeval)
#define BIOCGRTIMEOUT _IOR('B',110, struct timeval)
#define BIOCGSTATS _IOR('B',111, struct bpf_stat)
#define BIOCIMMEDIATE _IOW('B',112, u_int)
#define BIOCVERSION _IOR('B',113, struct bpf_version)
#define BIOCGRSIG _IOR('B',114, u_int)
#define BIOCSRSIG _IOW('B',115, u_int)
#define BIOCGHDRCMPLT _IOR('B',116, u_int)
#define BIOCSHDRCMPLT _IOW('B',117, u_int)
#define BIOCGSEESENT _IOR('B',118, u_int)
#define BIOCSSEESENT _IOW('B',119, u_int)
#define BIOCSDLT _IOW('B',120, u_int)
#define BIOCGDLTLIST _IOWR('B',121, struct bpf_dltlist)
#define BIOCSETFNR _IOW('B', 126, struct bpf_program)
/*
* Structure prepended to each packet.
*/
struct bpf_hdr {
struct BPF_TIMEVAL bh_tstamp; /* time stamp */
bpf_u_int32 bh_caplen; /* length of captured portion */
bpf_u_int32 bh_datalen; /* original length of packet */
u_short bh_hdrlen; /* length of bpf header (this struct
* plus alignment padding) */
};
/*
* Because the structure above is not a multiple of 4 bytes, some compilers
* will insist on inserting padding; hence, sizeof(struct bpf_hdr) won't work.
* Only the kernel needs to know about it; applications use bh_hdrlen.
*/
#define SIZEOF_BPF_HDR (sizeof(struct bpf_hdr) <= 20 ? 18 : \
sizeof(struct bpf_hdr))
/*
* Data-link level type codes.
*/
#define DLT_NULL 0 /* no link-layer encapsulation */
#define DLT_EN10MB 1 /* Ethernet (10Mb) */
#define DLT_EN3MB 2 /* Experimental Ethernet (3Mb) */
#define DLT_AX25 3 /* Amateur Radio AX.25 */
#define DLT_PRONET 4 /* Proteon ProNET Token Ring */
#define DLT_CHAOS 5 /* Chaos */
#define DLT_IEEE802 6 /* IEEE 802 Networks */
#define DLT_ARCNET 7 /* ARCNET */
#define DLT_SLIP 8 /* Serial Line IP */
#define DLT_PPP 9 /* Point-to-point Protocol */
#define DLT_FDDI 10 /* FDDI */
#define DLT_ATM_RFC1483 11 /* LLC/SNAP encapsulated atm */
#define DLT_RAW 12 /* raw IP */
/*
* These are values from BSD/OS's "bpf.h".
* These are not the same as the values from the traditional libpcap
* "bpf.h"; however, these values shouldn't be generated by any
* OS other than BSD/OS, so the correct values to use here are the
* BSD/OS values.
*
* Platforms that have already assigned these values to other
* DLT_ codes, however, should give these codes the values
* from that platform, so that programs that use these codes will
* continue to compile - even though they won't correctly read
* files of these types.
*/
#define DLT_SLIP_BSDOS 15 /* BSD/OS Serial Line IP */
#define DLT_PPP_BSDOS 16 /* BSD/OS Point-to-point Protocol */
/*
* 17 was used for DLT_PFLOG in OpenBSD; it no longer is.
*
* It was DLT_LANE8023 in SuSE 6.3, so we defined LINKTYPE_PFLOG
* as 117 so that pflog captures would use a link-layer header type
* value that didn't collide with any other values. On all
* platforms other than OpenBSD, we defined DLT_PFLOG as 117,
* and we mapped between LINKTYPE_PFLOG and DLT_PFLOG.
*
* OpenBSD eventually switched to using 117 for DLT_PFLOG as well.
*
* Don't use 17 for anything else.
*/
/*
* 18 is used for DLT_PFSYNC in OpenBSD, NetBSD, DragonFly BSD and
* Mac OS X; don't use it for anything else. (FreeBSD uses 121,
* which collides with DLT_HHDLC, even though it doesn't use 18
* for anything and doesn't appear to have ever used it for anything.)
*
* We define it as 18 on those platforms; it is, unfortunately, used
* for DLT_CIP in Suse 6.3, so we don't define it as DLT_PFSYNC
* in general. As the packet format for it, like that for
* DLT_PFLOG, is not only OS-dependent but OS-version-dependent,
* we don't support printing it in tcpdump except on OSes that
* have the relevant header files, so it's not that useful on
* other platforms.
*/
#define DLT_PFSYNC 18 /* Packet filter state syncing */
#define DLT_ATM_CLIP 19 /* Linux Classical-IP over ATM */
/*
* These values are defined by NetBSD; other platforms should refrain from
* using them for other purposes, so that NetBSD savefiles with link
* types of 50 or 51 can be read as this type on all platforms.
*/
#define DLT_PPP_SERIAL 50 /* PPP over serial with HDLC encapsulation */
#define DLT_PPP_ETHER 51 /* PPP over Ethernet */
/*
* The Axent Raptor firewall - now the Symantec Enterprise Firewall - uses
* a link-layer type of 99 for the tcpdump it supplies. The link-layer
* header has 6 bytes of unknown data, something that appears to be an
* Ethernet type, and 36 bytes that appear to be 0 in at least one capture
* I've seen.
*/
#define DLT_SYMANTEC_FIREWALL 99
/*
* Values between 100 and 103 are used in capture file headers as
* link-layer header type LINKTYPE_ values corresponding to DLT_ types
* that differ between platforms; don't use those values for new DLT_
* new types.
*/
/*
* Values starting with 104 are used for newly-assigned link-layer
* header type values; for those link-layer header types, the DLT_
* value returned by pcap_datalink() and passed to pcap_open_dead(),
* and the LINKTYPE_ value that appears in capture files, are the
* same.
*
* DLT_MATCHING_MIN is the lowest such value; DLT_MATCHING_MAX is
* the highest such value.
*/
#define DLT_MATCHING_MIN 104
/*
* This value was defined by libpcap 0.5; platforms that have defined
* it with a different value should define it here with that value -
* a link type of 104 in a save file will be mapped to DLT_C_HDLC,
* whatever value that happens to be, so programs will correctly
* handle files with that link type regardless of the value of
* DLT_C_HDLC.
*
* The name DLT_C_HDLC was used by BSD/OS; we use that name for source
* compatibility with programs written for BSD/OS.
*
* libpcap 0.5 defined it as DLT_CHDLC; we define DLT_CHDLC as well,
* for source compatibility with programs written for libpcap 0.5.
*/
#define DLT_C_HDLC 104 /* Cisco HDLC */
#define DLT_CHDLC DLT_C_HDLC
#define DLT_IEEE802_11 105 /* IEEE 802.11 wireless */
/*
* Values between 106 and 107 are used in capture file headers as
* link-layer types corresponding to DLT_ types that might differ
* between platforms; don't use those values for new DLT_ new types.
*/
/*
* Frame Relay; BSD/OS has a DLT_FR with a value of 11, but that collides
* with other values.
* DLT_FR and DLT_FRELAY packets start with the Q.922 Frame Relay header
* (DLCI, etc.).
*/
#define DLT_FRELAY 107
/*
* OpenBSD DLT_LOOP, for loopback devices; it's like DLT_NULL, except
* that the AF_ type in the link-layer header is in network byte order.
*
* OpenBSD defines it as 12, but that collides with DLT_RAW, so we
* define it as 108 here. If OpenBSD picks up this file, it should
* define DLT_LOOP as 12 in its version, as per the comment above -
* and should not use 108 for any purpose.
*/
#define DLT_LOOP 108
/*
* Values between 109 and 112 are used in capture file headers as
* link-layer types corresponding to DLT_ types that might differ
* between platforms; don't use those values for new DLT_ new types.
*/
/*
* Encapsulated packets for IPsec; DLT_ENC is 13 in OpenBSD, but that's
* DLT_SLIP_BSDOS in NetBSD, so we don't use 13 for it in OSes other
* than OpenBSD.
*/
#define DLT_ENC 109
/*
* This is for Linux cooked sockets.
*/
#define DLT_LINUX_SLL 113
/*
* Apple LocalTalk hardware.
*/
#define DLT_LTALK 114
/*
* Acorn Econet.
*/
#define DLT_ECONET 115
/*
* Reserved for use with OpenBSD ipfilter.
*/
#define DLT_IPFILTER 116
/*
* For use in capture-file headers as a link-layer type corresponding
* to OpenBSD PF (Packet Filter) log.
*/
#define DLT_PFLOG 117
/*
* Registered for Cisco-internal use.
*/
#define DLT_CISCO_IOS 118
/*
* Reserved for 802.11 cards using the Prism II chips, with a link-layer
* header including Prism monitor mode information plus an 802.11
* header.
*/
#define DLT_PRISM_HEADER 119
/*
* Reserved for Aironet 802.11 cards, with an Aironet link-layer header
* (see Doug Ambrisko's FreeBSD patches).
*/
#define DLT_AIRONET_HEADER 120
/*
* Reserved for Siemens HiPath HDLC. XXX
*/
#define DLT_HHDLC 121
/*
* Reserved for RFC 2625 IP-over-Fibre Channel.
*/
#define DLT_IP_OVER_FC 122
/*
* Reserved for Full Frontal ATM on Solaris.
*/
#define DLT_SUNATM 123
/*
* Reserved as per request from Kent Dahlgren <[email protected]>
* for private use.
*/
#define DLT_RIO 124 /* RapidIO */
#define DLT_PCI_EXP 125 /* PCI Express */
#define DLT_AURORA 126 /* Xilinx Aurora link layer */
/*
* BSD header for 802.11 plus a number of bits of link-layer information
* including radio information.
*/
#ifndef DLT_IEEE802_11_RADIO
#define DLT_IEEE802_11_RADIO 127
#endif
/*
* Reserved for TZSP encapsulation.
*/
#define DLT_TZSP 128 /* Tazmen Sniffer Protocol */
/*
* Reserved for Linux ARCNET.
*/
#define DLT_ARCNET_LINUX 129
/*
* Juniper-private data link types.
*/
#define DLT_JUNIPER_MLPPP 130
#define DLT_JUNIPER_MLFR 131
#define DLT_JUNIPER_ES 132
#define DLT_JUNIPER_GGSN 133
#define DLT_JUNIPER_MFR 134
#define DLT_JUNIPER_ATM2 135
#define DLT_JUNIPER_SERVICES 136
#define DLT_JUNIPER_ATM1 137
/*
* Apple IP-over-IEEE 1394, as per a request from Dieter Siegmund
* <[email protected]>. The header that's presented is an Ethernet-like
* header:
*
* #define FIREWIRE_EUI64_LEN 8
* struct firewire_header {
* u_char firewire_dhost[FIREWIRE_EUI64_LEN];
* u_char firewire_shost[FIREWIRE_EUI64_LEN];
* u_short firewire_type;
* };
*
* with "firewire_type" being an Ethernet type value, rather than,
* for example, raw GASP frames being handed up.
*/
#define DLT_APPLE_IP_OVER_IEEE1394 138
/*
* Various SS7 encapsulations, as per a request from Jeff Morriss
* <jeff.morriss[AT]ulticom.com> and subsequent discussions.
*/
#define DLT_MTP2_WITH_PHDR 139 /* pseudo-header with various info, followed by MTP2 */
#define DLT_MTP2 140 /* MTP2, without pseudo-header */
#define DLT_MTP3 141 /* MTP3, without pseudo-header or MTP2 */
#define DLT_SCCP 142 /* SCCP, without pseudo-header or MTP2 or MTP3 */
/*
* Reserved for DOCSIS.
*/
#define DLT_DOCSIS 143
/*
* Reserved for Linux IrDA.
*/
#define DLT_LINUX_IRDA 144
/*
* Reserved for IBM SP switch and IBM Next Federation switch.
*/
#define DLT_IBM_SP 145
#define DLT_IBM_SN 146
/*
* Reserved for private use. If you have some link-layer header type
* that you want to use within your organization, with the capture files
* using that link-layer header type not ever be sent outside your
* organization, you can use these values.
*
* No libpcap release will use these for any purpose, nor will any
* tcpdump release use them, either.
*
* Do *NOT* use these in capture files that you expect anybody not using
* your private versions of capture-file-reading tools to read; in
* particular, do *NOT* use them in products, otherwise you may find that
* people won't be able to use tcpdump, or snort, or Ethereal, or... to
* read capture files from your firewall/intrusion detection/traffic
* monitoring/etc. appliance, or whatever product uses that DLT_ value,
* and you may also find that the developers of those applications will
* not accept patches to let them read those files.
*
* Also, do not use them if somebody might send you a capture using them
* for *their* private type and tools using them for *your* private type
* would have to read them.
*
* Instead, ask "[email protected]" for a new DLT_ value,
* as per the comment above, and use the type you're given.
*/
#define DLT_USER0 147
#define DLT_USER1 148
#define DLT_USER2 149
#define DLT_USER3 150
#define DLT_USER4 151
#define DLT_USER5 152
#define DLT_USER6 153
#define DLT_USER7 154
#define DLT_USER8 155
#define DLT_USER9 156
#define DLT_USER10 157
#define DLT_USER11 158
#define DLT_USER12 159
#define DLT_USER13 160
#define DLT_USER14 161
#define DLT_USER15 162
/*
* For future use with 802.11 captures - defined by AbsoluteValue
* Systems to store a number of bits of link-layer information
* including radio information:
*
* http://www.shaftnet.org/~pizza/software/capturefrm.txt
*
* but it might be used by some non-AVS drivers now or in the
* future.
*/
#define DLT_IEEE802_11_RADIO_AVS 163 /* 802.11 plus AVS radio header */
/*
* Juniper-private data link type, as per request from
* Hannes Gredler <[email protected]>. The DLT_s are used
* for passing on chassis-internal metainformation such as
* QOS profiles, etc..
*/
#define DLT_JUNIPER_MONITOR 164
/*
* Reserved for BACnet MS/TP.
*/
#define DLT_BACNET_MS_TP 165
/*
* Another PPP variant as per request from Karsten Keil <[email protected]>.
*
* This is used in some OSes to allow a kernel socket filter to distinguish
* between incoming and outgoing packets, on a socket intended to
* supply pppd with outgoing packets so it can do dial-on-demand and
* hangup-on-lack-of-demand; incoming packets are filtered out so they
* don't cause pppd to hold the connection up (you don't want random
* input packets such as port scans, packets from old lost connections,
* etc. to force the connection to stay up).
*
* The first byte of the PPP header (0xff03) is modified to accomodate
* the direction - 0x00 = IN, 0x01 = OUT.
*/
#define DLT_PPP_PPPD 166
/*
* Names for backwards compatibility with older versions of some PPP
* software; new software should use DLT_PPP_PPPD.
*/
#define DLT_PPP_WITH_DIRECTION DLT_PPP_PPPD
#define DLT_LINUX_PPP_WITHDIRECTION DLT_PPP_PPPD
/*
* Juniper-private data link type, as per request from
* Hannes Gredler <[email protected]>. The DLT_s are used
* for passing on chassis-internal metainformation such as
* QOS profiles, cookies, etc..
*/
#define DLT_JUNIPER_PPPOE 167
#define DLT_JUNIPER_PPPOE_ATM 168
#define DLT_GPRS_LLC 169 /* GPRS LLC */
#define DLT_GPF_T 170 /* GPF-T (ITU-T G.7041/Y.1303) */
#define DLT_GPF_F 171 /* GPF-F (ITU-T G.7041/Y.1303) */
/*
* Requested by Oolan Zimmer <[email protected]> for use in Gcom's T1/E1 line
* monitoring equipment.
*/
#define DLT_GCOM_T1E1 172
#define DLT_GCOM_SERIAL 173
/*
* Juniper-private data link type, as per request from
* Hannes Gredler <[email protected]>. The DLT_ is used
* for internal communication to Physical Interface Cards (PIC)
*/
#define DLT_JUNIPER_PIC_PEER 174
/*
* Link types requested by Gregor Maier <[email protected]> of Endace
* Measurement Systems. They add an ERF header (see
* http://www.endace.com/support/EndaceRecordFormat.pdf) in front of
* the link-layer header.
*/
#define DLT_ERF_ETH 175 /* Ethernet */
#define DLT_ERF_POS 176 /* Packet-over-SONET */
/*
* Requested by Daniele Orlandi <[email protected]> for raw LAPD
* for vISDN (http://www.orlandi.com/visdn/). Its link-layer header
* includes additional information before the LAPD header, so it's
* not necessarily a generic LAPD header.
*/
#define DLT_LINUX_LAPD 177
/*
* Juniper-private data link type, as per request from
* Hannes Gredler <[email protected]>.
* The DLT_ are used for prepending meta-information
* like interface index, interface name
* before standard Ethernet, PPP, Frelay & C-HDLC Frames
*/
#define DLT_JUNIPER_ETHER 178
#define DLT_JUNIPER_PPP 179
#define DLT_JUNIPER_FRELAY 180
#define DLT_JUNIPER_CHDLC 181
/*
* Multi Link Frame Relay (FRF.16)
*/
#define DLT_MFR 182
/*
* Juniper-private data link type, as per request from
* Hannes Gredler <[email protected]>.
* The DLT_ is used for internal communication with a
* voice Adapter Card (PIC)
*/
#define DLT_JUNIPER_VP 183
/*
* Arinc 429 frames.
* DLT_ requested by Gianluca Varenni <[email protected]>.
* Every frame contains a 32bit A429 label.
* More documentation on Arinc 429 can be found at
* http://www.condoreng.com/support/downloads/tutorials/ARINCTutorial.pdf
*/
#define DLT_A429 184
/*
* Arinc 653 Interpartition Communication messages.
* DLT_ requested by Gianluca Varenni <[email protected]>.
* Please refer to the A653-1 standard for more information.
*/
#define DLT_A653_ICM 185
/*
* USB packets, beginning with a USB setup header; requested by
* Paolo Abeni <[email protected]>.
*/
#define DLT_USB 186
/*
* Bluetooth HCI UART transport layer (part H:4); requested by
* Paolo Abeni.
*/
#define DLT_BLUETOOTH_HCI_H4 187
/*
* IEEE 802.16 MAC Common Part Sublayer; requested by Maria Cruz
* <[email protected]>.
*/
#define DLT_IEEE802_16_MAC_CPS 188
/*
* USB packets, beginning with a Linux USB header; requested by
* Paolo Abeni <[email protected]>.
*/
#define DLT_USB_LINUX 189
/*
* Controller Area Network (CAN) v. 2.0B packets.
* DLT_ requested by Gianluca Varenni <[email protected]>.
* Used to dump CAN packets coming from a CAN Vector board.
* More documentation on the CAN v2.0B frames can be found at
* http://www.can-cia.org/downloads/?269
*/
#define DLT_CAN20B 190
/*
* IEEE 802.15.4, with address fields padded, as is done by Linux
* drivers; requested by Juergen Schimmer.
*/
#define DLT_IEEE802_15_4_LINUX 191
/*
* Per Packet Information encapsulated packets.
* DLT_ requested by Gianluca Varenni <[email protected]>.
*/
#define DLT_PPI 192
/*
* Header for 802.16 MAC Common Part Sublayer plus a radiotap radio header;
* requested by Charles Clancy.
*/
#define DLT_IEEE802_16_MAC_CPS_RADIO 193
/*
* Juniper-private data link type, as per request from
* Hannes Gredler <[email protected]>.
* The DLT_ is used for internal communication with a
* integrated service module (ISM).
*/
#define DLT_JUNIPER_ISM 194
/*
* IEEE 802.15.4, exactly as it appears in the spec (no padding, no
* nothing); requested by Mikko Saarnivala <[email protected]>.
*/
#define DLT_IEEE802_15_4 195
/*
* Various link-layer types, with a pseudo-header, for SITA
* (http://www.sita.aero/); requested by Fulko Hew ([email protected]).
*/
#define DLT_SITA 196
/*
* Various link-layer types, with a pseudo-header, for Endace DAG cards;
* encapsulates Endace ERF records. Requested by Stephen Donnelly
* <[email protected]>.
*/
#define DLT_ERF 197
/*
* Special header prepended to Ethernet packets when capturing from a
* u10 Networks board. Requested by Phil Mulholland
* <[email protected]>.
*/
#define DLT_RAIF1 198
/*
* IPMB packet for IPMI, beginning with the I2C slave address, followed
* by the netFn and LUN, etc.. Requested by Chanthy Toeung
* <[email protected]>.
*/
#define DLT_IPMB 199
/*
* Juniper-private data link type, as per request from
* Hannes Gredler <[email protected]>.
* The DLT_ is used for capturing data on a secure tunnel interface.
*/
#define DLT_JUNIPER_ST 200
/*
* Bluetooth HCI UART transport layer (part H:4), with pseudo-header
* that includes direction information; requested by Paolo Abeni.
*/
#define DLT_BLUETOOTH_HCI_H4_WITH_PHDR 201
/*
* AX.25 packet with a 1-byte KISS header; see
*
* http://www.ax25.net/kiss.htm
*
* as per Richard Stearn <[email protected]>.
*/
#define DLT_AX25_KISS 202
/*
* LAPD packets from an ISDN channel, starting with the address field,
* with no pseudo-header.
* Requested by Varuna De Silva <[email protected]>.
*/
#define DLT_LAPD 203
/*
* Variants of various link-layer headers, with a one-byte direction
* pseudo-header prepended - zero means "received by this host",
* non-zero (any non-zero value) means "sent by this host" - as per
* Will Barker <[email protected]>.
*/
#define DLT_PPP_WITH_DIR 204 /* PPP - don't confuse with DLT_PPP_WITH_DIRECTION */
#define DLT_C_HDLC_WITH_DIR 205 /* Cisco HDLC */
#define DLT_FRELAY_WITH_DIR 206 /* Frame Relay */
#define DLT_LAPB_WITH_DIR 207 /* LAPB */
/*
* 208 is reserved for an as-yet-unspecified proprietary link-layer
* type, as requested by Will Barker.
*/
/*
* IPMB with a Linux-specific pseudo-header; as requested by Alexey Neyman
* <[email protected]>.
*/
#define DLT_IPMB_LINUX 209
/*
* FlexRay automotive bus - http://www.flexray.com/ - as requested
* by Hannes Kaelber <[email protected]>.
*/
#define DLT_FLEXRAY 210
/*
* Media Oriented Systems Transport (MOST) bus for multimedia
* transport - http://www.mostcooperation.com/ - as requested
* by Hannes Kaelber <[email protected]>.
*/
#define DLT_MOST 211
/*
* Local Interconnect Network (LIN) bus for vehicle networks -
* http://www.lin-subbus.org/ - as requested by Hannes Kaelber
* <[email protected]>.
*/
#define DLT_LIN 212
/*
* X2E-private data link type used for serial line capture,
* as requested by Hannes Kaelber <[email protected]>.
*/
#define DLT_X2E_SERIAL 213
/*
* X2E-private data link type used for the Xoraya data logger
* family, as requested by Hannes Kaelber <[email protected]>.
*/
#define DLT_X2E_XORAYA 214
/*
* IEEE 802.15.4, exactly as it appears in the spec (no padding, no
* nothing), but with the PHY-level data for non-ASK PHYs (4 octets
* of 0 as preamble, one octet of SFD, one octet of frame length+
* reserved bit, and then the MAC-layer data, starting with the
* frame control field).
*
* Requested by Max Filippov <[email protected]>.
*/
#define DLT_IEEE802_15_4_NONASK_PHY 215
/*
* David Gibson <[email protected]> requested this for
* captures from the Linux kernel /dev/input/eventN devices. This
* is used to communicate keystrokes and mouse movements from the
* Linux kernel to display systems, such as Xorg.
*/
#define DLT_LINUX_EVDEV 216
/*
* GSM Um and Abis interfaces, preceded by a "gsmtap" header.
*
* Requested by Harald Welte <[email protected]>.
*/
#define DLT_GSMTAP_UM 217
#define DLT_GSMTAP_ABIS 218
/*
* MPLS, with an MPLS label as the link-layer header.
* Requested by Michele Marchetto <[email protected]> on behalf
* of OpenBSD.
*/
#define DLT_MPLS 219
/*
* USB packets, beginning with a Linux USB header, with the USB header
* padded to 64 bytes; required for memory-mapped access.
*/
#define DLT_USB_LINUX_MMAPPED 220
/*
* DECT packets, with a pseudo-header; requested by
* Matthias Wenzel <[email protected]>.
*/
#define DLT_DECT 221
/*
* From: "Lidwa, Eric (GSFC-582.0)[SGT INC]" <[email protected]>
* Date: Mon, 11 May 2009 11:18:30 -0500
*
* DLT_AOS. We need it for AOS Space Data Link Protocol.
* I have already written dissectors for but need an OK from
* legal before I can submit a patch.
*
*/
#define DLT_AOS 222
/*
* Wireless HART (Highway Addressable Remote Transducer)
* From the HART Communication Foundation
* IES/PAS 62591
*
* Requested by Sam Roberts <[email protected]>.
*/
#define DLT_WIHART 223
/*
* Fibre Channel FC-2 frames, beginning with a Frame_Header.
* Requested by Kahou Lei <[email protected]>.
*/
#define DLT_FC_2 224
/*
* Fibre Channel FC-2 frames, beginning with an encoding of the
* SOF, and ending with an encoding of the EOF.
*
* The encodings represent the frame delimiters as 4-byte sequences
* representing the corresponding ordered sets, with K28.5
* represented as 0xBC, and the D symbols as the corresponding
* byte values; for example, SOFi2, which is K28.5 - D21.5 - D1.2 - D21.2,
* is represented as 0xBC 0xB5 0x55 0x55.
*
* Requested by Kahou Lei <[email protected]>.
*/
#define DLT_FC_2_WITH_FRAME_DELIMS 225
/*
* Solaris ipnet pseudo-header; requested by Darren Reed <[email protected]>.
*
* The pseudo-header starts with a one-byte version number; for version 2,
* the pseudo-header is:
*
* struct dl_ipnetinfo {
* u_int8_t dli_version;
* u_int8_t dli_family;
* u_int16_t dli_htype;
* u_int32_t dli_pktlen;
* u_int32_t dli_ifindex;
* u_int32_t dli_grifindex;
* u_int32_t dli_zsrc;
* u_int32_t dli_zdst;
* };
*
* dli_version is 2 for the current version of the pseudo-header.
*
* dli_family is a Solaris address family value, so it's 2 for IPv4
* and 26 for IPv6.
*
* dli_htype is a "hook type" - 0 for incoming packets, 1 for outgoing
* packets, and 2 for packets arriving from another zone on the same
* machine.
*
* dli_pktlen is the length of the packet data following the pseudo-header
* (so the captured length minus dli_pktlen is the length of the
* pseudo-header, assuming the entire pseudo-header was captured).
*
* dli_ifindex is the interface index of the interface on which the
* packet arrived.
*
* dli_grifindex is the group interface index number (for IPMP interfaces).
*
* dli_zsrc is the zone identifier for the source of the packet.
*
* dli_zdst is the zone identifier for the destination of the packet.
*
* A zone number of 0 is the global zone; a zone number of 0xffffffff
* means that the packet arrived from another host on the network, not
* from another zone on the same machine.
*
* An IPv4 or IPv6 datagram follows the pseudo-header; dli_family indicates
* which of those it is.
*/
#define DLT_IPNET 226
/*
* CAN (Controller Area Network) frames, with a pseudo-header as supplied
* by Linux SocketCAN. See Documentation/networking/can.txt in the Linux
* source.
*
* Requested by Felix Obenhuber <[email protected]>.
*/
#define DLT_CAN_SOCKETCAN 227
/*
* Raw IPv4/IPv6; different from DLT_RAW in that the DLT_ value specifies
* whether it's v4 or v6. Requested by Darren Reed <[email protected]>.
*/
#define DLT_IPV4 228
#define DLT_IPV6 229
/*
* IEEE 802.15.4, exactly as it appears in the spec (no padding, no
* nothing), and with no FCS at the end of the frame; requested by
* Jon Smirl <[email protected]>.
*/
#define DLT_IEEE802_15_4_NOFCS 230
/*
* Raw D-Bus:
*
* http://www.freedesktop.org/wiki/Software/dbus
*
* messages:
*
* http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-messages
*
* starting with the endianness flag, followed by the message type, etc.,
* but without the authentication handshake before the message sequence:
*
* http://dbus.freedesktop.org/doc/dbus-specification.html#auth-protocol
*
* Requested by Martin Vidner <[email protected]>.
*/
#define DLT_DBUS 231
/*
* Juniper-private data link type, as per request from
* Hannes Gredler <[email protected]>.
*/
#define DLT_JUNIPER_VS 232
#define DLT_JUNIPER_SRX_E2E 233
#define DLT_JUNIPER_FIBRECHANNEL 234
/*
* DVB-CI (DVB Common Interface for communication between a PC Card
* module and a DVB receiver). See
*
* http://www.kaiser.cx/pcap-dvbci.html
*
* for the specification.
*
* Requested by Martin Kaiser <[email protected]>.
*/
#define DLT_DVB_CI 235
/*
* Variant of 3GPP TS 27.010 multiplexing protocol (similar to, but
* *not* the same as, 27.010). Requested by Hans-Christoph Schemmel
* <[email protected]>.
*/
#define DLT_MUX27010 236
/*
* STANAG 5066 D_PDUs. Requested by M. Baris Demiray
* <[email protected]>.
*/
#define DLT_STANAG_5066_D_PDU 237
/*
* Juniper-private data link type, as per request from
* Hannes Gredler <[email protected]>.
*/
#define DLT_JUNIPER_ATM_CEMIC 238
/*
* NetFilter LOG messages
* (payload of netlink NFNL_SUBSYS_ULOG/NFULNL_MSG_PACKET packets)
*
* Requested by Jakub Zawadzki <[email protected]>
*/
#define DLT_NFLOG 239
/*
* Hilscher Gesellschaft fuer Systemautomation mbH link-layer type
* for Ethernet packets with a 4-byte pseudo-header and always
* with the payload including the FCS, as supplied by their
* netANALYZER hardware and software.
*
* Requested by Holger P. Frommer <[email protected]>
*/
#define DLT_NETANALYZER 240
/*
* Hilscher Gesellschaft fuer Systemautomation mbH link-layer type
* for Ethernet packets with a 4-byte pseudo-header and FCS and
* with the Ethernet header preceded by 7 bytes of preamble and
* 1 byte of SFD, as supplied by their netANALYZER hardware and
* software.
*
* Requested by Holger P. Frommer <[email protected]>
*/
#define DLT_NETANALYZER_TRANSPARENT 241
/*
* IP-over-Infiniband, as specified by RFC 4391.
*
* Requested by Petr Sumbera <[email protected]>.
*/
#define DLT_IPOIB 242
/*
* MPEG-2 transport stream (ISO 13818-1/ITU-T H.222.0).
*
* Requested by Guy Martin <[email protected]>.
*/
#define DLT_MPEG_2_TS 243
/*
* ng4T GmbH's UMTS Iub/Iur-over-ATM and Iub/Iur-over-IP format as
* used by their ng40 protocol tester.
*
* Requested by Jens Grimmer <[email protected]>.
*/
#define DLT_NG40 244
/*
* Pseudo-header giving adapter number and flags, followed by an NFC
* (Near-Field Communications) Logical Link Control Protocol (LLCP) PDU,
* as specified by NFC Forum Logical Link Control Protocol Technical
* Specification LLCP 1.1.
*
* Requested by Mike Wakerly <[email protected]>.
*/
#define DLT_NFC_LLCP 245
/*
* USB packets, beginning with a Darwin (macOS, etc.) USB header.
*/
#define DLT_USB_DARWIN 266
#define DLT_MATCHING_MAX 266 /* highest value in the "matching" range */
/*
* The instruction encodings.
*/
/* instruction classes */
#define BPF_CLASS(code) ((code) & 0x07)
#define BPF_LD 0x00
#define BPF_LDX 0x01
#define BPF_ST 0x02
#define BPF_STX 0x03
#define BPF_ALU 0x04
#define BPF_JMP 0x05
#define BPF_RET 0x06
#define BPF_MISC 0x07
/* ld/ldx fields */
#define BPF_SIZE(code) ((code) & 0x18)
#define BPF_W 0x00
#define BPF_H 0x08
#define BPF_B 0x10
#define BPF_MODE(code) ((code) & 0xe0)
#define BPF_IMM 0x00
#define BPF_ABS 0x20
#define BPF_IND 0x40
#define BPF_MEM 0x60
#define BPF_LEN 0x80
#define BPF_MSH 0xa0
/* alu/jmp fields */
#define BPF_OP(code) ((code) & 0xf0)
#define BPF_ADD 0x00
#define BPF_SUB 0x10
#define BPF_MUL 0x20
#define BPF_DIV 0x30
#define BPF_OR 0x40
#define BPF_AND 0x50
#define BPF_LSH 0x60
#define BPF_RSH 0x70
#define BPF_NEG 0x80
#define BPF_JA 0x00
#define BPF_JEQ 0x10
#define BPF_JGT 0x20
#define BPF_JGE 0x30
#define BPF_JSET 0x40
#define BPF_SRC(code) ((code) & 0x08)
#define BPF_K 0x00
#define BPF_X 0x08
/* ret - BPF_K and BPF_X also apply */
#define BPF_RVAL(code) ((code) & 0x18)
#define BPF_A 0x10
/* misc */
#define BPF_MISCOP(code) ((code) & 0xf8)
#define BPF_TAX 0x00
#define BPF_TXA 0x80
/*
* Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST).
*/
#define BPF_MEMWORDS 16
/*
* The instruction data structure.
*/
struct bpf_insn {
u_short code;
u_char jt;
u_char jf;
bpf_u_int32 k;
};
/*
* Macros for insn array initializers.
*/
#define BPF_STMT(code, k) { (u_short)(code), 0, 0, k }
#define BPF_JUMP(code, k, jt, jf) { (u_short)(code), jt, jf, k }
#pragma pack(4)
/*
* Structure to retrieve available DLTs for the interface.
*/
struct bpf_dltlist {
u_int32_t bfl_len; /* number of bfd_list array */
union {
u_int32_t *bflu_list; /* array of DLTs */
u_int64_t bflu_pad;
} bfl_u;
};
#define bfl_list bfl_u.bflu_list
#pragma pack()
#ifndef BPF_TAP_MODE_T
#define BPF_TAP_MODE_T
/*!
* @enum BPF tap mode
* @abstract Constants defining interface families.
* @constant BPF_MODE_DISABLED Disable bpf.
* @constant BPF_MODE_INPUT Enable input only.
* @constant BPF_MODE_OUTPUT Enable output only.
* @constant BPF_MODE_INPUT_OUTPUT Enable input and output.
*/
enum {
BPF_MODE_DISABLED = 0,
BPF_MODE_INPUT = 1,
BPF_MODE_OUTPUT = 2,
BPF_MODE_INPUT_OUTPUT = 3
};
/*!
* @typedef bpf_tap_mode
* @abstract Mode for tapping. BPF_MODE_DISABLED/BPF_MODE_INPUT_OUTPUT etc.
*/
typedef uint32_t bpf_tap_mode;
#endif /* !BPF_TAP_MODE_T */
/*!
* @typedef bpf_send_func
* @discussion bpf_send_func is called when a bpf file descriptor is
* used to send a raw packet on the interface. The mbuf and data
* link type are specified. The callback is responsible for
* releasing the mbuf whether or not it returns an error.
* @param interface The interface the packet is being sent on.
* @param data_link_type The data link type the bpf device is attached to.
* @param packet The packet to be sent.
*/
typedef errno_t (*bpf_send_func)(ifnet_t interface, u_int32_t data_link_type,
mbuf_t packet);
/*!
* @typedef bpf_tap_func
* @discussion bpf_tap_func is called when the tap state of the
* interface changes. This happens when a bpf device attaches to an
* interface or detaches from an interface. The tap mode will join
* together (bit or) the modes of all bpf devices using that
* interface for that dlt. If you return an error from this
* function, the bpf device attach attempt that triggered the tap
* will fail. If this function was called bacuse the tap state was
* decreasing (tap in or out is stopping), the error will be
* ignored.
* @param interface The interface being tapped.
* @param data_link_type The data link type being tapped.
* @param direction The direction of the tap.
*/
typedef errno_t (*bpf_tap_func)(ifnet_t interface, u_int32_t data_link_type,
bpf_tap_mode direction);
/*!
* @function bpfattach
* @discussion Registers an interface with BPF. This allows bpf devices
* to attach to your interface to capture packets. Your interface
* will be unregistered automatically when your interface is
* detached.
* @param interface The interface to register with BPF.
* @param data_link_type The data link type of the interface. See the
* DLT_* defines in bpf.h.
* @param header_length The length, in bytes, of the data link header.
*/
extern void bpfattach(ifnet_t interface, u_int data_link_type,
u_int header_length);
/*!
* @function bpf_attach
* @discussion Registers an interface with BPF. This allows bpf devices
* to attach to your interface to capture and transmit packets.
* Your interface will be unregistered automatically when your
* interface is detached. You may register multiple times with
* different data link types. An 802.11 interface would use this to
* allow clients to pick whether they want just an ethernet style
* frame or the 802.11 wireless headers as well. The first dlt you
* register will be considered the default. Any bpf device attaches
* that do not specify a data link type will use the default.
* @param interface The interface to register with BPF.
* @param data_link_type The data link type of the interface. See the
* DLT_* defines in bpf.h.
* @param header_length The length, in bytes, of the data link header.
* @param send See the bpf_send_func described above.
* @param tap See the bpf_tap_func described above.
*/
extern errno_t bpf_attach(ifnet_t interface, u_int32_t data_link_type,
u_int32_t header_length, bpf_send_func send, bpf_tap_func tap);
/*!
* @function bpf_tap_in
* @discussion Call this function when your interface receives a
* packet. This function will check if any bpf devices need a
* a copy of the packet.
* @param interface The interface the packet was received on.
* @param dlt The data link type of the packet.
* @param packet The packet received.
* @param header An optional pointer to a header that will be prepended.
* @param header_len If the header was specified, the length of the header.
*/
extern void bpf_tap_in(ifnet_t interface, u_int32_t dlt, mbuf_t packet,
void *header, size_t header_len);
/*!
* @function bpf_tap_out
* @discussion Call this function when your interface transmits a
* packet. This function will check if any bpf devices need a
* a copy of the packet.
* @param interface The interface the packet was or will be transmitted on.
* @param dlt The data link type of the packet.
* @param packet The packet received.
* @param header An optional pointer to a header that will be prepended.
* @param header_len If the header was specified, the length of the header.
*/
extern void bpf_tap_out(ifnet_t interface, u_int32_t dlt, mbuf_t packet,
void *header, size_t header_len);
#endif /* _NET_BPF_H_ */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/default_pager/default_pager_types.h | /*
* Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
#ifndef _MACH_DEFAULT_PAGER_TYPES_H_
#define _MACH_DEFAULT_PAGER_TYPES_H_
#include <sys/appleapiopts.h>
#ifdef __APPLE_API_UNSTABLE
#include <mach/mach_types.h>
#include <mach/machine/vm_types.h>
#include <mach/memory_object_types.h>
#define HI_WAT_ALERT 0x01
#define LO_WAT_ALERT 0x02
#define SWAP_ENCRYPT_ON 0x04
#define SWAP_ENCRYPT_OFF 0x08
#define SWAP_COMPACT_DISABLE 0x10
#define SWAP_COMPACT_ENABLE 0x20
#define PROC_RESUME 0x40
#define SWAP_FILE_CREATION_ERROR 0x80
#define USE_EMERGENCY_SWAP_FILE_FIRST 0x100
#endif /* __APPLE_API_UNSTABLE */
#endif /* _MACH_DEFAULT_PAGER_TYPES_H_ */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/DriverKit/bounded_ptr.h | //
// Copyright (c) 2019 Apple, Inc. All rights reserved.
//
// @APPLE_OSREFERENCE_LICENSE_HEADER_START@
//
// This file contains Original Code and/or Modifications of Original Code
// as defined in and that are subject to the Apple Public Source License
// Version 2.0 (the 'License'). You may not use this file except in
// compliance with the License. The rights granted to you under the License
// may not be used to create, or enable the creation or redistribution of,
// unlawful or unlicensed copies of an Apple operating system, or to
// circumvent, violate, or enable the circumvention or violation of, any
// terms of an Apple operating system software license agreement.
//
// Please obtain a copy of the License at
// http://www.opensource.apple.com/apsl/ and read it before using this file.
//
// The Original Code and all software distributed under the License are
// distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
// EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
// INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
// Please see the License for the specific language governing rights and
// limitations under the License.
//
// @APPLE_OSREFERENCE_LICENSE_HEADER_END@
//
#ifndef XNU_LIBKERN_LIBKERN_CXX_BOUNDED_PTR_H
#define XNU_LIBKERN_LIBKERN_CXX_BOUNDED_PTR_H
#if !TAPI
#include <stddef.h>
#include <stdint.h>
#include <os/overflow.h>
#include <os/base.h>
#if !defined(__improbable)
# define __improbable(...) __builtin_expect((__VA_ARGS__), 0)
#endif
namespace libkern {
namespace detail {
// Reimplementation of things in <type_traits> because we don't seem
// to have the right to rely on the C++ Standard Library (based on
// attempts to compile IOHIDFamily).
// TODO: Do we really need to re-implement this here?
template <typename ...> using void_t = void;
template <typename T> T && declval() noexcept;
using nullptr_t = decltype(nullptr);
template <bool Cond, typename T = void> struct enable_if;
template <typename T> struct enable_if<true, T> { using type = T; };
template <bool Cond, typename T = void> using enable_if_t = typename enable_if<Cond, T>::type;
template <typename T1, typename T2>
constexpr bool is_convertible_v = __is_convertible_to(T1, T2);
template <typename T> inline constexpr bool is_void_v = false;
template <> inline constexpr bool is_void_v<void> = true;
template <> inline constexpr bool is_void_v<void const> = true;
template <typename T, typename U> struct copy_const { using type = U; };
template <typename T, typename U> struct copy_const<T const, U> { using type = U const; };
template <typename T, typename U> using copy_const_t = typename copy_const<T, U>::type;
template <typename T, typename U> struct copy_cv { using type = U; };
template <typename T, typename U> struct copy_cv<T const, U> { using type = U const; };
template <typename T, typename U> struct copy_cv<T volatile, U> { using type = U volatile; };
template <typename T, typename U> struct copy_cv<T const volatile, U> { using type = U const volatile; };
template <typename T, typename U> using copy_cv_t = typename copy_cv<T, U>::type;
template <typename T, typename U>
using WhenComparable = void_t<
decltype(declval<T>() == declval<U>()),
decltype(declval<T>() != declval<U>())
>;
template <typename T, typename U>
using WhenOrderable = void_t <
decltype(declval<T>() < declval<U>()),
decltype(declval<T>() > declval<U>()),
decltype(declval<T>() >= declval<U>()),
decltype(declval<T>() <= declval<U>())
>;
// Pretend that sizeof(void) is 1, otherwise the in-bounds check doesn't
// make sense for `bounded_ptr<void>`.
template <typename T> constexpr size_t sizeof_v = sizeof(T);
template <> inline constexpr size_t sizeof_v<void> = 1;
template <> inline constexpr size_t sizeof_v<void const> = 1;
template <> inline constexpr size_t sizeof_v<void volatile> = 1;
template <> inline constexpr size_t sizeof_v<void const volatile> = 1;
} // end namespace detail
// Non-owning pointer to an object (or a range of objects) of type `T`
// that validates that the address is within some specified bounds on
// dereference-like operations.
//
// Conceptually, a `bounded_ptr` points within a range of memory `[begin, end)`.
// If accessing any part of the result of dereferencing the pointer would
// lead to an access outside of the `[begin, end)` range, the pointer is
// said to be out-of-bounds. Due to representational constraints, the range
// of in-bounds memory must be no larger than 4GB.
//
// Dereference-like operations (dereference, subscript, pointer member access)
// validate that the pointer is not out-of-bounds. If an out-of-bounds pointer
// is dereferenced, the `TrappingPolicy` is called as
// `TrappingPolicy::trap(some-message)`, and the operation is said to "trap".
// This terminology is used below to describe the behavior of the `TrappingPolicy`.
//
// Pointer arithmetic is allowed (and the bounds are not validated), so it is
// entirely possible to make a `bounded_ptr` point outside of its range.
// However, overflow checking is performed on arithmetic operations, and
// any operation resulting in an overflow will also "trap".
//
// The behavior of the `TrappingPolicy` can be customized as desired, however
// a trap should never return, causing the current `bounded_ptr` operation to
// be aborted. This is important since the trap could signify an integer
// overflow, a null-pointer dereference or something else that would lead to
// undefined behavior (UB) if `TrappingPolicy::trap` were to return.
//
// Creation of `bounded_ptr`s
// ==========================
// `bounded_ptr` provides a single constructor allowing the bounds of the
// pointer to be specified. When integrating `bounded_ptr` into an existing
// code base, it is recommended to use `bounded_ptr` as an iterator obtained
// from other container-like abstractions, instead of manually using the
// constructor that allows specifying a range. Specifying the range manually
// on construction is error-prone, and `bounded_ptr` can't help reduce
// out-of-bounds accesses if the bounds are specified incorrectly.
//
// Furthermore, it is a design choice to not provide a constructor that uses
// relative offsets from the pointer itself to determine the range, because
// such a constructor is deemed more confusing than helpful. For example, is
// the offset a number of bytes or a number of objects? Is the offset inclusive
// or exclusive? Instead, factory functions should be used to create `bounded_ptr`s.
//
// Remark on const-ness
// ====================
// Like for raw pointers, the const-ness of a `bounded_ptr` has no bearing on
// whether the pointee is const. Hence, it is possible to obtain a non-const
// reference to an object from a const `bounded_ptr`. To encode a
// pointer-to-const, simply create a `bounded_ptr<T const>`.
template <typename T, typename TrappingPolicy>
struct __attribute__((trivial_abi)) bounded_ptr {
private:
using CharType = detail::copy_cv_t<T, char>;
public:
// Creates a null `bounded_ptr`.
//
// A null `bounded_ptr` does not point to any object and is conceptually
// out of bounds, so dereferencing it will trap. "Observing" operations
// like comparison and check-for-null, along with assignment, are valid
// operations on a null `bounded_ptr`.
OS_ALWAYS_INLINE constexpr
bounded_ptr(detail::nullptr_t)
: base_(nullptr), count_(0), offset_(0)
{
}
OS_ALWAYS_INLINE constexpr
explicit
bounded_ptr()
: bounded_ptr(nullptr)
{
}
// Creates a `bounded_ptr` pointing to the given object, and whose bounds
// are described by the provided `[begin, end)` range.
//
// This constructor does not check whether the constructed pointer is
// within its bounds. However, it does check that the provided `[begin, end)`
// range is a valid range (that is, `begin <= end`).
//
// Furthermore, the number of bytes in the range of in-bounds memory must be
// representable by a uint32_t, which means that there can be no more than
// 2^32 bytes (i.e. 4GB) in that range. Otherwise, the constructor will trap.
OS_ALWAYS_INLINE explicit
bounded_ptr(T* pointer, T const* begin, T const* end)
{
base_ = reinterpret_cast<CharType*>(const_cast<T*>(begin));
// Store (end - begin) into count_, making sure we don't overflow
if (__improbable(os_sub_overflow(reinterpret_cast<uintptr_t>(end),
reinterpret_cast<uintptr_t>(begin),
&count_))) {
TrappingPolicy::trap("The range of valid memory is too large to be represented "
"by this type, or [begin, end) is not a well-formed range");
}
// Store (pointer - begin) into offset_, making sure we don't overflow.
// Note that offset_ can be negative if `pointer` is outside of the
// range delimited by [begin, end), which can be valid if it represents
// e.g. a subrange of an array.
if (__improbable(os_sub_overflow(reinterpret_cast<uintptr_t>(pointer),
reinterpret_cast<uintptr_t>(begin),
&offset_))) {
TrappingPolicy::trap("The offset of the pointer inside its valid memory "
"range can't be represented using int32_t");
}
}
// Creates a `bounded_ptr` to a type `T` from a `bounded_ptr` to a type `U`.
//
// This converting constructor is enabled whenever `U*` is implicitly
// convertible to `T*`. This allows the usual implicit conversions
// between base-and-derived types, and also from any type `U*` to a
// `void*`. If other casts (like between unrelated pointer types) are
// desired, `libkern::reinterpret_pointer_cast` can be used instead.
//
// The bounds on the resulting `bounded_ptr` are inherited from the
// original `bounded_ptr`.
template <typename U, typename Policy, typename = detail::enable_if_t<detail::is_convertible_v<U*, T*> > >
OS_ALWAYS_INLINE
bounded_ptr(bounded_ptr<U, Policy> const & other)
: base_(other.base_)
, count_(other.count_)
, offset_(static_cast<int32_t>(reinterpret_cast<CharType*>(static_cast<T*>(other.get_ptr_())) - other.base_))
{
}
// Assigns a `bounded_ptr` to a type `U` to a `bounded_ptr` to a type `T`,
// as long as `U*` is convertible to `T*`.
//
// This is a rebinding operation, like assignment between raw pointers,
// and the destination `bounded_ptr` will inherit the bounds of the
// source `bounded_ptr`.
template <typename U, typename Policy, typename = detail::enable_if_t<detail::is_convertible_v<U*, T*> > >
OS_ALWAYS_INLINE bounded_ptr&
operator=(bounded_ptr<U, Policy> const& other)
{
base_ = other.base_;
count_ = other.count_;
offset_ = static_cast<int32_t>(reinterpret_cast<CharType*>(static_cast<T*>(other.get_ptr_())) - other.base_);
return *this;
}
// Sets a `bounded_ptr` to null.
//
// This is effectively equivalent to assigning a default-constructed
// `bounded_ptr` to the target. As a result, the original bounds of
// the `bounded_ptr` are discarded, and the resulting `bounded_ptr`
// is both out-of-bounds and also has no bounds assigned to it (like
// a default-constructed `bounded_ptr`).
OS_ALWAYS_INLINE bounded_ptr&
operator=(detail::nullptr_t)
{
*this = bounded_ptr();
return *this;
}
// Returns a reference to the object pointed-to by the `bounded_ptr`.
//
// Traps if the pointer is pointing outside of its bounds.
//
// Also note that this function will trap when dereferencing a null
// `bounded_ptr`, unless the bounds of the pointer have been set and
// include address 0, in which case there's effectively nothing to
// diagnose.
template <typename T_ = T> // delay instantiation to avoid forming invalid ref for bounded_ptr<void>
OS_ALWAYS_INLINE T_&
operator*() const
{
if (__improbable(!in_bounds_())) {
TrappingPolicy::trap("bounded_ptr<T>::operator*: Dereferencing this pointer "
"would access memory outside of the bounds set originally");
}
return *get_ptr_();
}
OS_ALWAYS_INLINE T*
operator->() const
{
if (__improbable(!in_bounds_())) {
TrappingPolicy::trap("bounded_ptr<T>::operator->: Accessing a member through this pointer "
"would access memory outside of the bounds set originally");
}
return get_ptr_();
}
// Provides access to the n-th element past the given pointer.
//
// The `bounded_ptr` validates whether the provided index is within the
// bounds of the `bounded_ptr`. Like for raw pointers, a negative index
// may be passed, in which case the pointer is accessed at a negative
// offset (which must still be in bounds).
template <typename T_ = T> // delay instantiation to avoid forming invalid ref for bounded_ptr<void>
OS_ALWAYS_INLINE T_&
operator[](ptrdiff_t n) const
{
return *(*this + n);
}
// Converts a `bounded_ptr` to a raw pointer, after checking it is within
// its bounds.
//
// The primary intended usage of this function is to aid bridging between
// code that uses `bounded_ptr`s and code that does not.
OS_ALWAYS_INLINE T*
discard_bounds() const
{
if (__improbable(!in_bounds_())) {
TrappingPolicy::trap("bounded_ptr<T>::discard_bounds: Discarding the bounds on "
"this pointer would lose the fact that it is outside of the "
"bounds set originally");
}
return get_ptr_();
}
// Converts a `bounded_ptr` to a raw pointer, without checking whether the
// pointer is within its bounds.
//
// Like `discard_bounds()`, the primary intended usage of this function
// is to aid bridging between code that uses `bounded_ptr`s and code that
// does not. However, unlike `discard_bounds()`, this function does not
// validate that the returned pointer is in bounds. This functionality is
// necessary when the pointer represents something that can't be
// dereferenced (hence it's OK for it to be out-of-bounds), but that
// is still useful for other purposes like comparing against other
// pointers. An example of that is the `end` pointer in a half-open
// interval `[begin, end)`, where the `end` pointer is out-of-bounds and
// can't be dereferenced, yet it's still useful to delimit the range.
OS_ALWAYS_INLINE T*
unsafe_discard_bounds() const
{
return get_ptr_();
}
// Implicit conversion to bool, returning whether the pointer is null.
//
// This operation does not perform any validation of the bounds.
OS_ALWAYS_INLINE explicit
operator bool() const
{
return get_ptr_() != nullptr;
}
// Increment/decrement a `bounded_ptr`.
//
// Like for other arithmetic operations, this does not check whether the
// increment or decrement operation results in an out-of-bounds pointer.
OS_ALWAYS_INLINE bounded_ptr&
operator++()
{
*this += 1;
return *this;
}
OS_ALWAYS_INLINE bounded_ptr
operator++(int)
{
bounded_ptr old = *this;
++*this;
return old;
}
OS_ALWAYS_INLINE bounded_ptr&
operator--()
{
*this -= 1;
return *this;
}
OS_ALWAYS_INLINE bounded_ptr
operator--(int)
{
bounded_ptr old = *this;
--*this;
return old;
}
// Increment or decrement a `bounded_ptr` by a given offset.
//
// This is equivalent to adding the given offset to the underlying raw
// pointer. In particular, the bounds of the `bounded_ptr` are left
// untouched by this operation. Furthermore, like for raw pointers, it
// is possible to provide a negative offset, which will have the effect
// of decrementing the `bounded_ptr` instead of incrementing it.
//
// Also note that the offset is NOT a number of bytes -- just like for
// raw pointers, it is a number of "positions" to move the pointer from,
// which essentially means `n * sizeof(T)` bytes. Again, this works exactly
// the same as a raw pointer to an object of type `T`.
//
// Like other arithmetic operations, this does not check whether the
// increment or decrement operation results in an out-of-bounds pointer.
// However, this does check whether the arithmetic operation would result
// in an overflow, in which case the operation will trap.
template <typename T_ = T>
OS_ALWAYS_INLINE bounded_ptr&
operator+=(ptrdiff_t n)
{
static_assert(!detail::is_void_v<T_>, "Arithmetic on bounded_ptr<void> is not allowed.");
ptrdiff_t bytes;
if (__improbable(os_mul_overflow(n, sizeof(T), &bytes))) {
TrappingPolicy::trap(
"bounded_ptr<T>::operator+=(n): Calculating the number of bytes to "
"add to the offset (n * sizeof(T)) would trigger an overflow");
}
if (__improbable(os_add_overflow(offset_, bytes, &offset_))) {
TrappingPolicy::trap(
"bounded_ptr<T>::operator+=(n): Adding the specified number of bytes "
"to the offset representing the current position would overflow.");
}
return *this;
}
template <typename T_ = T>
OS_ALWAYS_INLINE bounded_ptr&
operator-=(ptrdiff_t n)
{
static_assert(!detail::is_void_v<T_>, "Arithmetic on bounded_ptr<void> is not allowed.");
ptrdiff_t bytes;
if (__improbable(os_mul_overflow(n, sizeof(T), &bytes))) {
TrappingPolicy::trap(
"bounded_ptr<T>::operator-=(n): Calculating the number of bytes to "
"subtract from the offset (n * sizeof(T)) would trigger an overflow");
}
if (__improbable(os_sub_overflow(offset_, bytes, &offset_))) {
TrappingPolicy::trap(
"bounded_ptr<T>::operator-=(n): Subtracting the specified number of bytes "
"from the offset representing the current position would overflow.");
}
return *this;
}
friend OS_ALWAYS_INLINE bounded_ptr
operator+(bounded_ptr p, ptrdiff_t n)
{
p += n;
return p;
}
friend OS_ALWAYS_INLINE bounded_ptr
operator+(ptrdiff_t n, bounded_ptr p)
{
p += n;
return p;
}
friend OS_ALWAYS_INLINE bounded_ptr
operator-(bounded_ptr p, ptrdiff_t n)
{
p -= n;
return p;
}
// Returns the difference between two `bounded_ptr`s.
//
// This is semantically equivalent to subtracting the two underlying
// pointers. The bounds of the pointers are not validated by this
// operation.
friend OS_ALWAYS_INLINE ptrdiff_t
operator-(bounded_ptr const& a, bounded_ptr const& b)
{
return a.get_ptr_() - b.get_ptr_();
}
friend OS_ALWAYS_INLINE ptrdiff_t
operator-(bounded_ptr const& a, T const* b)
{
return a.get_ptr_() - b;
}
friend OS_ALWAYS_INLINE ptrdiff_t
operator-(T const* a, bounded_ptr const& b)
{
return a - b.get_ptr_();
}
private:
OS_ALWAYS_INLINE bool
in_bounds_() const
{
static_assert(detail::sizeof_v<T> <= UINT32_MAX - INT32_MAX,
"The type pointed-to by bounded_ptr is too large, which would defeat "
"our optimization to check for inboundedness using arithmetic on unsigned");
return offset_ >= 0 && static_cast<uint32_t>(offset_) + static_cast<uint32_t>(detail::sizeof_v<T>) <= count_;
}
OS_ALWAYS_INLINE T*
get_ptr_() const
{
// Compute `base_ + offset_`, catching overflows.
uintptr_t ptr;
if (__improbable(os_add_overflow(reinterpret_cast<uintptr_t>(base_), offset_, &ptr))) {
TrappingPolicy::trap("This bounded_ptr is pointing to memory outside of what can "
"be represented by a native pointer.");
}
return reinterpret_cast<T*>(ptr);
}
template <typename T_, typename U, typename Policy>
friend bounded_ptr<T_, Policy> reinterpret_pointer_cast(bounded_ptr<U, Policy> const&) noexcept;
template <typename U, typename P> friend struct bounded_ptr; // for cross-type operations and conversions
CharType* base_; // pointer to the beginning of the valid address range
uint32_t count_; // number of bytes considered in-bounds (non-negative)
int32_t offset_; // current offset into the range, in bytes
};
// Returns whether two `bounded_ptr`s point to the same object.
//
// This comparison is semantically equivalent to comparing the underlying
// raw pointers. In particular, it doesn't validate the bounds of either
// `bounded_ptr`, nor does it compare whether the two `bounded_ptr`s have
// the same bounds.
//
// This comparison is enabled between `bounded_ptr`s whenever the two
// corresponding raw pointer types are comparable. Comparison between a
// raw pointer and a `bounded_ptr` is also allowed, so long as the
// two corresponding raw pointer types are comparable.
template <typename T, typename P1, typename U, typename P2, typename = detail::WhenComparable<T*, U*> >
OS_ALWAYS_INLINE bool
operator==(bounded_ptr<T, P1> const& a, bounded_ptr<U, P2> const& b)
{
return a.unsafe_discard_bounds() == b.unsafe_discard_bounds();
}
template <typename T, typename P1, typename U, typename P2, typename = detail::WhenComparable<T*, U*> >
OS_ALWAYS_INLINE bool
operator!=(bounded_ptr<T, P1> const& a, bounded_ptr<U, P2> const& b)
{
return !(a == b);
}
template <typename T, typename P, typename U, typename = detail::WhenComparable<T*, U*> >
OS_ALWAYS_INLINE bool
operator==(bounded_ptr<T, P> const& a, U* b)
{
return a.unsafe_discard_bounds() == b;
}
template <typename T, typename P, typename U, typename = detail::WhenComparable<T*, U*> >
OS_ALWAYS_INLINE bool
operator==(U* a, bounded_ptr<T, P> const& b)
{
return a == b.unsafe_discard_bounds();
}
template <typename T, typename P, typename U, typename = detail::WhenComparable<T*, U*> >
OS_ALWAYS_INLINE bool
operator!=(bounded_ptr<T, P> const& a, U* b)
{
return !(a == b);
}
template <typename T, typename P, typename U, typename = detail::WhenComparable<T*, U*> >
OS_ALWAYS_INLINE bool
operator!=(U* a, bounded_ptr<T, P> const& b)
{
return !(a == b);
}
template <typename T, typename Policy>
OS_ALWAYS_INLINE bool
operator==(detail::nullptr_t, bounded_ptr<T, Policy> const& p)
{
return p.unsafe_discard_bounds() == nullptr;
}
template <typename T, typename Policy>
OS_ALWAYS_INLINE bool
operator!=(detail::nullptr_t, bounded_ptr<T, Policy> const& p)
{
return p.unsafe_discard_bounds() != nullptr;
}
template <typename T, typename Policy>
OS_ALWAYS_INLINE bool
operator==(bounded_ptr<T, Policy> const& p, detail::nullptr_t)
{
return p.unsafe_discard_bounds() == nullptr;
}
template <typename T, typename Policy>
OS_ALWAYS_INLINE bool
operator!=(bounded_ptr<T, Policy> const& p, detail::nullptr_t)
{
return p.unsafe_discard_bounds() != nullptr;
}
// Returns whether a `bounded_ptr` points to an address that is {less-than,
// less-than-or-equal-to, greater-than, greater-than-or-equal-to} the address
// held in another `bounded_ptr`.
//
// This doesn't validate the bounds of either `bounded_ptr`, nor does it
// compare those bounds to determine the ordering result. This ordering is
// semantically equivalent to ordering the result of calling `get()` on both
// `bounded_ptr`s.
//
// This ordering is enabled between `bounded_ptr`s whenever the two
// corresponding raw pointer types are orderable. Ordering between a
// raw pointer and a `bounded_ptr` is also allowed, so long as the
// two corresponding raw pointer types are orderable.
//
template <typename T, typename U, typename P1, typename P2, typename = detail::WhenOrderable<T*, U*> >
OS_ALWAYS_INLINE bool
operator<(bounded_ptr<T, P1> const& a, bounded_ptr<U, P2> const& b)
{
return a.unsafe_discard_bounds() < b.unsafe_discard_bounds();
}
template <typename T, typename U, typename P1, typename P2, typename = detail::WhenOrderable<T*, U*> >
OS_ALWAYS_INLINE bool
operator<=(bounded_ptr<T, P1> const& a, bounded_ptr<U, P2> const& b)
{
return a.unsafe_discard_bounds() <= b.unsafe_discard_bounds();
}
template <typename T, typename U, typename P1, typename P2, typename = detail::WhenOrderable<T*, U*> >
OS_ALWAYS_INLINE bool
operator>(bounded_ptr<T, P1> const& a, bounded_ptr<U, P2> const& b)
{
return a.unsafe_discard_bounds() > b.unsafe_discard_bounds();
}
template <typename T, typename U, typename P1, typename P2, typename = detail::WhenOrderable<T*, U*> >
OS_ALWAYS_INLINE bool
operator>=(bounded_ptr<T, P1> const& a, bounded_ptr<U, P2> const& b)
{
return a.unsafe_discard_bounds() >= b.unsafe_discard_bounds();
}
template <typename T, typename U, typename P, typename = detail::WhenOrderable<T*, U*> >
OS_ALWAYS_INLINE bool
operator<(T* a, bounded_ptr<U, P> const& b)
{
return a < b.unsafe_discard_bounds();
}
template <typename T, typename U, typename P, typename = detail::WhenOrderable<T*, U*> >
OS_ALWAYS_INLINE bool
operator<(bounded_ptr<T, P> const& a, U* b)
{
return a.unsafe_discard_bounds() < b;
}
template <typename T, typename U, typename P, typename = detail::WhenOrderable<T*, U*> >
OS_ALWAYS_INLINE bool
operator<=(T* a, bounded_ptr<U, P> const& b)
{
return a <= b.unsafe_discard_bounds();
}
template <typename T, typename U, typename P, typename = detail::WhenOrderable<T*, U*> >
OS_ALWAYS_INLINE bool
operator<=(bounded_ptr<T, P> const& a, U* b)
{
return a.unsafe_discard_bounds() <= b;
}
template <typename T, typename U, typename P, typename = detail::WhenOrderable<T*, U*> >
OS_ALWAYS_INLINE bool
operator>(T* a, bounded_ptr<U, P> const& b)
{
return a > b.unsafe_discard_bounds();
}
template <typename T, typename U, typename P, typename = detail::WhenOrderable<T*, U*> >
OS_ALWAYS_INLINE bool
operator>(bounded_ptr<T, P> const& a, U* b)
{
return a.unsafe_discard_bounds() > b;
}
template <typename T, typename U, typename P, typename = detail::WhenOrderable<T*, U*> >
OS_ALWAYS_INLINE bool
operator>=(T* a, bounded_ptr<U, P> const& b)
{
return a >= b.unsafe_discard_bounds();
}
template <typename T, typename U, typename P, typename = detail::WhenOrderable<T*, U*> >
OS_ALWAYS_INLINE bool
operator>=(bounded_ptr<T, P> const& a, U* b)
{
return a.unsafe_discard_bounds() >= b;
}
template <typename T, typename U>
OS_ALWAYS_INLINE T*
reinterpret_pointer_cast(U* p) noexcept
{
return reinterpret_cast<T*>(p);
}
// Reinterprets a `bounded_ptr` to a type `T` to a `bounded_ptr` to a type `U`.
//
// This is equivalent to `reinterpret_cast`ing the underlying pointer as well
// as the bounds of the original pointer. Like for a raw `reinterpret_cast`,
// no offset adjustment is performed (even if needed, e.g. for derived-to-base
// casts with multiple inheritance). Because this is extremely unsafe, it should
// be used extremely sparingly.
template <typename T, typename U, typename Policy>
OS_ALWAYS_INLINE bounded_ptr<T, Policy>
reinterpret_pointer_cast(bounded_ptr<U, Policy> const& p) noexcept
{
using CharType = detail::copy_cv_t<T, char>;
CharType* new_begin = reinterpret_cast<CharType*>(p.base_);
CharType* new_end = new_begin + p.count_;
return bounded_ptr<T, Policy>(reinterpret_cast<T*>(p.get_ptr_()),
reinterpret_cast<T const*>(new_begin),
reinterpret_cast<T const*>(new_end));
}
} // end namespace libkern
#endif /* !TAPI */
#endif // !XNU_LIBKERN_LIBKERN_CXX_BOUNDED_PTR_H
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/DriverKit/safe_allocation.h | //
// Copyright (c) 2019-2021 Apple, Inc. All rights reserved.
//
// @APPLE_OSREFERENCE_LICENSE_HEADER_START@
//
// This file contains Original Code and/or Modifications of Original Code
// as defined in and that are subject to the Apple Public Source License
// Version 2.0 (the 'License'). You may not use this file except in
// compliance with the License. The rights granted to you under the License
// may not be used to create, or enable the creation or redistribution of,
// unlawful or unlicensed copies of an Apple operating system, or to
// circumvent, violate, or enable the circumvention or violation of, any
// terms of an Apple operating system software license agreement.
//
// Please obtain a copy of the License at
// http://www.opensource.apple.com/apsl/ and read it before using this file.
//
// The Original Code and all software distributed under the License are
// distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
// EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
// INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
// Please see the License for the specific language governing rights and
// limitations under the License.
//
// @APPLE_OSREFERENCE_LICENSE_HEADER_END@
//
#ifndef XNU_LIBKERN_LIBKERN_CXX_SAFE_ALLOCATION_H
#define XNU_LIBKERN_LIBKERN_CXX_SAFE_ALLOCATION_H
#if !TAPI
#include <stddef.h>
#include <stdint.h>
#include <os/base.h>
#if DRIVERKIT_FRAMEWORK_INCLUDE
#include <DriverKit/bounded_ptr.h>
#else
#include <libkern/c++/bounded_ptr.h>
#endif /* DRIVERKIT_FRAMEWORK_INCLUDE */
void* operator new(size_t, void*) noexcept; // forward declaration needed for placement-new
namespace libkern {
namespace sa_detail {
// TODO: Deduplicate these utilities with other smart pointer utilities
using nullptr_t = decltype(nullptr);
template <typename T>
constexpr bool is_trivially_destructible_v = __is_trivially_destructible(T);
template <typename T>
constexpr bool is_empty_v = __is_empty(T);
template <typename T>
constexpr bool is_nothrow_default_constructible_v = __is_nothrow_constructible(T);
template <bool Cond, typename T = void> struct enable_if;
template <typename T> struct enable_if<true, T> { using type = T; };
template <bool Cond, typename T = void> using enable_if_t = typename enable_if<Cond, T>::type;
template <typename T> struct remove_const { using type = T; };
template <typename T> struct remove_const<T const> { using type = T; };
template <typename T> using remove_const_t = typename remove_const<T>::type;
template <typename T>
void
generic_swap(T& a, T& b)
{
T tmp = a;
a = b;
b = tmp;
}
template <typename T, enable_if_t<!is_trivially_destructible_v<T> >* = nullptr>
void
destroy(T* first, T* last)
{
for (; first != last; ++first) {
first->~T();
}
}
template <typename T, enable_if_t<is_trivially_destructible_v<T> >* = nullptr>
void
destroy(T*, T*)
{
// Nothing to do, the elements are trivially destructible
}
template <typename T>
void
uninitialized_value_construct(T* first, T* last)
{
for (; first != last; ++first) {
::new (static_cast<void*>(first)) T();
}
}
} // end namespace sa_detail
struct adopt_memory_t {
explicit constexpr
adopt_memory_t() = default;
};
inline constexpr adopt_memory_t adopt_memory{};
struct allocate_memory_t {
explicit constexpr
allocate_memory_t() = default;
};
inline constexpr allocate_memory_t allocate_memory{};
struct allocate_memory_zero_t {
explicit constexpr
allocate_memory_zero_t() = default;
};
inline constexpr allocate_memory_zero_t allocate_memory_zero{};
// Lightweight utility class representing a dynamically allocated slab of
// memory, with contiguous objects in it.
//
// The main purpose `safe_allocation` is to:
// 1. Manage a uniquely-owned allocation of memory containing multiple objects
// 2. Check that the allocation is accessed within its bounds on indexing operations
// 3. Act as a source for obtaining (non-owning) `bounded_ptr`s to the underlying memory
//
// In fact, `safe_allocation` should be the primary source of `bounded_ptr`s to
// heap-allocated memory, via its `.begin()` and `.end()` methods. `safe_allocation`
// is optimized for use cases where simple scratch space is needed for calculation
// and deallocated once the calculation is done. As such, it is not a full-blown
// container class, which drives many design choices behind `safe_allocation`:
//
// 1. It can't be copied or compared for equality -- `safe_allocation` is not a proper value type
// 2. It can't be resized -- this keeps the design extremely simple and free of overhead
// 3. You can transfer ownership of `safe_allocation` by using std::move
//
// Design decision: stateless allocators
// =====================================
// Only allow stateless allocators. While we could technically handle stateful
// allocators (as the C++ Standard Library) does, the benefit of doing so
// compared to the added complexity is absolutely not worth it. Supporting
// stateful allocators everywhere in C++ is regarded (at least in the
// Standardization Committee) as one of the worst design mistakes we've made,
// and so we won't repeat it here.
//
// Design decision: size() is 0 when allocation is null
// ====================================================
// When the `safe_allocation` is null (because it's been moved-from, or because
// allocation failed, or whatever), we could technically leave the `size_`
// undefined (as long as we make `data_` null). However, this would mean
// that querying the size of the allocation in that case is undefined behavior
// (UB), which is seen as something bad in the context of a type that vends
// itself as safe. So instead, we "overimplement" the type to provide stronger
// guarantees than would be strictly required if performance were the main goal.
template <typename T, typename Allocator, typename TrappingPolicy>
struct safe_allocation {
static_assert(sa_detail::is_empty_v<Allocator>,
"safe_allocation<T, Alloc, ...> requires the Allocator to be stateless");
// Create a null allocation, pointing to no memory.
//
// A null allocation can be destroyed, assigned-to, checked for nullness,
// and otherwise queries for length, but trying to access an element of
// the allocation will fail.
//
// A null allocation basically behaves as an empty array, i.e. `begin()`
// and `end()` will return iterators that are equal and `size()` will
// return `0`.
explicit constexpr safe_allocation() noexcept : data_(nullptr), size_(0)
{
}
constexpr safe_allocation(sa_detail::nullptr_t) noexcept : safe_allocation()
{
}
// Create an allocation pointing to already-allocated and initialized memory.
//
// This constructor attaches existing memory to a `safe_allocation`, such
// that it will be released automatically when the `safe_allocation` goes
// out of scope. The objects in that memory must already have been
// initialized, or they must be initialized before the `safe_allocation`
// goes out of scope.
//
// The `n` argument is the number of objects of type `T` in the allocation,
// i.e. `n * sizeof(T)` bytes should have been allocated.
//
// Note that the memory MUST have been allocated with an allocator compatible
// with the `safe_allocation`'s `Allocator`, since the memory will be
// deallocated using that `Allocator`. Bad things will happen if, for
// example, `adopt_memory` is used with memory allocated on the stack:
// the destructor will try to deallocate that memory and will fail to do so.
explicit safe_allocation(T* data, size_t n, adopt_memory_t) : data_(data)
{
if (__improbable(n > UINT32_MAX)) {
TrappingPolicy::trap("safe_allocation size exceeds UINT32_MAX");
}
size_ = static_cast<uint32_t>(n);
}
// Allocate memory for `n` objects of type `T`, and manage it.
//
// This constructor allocates enough memory for `n` objects of type `T`
// using the `Allocator`, and manages that. Each object in the allocation
// is value-initialized (either set to 0 or the default-constructor called).
//
// If either `n * sizeof(T)` overflows or the allocation fails, the
// resulting `safe_allocation` will be null. It is therefore necessary
// to check whether the allocation is null after using this constructor.
explicit safe_allocation(size_t n, allocate_memory_t)
{
size_t bytes;
if (__improbable(os_mul_overflow(n, sizeof(T), &bytes) || (n > UINT32_MAX))) {
data_ = nullptr;
size_ = 0;
} else {
data_ = reinterpret_cast<T*>(Allocator::allocate(bytes));
size_ = static_cast<uint32_t>(n);
using RawT = sa_detail::remove_const_t<T>;
RawT* const data = const_cast<RawT*>(data_);
sa_detail::uninitialized_value_construct(data, data + size_);
}
}
// same as allocate_memory_t variant but allocated data is zero-initialized
explicit safe_allocation(size_t n, allocate_memory_zero_t)
{
static_assert(__is_scalar(T) || __is_aggregate(T),
"Creating objects via zero-allocation requires those objects to be scalars or aggregates (more broadly implicit lifetime types)");
size_t bytes;
if (__improbable(os_mul_overflow(n, sizeof(T), &bytes) || (n > UINT32_MAX))) {
data_ = nullptr;
size_ = 0;
} else {
data_ = reinterpret_cast<T*>(Allocator::allocate_zero(bytes));
size_ = static_cast<uint32_t>(n);
}
}
// A `safe_allocation` can't be copied, because it is not a proper value
// type and it doesn't assume that the elements of the allocation can be
// copied.
safe_allocation(safe_allocation const&) = delete;
safe_allocation& operator=(safe_allocation const&) = delete;
// Moves the ownership of an allocation from one `safe_allocation` to
// another one.
//
// After this operation, the moved-from `safe_allocation` is null, and
// any iterator into the moved-from `safe_allocation` are now tied to
// the `safe_allocation` that's the target of the assignment, in the
// sense that the iterators will be invalidated when the target of the
// assignment goes out of scope, not when the moved-from allocation
// goes out of scope.
safe_allocation(safe_allocation&& other) noexcept : data_(other.data_), size_(other.size_)
{
other.data_ = nullptr;
other.size_ = 0;
}
// Clears a `safe_allocation`, making it a null allocation.
//
// If the `safe_allocation` was pointing to valid memory, the objects
// in that memory are destroyed and that memory is freed.
safe_allocation&
operator=(sa_detail::nullptr_t)
{
if (data_ != nullptr) {
destroy_dealloc_(data_, size_);
}
data_ = nullptr;
size_ = 0;
return *this;
}
// Moves the ownership of an allocation from one `safe_allocation` to
// another one.
//
// After this operation, the moved-from `safe_allocation` is null, and
// any iterator to the moved-from `safe_allocation` obtained before the
// move operation are invalidated.
//
// If the destination `safe_allocation` was pointing to memory before the
// move-assignment, the objects in that memory are destroyed and the
// memory itself is freed.
//
// In case of self-move-assignment, nothing is done.
safe_allocation&
operator=(safe_allocation&& other)
{
if (&other == this) {
return *this;
}
T* old_data = data_;
size_t old_size = size_;
data_ = other.data_;
size_ = other.size_;
other.data_ = nullptr;
other.size_ = 0;
if (old_data != nullptr) {
destroy_dealloc_(old_data, old_size);
}
return *this;
}
// Destroys a `safe_allocation`, destroying the objects in it and
// deallocating the underlying memory with the `Allocator`.
//
// If the `safe_allocation` is null, this destructor does nothing.
~safe_allocation()
{
if (data_ != nullptr) {
destroy_dealloc_(data_, size_);
}
}
// Returns whether a `safe_allocation` is non-null, i.e. whether it is
// pointing to some memory.
explicit
operator bool() const noexcept
{
return data_ != nullptr;
}
using iterator = bounded_ptr<T, TrappingPolicy>;
using const_iterator = bounded_ptr<T const, TrappingPolicy>;
// The following methods allow obtaining iterators (i.e. cursors) to
// objects inside a `safe_allocation`.
//
// The iterators of a `safe_allocation` are `bounded_ptr`s, which know
// the bounds of the allocation and will trap when dereferenced outside
// of those bounds.
//
// `begin()` returns a (const) iterator to the first element in the
// allocation, and `end()` returns a (const) iterator to one-past-the-last
// element in the allocation. The `end()` iterator can't be dereferenced,
// since it is out of bounds.
//
// If the allocation is null, these methods will return null `bounded_ptr`s,
// which can be checked for equality but can't be dereferenced.
OS_ALWAYS_INLINE iterator
begin() noexcept
{
if (data_ == nullptr) {
return iterator();
} else {
return iterator(data_, data_, data_ + size_);
}
}
OS_ALWAYS_INLINE const_iterator
begin() const noexcept
{
if (data_ == nullptr) {
return const_iterator();
} else {
return const_iterator(data_, data_, data_ + size_);
}
}
iterator
end() noexcept
{
if (data_ == nullptr) {
return iterator();
} else {
return iterator(data_ + size_, data_, data_ + size_);
}
}
const_iterator
end() const noexcept
{
if (data_ == nullptr) {
return const_iterator();
} else {
return const_iterator(data_ + size_, data_, data_ + size_);
}
}
// Returns the number of objects in the allocation.
//
// This method returns `0` if the allocation is null, since such an
// allocation behaves the same as an empty range.
size_t
size() const
{
return size_;
}
// Returns a non-owning pointer to the underlying memory managed by a
// `safe_allocation`.
//
// This method can be called even if the `safe_allocation` is null, in
// which case the returned pointer will be null.
T*
data() noexcept
{
return data_;
}
T const*
data() const noexcept
{
return data_;
}
// Access the n-th element of an allocation.
//
// If `n` is out of the bounds of the allocation, this operation will
// trap. If the allocation is null, this operation will trap too.
//
// Design note:
// We voluntarily use a signed type to represent the index even though a
// negative index will always cause a trap. If we used an unsigned type,
// we could get an implicit conversion from signed to unsigned, which
// could silently wrap around. We think trapping early is more likely
// to be helpful in this situation.
OS_ALWAYS_INLINE T&
operator[](ptrdiff_t n)
{
return begin()[n]; // trap happens in `bounded_ptr` if null or OOB
}
OS_ALWAYS_INLINE T const&
operator[](ptrdiff_t n) const
{
return begin()[n]; // trap happens in `bounded_ptr` if null or OOB
}
private:
// Swap support
friend void
swap(safe_allocation& a, safe_allocation& b) noexcept
{
sa_detail::generic_swap(a.data_, b.data_);
sa_detail::generic_swap(a.size_, b.size_);
}
static void
destroy_dealloc_(T* ptr, size_t size)
{
sa_detail::destroy(ptr, ptr + size);
// `size * sizeof(T)` can't overflow, because it would have
// overflowed when the allocation was performed otherwise.
using RawT = sa_detail::remove_const_t<T>;
Allocator::deallocate(const_cast<RawT*>(ptr), size * sizeof(T));
}
T* data_;
uint32_t size_;
};
// The comparison functions against `nullptr` all return whether the allocation
// is null or not.
template <typename T, typename A, typename P>
bool
operator==(safe_allocation<T, A, P> const& x, sa_detail::nullptr_t)
{
return !static_cast<bool>(x);
}
template <typename T, typename A, typename P>
bool
operator!=(safe_allocation<T, A, P> const& x, sa_detail::nullptr_t)
{
return !(x == nullptr);
}
template <typename T, typename A, typename P>
bool
operator==(sa_detail::nullptr_t, safe_allocation<T, A, P> const& x)
{
return x == nullptr;
}
template <typename T, typename A, typename P>
bool
operator!=(sa_detail::nullptr_t, safe_allocation<T, A, P> const& x)
{
return !(x == nullptr);
}
} // end namespace libkern
#endif /* !TAPI */
#endif // !XNU_LIBKERN_LIBKERN_CXX_SAFE_ALLOCATION_H
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/DriverKit/IOKitKeys.h | /*
* Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
*
* Common symbol definitions for IOKit.
*
* HISTORY
*
*/
#ifndef _IOKIT_IOKITKEYS_H
#define _IOKIT_IOKITKEYS_H
// properties found in the registry root
#define kIOKitBuildVersionKey "IOKitBuildVersion"
#define kIOKitDiagnosticsKey "IOKitDiagnostics"
// a dictionary keyed by plane name
#define kIORegistryPlanesKey "IORegistryPlanes"
#define kIOCatalogueKey "IOCatalogue"
// registry plane names
#define kIOServicePlane "IOService"
#define kIOPowerPlane "IOPower"
#define kIODeviceTreePlane "IODeviceTree"
#define kIOAudioPlane "IOAudio"
#define kIOFireWirePlane "IOFireWire"
#define kIOUSBPlane "IOUSB"
// registry ID number
#define kIORegistryEntryIDKey "IORegistryEntryID"
// property name to get array of property names
#define kIORegistryEntryPropertyKeysKey "IORegistryEntryPropertyKeys"
// IOService class name
#define kIOServiceClass "IOService"
// IOResources class name
#define kIOResourcesClass "IOResources"
// IOService driver probing property names
#define kIOClassKey "IOClass"
#define kIOProbeScoreKey "IOProbeScore"
#define kIOKitDebugKey "IOKitDebug"
// Properties to be supported as API
#define kIOSupportedPropertiesKey "IOSupportedProperties"
// Properties writable by dexts
#define kIOUserServicePropertiesKey "IOUserServiceProperties"
// IOService matching property names
#define kIOProviderClassKey "IOProviderClass"
#define kIONameMatchKey "IONameMatch"
#define kIOPropertyMatchKey "IOPropertyMatch"
#define kIOPropertyExistsMatchKey "IOPropertyExistsMatch"
#define kIOPathMatchKey "IOPathMatch"
#define kIOLocationMatchKey "IOLocationMatch"
#define kIOParentMatchKey "IOParentMatch"
#define kIOResourceMatchKey "IOResourceMatch"
#define kIOResourceMatchedKey "IOResourceMatched"
#define kIOMatchedServiceCountKey "IOMatchedServiceCountMatch"
#define kIONameMatchedKey "IONameMatched"
#define kIOMatchCategoryKey "IOMatchCategory"
#define kIODefaultMatchCategoryKey "IODefaultMatchCategory"
#define kIOMatchedPersonalityKey "IOMatchedPersonality"
#define kIORematchPersonalityKey "IORematchPersonality"
#define kIORematchCountKey "IORematchCount"
#define kIODEXTMatchCountKey "IODEXTMatchCount"
// Entitlements to check against dext process
// Property is an array, one or more of which may match, of:
// an array of entitlement strings, all must be present
// Any array can be a single string.
#define kIOServiceDEXTEntitlementsKey "IOServiceDEXTEntitlements"
// Entitlement required to open dext connection
#define kIODriverKitEntitlementKey "com.apple.developer.driverkit"
// Entitlements required to open dext IOUserClient
// Property is an array of strings containing CFBundleIdentifiers of service being opened
#define kIODriverKitUserClientEntitlementsKey "com.apple.developer.driverkit.userclient-access"
// Allows the entitled process to open a user client connection to any dext that has specific entitlements
// Property is an array of strings containing entitlements, one of which needs to be present
// in the dext providing the user client being opened
#define kIODriverKitRequiredEntitlementsKey "com.apple.private.driverkit.driver-access"
// Entitlement of a dext that allows any task to open one of its IOUserClients
#define kIODriverKitUserClientEntitlementAllowAnyKey "com.apple.developer.driverkit.allow-any-userclient-access"
#define kIODriverKitUserClientEntitlementAdministratorKey "com.apple.developer.driverkit.administrator"
// Other DriverKit entitlements
#define kIODriverKitUSBTransportEntitlementKey "com.apple.developer.driverkit.transport.usb"
#define kIODriverKitHIDTransportEntitlementKey "com.apple.developer.driverkit.transport.hid"
#define kIODriverKitHIDFamilyDeviceEntitlementKey "com.apple.developer.driverkit.family.hid.device"
#define kIODriverKitHIDFamilyEventServiceEntitlementKey "com.apple.developer.driverkit.family.hid.eventservice"
#define kIODriverKitTransportBuiltinEntitlementKey "com.apple.developer.driverkit.builtin"
// Entitlement required to read nvram root-only properties as non-root user
#define kIONVRAMReadAccessKey "com.apple.private.iokit.nvram-read-access"
// Entitlement required to write nvram properties as non-root user
#define kIONVRAMWriteAccessKey "com.apple.private.iokit.nvram-write-access"
// Entitlement required to set properties on the IOResources object as non-root user
#define kIOResourcesSetPropertyKey "com.apple.private.iokit.ioresources.setproperty"
// Entitlement required to read/write to the system nvram region
#define kIONVRAMSystemAllowKey "com.apple.private.iokit.system-nvram-allow"
// When possible, defer matching of this driver until kextd has started.
#define kIOMatchDeferKey "IOMatchDefer"
// Published after processor_start() has been called on all CPUs at boot time.
#define kIOAllCPUInitializedKey "IOAllCPUInitialized"
// IOService default user client class, for loadable user clients
#define kIOUserClientClassKey "IOUserClientClass"
// key to find IOMappers
#define kIOMapperIDKey "IOMapperID"
#define kIOUserClientCrossEndianKey "IOUserClientCrossEndian"
#define kIOUserClientCrossEndianCompatibleKey "IOUserClientCrossEndianCompatible"
#define kIOUserClientSharedInstanceKey "IOUserClientSharedInstance"
#define kIOUserClientDefaultLockingKey "IOUserClientDefaultLocking"
// diagnostic string describing the creating task
#define kIOUserClientCreatorKey "IOUserClientCreator"
// the expected cdhash value of the userspace driver executable
#define kIOUserServerCDHashKey "IOUserServerCDHash"
#define kIOUserUserClientKey "IOUserUserClient"
#define kIOUserServerOneProcessKey "IOUserServerOneProcess"
// IOService notification types
#define kIOPublishNotification "IOServicePublish"
#define kIOFirstPublishNotification "IOServiceFirstPublish"
#define kIOMatchedNotification "IOServiceMatched"
#define kIOFirstMatchNotification "IOServiceFirstMatch"
#define kIOTerminatedNotification "IOServiceTerminate"
#define kIOWillTerminateNotification "IOServiceWillTerminate"
// IOService interest notification types
#define kIOGeneralInterest "IOGeneralInterest"
#define kIOBusyInterest "IOBusyInterest"
#define kIOAppPowerStateInterest "IOAppPowerStateInterest"
#define kIOPriorityPowerStateInterest "IOPriorityPowerStateInterest"
#define kIOPlatformDeviceMessageKey "IOPlatformDeviceMessage"
// IOService interest notification types
#define kIOCFPlugInTypesKey "IOCFPlugInTypes"
#define kIOCompatibilityMatchKey "IOCompatibilityMatch"
#define kIOCompatibilityPropertiesKey "IOCompatibilityProperties"
#define kIOPathKey "IOPath"
// properties found in services that implement command pooling
#define kIOCommandPoolSizeKey "IOCommandPoolSize" // (OSNumber)
// properties found in services that implement priority
#define kIOMaximumPriorityCountKey "IOMaximumPriorityCount" // (OSNumber)
// properties found in services that have transfer constraints
#define kIOMaximumBlockCountReadKey "IOMaximumBlockCountRead" // (OSNumber)
#define kIOMaximumBlockCountWriteKey "IOMaximumBlockCountWrite" // (OSNumber)
#define kIOMaximumByteCountReadKey "IOMaximumByteCountRead" // (OSNumber)
#define kIOMaximumByteCountWriteKey "IOMaximumByteCountWrite" // (OSNumber)
#define kIOMaximumSegmentCountReadKey "IOMaximumSegmentCountRead" // (OSNumber)
#define kIOMaximumSegmentCountWriteKey "IOMaximumSegmentCountWrite" // (OSNumber)
#define kIOMaximumSegmentByteCountReadKey "IOMaximumSegmentByteCountRead" // (OSNumber)
#define kIOMaximumSegmentByteCountWriteKey "IOMaximumSegmentByteCountWrite" // (OSNumber)
#define kIOMinimumSegmentAlignmentByteCountKey "IOMinimumSegmentAlignmentByteCount" // (OSNumber)
#define kIOMaximumSegmentAddressableBitCountKey "IOMaximumSegmentAddressableBitCount" // (OSNumber)
#define kIOMinimumSaturationByteCountKey "IOMinimumSaturationByteCount" // (OSNumber)
#define kIOMaximumSwapWriteKey "IOMaximumSwapWrite" // (OSNumber)
// properties found in services that wish to describe an icon
//
// IOIcon =
// {
// CFBundleIdentifier = "com.example.driver.example";
// IOBundleResourceFile = "example.icns";
// };
//
// where IOBundleResourceFile is the filename of the resource
#define kIOIconKey "IOIcon" // (OSDictionary)
#define kIOBundleResourceFileKey "IOBundleResourceFile" // (OSString)
#define kIOBusBadgeKey "IOBusBadge" // (OSDictionary)
#define kIODeviceIconKey "IODeviceIcon" // (OSDictionary)
// property of root that describes the machine's serial number as a string
#define kIOPlatformSerialNumberKey "IOPlatformSerialNumber" // (OSString)
// property of root that describes the machine's UUID as a string
#define kIOPlatformUUIDKey "IOPlatformUUID" // (OSString)
// IODTNVRAM property keys
#define kIONVRAMBootArgsKey "boot-args"
#define kIONVRAMDeletePropertyKey "IONVRAM-DELETE-PROPERTY"
#define kIONVRAMSyncNowPropertyKey "IONVRAM-SYNCNOW-PROPERTY"
#define kIONVRAMActivateCSRConfigPropertyKey "IONVRAM-ARMCSR-PROPERTY"
#define kIODTNVRAMPanicInfoKey "aapl,panic-info"
// keys for complex boot information
#define kIOBootDeviceKey "IOBootDevice" // dict | array of dicts
#define kIOBootDevicePathKey "IOBootDevicePath" // arch-neutral OSString
#define kIOBootDeviceSizeKey "IOBootDeviceSize" // OSNumber of bytes
// keys for OS Version information
#define kOSBuildVersionKey "OS Build Version"
//
#define kIOStateNotificationItemCreateKey "com.apple.iokit.statenotification.create"
#define kIOStateNotificationItemSetKey "com.apple.iokit.statenotification.set"
#define kIOStateNotificationItemCopyKey "com.apple.iokit.statenotification.copy"
#define kIOStateNotificationNameKey "com.apple.iokit.statenotification.name"
#define kIOStateNotificationEntitlementSetKey "com.apple.iokit.statenotification.entitlement-set"
#define kIOStateNotificationEntitlementGetKey "com.apple.iokit.statenotification.entitlement-get"
//
#define kIOSystemStateClamshellKey "com.apple.iokit.pm.clamshell"
#define kIOSystemStateSleepDescriptionKey "com.apple.iokit.pm.sleepdescription"
#define kIOSystemStateSleepDescriptionReasonKey "com.apple.iokit.pm.sleepreason"
#define kIOSystemStateSleepDescriptionHibernateStateKey "com.apple.iokit.pm.hibernatestate"
#define kIOSystemStateHaltDescriptionKey "com.apple.iokit.pm.haltdescription"
#define kIOSystemStateHaltDescriptionHaltStateKey "com.apple.iokit.pm.haltstate"
#define kIOSystemStatePowerSourceDescriptionKey "com.apple.iokit.pm.powersourcedescription"
#define kIOSystemStatePowerSourceDescriptionACAttachedKey "com.apple.iokit.pm.acattached"
#endif /* ! _IOKIT_IOKITKEYS_H */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/DriverKit/OSObject.h | /* iig(DriverKit-191.30.2) generated from OSObject.iig */
/* OSObject.iig:1-147 */
/*
* Copyright (c) 2019-2019 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#if !__IIG
#include <libkern/c++/OSObject.h>
#endif
#ifndef _IOKIT_UOSOBJECT_H
#define _IOKIT_UOSOBJECT_H
#if !__IIG_ATTRIBUTES_DEFINED__
#define __IIG_ATTRIBUTES_DEFINED__ 1
#if __IIG || __DOCUMENTATION__
#define IIG_KERNEL __attribute__((annotate("kernel")))
#define IIG_NATIVE __attribute__((annotate("native")))
#define IIG_LOCAL __attribute__((annotate("local")))
#define IIG_LOCALONLY __attribute__((annotate("localonly")))
#define IIG_REMOTE __attribute__((annotate("remote")))
#define IIG_LOCALHOST __attribute__((annotate("localhost")))
#define IIG_INVOKEREPLY __attribute__((annotate("invokereply")))
#define IIG_REPLY __attribute__((annotate("reply")))
#define IIG_PORTMAKESEND __attribute__((annotate("MACH_MSG_TYPE_MAKE_SEND")))
#define IIG_PORTCOPYSEND __attribute__((annotate("MACH_MSG_TYPE_COPY_SEND")))
#define IIG_TARGET __attribute__((annotate("target")))
#define IIG_TYPE(p) __attribute__((annotate("type=" # p)))
//#define IIG_ARRAY(maxcount) __attribute__((annotate(# maxcount), annotate("array")))
#define IIG_EXTENDS(cls) __attribute__((annotate("extends=" # cls)))
//#define IIG_INTERFACE __attribute__((annotate("interface")))
//#define IIG_IMPLEMENTS(i) void __implements(i *);
#define IIG_QUEUENAME(name) __attribute__((annotate("queuename=" # name)))
#define IIG_SERIALIZABLE __attribute__((annotate("serializable")))
#if __IIG
#define KERNEL IIG_KERNEL
#endif /* __IIG */
#define NATIVE IIG_NATIVE
#define LOCAL IIG_LOCAL
#define LOCALONLY IIG_LOCALONLY
#define REMOTE IIG_REMOTE
#define LOCALHOST IIG_LOCALHOST
#define INVOKEREPLY IIG_INVOKEREPLY
#define REPLY IIG_REPLY
#define PORTMAKESEND IIG_PORTMAKESEND
#define PORTCOPYSEND IIG_PORTCOPYSEND
#define TARGET IIG_TARGET
#define TYPE(p) IIG_TYPE(p)
//#define ARRAY(maxcount) IIG_ARRAY(maxcount)
#define EXTENDS(cls) IIG_EXTENDS(cls)
//#define INTERFACE IIG_INTERFACE
//#define IMPLEMENTS(i) IIG_IMPLEMENTS(i)
#define QUEUENAME(name) IIG_QUEUENAME(name)
#else /* __IIG || __DOCUMENTATION__ */
#define IIG_KERNEL
#define IIG_NATIVE
#define IIG_LOCAL
#define IIG_LOCALONLY
#define IIG_REMOTE
#define IIG_LOCALHOST
#define IIG_INVOKEREPLY
#define IIG_REPLY
#define IIG_PORTMAKESEND
#define IIG_PORTCOPYSEND
#define IIG_TARGET
#define IIG_TYPE(p)
//#define IIG_ARRAY(maxcount)
#define IIG_EXTENDS(cls)
//#define IIG_INTERFACE
//#define IIG_IMPLEMENTS(i)
#define IIG_QUEUENAME(name)
#define IIG_SERIALIZABLE
#endif /* __IIG || __DOCUMENTATION__ */
#endif /* __IIG_ATTRIBUTES_DEFINED__ */
#if !__IIG
typedef OSObject OSContainer;
#else /* !__IIG */
class IIG_SERIALIZABLE OSContainer;
#endif /* !__IIG */
class IIG_SERIALIZABLE OSData;
class IIG_SERIALIZABLE OSNumber;
class IIG_SERIALIZABLE OSString;
class IIG_SERIALIZABLE OSBoolean;
class IIG_SERIALIZABLE OSDictionary;
class IIG_SERIALIZABLE OSArray;
class IIG_SERIALIZABLE OSSet;
class IIG_SERIALIZABLE OSOrderedSet;
class OSMetaClass;
class IODispatchQueue;
typedef char IODispatchQueueName[256];
#if __IIG
/* OSObject.iig:162-164 */
#endif /* __IIG */
/* source class OSObject OSObject.iig:165-195 */
#if __DOCUMENTATION__
#define KERNEL IIG_KERNEL
/*!
*/
class OSObject : public OSMetaClassBase
{
public:
virtual bool
init() LOCALONLY;
virtual void
free() LOCALONLY;
virtual void
retain() const override;
virtual void
release() const override;
virtual kern_return_t
SetDispatchQueue(
const IODispatchQueueName name,
IODispatchQueue * queue) KERNEL = 0;
virtual kern_return_t
CopyDispatchQueue(
const IODispatchQueueName name,
IODispatchQueue ** queue) KERNEL = 0;
};
#undef KERNEL
#else /* __DOCUMENTATION__ */
/* generated class OSObject OSObject.iig:165-195 */
#define OSObject_SetDispatchQueue_ID 0xe608ae8273dae1bcULL
#define OSObject_CopyDispatchQueue_ID 0x95115b48fd29f7c9ULL
#define OSObject_SetDispatchQueue_Args \
const char * name, \
IODispatchQueue * queue
#define OSObject_CopyDispatchQueue_Args \
const char * name, \
IODispatchQueue ** queue
#define OSObject_Methods \
\
public:\
\
virtual kern_return_t\
Dispatch(const IORPC rpc) APPLE_KEXT_OVERRIDE;\
\
static kern_return_t\
_Dispatch(OSObject * self, const IORPC rpc);\
\
kern_return_t\
SetDispatchQueue(\
const IODispatchQueueName name,\
IODispatchQueue * queue,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
CopyDispatchQueue(\
const IODispatchQueueName name,\
IODispatchQueue ** queue,\
OSDispatchMethod supermethod = NULL);\
\
\
protected:\
/* _Impl methods */\
\
\
public:\
/* _Invoke methods */\
\
typedef kern_return_t (*SetDispatchQueue_Handler)(OSMetaClassBase * target, OSObject_SetDispatchQueue_Args);\
static kern_return_t\
SetDispatchQueue_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
SetDispatchQueue_Handler func);\
\
typedef kern_return_t (*CopyDispatchQueue_Handler)(OSMetaClassBase * target, OSObject_CopyDispatchQueue_Args);\
static kern_return_t\
CopyDispatchQueue_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
CopyDispatchQueue_Handler func);\
\
#define OSObject_KernelMethods \
\
protected:\
/* _Impl methods */\
\
#define OSObject_VirtualMethods \
\
public:\
\
virtual bool\
init(\
) APPLE_KEXT_OVERRIDE;\
\
virtual void\
free(\
) APPLE_KEXT_OVERRIDE;\
\
virtual void\
retain(\
) const APPLE_KEXT_OVERRIDE;\
\
virtual void\
release(\
) const APPLE_KEXT_OVERRIDE;\
\
#endif /* !__DOCUMENTATION__ */
/* OSObject.iig:197- */
#define DEFN(classname, name) \
name ## _Impl(classname ## _ ## name ## _Args)
/*
* Use of the IMPL macro is discouraged and should be replaced by a normal c++
* method implementation (with the all method arguments) and the name of the method
* given a suffix '_Impl'
*/
#define IMPL(classname, name) \
classname :: DEFN(classname, name)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#endif /* ! _IOKIT_UOSOBJECT_H */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/DriverKit/IOServiceStateNotificationDispatchSource.h | /* iig(DriverKit-191.30.2) generated from IOServiceStateNotificationDispatchSource.iig */
/* IOServiceStateNotificationDispatchSource.iig:1-36 */
/*
* Copyright (c) 2019-2019 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _IOKIT_UIOSERVICESTATEDISPATCHSOURCE_H
#define _IOKIT_UIOSERVICESTATEDISPATCHSOURCE_H
#include <DriverKit/IODispatchQueue.h> /* .iig include */
#include <DriverKit/OSAction.h> /* .iig include */
#include <DriverKit/IOService.h> /* .iig include */
/* source class IOServiceStateNotificationDispatchSource IOServiceStateNotificationDispatchSource.iig:37-106 */
#if __DOCUMENTATION__
#define KERNEL IIG_KERNEL
class NATIVE KERNEL IOServiceStateNotificationDispatchSource : public IODispatchSource
{
public:
virtual bool
init() override;
virtual void
free() override;
/*!
* @brief Create an IOServiceStateNotificationDispatchSource for notification of IOService state events sent by the StateNotificationSet() api.
* @param service The object hosting state, typically returned by IOService::CopySystemStateNotificationService().
* @param items Array of state item names to be notified about.
* @param queue IODispatchQueue the source is attached to. Note that the StateNotificationReady
* handler is invoked on the queue set for the target method
* of the OSAction, not this queue.
* @param source Created source with +1 retain count to be released by the caller.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
static kern_return_t
Create(IOService * service, OSArray * items, IODispatchQueue * queue, IOServiceStateNotificationDispatchSource ** source) LOCAL;
/*!
* @brief Control the enable state of the notification.
* @param enable Pass true to enable the source or false to disable.
* @param handler Optional block to be executed after the interrupt has been disabled and any pending
* interrupt handlers completed.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
SetEnableWithCompletion(
bool enable,
IODispatchSourceCancelHandler handler) override LOCAL;
/*!
* @brief Cancel all callbacks from the event source.
* @discussion After cancellation, the source can only be freed. It cannot be reactivated.
* @param handler Handler block to be invoked after any callbacks have completed.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
Cancel(IODispatchSourceCancelHandler handler) override LOCAL;
/*!
* @brief Set the handler block to run when the notification has become ready.
* @param action OSAction instance specifying the callback method. The OSAction object will be retained
* until SetHandler is called again or the event source is cancelled.
* The StateNotificationReady handler is invoked on the queue set for the target method of the
* OSAction.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
SetHandler(
OSAction * action TYPE(StateNotificationReady));
/*!
* @brief Rearm the notification.
* @discussion Call this method in the implementation of your StateNotificationReady action
* before reading any item values.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
StateNotificationBegin(void);
private:
virtual void
StateNotificationReady(
OSAction * action TARGET) LOCAL = 0;
};
#undef KERNEL
#else /* __DOCUMENTATION__ */
/* generated class IOServiceStateNotificationDispatchSource IOServiceStateNotificationDispatchSource.iig:37-106 */
#define IOServiceStateNotificationDispatchSource_Create_ID 0xddfc03b5eb685059ULL
#define IOServiceStateNotificationDispatchSource_SetHandler_ID 0x91981670bc7b5188ULL
#define IOServiceStateNotificationDispatchSource_StateNotificationBegin_ID 0xe0940d907a5fc5dcULL
#define IOServiceStateNotificationDispatchSource_StateNotificationReady_ID 0xda6f23bbb0b49076ULL
#define IOServiceStateNotificationDispatchSource_Create_Args \
IOService * service, \
OSArray * items, \
IODispatchQueue * queue, \
IOServiceStateNotificationDispatchSource ** source
#define IOServiceStateNotificationDispatchSource_SetEnableWithCompletion_Args \
bool enable, \
IODispatchSourceCancelHandler handler
#define IOServiceStateNotificationDispatchSource_Cancel_Args \
IODispatchSourceCancelHandler handler
#define IOServiceStateNotificationDispatchSource_SetHandler_Args \
OSAction * action
#define IOServiceStateNotificationDispatchSource_StateNotificationBegin_Args \
#define IOServiceStateNotificationDispatchSource_StateNotificationReady_Args \
OSAction * action
#define IOServiceStateNotificationDispatchSource_Methods \
\
public:\
\
virtual kern_return_t\
Dispatch(const IORPC rpc) APPLE_KEXT_OVERRIDE;\
\
static kern_return_t\
_Dispatch(IOServiceStateNotificationDispatchSource * self, const IORPC rpc);\
\
static kern_return_t\
Create(\
IOService * service,\
OSArray * items,\
IODispatchQueue * queue,\
IOServiceStateNotificationDispatchSource ** source);\
\
kern_return_t\
SetHandler(\
OSAction * action,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
StateNotificationBegin(\
OSDispatchMethod supermethod = NULL);\
\
void\
StateNotificationReady(\
OSAction * action,\
OSDispatchMethod supermethod = NULL);\
\
\
protected:\
/* _Impl methods */\
\
static kern_return_t\
Create_Call(IOServiceStateNotificationDispatchSource_Create_Args);\
\
kern_return_t\
SetEnableWithCompletion_Impl(IODispatchSource_SetEnableWithCompletion_Args);\
\
kern_return_t\
Cancel_Impl(IODispatchSource_Cancel_Args);\
\
\
public:\
/* _Invoke methods */\
\
typedef kern_return_t (*Create_Handler)(IOServiceStateNotificationDispatchSource_Create_Args);\
static kern_return_t\
Create_Invoke(const IORPC rpc,\
Create_Handler func);\
\
typedef kern_return_t (*SetHandler_Handler)(OSMetaClassBase * target, IOServiceStateNotificationDispatchSource_SetHandler_Args);\
static kern_return_t\
SetHandler_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
SetHandler_Handler func);\
\
typedef kern_return_t (*StateNotificationBegin_Handler)(OSMetaClassBase * targetIOServiceStateNotificationDispatchSource_StateNotificationBegin_Args);\
static kern_return_t\
StateNotificationBegin_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
StateNotificationBegin_Handler func);\
\
typedef void (*StateNotificationReady_Handler)(OSMetaClassBase * target, IOServiceStateNotificationDispatchSource_StateNotificationReady_Args);\
static kern_return_t\
StateNotificationReady_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
StateNotificationReady_Handler func,\
const OSMetaClass * targetActionClass);\
\
static kern_return_t\
StateNotificationReady_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
StateNotificationReady_Handler func);\
\
#define IOServiceStateNotificationDispatchSource_KernelMethods \
\
protected:\
/* _Impl methods */\
\
static kern_return_t\
Create_Impl(IOServiceStateNotificationDispatchSource_Create_Args);\
\
kern_return_t\
SetHandler_Impl(IOServiceStateNotificationDispatchSource_SetHandler_Args);\
\
kern_return_t\
StateNotificationBegin_Impl(IOServiceStateNotificationDispatchSource_StateNotificationBegin_Args);\
\
#define IOServiceStateNotificationDispatchSource_VirtualMethods \
\
public:\
\
virtual bool\
init(\
) APPLE_KEXT_OVERRIDE;\
\
virtual void\
free(\
) APPLE_KEXT_OVERRIDE;\
\
class IOServiceStateNotificationDispatchSourceInterface : public OSInterface
{
public:
};
struct IOServiceStateNotificationDispatchSource_IVars;
struct IOServiceStateNotificationDispatchSource_LocalIVars;
class IOServiceStateNotificationDispatchSource : public IODispatchSource, public IOServiceStateNotificationDispatchSourceInterface
{
OSDeclareDefaultStructorsWithDispatch(IOServiceStateNotificationDispatchSource);
public:
#ifdef IOServiceStateNotificationDispatchSource_DECLARE_IVARS
IOServiceStateNotificationDispatchSource_DECLARE_IVARS
#else /* IOServiceStateNotificationDispatchSource_DECLARE_IVARS */
union
{
IOServiceStateNotificationDispatchSource_IVars * ivars;
IOServiceStateNotificationDispatchSource_LocalIVars * lvars;
};
#endif /* IOServiceStateNotificationDispatchSource_DECLARE_IVARS */
using super = IODispatchSource;
IOServiceStateNotificationDispatchSource_VirtualMethods
};
#endif /* !__DOCUMENTATION__ */
/* IOServiceStateNotificationDispatchSource.iig:108- */
#endif /* ! _IOKIT_UIOSERVICESTATEDISPATCHSOURCE_H */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/DriverKit/OSBoundedArray.h | /*
* Copyright (c) 2019 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef XNU_LIBKERN_LIBKERN_CXX_OS_BOUNDED_ARRAY_H
#define XNU_LIBKERN_LIBKERN_CXX_OS_BOUNDED_ARRAY_H
#if !TAPI
#if DRIVERKIT_FRAMEWORK_INCLUDE
#include <DriverKit/bounded_array.h>
#include <DriverKit/OSBoundedPtr.h>
#else
#include <libkern/c++/bounded_array.h>
#include <libkern/c++/OSBoundedPtr.h>
#endif /* DRIVERKIT_FRAMEWORK_INCLUDE */
#include <stddef.h>
template <typename T, size_t N>
using OSBoundedArray = libkern::bounded_array<T, N, os_detail::panic_trapping_policy>;
#endif /* !TAPI */
#endif /* !XNU_LIBKERN_LIBKERN_CXX_OS_BOUNDED_ARRAY_H */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/DriverKit/OSBoundedArrayRef.h | /*
* Copyright (c) 2019 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef XNU_LIBKERN_LIBKERN_CXX_OS_BOUNDED_ARRAY_REF_H
#define XNU_LIBKERN_LIBKERN_CXX_OS_BOUNDED_ARRAY_REF_H
#if !TAPI
#if DRIVERKIT_FRAMEWORK_INCLUDE
#include <DriverKit/bounded_array_ref.h>
#include <DriverKit/OSBoundedPtr.h>
#else
#include <libkern/c++/bounded_array_ref.h>
#include <libkern/c++/OSBoundedPtr.h>
#endif /* DRIVERKIT_FRAMEWORK_INCLUDE */
template <typename T>
using OSBoundedArrayRef = libkern::bounded_array_ref<T, os_detail::panic_trapping_policy>;
#endif /* !TAPI */
#endif /* !XNU_LIBKERN_LIBKERN_CXX_OS_BOUNDED_ARRAY_REF_H */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/DriverKit/IOMemoryMap.h | /* iig(DriverKit-191.30.2) generated from IOMemoryMap.iig */
/* IOMemoryMap.iig:1-46 */
/*
* Copyright (c) 2019-2019 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#if !__IIG
#include <IOKit/IOMemoryDescriptor.h>
#endif
#ifndef _IOKIT_UIOMEMORYMAP_H
#define _IOKIT_UIOMEMORYMAP_H
#include <DriverKit/OSObject.h> /* .iig include */
struct _IOMemoryMapPrivateState {
uint64_t length;
uint64_t offset;
uint64_t options;
uint64_t address;
};
/* source class IOMemoryMap IOMemoryMap.iig:47-87 */
#if __DOCUMENTATION__
#define KERNEL IIG_KERNEL
/*!
* @class IOMemoryMap
*
* @abstract
* IOMemoryMap describes a memory mapping created with IOMemoryDescriptor::CreateMapping()
*
* @discussion
* To allocate memory for I/O or sharing, use IOBufferMemoryDescriptor::Create()
* Methods in this class are used for memory that was supplied as a parameter.
*/
class KERNEL IOMemoryMap : public OSObject
{
public:
virtual bool
init() override;
virtual void
free() override;
/*!
* @brief Obtain the address of the memory mapping.
* @return Address.
*/
uint64_t
GetAddress() LOCALONLY;
/*!
* @brief Obtain the length of the memory mapping.
* @return Length.
*/
uint64_t
GetLength() LOCALONLY;
/*!
* @brief Obtain the offset of the memory mapping.
* @return Offset.
*/
uint64_t
GetOffset() LOCALONLY;
};
#undef KERNEL
#else /* __DOCUMENTATION__ */
/* generated class IOMemoryMap IOMemoryMap.iig:47-87 */
#define IOMemoryMap__CopyState_ID 0xfc92b3d7f2d48ec7ULL
#define IOMemoryMap__CopyState_Args \
_IOMemoryMapPrivateState * state
#define IOMemoryMap_Methods \
\
public:\
\
virtual kern_return_t\
Dispatch(const IORPC rpc) APPLE_KEXT_OVERRIDE;\
\
static kern_return_t\
_Dispatch(IOMemoryMap * self, const IORPC rpc);\
\
kern_return_t\
_CopyState(\
_IOMemoryMapPrivateState * state,\
OSDispatchMethod supermethod = NULL);\
\
uint64_t\
GetAddress(\
);\
\
uint64_t\
GetLength(\
);\
\
uint64_t\
GetOffset(\
);\
\
\
protected:\
/* _Impl methods */\
\
\
public:\
/* _Invoke methods */\
\
typedef kern_return_t (*_CopyState_Handler)(OSMetaClassBase * target, IOMemoryMap__CopyState_Args);\
static kern_return_t\
_CopyState_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
_CopyState_Handler func);\
\
#define IOMemoryMap_KernelMethods \
\
protected:\
/* _Impl methods */\
\
kern_return_t\
_CopyState_Impl(IOMemoryMap__CopyState_Args);\
\
#define IOMemoryMap_VirtualMethods \
\
public:\
\
virtual bool\
init(\
) APPLE_KEXT_OVERRIDE;\
\
virtual void\
free(\
) APPLE_KEXT_OVERRIDE;\
\
#endif /* !__DOCUMENTATION__ */
/* IOMemoryMap.iig:96- */
#endif /* ! _IOKIT_UIOMEMORYMAP_H */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/DriverKit/IOMemoryDescriptor.h | /* iig(DriverKit-191.30.2) generated from IOMemoryDescriptor.iig */
/* IOMemoryDescriptor.iig:1-78 */
/*
* Copyright (c) 2019-2019 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#if !__IIG
#include <IOKit/IOMemoryDescriptor.h>
#endif
#ifndef _IOKIT_UIOMEMORYDESCRIPTOR_H
#define _IOKIT_UIOMEMORYDESCRIPTOR_H
#include <DriverKit/OSObject.h> /* .iig include */
class IOService;
class IOMemoryMap;
// IOMemoryDescriptor Create options
enum {
kIOMemoryDirectionNone = 0x00000000,
kIOMemoryDirectionIn = 0x00000001,
kIOMemoryDirectionOut = 0x00000002,
kIOMemoryDirectionOutIn = kIOMemoryDirectionIn | kIOMemoryDirectionOut,
kIOMemoryDirectionInOut = kIOMemoryDirectionOutIn,
kIOMemoryDisableCopyOnWrite = 0x00000010
};
// IOMemoryDescriptor CreateMapping options
enum {
kIOMemoryMapFixedAddress = 0x00000001,
kIOMemoryMapReadOnly = 0x00000002,
kIOMemoryMapGuardedMask = 0x0000001C,
kIOMemoryMapGuardedDefault = 0x00000000,
kIOMemoryMapGuardedNone = 0x00000004,
kIOMemoryMapGuardedSmall = 0x00000008,
kIOMemoryMapGuardedLarge = 0x0000000C,
kIOMemoryMapCacheModeDefault = 0x00000000,
kIOMemoryMapCacheModeInhibit = 0x00000100,
kIOMemoryMapCacheModeCopyback = 0x00000200,
kIOMemoryMapCacheModeWriteThrough = 0x00000400,
};
struct IOAddressSegment {
uint64_t address;
uint64_t length;
};
struct _IOMDPrivateState {
uint64_t length;
uint64_t options;
};
/* source class IOMemoryDescriptor IOMemoryDescriptor.iig:79-191 */
#if __DOCUMENTATION__
#define KERNEL IIG_KERNEL
/*!
* @class IOMemoryDescriptor
*
* @abstract
* IOMemoryDescriptor describes a memory buffer.
*
* @discussion
* To allocate memory for I/O or sharing, use IOBufferMemoryDescriptor::Create()
* Methods in this class are used for memory that was supplied as a parameter.
*
*/
class KERNEL IOMemoryDescriptor : public OSObject
{
public:
virtual bool
init() override;
virtual void
free() override;
/*!
* @brief Obtain the length of the memory described.
* @param returnLength Returned length.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
kern_return_t
GetLength(
uint64_t * returnLength) LOCALONLY;
/*!
* @brief Create a mapping of the memory in the callers address space.
* @param options
* kIOMemoryMapFixedAddress map at the address requested
* kIOMemoryMapReadOnly create a read only mapping
* kIOMemoryMapCacheModeDefault default cache mode
* kIOMemoryMapCacheModeInhibit inhibited cache mode
* kIOMemoryMapCacheModeCopyback copyback cache mode
* kIOMemoryMapCacheModeWriteThrough write through cache mode
* @param address Requested address if kIOMemoryMapFixedAddress was passed
* @param offset Start offset of the mapping in the descriptor.
* @param length Pass zero to map the entire memory, or a value <= the length of the descriptor.
* @param alignment of the memory virtual mapping. Only zero for no alignment is supported.
* @param map Returned IOMemoryMap object with +1 retain count.
* It should be retained until the map is no longer required.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
CreateMapping(
uint64_t options,
uint64_t address,
uint64_t offset,
uint64_t length,
uint64_t alignment,
IOMemoryMap ** map);
/*!
* @brief Create a memory descriptor that is a subrange of another memory
* descriptor
* @param memoryDescriptorCreateOptions
* kIOMemoryDirectionIn memory described will be writable
* kIOMemoryDirectionOut memory described will be readable
* @param offset Start offset of the memory relative to the descriptor ofDescriptor.
* @param length Length of the memory.
* @param ofDescriptor Memory descriptor describing source memory.
* @param memory Returned IOMemoryDescriptor object with +1 retain count.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
static kern_return_t
CreateSubMemoryDescriptor(
uint64_t memoryDescriptorCreateOptions,
uint64_t offset,
uint64_t length,
IOMemoryDescriptor * ofDescriptor,
IOMemoryDescriptor ** memory) __attribute__((availability(driverkit,introduced=20.0)));
/*!
* @brief Create a memory descriptor that is a concatenation of a set of memory
* descriptors
* @param memoryDescriptorCreateOptions
* kIOMemoryDirectionIn memory described will be writable. The source
* descriptors must include this direction.
* kIOMemoryDirectionOut memory described will be readable. The source
* descriptors must include this direction.
* @param withDescriptorsCount Number of valid memory descriptors being passed
* in the withDescriptors array.
* @param withDescriptors Source memory descriptor array.
* @param memory Returned IOMemoryDescriptor object with +1 retain count.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
static kern_return_t
CreateWithMemoryDescriptors(
uint64_t memoryDescriptorCreateOptions,
uint32_t withDescriptorsCount,
IOMemoryDescriptor * const withDescriptors[32],
IOMemoryDescriptor ** memory) __attribute__((availability(driverkit,introduced=20.0)));
private:
kern_return_t
Map(
uint64_t options,
uint64_t address,
uint64_t length,
uint64_t alignment,
uint64_t * returnAddress,
uint64_t * returnLength) LOCALONLY;
};
#undef KERNEL
#else /* __DOCUMENTATION__ */
/* generated class IOMemoryDescriptor IOMemoryDescriptor.iig:79-191 */
#define IOMemoryDescriptor__CopyState_ID 0xa2c0861d4118ce5eULL
#define IOMemoryDescriptor_CreateMapping_ID 0xc5e69b0414ff6ee5ULL
#define IOMemoryDescriptor_CreateSubMemoryDescriptor_ID 0xb085b5ee60ac732fULL
#define IOMemoryDescriptor_CreateWithMemoryDescriptors_ID 0xba1530c996c4febcULL
#define IOMemoryDescriptor__CopyState_Args \
_IOMDPrivateState * state
#define IOMemoryDescriptor_CreateMapping_Args \
uint64_t options, \
uint64_t address, \
uint64_t offset, \
uint64_t length, \
uint64_t alignment, \
IOMemoryMap ** map
#define IOMemoryDescriptor_CreateSubMemoryDescriptor_Args \
uint64_t memoryDescriptorCreateOptions, \
uint64_t offset, \
uint64_t length, \
IOMemoryDescriptor * ofDescriptor, \
IOMemoryDescriptor ** memory
#define IOMemoryDescriptor_CreateWithMemoryDescriptors_Args \
uint64_t memoryDescriptorCreateOptions, \
uint32_t withDescriptorsCount, \
IOMemoryDescriptor ** const withDescriptors, \
IOMemoryDescriptor ** memory
#define IOMemoryDescriptor_Methods \
\
public:\
\
virtual kern_return_t\
Dispatch(const IORPC rpc) APPLE_KEXT_OVERRIDE;\
\
static kern_return_t\
_Dispatch(IOMemoryDescriptor * self, const IORPC rpc);\
\
kern_return_t\
_CopyState(\
_IOMDPrivateState * state,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
GetLength(\
uint64_t * returnLength);\
\
kern_return_t\
CreateMapping(\
uint64_t options,\
uint64_t address,\
uint64_t offset,\
uint64_t length,\
uint64_t alignment,\
IOMemoryMap ** map,\
OSDispatchMethod supermethod = NULL);\
\
static kern_return_t\
CreateSubMemoryDescriptor(\
uint64_t memoryDescriptorCreateOptions,\
uint64_t offset,\
uint64_t length,\
IOMemoryDescriptor * ofDescriptor,\
IOMemoryDescriptor ** memory) __attribute__((availability(driverkit,introduced=20.0)));\
\
static kern_return_t\
CreateWithMemoryDescriptors(\
uint64_t memoryDescriptorCreateOptions,\
uint32_t withDescriptorsCount,\
IOMemoryDescriptor ** const withDescriptors,\
IOMemoryDescriptor ** memory) __attribute__((availability(driverkit,introduced=20.0)));\
\
kern_return_t\
Map(\
uint64_t options,\
uint64_t address,\
uint64_t length,\
uint64_t alignment,\
uint64_t * returnAddress,\
uint64_t * returnLength);\
\
\
protected:\
/* _Impl methods */\
\
\
public:\
/* _Invoke methods */\
\
typedef kern_return_t (*_CopyState_Handler)(OSMetaClassBase * target, IOMemoryDescriptor__CopyState_Args);\
static kern_return_t\
_CopyState_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
_CopyState_Handler func);\
\
typedef kern_return_t (*CreateMapping_Handler)(OSMetaClassBase * target, IOMemoryDescriptor_CreateMapping_Args);\
static kern_return_t\
CreateMapping_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
CreateMapping_Handler func);\
\
typedef kern_return_t (*CreateSubMemoryDescriptor_Handler)(IOMemoryDescriptor_CreateSubMemoryDescriptor_Args);\
static kern_return_t\
CreateSubMemoryDescriptor_Invoke(const IORPC rpc,\
CreateSubMemoryDescriptor_Handler func);\
\
typedef kern_return_t (*CreateWithMemoryDescriptors_Handler)(IOMemoryDescriptor_CreateWithMemoryDescriptors_Args);\
static kern_return_t\
CreateWithMemoryDescriptors_Invoke(const IORPC rpc,\
CreateWithMemoryDescriptors_Handler func);\
\
#define IOMemoryDescriptor_KernelMethods \
\
protected:\
/* _Impl methods */\
\
kern_return_t\
_CopyState_Impl(IOMemoryDescriptor__CopyState_Args);\
\
kern_return_t\
CreateMapping_Impl(IOMemoryDescriptor_CreateMapping_Args);\
\
static kern_return_t\
CreateSubMemoryDescriptor_Impl(IOMemoryDescriptor_CreateSubMemoryDescriptor_Args);\
\
static kern_return_t\
CreateWithMemoryDescriptors_Impl(IOMemoryDescriptor_CreateWithMemoryDescriptors_Args);\
\
#define IOMemoryDescriptor_VirtualMethods \
\
public:\
\
virtual bool\
init(\
) APPLE_KEXT_OVERRIDE;\
\
virtual void\
free(\
) APPLE_KEXT_OVERRIDE;\
\
#endif /* !__DOCUMENTATION__ */
/* IOMemoryDescriptor.iig:200- */
#endif /* ! _IOKIT_UIOMEMORYDESCRIPTOR_H */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/DriverKit/IODispatchSource.h | /* iig(DriverKit-191.30.2) generated from IODispatchSource.iig */
/* IODispatchSource.iig:1-36 */
/*
* Copyright (c) 2019-2019 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _IOKIT_UIODISPATCHSOURCE_H
#define _IOKIT_UIODISPATCHSOURCE_H
#include <DriverKit/OSObject.h> /* .iig include */
typedef void (^IODispatchSourceCancelHandler)(void);
/* source class IODispatchSource IODispatchSource.iig:37-66 */
#if __DOCUMENTATION__
#define KERNEL IIG_KERNEL
/*!
* @class IODispatchSource
* @abstract
* IODispatchSource common base class for dispatch sources.
*/
class NATIVE KERNEL IODispatchSource : public OSObject
{
public:
virtual bool
init() override;
virtual void
free() override;
virtual kern_return_t
Cancel(IODispatchSourceCancelHandler handler) = 0;
virtual kern_return_t
SetEnableWithCompletion(
bool enable,
IODispatchSourceCancelHandler handler) = 0;
virtual kern_return_t
CheckForWork(bool synchronous) INVOKEREPLY = 0;
virtual kern_return_t
SetEnable(bool enable) LOCAL;
};
#undef KERNEL
#else /* __DOCUMENTATION__ */
/* generated class IODispatchSource IODispatchSource.iig:37-66 */
#define IODispatchSource_Cancel_ID 0xd963bb196f70bb93ULL
#define IODispatchSource_SetEnableWithCompletion_ID 0xbb42c489fe4dee8eULL
#define IODispatchSource_CheckForWork_ID 0xef19d38d4f945fd0ULL
#define IODispatchSource_SetEnable_ID 0xbbc036b4c2a26c45ULL
#define IODispatchSource_Cancel_Args \
IODispatchSourceCancelHandler handler
#define IODispatchSource_SetEnableWithCompletion_Args \
bool enable, \
IODispatchSourceCancelHandler handler
#define IODispatchSource_CheckForWork_Args \
const IORPC rpc, \
bool synchronous
#define IODispatchSource_SetEnable_Args \
bool enable
#define IODispatchSource_Methods \
\
public:\
\
virtual kern_return_t\
Dispatch(const IORPC rpc) APPLE_KEXT_OVERRIDE;\
\
static kern_return_t\
_Dispatch(IODispatchSource * self, const IORPC rpc);\
\
kern_return_t\
Cancel(\
IODispatchSourceCancelHandler handler,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
SetEnableWithCompletion(\
bool enable,\
IODispatchSourceCancelHandler handler,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
CheckForWork(\
bool synchronous,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
SetEnable(\
bool enable,\
OSDispatchMethod supermethod = NULL);\
\
\
protected:\
/* _Impl methods */\
\
kern_return_t\
SetEnable_Impl(IODispatchSource_SetEnable_Args);\
\
\
public:\
/* _Invoke methods */\
\
typedef kern_return_t (*Cancel_Handler)(OSMetaClassBase * target, IODispatchSource_Cancel_Args);\
static kern_return_t\
Cancel_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
Cancel_Handler func);\
\
typedef kern_return_t (*SetEnableWithCompletion_Handler)(OSMetaClassBase * target, IODispatchSource_SetEnableWithCompletion_Args);\
static kern_return_t\
SetEnableWithCompletion_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
SetEnableWithCompletion_Handler func);\
\
typedef kern_return_t (*CheckForWork_Handler)(OSMetaClassBase * target, IODispatchSource_CheckForWork_Args);\
static kern_return_t\
CheckForWork_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
CheckForWork_Handler func);\
\
typedef kern_return_t (*SetEnable_Handler)(OSMetaClassBase * target, IODispatchSource_SetEnable_Args);\
static kern_return_t\
SetEnable_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
SetEnable_Handler func);\
\
#define IODispatchSource_KernelMethods \
\
protected:\
/* _Impl methods */\
\
#define IODispatchSource_VirtualMethods \
\
public:\
\
virtual bool\
init(\
) APPLE_KEXT_OVERRIDE;\
\
virtual void\
free(\
) APPLE_KEXT_OVERRIDE;\
\
class IODispatchSourceInterface : public OSInterface
{
public:
};
struct IODispatchSource_IVars;
struct IODispatchSource_LocalIVars;
class IODispatchSource : public OSObject, public IODispatchSourceInterface
{
OSDeclareDefaultStructorsWithDispatch(IODispatchSource);
public:
#ifdef IODispatchSource_DECLARE_IVARS
IODispatchSource_DECLARE_IVARS
#else /* IODispatchSource_DECLARE_IVARS */
union
{
IODispatchSource_IVars * ivars;
IODispatchSource_LocalIVars * lvars;
};
#endif /* IODispatchSource_DECLARE_IVARS */
using super = OSObject;
IODispatchSource_VirtualMethods
};
#endif /* !__DOCUMENTATION__ */
/* IODispatchSource.iig:68- */
#endif /* ! _IOKIT_UIODISPATCHSOURCE_H */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/DriverKit/OSAction.h | /* iig(DriverKit-191.30.2) generated from OSAction.iig */
/* OSAction.iig:1-38 */
/*
* Copyright (c) 2019-2019 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _IOKIT_OSACTION_H
#define _IOKIT_OSACTION_H
#include <DriverKit/OSObject.h> /* .iig include */
typedef void (^OSActionCancelHandler)(void);
typedef void (^OSActionAbortedHandler)(void);
struct OSActionWaitToken;
class OSString;
/* source class OSAction OSAction.iig:39-170 */
#if __DOCUMENTATION__
#define KERNEL IIG_KERNEL
/*!
* @class OSAction
*
* @abstract
* OSAction is an object that represents a callback to be be invoked.
*
* @discussion
* The callback is specified as a method and object pair.
* State associated with the callback may be allocated and stored for the creator of the object.
* Methods to allocate an OSAction instance are generated for each method defined in a class with
* a TYPE attribute. The generated methods are named CreateAction{name of method with type attribute}
* and have the following declaration:
*
* kern_return_t CreateActionNameOfMethod(size_t referenceSize, OSAction **action);
*
* referenceSize refers to the size of additional state structure available to the creator of the OSAction
* with GetReference. If successful, the generated method returns kIOReturnSuccess and a created OSAction
* through the 'action' parameter with a +1 retain count to be released by the caller. See IOReturn.h for
* error codes.
*/
class NATIVE KERNEL OSAction : public OSObject
{
public:
#if DRIVERKIT_PRIVATE
/*!
* @brief Create an instance of OSAction.
* @discussion Methods to allocate an OSAction instance are generated for each method defined in a class with
* a TYPE attribute, so there should not be any need to directly call OSAction::Create().
* @param target OSObject to receive the callback. This object will be retained until the OSAction is
* canceled or freed.
* @param targetmsgid Generated message ID for the target method.
* @param msgid Generated message ID for the method invoked by the receiver of the OSAction
* to generate the callback.
* @param referenceSize Size of additional state structure available to the creator of the OSAction
* with GetReference.
* @param action Created OSAction with +1 retain count to be released by the caller.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
static kern_return_t
Create(
OSObject * target,
uint64_t targetmsgid,
uint64_t msgid,
size_t referenceSize,
OSAction ** action) LOCAL;
static kern_return_t
CreateWithTypeName(
OSObject * target,
uint64_t targetmsgid,
uint64_t msgid,
size_t referenceSize,
OSString * typeName,
OSAction ** action) LOCAL;
#endif
virtual void
free() override;
/*!
* @brief Return a pointer to any state allocated by the OSAction creator.
* @discussion Reference data is allocated with zero initialized content. It may be set and retrieved later
* with this method.
* @return A pointer to storage for the owner. It will be NULL if referenceSize was zero, and NULL
* when called in a process other than the owner that is receiving the OSAction as a parameter.
*/
void *
GetReference() LOCALONLY;
/*!
* @brief Cancel all callbacks from the action.
* @discussion After cancellation, the action can only be freed. It cannot be reactivated.
* @param handler Handler block to be invoked after any callbacks have completed.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
kern_return_t
Cancel(OSActionCancelHandler handler) LOCALONLY;
/*!
* @brief Install a handler to be invoked when no other processes reference the action.
* @discussion When all tasks other than the creator release their references to the action,
* invoke the handler in the owner. A task exiting will always remove its references.
* @param handler Handler block to be invoked on no more references.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
kern_return_t
SetAbortedHandler(OSActionAbortedHandler handler) LOCALONLY;
/*!
* @brief Mark this OSAction to be waited for later with Wait().
* @discussion This call should be made before any possible invocation of the action.
* An OSAction instance only supports one waiter and WillWait() will return an error if already called.
* @param token Opaque value to be passed to a later call to Wait() and EndWait().
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
kern_return_t
WillWait(OSActionWaitToken ** token) LOCALONLY;
/*!
* @brief Discard the OSActionWaitToken for the action.
* @discussion Free any resources needed to wait for the action allocated by WillWait().
* There should be no outstanding invocations of the action when EndWait is called,
* if necessary the action should be canceled before calling EndWait().
* @param token Opaque value to be passed from an earlier call to WillWait().
* @return kIOReturnSuccess on success. kIOReturnAborted if aborted or canceled.
kIOReturnTimeout if the deadline was passed. See IOReturn.h for error codes.
*/
kern_return_t
EndWait(
OSActionWaitToken * token) LOCALONLY;
/*!
* @brief Wait for the action to be invoked.
* @discussion The current thread is blocked until the action invocation has completed, the action canceled
or aborted, or the deadline passed.
* @param token Opaque value to be passed from an earlier call to WillWait().
* @param options Pass one of the kIOTimerClock* options to specify the timebase for the
* deadline, or zero for no timeout.
* @param deadline Pass the time the wait should timeout, or zero for no timeout.
* @return kIOReturnSuccess on success. kIOReturnAborted if aborted or canceled.
kIOReturnTimeout if the deadline was passed. See IOReturn.h for error codes.
*/
kern_return_t
Wait(
OSActionWaitToken * token,
uint64_t options,
uint64_t deadline) LOCALONLY;
virtual void
Aborted(void) LOCAL;
};
#undef KERNEL
#else /* __DOCUMENTATION__ */
/* generated class OSAction OSAction.iig:39-170 */
#define OSAction_Create_ID 0xaa1fc3ce85ce5497ULL
#define OSAction_CreateWithTypeName_ID 0xa0c5b3ed5a8ea283ULL
#define OSAction_Aborted_ID 0xbfb95094c657d68fULL
#define OSAction_Create_Args \
OSObject * target, \
uint64_t targetmsgid, \
uint64_t msgid, \
size_t referenceSize, \
OSAction ** action
#define OSAction_CreateWithTypeName_Args \
OSObject * target, \
uint64_t targetmsgid, \
uint64_t msgid, \
size_t referenceSize, \
OSString * typeName, \
OSAction ** action
#define OSAction_Aborted_Args \
#define OSAction_Methods \
\
public:\
\
virtual kern_return_t\
Dispatch(const IORPC rpc) APPLE_KEXT_OVERRIDE;\
\
static kern_return_t\
_Dispatch(OSAction * self, const IORPC rpc);\
\
static kern_return_t\
Create(\
OSObject * target,\
uint64_t targetmsgid,\
uint64_t msgid,\
size_t referenceSize,\
OSAction ** action);\
\
static kern_return_t\
CreateWithTypeName(\
OSObject * target,\
uint64_t targetmsgid,\
uint64_t msgid,\
size_t referenceSize,\
OSString * typeName,\
OSAction ** action);\
\
void *\
GetReference(\
);\
\
kern_return_t\
Cancel(\
OSActionCancelHandler handler);\
\
kern_return_t\
SetAbortedHandler(\
OSActionAbortedHandler handler);\
\
kern_return_t\
WillWait(\
OSActionWaitToken ** token);\
\
kern_return_t\
EndWait(\
OSActionWaitToken * token);\
\
kern_return_t\
Wait(\
OSActionWaitToken * token,\
uint64_t options,\
uint64_t deadline);\
\
void\
Aborted(\
OSDispatchMethod supermethod = NULL);\
\
\
protected:\
/* _Impl methods */\
\
static kern_return_t\
Create_Call(OSAction_Create_Args);\
\
static kern_return_t\
CreateWithTypeName_Call(OSAction_CreateWithTypeName_Args);\
\
void\
Aborted_Impl(OSAction_Aborted_Args);\
\
\
public:\
/* _Invoke methods */\
\
typedef kern_return_t (*Create_Handler)(OSAction_Create_Args);\
static kern_return_t\
Create_Invoke(const IORPC rpc,\
Create_Handler func);\
\
typedef kern_return_t (*CreateWithTypeName_Handler)(OSAction_CreateWithTypeName_Args);\
static kern_return_t\
CreateWithTypeName_Invoke(const IORPC rpc,\
CreateWithTypeName_Handler func);\
\
typedef void (*Aborted_Handler)(OSMetaClassBase * targetOSAction_Aborted_Args);\
static kern_return_t\
Aborted_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
Aborted_Handler func);\
\
#define OSAction_KernelMethods \
\
protected:\
/* _Impl methods */\
\
static kern_return_t\
Create_Impl(OSAction_Create_Args);\
\
static kern_return_t\
CreateWithTypeName_Impl(OSAction_CreateWithTypeName_Args);\
\
#define OSAction_VirtualMethods \
\
public:\
\
virtual void\
free(\
) APPLE_KEXT_OVERRIDE;\
\
class OSActionInterface : public OSInterface
{
public:
};
struct OSAction_IVars;
struct OSAction_LocalIVars;
class OSAction : public OSObject, public OSActionInterface
{
OSDeclareDefaultStructorsWithDispatch(OSAction);
public:
#ifdef OSAction_DECLARE_IVARS
OSAction_DECLARE_IVARS
#else /* OSAction_DECLARE_IVARS */
union
{
OSAction_IVars * ivars;
OSAction_LocalIVars * lvars;
};
#endif /* OSAction_DECLARE_IVARS */
using super = OSObject;
OSAction_VirtualMethods
};
#endif /* !__DOCUMENTATION__ */
/* OSAction.iig:172- */
#endif /* ! _IOKIT_OSACTION_H */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/DriverKit/IODataQueueDispatchSource.h | /* iig(DriverKit-191.30.2) generated from IODataQueueDispatchSource.iig */
/* IODataQueueDispatchSource.iig:1-37 */
/*
* Copyright (c) 2019-2019 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _IOKIT_UIODATAQUEUEDISPATCHSOURCE_H
#define _IOKIT_UIODATAQUEUEDISPATCHSOURCE_H
#include <DriverKit/IODispatchQueue.h> /* .iig include */
#include <DriverKit/IOMemoryDescriptor.h> /* .iig include */
typedef void (^IODataQueueClientEnqueueEntryBlock)(void *data, size_t dataSize);
typedef void (^IODataQueueClientDequeueEntryBlock)(const void *data, size_t dataSize);
/* source class IODataQueueDispatchSource IODataQueueDispatchSource.iig:38-207 */
#if __DOCUMENTATION__
#define KERNEL IIG_KERNEL
class NATIVE KERNEL IODataQueueDispatchSource : public IODispatchSource
{
public:
/*!
* @brief Create an IODataQueueDispatchSource for a shared memory data queue.
* @param queueByteCount The size of the queue in bytes.
* @param queue IODispatchQueue the source is attached to. Note that the DataAvailable
* and DataServiced handlers are invoked on the queue set for the target method
* of the OSAction, not this queue.
* @param source Created source with +1 retain count to be released by the caller.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
static kern_return_t
Create(
uint64_t queueByteCount,
IODispatchQueue * queue,
IODataQueueDispatchSource ** source);
virtual bool
init() override;
virtual void
free() override;
/*!
* @brief As a consumer, set the handler block to run when the queue becomes non-empty.
* @param action OSAction instance specifying the callback method. The OSAction object will be retained
* until SetHandler is called again or the event source is cancelled.
* The DataAvailable handler is invoked on the queue set for the target method of the OSAction.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
SetDataAvailableHandler(
OSAction * action TYPE(DataAvailable));
/*!
* @brief As a producer, set the handler block to run when the queue becomes non-full, after an attempt
* to enqueue data failed.
* @param action OSAction instance specifying the callback method. The OSAction object will be retained
* until SetHandler is called again or the event source is cancelled.
* The DataServiced handler is invoked on the queue set for the target method of the OSAction.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
SetDataServicedHandler(
OSAction * action TYPE(DataServiced));
/*!
* @brief Control the enable state of the interrupt source.
* @param enable Pass true to enable the source or false to disable.
* @param handler Optional block to be executed after the interrupt has been disabled and any pending
* interrupt handlers completed.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
SetEnableWithCompletion(
bool enable,
IODispatchSourceCancelHandler handler) override LOCAL;
/*!
* @brief Cancel all callbacks from the event source.
* @discussion After cancellation, the source can only be freed. It cannot be reactivated.
* @param handler Handler block to be invoked after any callbacks have completed.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
Cancel(IODispatchSourceCancelHandler handler) override LOCAL;
/*!
* @brief As a consumer, check if the data queue is non-empty.
* @return True if the queue is non-empty.
*/
bool
IsDataAvailable(void) LOCALONLY;
/*!
* @brief As a consumer, get access to the next queue entry without dequeuing it.
* @param callback to invoked if the queue is non-empty with the next entry to be dequeued.
* @return kIOReturnSuccess if the callback was invoked.
* kIOReturnUnderrun if the queue was empty.
* kIOReturnError if the queue was corrupt.
*/
kern_return_t
Peek(IODataQueueClientDequeueEntryBlock callback) LOCALONLY;
/*!
* @brief As a consumer, dequeue the next queue entry.
* @param callback invoked if the queue was non-empty with the entry that was dequeued.
* @return kIOReturnSuccess if the callback was invoked.
* kIOReturnUnderrun if the queue was empty.
* kIOReturnError if the queue was corrupt.
*/
kern_return_t
Dequeue(IODataQueueClientDequeueEntryBlock callback) LOCALONLY;
/*!
* @brief As a producer, enqueue a queue entry.
* @param dataSize size of the data to enqueue.
* @param callback invoked if the queue has enough space to enqueue the data.
* @return kIOReturnSuccess if the callback was invoked.
* kIOReturnOverrun if the queue was full.
* kIOReturnError if the queue was corrupt.
*/
kern_return_t
Enqueue(uint32_t dataSize, IODataQueueClientEnqueueEntryBlock callback) LOCALONLY;
/*!
* @brief As a consumer, dequeue the next queue entry, but don't send any DataServiced notification.
* @param sendDataServiced Flag that indicates a DataServiced notification would have sent.
* It should be initialized to false before a series of calls to this method,
* and if true after those calls, the notification sent with SendDataServiced().
* @param callback invoked if the queue was non-empty with the entry that was dequeued.
* @return kIOReturnSuccess if the callback was invoked.
* kIOReturnUnderrun if the queue was empty.
* kIOReturnError if the queue was corrupt.
*/
kern_return_t
DequeueWithCoalesce(bool * sendDataServiced, IODataQueueClientDequeueEntryBlock callback) LOCALONLY;
/*!
* @brief As a producer, enqueue a queue entry, but don't send any DataAvailable notification.
* @param dataSize size of the data to enqueue
* @param sendDataAvailable Flag that indicates a DataAvailable notification would have been sent.
* It should be initialized to false before a series of calls to this method,
* and if true after those calls, the notification sent with SendDataAvailable().
* @param callback invoked if the queue has enough space to enqueue the data.
* @return kIOReturnSuccess if the callback was invoked.
* kIOReturnOverrun if the queue was full.
* kIOReturnError if the queue was corrupt.
*/
kern_return_t
EnqueueWithCoalesce(uint32_t dataSize, bool * sendDataAvailable, IODataQueueClientEnqueueEntryBlock callback) LOCALONLY;
/*!
* @brief As a consumer, send the DataServiced notification indicated by DequeueWithCoalesce.
*/
void
SendDataServiced(void) LOCALONLY;
/*!
* @brief As a producer, send the DataAvailable notification indicated by EnqueueWithCoalesce.
*/
void
SendDataAvailable(void) LOCALONLY;
private:
virtual kern_return_t
CopyMemory(
IOMemoryDescriptor ** memory);
virtual kern_return_t
CopyDataAvailableHandler(
OSAction ** action);
virtual kern_return_t
CopyDataServicedHandler(
OSAction ** action);
virtual kern_return_t
CheckForWork(bool synchronous) override LOCAL;
virtual void
DataAvailable(
OSAction * action TARGET) LOCAL = 0;
virtual void
DataServiced(
OSAction * action TARGET) LOCAL = 0;
};
#undef KERNEL
#else /* __DOCUMENTATION__ */
/* generated class IODataQueueDispatchSource IODataQueueDispatchSource.iig:38-207 */
#define IODataQueueDispatchSource_Create_ID 0xe8544306a54d09e0ULL
#define IODataQueueDispatchSource_SetDataAvailableHandler_ID 0xd2c1d8cc6ec3a591ULL
#define IODataQueueDispatchSource_SetDataServicedHandler_ID 0xd0aac29bba67b644ULL
#define IODataQueueDispatchSource_CopyMemory_ID 0x9be617ec7d8cd728ULL
#define IODataQueueDispatchSource_CopyDataAvailableHandler_ID 0xc856b17471f65d99ULL
#define IODataQueueDispatchSource_CopyDataServicedHandler_ID 0xd8759c8da406b3fcULL
#define IODataQueueDispatchSource_DataAvailable_ID 0xf799c876baf566f3ULL
#define IODataQueueDispatchSource_DataServiced_ID 0x8daa79f78047d8d8ULL
#define IODataQueueDispatchSource_Create_Args \
uint64_t queueByteCount, \
IODispatchQueue * queue, \
IODataQueueDispatchSource ** source
#define IODataQueueDispatchSource_SetDataAvailableHandler_Args \
OSAction * action
#define IODataQueueDispatchSource_SetDataServicedHandler_Args \
OSAction * action
#define IODataQueueDispatchSource_SetEnableWithCompletion_Args \
bool enable, \
IODispatchSourceCancelHandler handler
#define IODataQueueDispatchSource_Cancel_Args \
IODispatchSourceCancelHandler handler
#define IODataQueueDispatchSource_CopyMemory_Args \
IOMemoryDescriptor ** memory
#define IODataQueueDispatchSource_CopyDataAvailableHandler_Args \
OSAction ** action
#define IODataQueueDispatchSource_CopyDataServicedHandler_Args \
OSAction ** action
#define IODataQueueDispatchSource_CheckForWork_Args \
const IORPC rpc, \
bool synchronous
#define IODataQueueDispatchSource_DataAvailable_Args \
OSAction * action
#define IODataQueueDispatchSource_DataServiced_Args \
OSAction * action
#define IODataQueueDispatchSource_Methods \
\
public:\
\
virtual kern_return_t\
Dispatch(const IORPC rpc) APPLE_KEXT_OVERRIDE;\
\
static kern_return_t\
_Dispatch(IODataQueueDispatchSource * self, const IORPC rpc);\
\
static kern_return_t\
Create(\
uint64_t queueByteCount,\
IODispatchQueue * queue,\
IODataQueueDispatchSource ** source);\
\
kern_return_t\
SetDataAvailableHandler(\
OSAction * action,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
SetDataServicedHandler(\
OSAction * action,\
OSDispatchMethod supermethod = NULL);\
\
bool\
IsDataAvailable(\
);\
\
kern_return_t\
Peek(\
IODataQueueClientDequeueEntryBlock callback);\
\
kern_return_t\
Dequeue(\
IODataQueueClientDequeueEntryBlock callback);\
\
kern_return_t\
Enqueue(\
uint32_t dataSize,\
IODataQueueClientEnqueueEntryBlock callback);\
\
kern_return_t\
DequeueWithCoalesce(\
bool * sendDataServiced,\
IODataQueueClientDequeueEntryBlock callback);\
\
kern_return_t\
EnqueueWithCoalesce(\
uint32_t dataSize,\
bool * sendDataAvailable,\
IODataQueueClientEnqueueEntryBlock callback);\
\
void\
SendDataServiced(\
);\
\
void\
SendDataAvailable(\
);\
\
kern_return_t\
CopyMemory(\
IOMemoryDescriptor ** memory,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
CopyDataAvailableHandler(\
OSAction ** action,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
CopyDataServicedHandler(\
OSAction ** action,\
OSDispatchMethod supermethod = NULL);\
\
void\
DataAvailable(\
OSAction * action,\
OSDispatchMethod supermethod = NULL);\
\
void\
DataServiced(\
OSAction * action,\
OSDispatchMethod supermethod = NULL);\
\
\
protected:\
/* _Impl methods */\
\
kern_return_t\
SetEnableWithCompletion_Impl(IODispatchSource_SetEnableWithCompletion_Args);\
\
kern_return_t\
Cancel_Impl(IODispatchSource_Cancel_Args);\
\
kern_return_t\
CheckForWork_Impl(IODispatchSource_CheckForWork_Args);\
\
\
public:\
/* _Invoke methods */\
\
typedef kern_return_t (*Create_Handler)(IODataQueueDispatchSource_Create_Args);\
static kern_return_t\
Create_Invoke(const IORPC rpc,\
Create_Handler func);\
\
typedef kern_return_t (*SetDataAvailableHandler_Handler)(OSMetaClassBase * target, IODataQueueDispatchSource_SetDataAvailableHandler_Args);\
static kern_return_t\
SetDataAvailableHandler_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
SetDataAvailableHandler_Handler func);\
\
typedef kern_return_t (*SetDataServicedHandler_Handler)(OSMetaClassBase * target, IODataQueueDispatchSource_SetDataServicedHandler_Args);\
static kern_return_t\
SetDataServicedHandler_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
SetDataServicedHandler_Handler func);\
\
typedef kern_return_t (*CopyMemory_Handler)(OSMetaClassBase * target, IODataQueueDispatchSource_CopyMemory_Args);\
static kern_return_t\
CopyMemory_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
CopyMemory_Handler func);\
\
typedef kern_return_t (*CopyDataAvailableHandler_Handler)(OSMetaClassBase * target, IODataQueueDispatchSource_CopyDataAvailableHandler_Args);\
static kern_return_t\
CopyDataAvailableHandler_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
CopyDataAvailableHandler_Handler func);\
\
typedef kern_return_t (*CopyDataServicedHandler_Handler)(OSMetaClassBase * target, IODataQueueDispatchSource_CopyDataServicedHandler_Args);\
static kern_return_t\
CopyDataServicedHandler_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
CopyDataServicedHandler_Handler func);\
\
typedef void (*DataAvailable_Handler)(OSMetaClassBase * target, IODataQueueDispatchSource_DataAvailable_Args);\
static kern_return_t\
DataAvailable_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
DataAvailable_Handler func,\
const OSMetaClass * targetActionClass);\
\
static kern_return_t\
DataAvailable_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
DataAvailable_Handler func);\
\
typedef void (*DataServiced_Handler)(OSMetaClassBase * target, IODataQueueDispatchSource_DataServiced_Args);\
static kern_return_t\
DataServiced_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
DataServiced_Handler func,\
const OSMetaClass * targetActionClass);\
\
static kern_return_t\
DataServiced_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
DataServiced_Handler func);\
\
#define IODataQueueDispatchSource_KernelMethods \
\
protected:\
/* _Impl methods */\
\
static kern_return_t\
Create_Impl(IODataQueueDispatchSource_Create_Args);\
\
kern_return_t\
SetDataAvailableHandler_Impl(IODataQueueDispatchSource_SetDataAvailableHandler_Args);\
\
kern_return_t\
SetDataServicedHandler_Impl(IODataQueueDispatchSource_SetDataServicedHandler_Args);\
\
kern_return_t\
CopyMemory_Impl(IODataQueueDispatchSource_CopyMemory_Args);\
\
kern_return_t\
CopyDataAvailableHandler_Impl(IODataQueueDispatchSource_CopyDataAvailableHandler_Args);\
\
kern_return_t\
CopyDataServicedHandler_Impl(IODataQueueDispatchSource_CopyDataServicedHandler_Args);\
\
#define IODataQueueDispatchSource_VirtualMethods \
\
public:\
\
virtual bool\
init(\
) APPLE_KEXT_OVERRIDE;\
\
virtual void\
free(\
) APPLE_KEXT_OVERRIDE;\
\
class IODataQueueDispatchSourceInterface : public OSInterface
{
public:
};
struct IODataQueueDispatchSource_IVars;
struct IODataQueueDispatchSource_LocalIVars;
class IODataQueueDispatchSource : public IODispatchSource, public IODataQueueDispatchSourceInterface
{
OSDeclareDefaultStructorsWithDispatch(IODataQueueDispatchSource);
public:
#ifdef IODataQueueDispatchSource_DECLARE_IVARS
IODataQueueDispatchSource_DECLARE_IVARS
#else /* IODataQueueDispatchSource_DECLARE_IVARS */
union
{
IODataQueueDispatchSource_IVars * ivars;
IODataQueueDispatchSource_LocalIVars * lvars;
};
#endif /* IODataQueueDispatchSource_DECLARE_IVARS */
using super = IODispatchSource;
IODataQueueDispatchSource_VirtualMethods
};
#endif /* !__DOCUMENTATION__ */
/* IODataQueueDispatchSource.iig:209- */
#endif /* ! _IOKIT_UIODATAQUEUEDISPATCHSOURCE_H */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/DriverKit/queue_implementation.h | /*
* Copyright (c) 2000-2009 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or [email protected]
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon rights
* to redistribute these changes.
*/
/*
*/
/*
* File: queue.h
* Author: Avadis Tevanian, Jr.
* Date: 1985
*
* Type definitions for generic queues.
*
*/
#ifndef _KERN_QUEUE_H_
#define _KERN_QUEUE_H_
#if DRIVERKIT_FRAMEWORK_INCLUDE
#include <DriverKit/macro_help.h>
#else
#include <mach/mach_types.h>
#include <kern/macro_help.h>
#endif /* DRIVERKIT_FRAMEWORK_INCLUDE */
#include <sys/cdefs.h>
#include <string.h>
__BEGIN_DECLS
/*
* Queue Management APIs
*
* There are currently two subtly different methods of maintining
* a queue of objects. Both APIs are contained in this file, and
* unfortunately overlap.
* (there is also a third way maintained in bsd/sys/queue.h)
*
* Both methods use a common queue head and linkage pattern:
* The head of a queue is declared as:
* queue_head_t q_head;
*
* Elements in this queue are chained together using
* struct queue_entry objects embedded within a structure:
* struct some_data {
* int field1;
* int field2;
* ...
* queue_chain_t link;
* ...
* int last_field;
* };
* struct some_data is referred to as the queue "element."
* (note that queue_chain_t is typedef'd to struct queue_entry)
*
* IMPORTANT: The two queue iteration methods described below are not
* compatible with one another. You must choose one and be careful
* to use only the supported APIs for that method.
*
* Method 1: chaining of queue_chain_t (linkage chains)
* This method uses the next and prev pointers of the struct queue_entry
* linkage object embedded in a queue element to point to the next or
* previous queue_entry structure in the chain. The head of the queue
* (the queue_head_t object) will point to the first and last
* struct queue_entry object, and both the next and prev pointer will
* point back to the head if the queue is empty.
*
* This method is the most flexible method of chaining objects together
* as it allows multiple chains through a given object, by embedding
* multiple queue_chain_t objects in the structure, while simultaneously
* providing fast removal and insertion into the queue using only
* struct queue_entry object pointers.
*
* ++ Valid APIs for this style queue ++
* -------------------------------------
* [C] queue_init
* [C] queue_first
* [C] queue_next
* [C] queue_last
* [C] queue_prev
* [C] queue_end
* [C] queue_empty
*
* [1] enqueue
* [1] dequeue
* [1] enqueue_head
* [1] enqueue_tail
* [1] dequeue_head
* [1] dequeue_tail
* [1] remqueue
* [1] insque
* [1] remque
* [1] re_queue_head
* [1] re_queue_tail
* [1] movqueue
* [1] qe_element
* [1] qe_foreach
* [1] qe_foreach_safe
* [1] qe_foreach_element
* [1] qe_foreach_element_safe
*
* Method 2: chaining of elements (element chains)
* This method uses the next and prev pointers of the struct queue_entry
* linkage object embedded in a queue element to point to the next or
* previous queue element (not another queue_entry). The head of the
* queue will point to the first and last queue element (struct some_data
* from the above example) NOT the embedded queue_entry structure. The
* first queue element will have a prev pointer that points to the
* queue_head_t, and the last queue element will have a next pointer
* that points to the queue_head_t.
*
* This method requires knowledge of the queue_head_t of the queue on
* which an element resides in order to remove the element. Iterating
* through the elements of the queue is also more cumbersome because
* a check against the head pointer plus a cast then offset operation
* must be performed at each step of the iteration.
*
* ++ Valid APIs for this style queue ++
* -------------------------------------
* [C] queue_init
* [C] queue_first
* [C] queue_next
* [C] queue_last
* [C] queue_prev
* [C] queue_end
* [C] queue_empty
*
* [2] queue_enter
* [2] queue_enter_first
* [2] queue_insert_before
* [2] queue_insert_after
* [2] queue_field
* [2] queue_remove
* [2] queue_remove_first
* [2] queue_remove_last
* [2] queue_assign
* [2] queue_new_head
* [2] queue_iterate
*
* Legend:
* [C] -> API common to both methods
* [1] -> API used only in method 1 (linkage chains)
* [2] -> API used only in method 2 (element chains)
*/
/*
* A generic doubly-linked list (queue).
*/
struct queue_entry {
struct queue_entry *next; /* next element */
struct queue_entry *prev; /* previous element */
#if __arm__ && (__BIGGEST_ALIGNMENT__ > 4)
/* For the newer ARMv7k ABI where 64-bit types are 64-bit aligned, but pointers
* are 32-bit:
* Since this type is so often cast to various 64-bit aligned types
* aligning it to 64-bits will avoid -wcast-align without needing
* to disable it entirely. The impact on memory footprint should be
* negligible.
*/
} __attribute__ ((aligned(8)));
#else
};
#endif
typedef struct queue_entry *queue_t;
typedef struct queue_entry queue_head_t;
typedef struct queue_entry queue_chain_t;
typedef struct queue_entry *queue_entry_t;
/*
* enqueue puts "elt" on the "queue".
* dequeue returns the first element in the "queue".
* remqueue removes the specified "elt" from its queue.
*/
#if !DRIVERKIT_FRAMEWORK_INCLUDE
#define enqueue(queue, elt) enqueue_tail(queue, elt)
#define dequeue(queue) dequeue_head(queue)
#endif
#if defined(XNU_KERNEL_PRIVATE) || DRIVERKIT_FRAMEWORK_INCLUDE
#if !DRIVERKIT_FRAMEWORK_INCLUDE
#include <kern/debug.h>
#endif /* !DRIVERKIT_FRAMEWORK_INCLUDE */
static inline void
__QUEUE_ELT_VALIDATE(queue_entry_t elt)
{
queue_entry_t elt_next, elt_prev;
if (__improbable(elt == (queue_entry_t)NULL)) {
panic("Invalid queue element %p", elt);
}
elt_next = elt->next;
elt_prev = elt->prev;
if (__improbable(elt_next == (queue_entry_t)NULL || elt_prev == (queue_entry_t)NULL)) {
panic("Invalid queue element pointers for %p: next %p prev %p", elt, elt_next, elt_prev);
}
if (__improbable(elt_next->prev != elt || elt_prev->next != elt)) {
panic("Invalid queue element linkage for %p: next %p next->prev %p prev %p prev->next %p",
elt, elt_next, elt_next->prev, elt_prev, elt_prev->next);
}
}
static inline void
__DEQUEUE_ELT_CLEANUP(queue_entry_t elt)
{
(elt)->next = (queue_entry_t)NULL;
(elt)->prev = (queue_entry_t)NULL;
}
#else
#define __QUEUE_ELT_VALIDATE(elt) do { } while (0)
#define __DEQUEUE_ELT_CLEANUP(elt) do { } while(0)
#endif /* !(XNU_KERNEL_PRIVATE || DRIVERKIT_FRAMEWORK_INCLUDE)*/
static __inline__ void
enqueue_head(
queue_t que,
queue_entry_t elt)
{
queue_entry_t old_head;
__QUEUE_ELT_VALIDATE((queue_entry_t)que);
old_head = que->next;
elt->next = old_head;
elt->prev = que;
old_head->prev = elt;
que->next = elt;
}
static __inline__ void
enqueue_tail(
queue_t que,
queue_entry_t elt)
{
queue_entry_t old_tail;
__QUEUE_ELT_VALIDATE((queue_entry_t)que);
old_tail = que->prev;
elt->next = que;
elt->prev = old_tail;
old_tail->next = elt;
que->prev = elt;
}
static __inline__ queue_entry_t
dequeue_head(
queue_t que)
{
queue_entry_t elt = (queue_entry_t)NULL;
queue_entry_t new_head;
if (que->next != que) {
elt = que->next;
__QUEUE_ELT_VALIDATE(elt);
new_head = elt->next; /* new_head may point to que if elt was the only element */
new_head->prev = que;
que->next = new_head;
__DEQUEUE_ELT_CLEANUP(elt);
}
return elt;
}
static __inline__ queue_entry_t
dequeue_tail(
queue_t que)
{
queue_entry_t elt = (queue_entry_t)NULL;
queue_entry_t new_tail;
if (que->prev != que) {
elt = que->prev;
__QUEUE_ELT_VALIDATE(elt);
new_tail = elt->prev; /* new_tail may point to queue if elt was the only element */
new_tail->next = que;
que->prev = new_tail;
__DEQUEUE_ELT_CLEANUP(elt);
}
return elt;
}
static __inline__ void
remqueue(
queue_entry_t elt)
{
queue_entry_t next_elt, prev_elt;
__QUEUE_ELT_VALIDATE(elt);
next_elt = elt->next;
prev_elt = elt->prev; /* next_elt may equal prev_elt (and the queue head) if elt was the only element */
next_elt->prev = prev_elt;
prev_elt->next = next_elt;
__DEQUEUE_ELT_CLEANUP(elt);
}
static __inline__ void
insque(
queue_entry_t entry,
queue_entry_t pred)
{
queue_entry_t successor;
__QUEUE_ELT_VALIDATE(pred);
successor = pred->next;
entry->next = successor;
entry->prev = pred;
successor->prev = entry;
pred->next = entry;
}
static __inline__ void
remque(
queue_entry_t elt)
{
remqueue(elt);
}
/*
* Function: re_queue_head
* Parameters:
* queue_t que : queue onto which elt will be pre-pended
* queue_entry_t elt : element to re-queue
* Description:
* Remove elt from its current queue and put it onto the
* head of a new queue
* Note:
* This should only be used with Method 1 queue iteration (linkage chains)
*/
static __inline__ void
re_queue_head(queue_t que, queue_entry_t elt)
{
queue_entry_t n_elt, p_elt;
__QUEUE_ELT_VALIDATE(elt);
__QUEUE_ELT_VALIDATE((queue_entry_t)que);
/* remqueue */
n_elt = elt->next;
p_elt = elt->prev; /* next_elt may equal prev_elt (and the queue head) if elt was the only element */
n_elt->prev = p_elt;
p_elt->next = n_elt;
/* enqueue_head */
n_elt = que->next;
elt->next = n_elt;
elt->prev = que;
n_elt->prev = elt;
que->next = elt;
}
/*
* Function: re_queue_tail
* Parameters:
* queue_t que : queue onto which elt will be appended
* queue_entry_t elt : element to re-queue
* Description:
* Remove elt from its current queue and put it onto the
* end of a new queue
* Note:
* This should only be used with Method 1 queue iteration (linkage chains)
*/
static __inline__ void
re_queue_tail(queue_t que, queue_entry_t elt)
{
queue_entry_t n_elt, p_elt;
__QUEUE_ELT_VALIDATE(elt);
__QUEUE_ELT_VALIDATE((queue_entry_t)que);
/* remqueue */
n_elt = elt->next;
p_elt = elt->prev; /* next_elt may equal prev_elt (and the queue head) if elt was the only element */
n_elt->prev = p_elt;
p_elt->next = n_elt;
/* enqueue_tail */
p_elt = que->prev;
elt->next = que;
elt->prev = p_elt;
p_elt->next = elt;
que->prev = elt;
}
/*
* Macro: qe_element
* Function:
* Convert a queue_entry_t to a queue element pointer.
* Get a pointer to the user-defined element containing
* a given queue_entry_t
* Header:
* <type> * qe_element(queue_entry_t qe, <type>, field)
* qe - queue entry to convert
* <type> - what's in the queue (e.g., struct some_data)
* <field> - is the chain field in <type>
* Note:
* Do not use pointer types for <type>
*/
#define qe_element(qe, type, field) __container_of(qe, type, field)
/*
* Macro: qe_foreach
* Function:
* Iterate over each queue_entry_t structure.
* Generates a 'for' loop, setting 'qe' to
* each queue_entry_t in the queue.
* Header:
* qe_foreach(queue_entry_t qe, queue_t head)
* qe - iteration variable
* head - pointer to queue_head_t (head of queue)
* Note:
* This should only be used with Method 1 queue iteration (linkage chains)
*/
#define qe_foreach(qe, head) \
for (qe = (head)->next; qe != (head); qe = (qe)->next)
/*
* Macro: qe_foreach_safe
* Function:
* Safely iterate over each queue_entry_t structure.
*
* Use this iterator macro if you plan to remove the
* queue_entry_t, qe, from the queue during the
* iteration.
* Header:
* qe_foreach_safe(queue_entry_t qe, queue_t head)
* qe - iteration variable
* head - pointer to queue_head_t (head of queue)
* Note:
* This should only be used with Method 1 queue iteration (linkage chains)
*/
#define qe_foreach_safe(qe, head) \
for (queue_entry_t _ne = ((head)->next)->next, \
__ ## qe ## _unused_shadow __unused = (qe = (head)->next); \
qe != (head); \
qe = _ne, _ne = (qe)->next)
/*
* Macro: qe_foreach_element
* Function:
* Iterate over each _element_ in a queue
* where each queue_entry_t points to another
* queue_entry_t, i.e., managed by the [de|en]queue_head/
* [de|en]queue_tail / remqueue / etc. function.
* Header:
* qe_foreach_element(<type> *elt, queue_t head, <field>)
* elt - iteration variable
* <type> - what's in the queue (e.g., struct some_data)
* <field> - is the chain field in <type>
* Note:
* This should only be used with Method 1 queue iteration (linkage chains)
*/
#define qe_foreach_element(elt, head, field) \
for (elt = qe_element((head)->next, typeof(*(elt)), field); \
&((elt)->field) != (head); \
elt = qe_element((elt)->field.next, typeof(*(elt)), field))
/*
* Macro: qe_foreach_element_safe
* Function:
* Safely iterate over each _element_ in a queue
* where each queue_entry_t points to another
* queue_entry_t, i.e., managed by the [de|en]queue_head/
* [de|en]queue_tail / remqueue / etc. function.
*
* Use this iterator macro if you plan to remove the
* element, elt, from the queue during the iteration.
* Header:
* qe_foreach_element_safe(<type> *elt, queue_t head, <field>)
* elt - iteration variable
* <type> - what's in the queue (e.g., struct some_data)
* <field> - is the chain field in <type>
* Note:
* This should only be used with Method 1 queue iteration (linkage chains)
*/
#define qe_foreach_element_safe(elt, head, field) \
for (typeof(*(elt)) *_nelt = qe_element(((head)->next)->next, typeof(*(elt)), field), \
*__ ## elt ## _unused_shadow __unused = \
(elt = qe_element((head)->next, typeof(*(elt)), field)); \
&((elt)->field) != (head); \
elt = _nelt, _nelt = qe_element((elt)->field.next, typeof(*(elt)), field)) \
/*
* Macro: QUEUE_HEAD_INITIALIZER()
* Function:
* Static queue head initializer
*/
#define QUEUE_HEAD_INITIALIZER(name) \
{ &name, &name }
/*
* Macro: queue_init
* Function:
* Initialize the given queue.
* Header:
* void queue_init(q)
* queue_t q; \* MODIFIED *\
*/
#define queue_init(q) \
MACRO_BEGIN \
(q)->next = (q);\
(q)->prev = (q);\
MACRO_END
/*
* Macro: queue_head_init
* Function:
* Initialize the given queue head
* Header:
* void queue_head_init(q)
* queue_head_t q; \* MODIFIED *\
*/
#define queue_head_init(q) \
queue_init(&(q))
/*
* Macro: queue_chain_init
* Function:
* Initialize the given queue chain element
* Header:
* void queue_chain_init(q)
* queue_chain_t q; \* MODIFIED *\
*/
#define queue_chain_init(q) \
queue_init(&(q))
/*
* Macro: queue_first
* Function:
* Returns the first entry in the queue,
* Header:
* queue_entry_t queue_first(q)
* queue_t q; \* IN *\
*/
#define queue_first(q) ((q)->next)
/*
* Macro: queue_next
* Function:
* Returns the entry after an item in the queue.
* Header:
* queue_entry_t queue_next(qc)
* queue_t qc;
*/
#define queue_next(qc) ((qc)->next)
/*
* Macro: queue_last
* Function:
* Returns the last entry in the queue.
* Header:
* queue_entry_t queue_last(q)
* queue_t q; \* IN *\
*/
#define queue_last(q) ((q)->prev)
/*
* Macro: queue_prev
* Function:
* Returns the entry before an item in the queue.
* Header:
* queue_entry_t queue_prev(qc)
* queue_t qc;
*/
#define queue_prev(qc) ((qc)->prev)
/*
* Macro: queue_end
* Function:
* Tests whether a new entry is really the end of
* the queue.
* Header:
* boolean_t queue_end(q, qe)
* queue_t q;
* queue_entry_t qe;
*/
#define queue_end(q, qe) ((q) == (qe))
/*
* Macro: queue_empty
* Function:
* Tests whether a queue is empty.
* Header:
* boolean_t queue_empty(q)
* queue_t q;
*/
#define queue_empty(q) queue_end((q), queue_first(q))
/*
* Function: movqueue
* Parameters:
* queue_t _old : head of a queue whose items will be moved
* queue_t _new : new queue head onto which items will be moved
* Description:
* Rebase queue items in _old onto _new then re-initialize
* the _old object to an empty queue.
* Equivalent to the queue_new_head Method 2 macro
* Note:
* Similar to the queue_new_head macro, this macros is intented
* to function as an initializer method for '_new' and thus may
* leak any list items that happen to be on the '_new' list.
* This should only be used with Method 1 queue iteration (linkage chains)
*/
static __inline__ void
movqueue(queue_t _old, queue_t _new)
{
queue_entry_t next_elt, prev_elt;
__QUEUE_ELT_VALIDATE((queue_entry_t)_old);
if (queue_empty(_old)) {
queue_init(_new);
return;
}
/*
* move the queue at _old to _new
* and re-initialize _old
*/
next_elt = _old->next;
prev_elt = _old->prev;
_new->next = next_elt;
_new->prev = prev_elt;
next_elt->prev = _new;
prev_elt->next = _new;
queue_init(_old);
}
/*----------------------------------------------------------------*/
/*
* Macros that operate on generic structures. The queue
* chain may be at any location within the structure, and there
* may be more than one chain.
*/
/*
* Macro: queue_enter
* Function:
* Insert a new element at the tail of the queue.
* Header:
* void queue_enter(q, elt, type, field)
* queue_t q;
* <type> elt;
* <type> is what's in our queue
* <field> is the chain field in (*<type>)
* Note:
* This should only be used with Method 2 queue iteration (element chains)
*
* We insert a compiler barrier after setting the fields in the element
* to ensure that the element is updated before being added to the queue,
* which is especially important because stackshot, which operates from
* debugger context, iterates several queues that use this macro (the tasks
* lists and threads lists) without locks. Without this barrier, the
* compiler may re-order the instructions for this macro in a way that
* could cause stackshot to trip over an inconsistent queue during
* iteration.
*/
#define queue_enter(head, elt, type, field) \
MACRO_BEGIN \
queue_entry_t __prev; \
\
__prev = (head)->prev; \
(elt)->field.prev = __prev; \
(elt)->field.next = head; \
__compiler_barrier(); \
if ((head) == __prev) { \
(head)->next = (queue_entry_t) (elt); \
} \
else { \
((type)(void *)__prev)->field.next = \
(queue_entry_t)(elt); \
} \
(head)->prev = (queue_entry_t) elt; \
MACRO_END
/*
* Macro: queue_enter_first
* Function:
* Insert a new element at the head of the queue.
* Header:
* void queue_enter_first(q, elt, type, field)
* queue_t q;
* <type> elt;
* <type> is what's in our queue
* <field> is the chain field in (*<type>)
* Note:
* This should only be used with Method 2 queue iteration (element chains)
*/
#define queue_enter_first(head, elt, type, field) \
MACRO_BEGIN \
queue_entry_t __next; \
\
__next = (head)->next; \
if ((head) == __next) { \
(head)->prev = (queue_entry_t) (elt); \
} \
else { \
((type)(void *)__next)->field.prev = \
(queue_entry_t)(elt); \
} \
(elt)->field.next = __next; \
(elt)->field.prev = head; \
(head)->next = (queue_entry_t) elt; \
MACRO_END
/*
* Macro: queue_insert_before
* Function:
* Insert a new element before a given element.
* Header:
* void queue_insert_before(q, elt, cur, type, field)
* queue_t q;
* <type> elt;
* <type> cur;
* <type> is what's in our queue
* <field> is the chain field in (*<type>)
* Note:
* This should only be used with Method 2 queue iteration (element chains)
*/
#define queue_insert_before(head, elt, cur, type, field) \
MACRO_BEGIN \
queue_entry_t __prev; \
\
if ((head) == (queue_entry_t)(cur)) { \
(elt)->field.next = (head); \
if ((head)->next == (head)) { /* only element */ \
(elt)->field.prev = (head); \
(head)->next = (queue_entry_t)(elt); \
} else { /* last element */ \
__prev = (elt)->field.prev = (head)->prev; \
((type)(void *)__prev)->field.next = \
(queue_entry_t)(elt); \
} \
(head)->prev = (queue_entry_t)(elt); \
} else { \
(elt)->field.next = (queue_entry_t)(cur); \
if ((head)->next == (queue_entry_t)(cur)) { \
/* first element */ \
(elt)->field.prev = (head); \
(head)->next = (queue_entry_t)(elt); \
} else { /* middle element */ \
__prev = (elt)->field.prev = (cur)->field.prev; \
((type)(void *)__prev)->field.next = \
(queue_entry_t)(elt); \
} \
(cur)->field.prev = (queue_entry_t)(elt); \
} \
MACRO_END
/*
* Macro: queue_insert_after
* Function:
* Insert a new element after a given element.
* Header:
* void queue_insert_after(q, elt, cur, type, field)
* queue_t q;
* <type> elt;
* <type> cur;
* <type> is what's in our queue
* <field> is the chain field in (*<type>)
* Note:
* This should only be used with Method 2 queue iteration (element chains)
*/
#define queue_insert_after(head, elt, cur, type, field) \
MACRO_BEGIN \
queue_entry_t __next; \
\
if ((head) == (queue_entry_t)(cur)) { \
(elt)->field.prev = (head); \
if ((head)->next == (head)) { /* only element */ \
(elt)->field.next = (head); \
(head)->prev = (queue_entry_t)(elt); \
} else { /* first element */ \
__next = (elt)->field.next = (head)->next; \
((type)(void *)__next)->field.prev = \
(queue_entry_t)(elt); \
} \
(head)->next = (queue_entry_t)(elt); \
} else { \
(elt)->field.prev = (queue_entry_t)(cur); \
if ((head)->prev == (queue_entry_t)(cur)) { \
/* last element */ \
(elt)->field.next = (head); \
(head)->prev = (queue_entry_t)(elt); \
} else { /* middle element */ \
__next = (elt)->field.next = (cur)->field.next; \
((type)(void *)__next)->field.prev = \
(queue_entry_t)(elt); \
} \
(cur)->field.next = (queue_entry_t)(elt); \
} \
MACRO_END
/*
* Macro: queue_field [internal use only]
* Function:
* Find the queue_chain_t (or queue_t) for the
* given element (thing) in the given queue (head)
* Note:
* This should only be used with Method 2 queue iteration (element chains)
*/
#define queue_field(head, thing, type, field) \
(((head) == (thing)) ? (head) : &((type)(void *)(thing))->field)
/*
* Macro: queue_remove
* Function:
* Remove an arbitrary item from the queue.
* Header:
* void queue_remove(q, qe, type, field)
* arguments as in queue_enter
* Note:
* This should only be used with Method 2 queue iteration (element chains)
*/
#define queue_remove(head, elt, type, field) \
MACRO_BEGIN \
queue_entry_t __next, __prev; \
\
__next = (elt)->field.next; \
__prev = (elt)->field.prev; \
\
if ((head) == __next) \
(head)->prev = __prev; \
else \
((type)(void *)__next)->field.prev = __prev; \
\
if ((head) == __prev) \
(head)->next = __next; \
else \
((type)(void *)__prev)->field.next = __next; \
\
(elt)->field.next = NULL; \
(elt)->field.prev = NULL; \
MACRO_END
/*
* Macro: queue_remove_first
* Function:
* Remove and return the entry at the head of
* the queue.
* Header:
* queue_remove_first(head, entry, type, field)
* entry is returned by reference
* Note:
* This should only be used with Method 2 queue iteration (element chains)
*/
#define queue_remove_first(head, entry, type, field) \
MACRO_BEGIN \
queue_entry_t __next; \
\
(entry) = (type)(void *) ((head)->next); \
__next = (entry)->field.next; \
\
if ((head) == __next) \
(head)->prev = (head); \
else \
((type)(void *)(__next))->field.prev = (head); \
(head)->next = __next; \
\
(entry)->field.next = NULL; \
(entry)->field.prev = NULL; \
MACRO_END
/*
* Macro: queue_remove_last
* Function:
* Remove and return the entry at the tail of
* the queue.
* Header:
* queue_remove_last(head, entry, type, field)
* entry is returned by reference
* Note:
* This should only be used with Method 2 queue iteration (element chains)
*/
#define queue_remove_last(head, entry, type, field) \
MACRO_BEGIN \
queue_entry_t __prev; \
\
(entry) = (type)(void *) ((head)->prev); \
__prev = (entry)->field.prev; \
\
if ((head) == __prev) \
(head)->next = (head); \
else \
((type)(void *)(__prev))->field.next = (head); \
(head)->prev = __prev; \
\
(entry)->field.next = NULL; \
(entry)->field.prev = NULL; \
MACRO_END
/*
* Macro: queue_assign
* Note:
* This should only be used with Method 2 queue iteration (element chains)
*/
#define queue_assign(to, from, type, field) \
MACRO_BEGIN \
((type)(void *)((from)->prev))->field.next = (to); \
((type)(void *)((from)->next))->field.prev = (to); \
*to = *from; \
MACRO_END
/*
* Macro: queue_new_head
* Function:
* rebase old queue to new queue head
* Header:
* queue_new_head(old, new, type, field)
* queue_t old;
* queue_t new;
* <type> is what's in our queue
* <field> is the chain field in (*<type>)
* Note:
* This should only be used with Method 2 queue iteration (element chains)
*/
#define queue_new_head(old, new, type, field) \
MACRO_BEGIN \
if (!queue_empty(old)) { \
*(new) = *(old); \
((type)(void *)((new)->next))->field.prev = \
(new); \
((type)(void *)((new)->prev))->field.next = \
(new); \
} else { \
queue_init(new); \
} \
MACRO_END
/*
* Macro: queue_iterate
* Function:
* iterate over each item in the queue.
* Generates a 'for' loop, setting elt to
* each item in turn (by reference).
* Header:
* queue_iterate(q, elt, type, field)
* queue_t q;
* <type> elt;
* <type> is what's in our queue
* <field> is the chain field in (*<type>)
* Note:
* This should only be used with Method 2 queue iteration (element chains)
*/
#define queue_iterate(head, elt, type, field) \
for ((elt) = (type)(void *) queue_first(head); \
!queue_end((head), (queue_entry_t)(elt)); \
(elt) = (type)(void *) queue_next(&(elt)->field))
__END_DECLS
#endif /* _KERN_QUEUE_H_ */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/DriverKit/bounded_array_ref.h | //
// Copyright (c) 2019 Apple, Inc. All rights reserved.
//
// @APPLE_OSREFERENCE_LICENSE_HEADER_START@
//
// This file contains Original Code and/or Modifications of Original Code
// as defined in and that are subject to the Apple Public Source License
// Version 2.0 (the 'License'). You may not use this file except in
// compliance with the License. The rights granted to you under the License
// may not be used to create, or enable the creation or redistribution of,
// unlawful or unlicensed copies of an Apple operating system, or to
// circumvent, violate, or enable the circumvention or violation of, any
// terms of an Apple operating system software license agreement.
//
// Please obtain a copy of the License at
// http://www.opensource.apple.com/apsl/ and read it before using this file.
//
// The Original Code and all software distributed under the License are
// distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
// EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
// INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
// Please see the License for the specific language governing rights and
// limitations under the License.
//
// @APPLE_OSREFERENCE_LICENSE_HEADER_END@
//
#ifndef XNU_LIBKERN_LIBKERN_CXX_BOUNDED_ARRAY_REF_H
#define XNU_LIBKERN_LIBKERN_CXX_BOUNDED_ARRAY_REF_H
#if !TAPI
#if DRIVERKIT_FRAMEWORK_INCLUDE
#include <DriverKit/bounded_array.h>
#include <DriverKit/bounded_ptr.h>
#else
#include <libkern/c++/bounded_array.h>
#include <libkern/c++/bounded_ptr.h>
#endif /* DRIVERKIT_FRAMEWORK_INCLUDE */
#include <stddef.h>
#include <os/base.h>
namespace libkern {
namespace bar_detail {
using nullptr_t = decltype(nullptr);
}
// Represents a reference to a sequence of 0 or more elements consecutively in
// memory, i.e. a start pointer and a length.
//
// When elements of the sequence are accessed, `bounded_array_ref` ensures
// that those elements are in the bounds of the sequence (which are provided
// when the `bounded_array_ref` is constructed).
//
// This class does not own the underlying data, it is expected to be used in
// situations where the data resides in some other buffer, whose lifetime
// extends past that of the `bounded_array_ref`. For this reason, it is not
// in general safe to store a `bounded_array_ref`.
//
// `bounded_array_ref` is trivially copyable and it should be passed by value.
template <typename T, typename TrappingPolicy>
struct bounded_array_ref {
// Creates an empty `bounded_array_ref`.
//
// An empty `bounded_array_ref` does not reference anything, so its
// `data()` is null and its `size()` is 0.
explicit constexpr bounded_array_ref() noexcept : data_(nullptr), size_(0)
{
}
// Creates a `bounded_array_ref` from a bounded pointer and a size.
//
// The resulting `bounded_array_ref` starts at the location where the
// pointer points, and has the given number of elements. All the elements
// must be in the bounds of the `bounded_ptr`, otherwise this constructor
// will trap.
explicit constexpr bounded_array_ref(bounded_ptr<T, TrappingPolicy> data, size_t n)
: data_(data.unsafe_discard_bounds()), size_(static_cast<uint32_t>(n))
{
if (n != 0) {
data[n - 1]; // make sure the bounds are valid
// TODO: find a better way to do that
}
if (__improbable(n > UINT32_MAX)) {
TrappingPolicy::trap("bounded_array_ref: Can't construct from a size greater than UINT32_MAX");
}
}
// Creates a `bounded_array_ref` from a raw pointer and a size.
//
// The resulting `bounded_array_ref` starts at the location where the
// pointer points, and has the given number of elements. This constructor
// trusts that `n` elements are reachable from the given pointer.
explicit constexpr bounded_array_ref(T* data, size_t n) : data_(data), size_(static_cast<uint32_t>(n))
{
if (__improbable(n > UINT32_MAX)) {
TrappingPolicy::trap("bounded_array_ref: Can't construct from a size greater than UINT32_MAX");
}
}
// Creates a `bounded_array_ref` from a `[first, last)` half-open range.
//
// The resulting `bounded_array_ref` starts at the location pointed-to by
// `first`, and contains `last - first` elements. The `[first, last)`
// half-open range must be a valid range, i.e. it must be the case that
// `first <= last`, otherwise the constructor traps.
explicit constexpr bounded_array_ref(T* first, T* last) : data_(first), size_(static_cast<uint32_t>(last - first))
{
if (__improbable(first > last)) {
TrappingPolicy::trap("bounded_array_ref: The [first, last) constructor requires a valid range.");
}
if (__improbable(last - first > UINT32_MAX)) {
TrappingPolicy::trap("bounded_array_ref: Can't construct from a size greater than UINT32_MAX");
}
}
// Creates a `bounded_array_ref` from a `bounded_array`.
//
// The resulting `bounded_array_ref` starts at the first element of the
// `bounded_array`, and has the number of elements in the `bounded_array`.
template <size_t N>
constexpr bounded_array_ref(bounded_array<T, N, TrappingPolicy>& data) : data_(data.data()), size_(static_cast<uint32_t>(data.size()))
{
if (__improbable(data.size() > UINT32_MAX)) {
TrappingPolicy::trap("bounded_array_ref: Can't construct from a size greater than UINT32_MAX");
}
}
// Creates a `bounded_array_ref` from a C-style array.
//
// The resulting `bounded_array_ref` starts at the first element of the
// C-style array, and has the number of elements in that array.
template <size_t N>
constexpr bounded_array_ref(T (&array)[N]) : data_(array), size_(static_cast<uint32_t>(N))
{
if (__improbable(N > UINT32_MAX)) {
TrappingPolicy::trap("bounded_array_ref: Can't construct from a size greater than UINT32_MAX");
}
}
constexpr
bounded_array_ref(bounded_array_ref const&) = default;
constexpr
bounded_array_ref(bounded_array_ref&& other) noexcept = default;
constexpr bounded_array_ref& operator=(bounded_array_ref const&) = default;
constexpr bounded_array_ref& operator=(bounded_array_ref&& other) = default;
~bounded_array_ref() = default;
// Returns whether the `bounded_array_ref` points to a sequence or not.
//
// Note that pointing to a sequence at all is different from pointing to
// a valid sequence, or having a size of 0. If a `bounded_array_ref`
// points to a sequence (regardless of whether it is valid or whether
// the size of that sequence is 0), this operator will return true.
explicit
operator bool() const noexcept
{
return data_ != nullptr;
}
using iterator = bounded_ptr<T, TrappingPolicy>;
// The following methods allow obtaining iterators (i.e. cursors) to
// objects inside a `bounded_array_ref`.
//
// The iterators of a `bounded_array_ref` are `bounded_ptr`s, which know
// the bounds of the sequence and will trap when dereferenced outside
// of those bounds.
//
// `begin()` returns an iterator to the first element in the range, and
// `end()` returns an iterator to one-past-the-last element in the range.
// The `end()` iterator can't be dereferenced, since it is out of bounds.
//
// If the `bounded_array_ref` is empty, these methods will return null
// `bounded_ptr`s, which can be checked for equality but can't be
// dereferenced.
iterator
begin() const noexcept
{
return iterator(data_, data_, data_ + size_);
}
iterator
end() const noexcept
{
return iterator(data_ + size_, data_, data_ + size_);
}
// Returns the number of elements in the range referenced by the
// `bounded_array_ref`.
//
// This method returns `0` if the `bounded_array_ref` is null, since
// such an array ref behaves the same as an empty range.
constexpr size_t
size() const
{
return size_;
}
// Returns a non-owning pointer to the underlying memory referenced by a
// `bounded_array_ref`.
//
// This method can be called even if the `bounded_array_ref` is null, in
// which case the returned pointer will be null.
constexpr T*
data() const noexcept
{
return data_;
}
// Access the n-th element of a `bounded_array_ref`.
//
// If `n` is out of the bounds of the sequence, this operation will
// trap. If the array ref is null, this operation will trap too.
//
// Design note:
// We voluntarily use a signed type to represent the index even though a
// negative index will always cause a trap. If we used an unsigned type,
// we could get an implicit conversion from signed to unsigned, which
// could silently wrap around. We think trapping early is more likely
// to be helpful in this situation.
OS_ALWAYS_INLINE T&
operator[](ptrdiff_t n) const
{
return begin()[n];
}
// Chop off the first `n` elements of the array, and keep `m` elements
// in the array.
//
// The resulting range can be described by `[beg + n, beg + n + m)`, where
// `beg` is the `begin()` of the range being sliced. This operation traps
// if `n + m` is larger than the number of elements in the array.
//
// Since `bounded_array_ref` checks (or assumes) that the range it is
// given on construction is within bounds and `slice()` checks that the
// produced slice is within the original range, it is impossible to create
// a `bounded_array_ref` that isn't a subset of a valid range using this
// function.
bounded_array_ref<T, TrappingPolicy>
slice(size_t n, size_t m) const
{
uint32_t total;
if (__improbable(os_add_overflow(n, m, &total))) {
TrappingPolicy::trap("bounded_array_ref: n + m is larger than the size of any bounded_array_ref");
}
if (__improbable(total > size())) {
TrappingPolicy::trap("bounded_array_ref: invalid slice provided, the indices are of bounds for the bounded_array_ref");
}
return bounded_array_ref(data_ + n, m);
}
private:
T* data_;
uint32_t size_;
};
// The comparison functions against `nullptr` all return whether the
// `bounded_array_ref` references a sequence or not.
template <typename T, typename P>
bool
operator==(bounded_array_ref<T, P> const& x, bar_detail::nullptr_t)
{
return !static_cast<bool>(x);
}
template <typename T, typename P>
bool
operator!=(bounded_array_ref<T, P> const& x, bar_detail::nullptr_t)
{
return !(x == nullptr);
}
template <typename T, typename P>
bool
operator==(bar_detail::nullptr_t, bounded_array_ref<T, P> const& x)
{
return x == nullptr;
}
template <typename T, typename P>
bool
operator!=(bar_detail::nullptr_t, bounded_array_ref<T, P> const& x)
{
return x != nullptr;
}
} // end namespace libkern
#endif /* !TAPI */
#endif // !XNU_LIBKERN_LIBKERN_CXX_BOUNDED_ARRAY_REF_H
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/DriverKit/IODMACommand.h | /* iig(DriverKit-191.30.2) generated from IODMACommand.iig */
/* IODMACommand.iig:1-73 */
/*
* Copyright (c) 2020 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#if !__IIG
#include <IOKit/IODMACommand.h>
#endif
#ifndef _IOKIT_UIODMACOMMMAND_H
#define _IOKIT_UIODMACOMMMAND_H
#include <DriverKit/IOMemoryDescriptor.h> /* .iig include */
#include <DriverKit/IOService.h> /* .iig include */
// IODMACommand Create options
enum {
kIODMACommandCreateNoOptions = 0,
};
// IODMACommand PrepareForDMA options
enum {
kIODMACommandPrepareForDMANoOptions = 0,
};
// IODMACommand CompleteDMA options
enum {
kIODMACommandCompleteDMANoOptions = 0,
};
// IODMACommand PerformOperation options
enum {
kIODMACommandPerformOperationOptionRead = 0x00000001,
kIODMACommandPerformOperationOptionWrite = 0x00000002,
kIODMACommandPerformOperationOptionZero = 0x00000004,
};
// IODMACommandSpecification options
enum {
kIODMACommandSpecificationNoOptions = 0,
};
struct IODMACommandSpecification {
uint64_t options;
uint64_t maxAddressBits;
uint64_t _resv[16];
};
/* source class IODMACommand IODMACommand.iig:74-189 */
#if __DOCUMENTATION__
#define KERNEL IIG_KERNEL
/*!
* @class IODMACommand
*
* @abstract
* IODMACommand allows a mapping for DMA to be created from an IOMemoryDescriptor.
*
* @discussion
* IODMACommand allows a mapping for DMA to be created from an IOMemoryDescriptor.
* The IODMACommand instance represents the mapping and should be kept prepared for the
* duration of the I/O, and completed when the I/O is finished.
* IODMACommand does not perform bounce buffering but allows access to the mapping with
* the PerformOperation method so that data can moved into and out of the mapping, eg.
* to/from a driver allocated bounce buffer.
*
*/
class KERNEL IODMACommand : public OSObject
{
public:
virtual bool
init() override;
virtual void
free() override;
/*!
* @brief Create an IODMACommand instance.
* @param device The device (typically an IOPCIDevice instance that will be
* generating the I/O.
* @param options
* kIODMACommandCreateNoOptions No options needed
* @param specification A caller initialized structure describing
* the hardware's DMA capaibilities
* @param command Returned IODMACommand object with +1 retain count.
* It should be retained until the map is no longer required.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
static kern_return_t
Create(
IOService * device,
uint64_t options,
const IODMACommandSpecification * specification,
IODMACommand ** command);
/*!
* @brief Create a DMA mapping for memory.
* @param options
* kIODMACommandPrepareForDMANoOptions No options needed.
* @param memory IOMemoryDescriptor for memory.
* @param offset Start offset of the DMA operation in the descriptor.
* @param length Pass zero to map the entire memory, or a value <= the length of the descriptor.
* @param flags Returned bit mask of flags
kIOMemoryDirectionOut the memory is readable
kIOMemoryDirectionIn the memory is writable
* @param segmentsCount In/out parameter - size of segments array on input,
and number of valid segments returned
* @param segments Returned DMA physical address and length segments covering the DMA
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
PrepareForDMA(
uint64_t options,
IOMemoryDescriptor * memory,
uint64_t offset,
uint64_t length,
uint64_t * flags,
uint32_t * segmentsCount,
IOAddressSegment segments[32]);
/*!
* @brief Release a DMA mapping for memory.
* @param options
* kIODMACommandCompleteDMANoOptions No options needed.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
CompleteDMA(
uint64_t options);
/*!
* @brief Obtain the parameters of a DMA preparation.
* @param offset Returned starting offset of the preparation.
* @param length Returned length of the preparation.
* @param memory Returned IOMemoryDescriptor of the preparation. This should be
* released by the caller.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
GetPreparation(
uint64_t * offset,
uint64_t * length,
IOMemoryDescriptor ** memory);
/*!
* @brief Perform CPU access to the DMA mapping.
* @param options Flags for the operation to be performed
kIODMACommandPerformOperationOptionRead read from the DMA mapping to
the memory specified with the data param
kIODMACommandPerformOperationOptionWrite write to the DMA mapping from
the memory specified with the data param
kIODMACommandPerformOperationOptionZero zero the DMA mapping
* @param dmaOffset Offset into the DMA mapping for the operation to begin.
* @param length Length of the operation.
* @param dataffset Offset into the memory specified with the data param
* @param data Callers buffer to read into or write from. Pass NULL when
* using kIODMACommandPerformOperationOptionZero.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
PerformOperation(
uint64_t options,
uint64_t dmaOffset,
uint64_t length,
uint64_t dataOffset,
IOMemoryDescriptor * data);
};
#undef KERNEL
#else /* __DOCUMENTATION__ */
/* generated class IODMACommand IODMACommand.iig:74-189 */
#define IODMACommand_Create_ID 0xf296a92bb435af2eULL
#define IODMACommand_PrepareForDMA_ID 0xf88a8c08b75b1110ULL
#define IODMACommand_CompleteDMA_ID 0xae15e446c7041259ULL
#define IODMACommand_GetPreparation_ID 0xcb1908ddf3b73cdeULL
#define IODMACommand_PerformOperation_ID 0xc41cd97d9b3042eeULL
#define IODMACommand_Create_Args \
IOService * device, \
uint64_t options, \
const IODMACommandSpecification * specification, \
IODMACommand ** command
#define IODMACommand_PrepareForDMA_Args \
uint64_t options, \
IOMemoryDescriptor * memory, \
uint64_t offset, \
uint64_t length, \
uint64_t * flags, \
uint32_t * segmentsCount, \
IOAddressSegment * segments
#define IODMACommand_CompleteDMA_Args \
uint64_t options
#define IODMACommand_GetPreparation_Args \
uint64_t * offset, \
uint64_t * length, \
IOMemoryDescriptor ** memory
#define IODMACommand_PerformOperation_Args \
uint64_t options, \
uint64_t dmaOffset, \
uint64_t length, \
uint64_t dataOffset, \
IOMemoryDescriptor * data
#define IODMACommand_Methods \
\
public:\
\
virtual kern_return_t\
Dispatch(const IORPC rpc) APPLE_KEXT_OVERRIDE;\
\
static kern_return_t\
_Dispatch(IODMACommand * self, const IORPC rpc);\
\
static kern_return_t\
Create(\
IOService * device,\
uint64_t options,\
const IODMACommandSpecification * specification,\
IODMACommand ** command);\
\
kern_return_t\
PrepareForDMA(\
uint64_t options,\
IOMemoryDescriptor * memory,\
uint64_t offset,\
uint64_t length,\
uint64_t * flags,\
uint32_t * segmentsCount,\
IOAddressSegment * segments,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
CompleteDMA(\
uint64_t options,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
GetPreparation(\
uint64_t * offset,\
uint64_t * length,\
__attribute__((os_returns_retained)) IOMemoryDescriptor ** memory,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
PerformOperation(\
uint64_t options,\
uint64_t dmaOffset,\
uint64_t length,\
uint64_t dataOffset,\
IOMemoryDescriptor * data,\
OSDispatchMethod supermethod = NULL);\
\
\
protected:\
/* _Impl methods */\
\
\
public:\
/* _Invoke methods */\
\
typedef kern_return_t (*Create_Handler)(IODMACommand_Create_Args);\
static kern_return_t\
Create_Invoke(const IORPC rpc,\
Create_Handler func);\
\
typedef kern_return_t (*PrepareForDMA_Handler)(OSMetaClassBase * target, IODMACommand_PrepareForDMA_Args);\
static kern_return_t\
PrepareForDMA_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
PrepareForDMA_Handler func);\
\
typedef kern_return_t (*CompleteDMA_Handler)(OSMetaClassBase * target, IODMACommand_CompleteDMA_Args);\
static kern_return_t\
CompleteDMA_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
CompleteDMA_Handler func);\
\
typedef kern_return_t (*GetPreparation_Handler)(OSMetaClassBase * target, IODMACommand_GetPreparation_Args);\
static kern_return_t\
GetPreparation_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
GetPreparation_Handler func);\
\
typedef kern_return_t (*PerformOperation_Handler)(OSMetaClassBase * target, IODMACommand_PerformOperation_Args);\
static kern_return_t\
PerformOperation_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
PerformOperation_Handler func);\
\
#define IODMACommand_KernelMethods \
\
protected:\
/* _Impl methods */\
\
static kern_return_t\
Create_Impl(IODMACommand_Create_Args);\
\
kern_return_t\
PrepareForDMA_Impl(IODMACommand_PrepareForDMA_Args);\
\
kern_return_t\
CompleteDMA_Impl(IODMACommand_CompleteDMA_Args);\
\
kern_return_t\
GetPreparation_Impl(IODMACommand_GetPreparation_Args);\
\
kern_return_t\
PerformOperation_Impl(IODMACommand_PerformOperation_Args);\
\
#define IODMACommand_VirtualMethods \
\
public:\
\
virtual bool\
init(\
) APPLE_KEXT_OVERRIDE;\
\
virtual void\
free(\
) APPLE_KEXT_OVERRIDE;\
\
#endif /* !__DOCUMENTATION__ */
/* IODMACommand.iig:191- */
#endif /* ! _IOKIT_UIODMACOMMMAND_H */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/DriverKit/IOBufferMemoryDescriptor.h | /* iig(DriverKit-191.30.2) generated from IOBufferMemoryDescriptor.iig */
/* IOBufferMemoryDescriptor.iig:1-40 */
/*
* Copyright (c) 2019-2019 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#if !__IIG
#include <IOKit/IOBufferMemoryDescriptor.h>
#endif
#ifndef _IOKIT_UIOBUFFERMEMORYDESCRIPTOR_H
#define _IOKIT_UIOBUFFERMEMORYDESCRIPTOR_H
#include <DriverKit/IOMemoryDescriptor.h> /* .iig include */
/* source class IOBufferMemoryDescriptor IOBufferMemoryDescriptor.iig:41-96 */
#if __DOCUMENTATION__
#define KERNEL IIG_KERNEL
/*!
* @class IOBufferMemoryDescriptor
*
* @abstract
* IOBufferMemoryDescriptor describes a memory buffer allocated in the callers address space.
*
* @discussion
* To allocate memory for I/O or sharing, use IOBufferMemoryDescriptor::Create().
* IOBufferMemoryDescriptor can be handed to any API that expects an IOMemoryDescriptor.
*/
class KERNEL IOBufferMemoryDescriptor : public IOMemoryDescriptor
{
public:
/*!
* @brief Create an IOBufferMemoryDescriptor.
* @param options Pass the flags kIOMemoryDirectionIn, kIOMemoryDirectionOut or kIOMemoryDirectionOutIn
* to set the direction of the i/o
* @param capacity Maximum length of the memory buffer. The descriptor has no valid data
* and zero length until set with SetLength().
* @param memory Created descriptor with +1 retain count to be released by the caller.
* @param alignment For small less-than-page-size buffers, control the alignment of the memory buffer.
* Pass zero for no guaranteed alignment.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
static kern_return_t
Create(
uint64_t options,
uint64_t capacity,
uint64_t alignment,
IOBufferMemoryDescriptor ** memory);
virtual bool
init() override;
virtual void
free() override;
/*!
* @brief Obtain the address and length of the memory buffer.
* @param range An IOAddressSegment structure filled out with the address and length of the memory buffer.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
kern_return_t
GetAddressRange(IOAddressSegment * range) LOCALONLY;
/*!
* @brief Set the valid length of the memory buffer.
* @discussion IOBufferMemoryDescriptor have capacity allocated at Create() but no valid data until set
* with this method.
* @param length New valid length of the memory described.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
SetLength(uint64_t length);
};
#undef KERNEL
#else /* __DOCUMENTATION__ */
/* generated class IOBufferMemoryDescriptor IOBufferMemoryDescriptor.iig:41-96 */
#define IOBufferMemoryDescriptor_Create_ID 0xb78de684e17d5a4bULL
#define IOBufferMemoryDescriptor_SetLength_ID 0xc115230c191a6a9aULL
#define IOBufferMemoryDescriptor_Create_Args \
uint64_t options, \
uint64_t capacity, \
uint64_t alignment, \
IOBufferMemoryDescriptor ** memory
#define IOBufferMemoryDescriptor_SetLength_Args \
uint64_t length
#define IOBufferMemoryDescriptor_Methods \
\
public:\
\
virtual kern_return_t\
Dispatch(const IORPC rpc) APPLE_KEXT_OVERRIDE;\
\
static kern_return_t\
_Dispatch(IOBufferMemoryDescriptor * self, const IORPC rpc);\
\
static kern_return_t\
Create(\
uint64_t options,\
uint64_t capacity,\
uint64_t alignment,\
IOBufferMemoryDescriptor ** memory);\
\
kern_return_t\
GetAddressRange(\
IOAddressSegment * range);\
\
kern_return_t\
SetLength(\
uint64_t length,\
OSDispatchMethod supermethod = NULL);\
\
\
protected:\
/* _Impl methods */\
\
\
public:\
/* _Invoke methods */\
\
typedef kern_return_t (*Create_Handler)(IOBufferMemoryDescriptor_Create_Args);\
static kern_return_t\
Create_Invoke(const IORPC rpc,\
Create_Handler func);\
\
typedef kern_return_t (*SetLength_Handler)(OSMetaClassBase * target, IOBufferMemoryDescriptor_SetLength_Args);\
static kern_return_t\
SetLength_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
SetLength_Handler func);\
\
#define IOBufferMemoryDescriptor_KernelMethods \
\
protected:\
/* _Impl methods */\
\
static kern_return_t\
Create_Impl(IOBufferMemoryDescriptor_Create_Args);\
\
kern_return_t\
SetLength_Impl(IOBufferMemoryDescriptor_SetLength_Args);\
\
#define IOBufferMemoryDescriptor_VirtualMethods \
\
public:\
\
virtual bool\
init(\
) APPLE_KEXT_OVERRIDE;\
\
virtual void\
free(\
) APPLE_KEXT_OVERRIDE;\
\
#endif /* !__DOCUMENTATION__ */
/* IOBufferMemoryDescriptor.iig:98- */
#endif /* ! _IOKIT_UIOBUFFERMEMORYDESCRIPTOR_H */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/DriverKit/IOServiceNotificationDispatchSource.h | /* iig(DriverKit-191.30.2) generated from IOServiceNotificationDispatchSource.iig */
/* IOServiceNotificationDispatchSource.iig:1-45 */
/*
* Copyright (c) 2019-2019 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _IOKIT_UIOSERVICEDISPATCHSOURCE_H
#define _IOKIT_UIOSERVICEDISPATCHSOURCE_H
#include <DriverKit/IODispatchQueue.h> /* .iig include */
#include <DriverKit/OSAction.h> /* .iig include */
#include <DriverKit/IOService.h> /* .iig include */
typedef void (^IOServiceNotificationBlock)(uint64_t type, IOService * service, uint64_t options);
enum {
kIOServiceNotificationTypeTerminated = 0x00000000,
kIOServiceNotificationTypeMatched = 0x00000001,
kIOServiceNotificationTypeLast = kIOServiceNotificationTypeMatched,
kIOServiceNotificationTypeNone = 0xFFFFFFFF,
};
/* source class IOServiceNotificationDispatchSource IOServiceNotificationDispatchSource.iig:46-128 */
#if __DOCUMENTATION__
#define KERNEL IIG_KERNEL
class NATIVE KERNEL IOServiceNotificationDispatchSource : public IODispatchSource
{
public:
/*!
* @brief Create an IOServiceNotificationDispatchSource for IOService matching and termination events.
* @param matching An IOService matching dictionary.
* @param options None defined, pass zero.
* @param queue IODispatchQueue the source is attached to. Note that the ServiceNotificationReady
* handler is invoked on the queue set for the target method
* of the OSAction, not this queue.
* @param source Created source with +1 retain count to be released by the caller.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
static kern_return_t
Create(
OSDictionary * matching,
uint64_t options,
IODispatchQueue * queue,
IOServiceNotificationDispatchSource ** notification) LOCAL;
virtual bool
init() override;
virtual void
free() override;
/*!
* @brief Control the enable state of the notification.
* @param enable Pass true to enable the source or false to disable.
* @param handler Optional block to be executed after the interrupt has been disabled and any pending
* interrupt handlers completed.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
SetEnableWithCompletion(
bool enable,
IODispatchSourceCancelHandler handler) override LOCAL;
/*!
* @brief Cancel all callbacks from the event source.
* @discussion After cancellation, the source can only be freed. It cannot be reactivated.
* @param handler Handler block to be invoked after any callbacks have completed.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
Cancel(IODispatchSourceCancelHandler handler) override LOCAL;
/*!
* @brief Set the handler block to run when the notification has become ready.
* @param action OSAction instance specifying the callback method. The OSAction object will be retained
* until SetHandler is called again or the event source is cancelled.
* The ServiceNotificationReady handler is invoked on the queue set for the target method of the
* OSAction.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
SetHandler(
OSAction * action TYPE(ServiceNotificationReady));
/*!
* @brief Invoke a block for each notification available in response to ServiceNotificationReady.
* @discussion The IOService object passed to the notification is only retained for the duration of the block.
* It should be retained by the block code if used beyond the invocation.
* @param block to be invoked with each notification
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
kern_return_t
DeliverNotifications(IOServiceNotificationBlock block) LOCALONLY;
private:
virtual kern_return_t
CheckForWork(bool synchronous) override LOCAL;
virtual void
ServiceNotificationReady(
OSAction * action TARGET) LOCAL = 0;
virtual kern_return_t
CopyNextNotification(
uint64_t * type,
IOService ** service,
uint64_t * options);
};
#undef KERNEL
#else /* __DOCUMENTATION__ */
/* generated class IOServiceNotificationDispatchSource IOServiceNotificationDispatchSource.iig:46-128 */
#define IOServiceNotificationDispatchSource_Create_ID 0xb40d274e974e946aULL
#define IOServiceNotificationDispatchSource_SetHandler_ID 0xca55c48f95fc6f8eULL
#define IOServiceNotificationDispatchSource_ServiceNotificationReady_ID 0xfbaa85f2cdb990b4ULL
#define IOServiceNotificationDispatchSource_CopyNextNotification_ID 0xca420abbda782780ULL
#define IOServiceNotificationDispatchSource_Create_Args \
OSDictionary * matching, \
uint64_t options, \
IODispatchQueue * queue, \
IOServiceNotificationDispatchSource ** notification
#define IOServiceNotificationDispatchSource_SetEnableWithCompletion_Args \
bool enable, \
IODispatchSourceCancelHandler handler
#define IOServiceNotificationDispatchSource_Cancel_Args \
IODispatchSourceCancelHandler handler
#define IOServiceNotificationDispatchSource_SetHandler_Args \
OSAction * action
#define IOServiceNotificationDispatchSource_CheckForWork_Args \
const IORPC rpc, \
bool synchronous
#define IOServiceNotificationDispatchSource_ServiceNotificationReady_Args \
OSAction * action
#define IOServiceNotificationDispatchSource_CopyNextNotification_Args \
uint64_t * type, \
IOService ** service, \
uint64_t * options
#define IOServiceNotificationDispatchSource_Methods \
\
public:\
\
virtual kern_return_t\
Dispatch(const IORPC rpc) APPLE_KEXT_OVERRIDE;\
\
static kern_return_t\
_Dispatch(IOServiceNotificationDispatchSource * self, const IORPC rpc);\
\
static kern_return_t\
Create(\
OSDictionary * matching,\
uint64_t options,\
IODispatchQueue * queue,\
IOServiceNotificationDispatchSource ** notification);\
\
kern_return_t\
SetHandler(\
OSAction * action,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
DeliverNotifications(\
IOServiceNotificationBlock block);\
\
void\
ServiceNotificationReady(\
OSAction * action,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
CopyNextNotification(\
uint64_t * type,\
IOService ** service,\
uint64_t * options,\
OSDispatchMethod supermethod = NULL);\
\
\
protected:\
/* _Impl methods */\
\
static kern_return_t\
Create_Call(IOServiceNotificationDispatchSource_Create_Args);\
\
kern_return_t\
SetEnableWithCompletion_Impl(IODispatchSource_SetEnableWithCompletion_Args);\
\
kern_return_t\
Cancel_Impl(IODispatchSource_Cancel_Args);\
\
kern_return_t\
CheckForWork_Impl(IODispatchSource_CheckForWork_Args);\
\
\
public:\
/* _Invoke methods */\
\
typedef kern_return_t (*Create_Handler)(IOServiceNotificationDispatchSource_Create_Args);\
static kern_return_t\
Create_Invoke(const IORPC rpc,\
Create_Handler func);\
\
typedef kern_return_t (*SetHandler_Handler)(OSMetaClassBase * target, IOServiceNotificationDispatchSource_SetHandler_Args);\
static kern_return_t\
SetHandler_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
SetHandler_Handler func);\
\
typedef void (*ServiceNotificationReady_Handler)(OSMetaClassBase * target, IOServiceNotificationDispatchSource_ServiceNotificationReady_Args);\
static kern_return_t\
ServiceNotificationReady_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
ServiceNotificationReady_Handler func,\
const OSMetaClass * targetActionClass);\
\
static kern_return_t\
ServiceNotificationReady_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
ServiceNotificationReady_Handler func);\
\
typedef kern_return_t (*CopyNextNotification_Handler)(OSMetaClassBase * target, IOServiceNotificationDispatchSource_CopyNextNotification_Args);\
static kern_return_t\
CopyNextNotification_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
CopyNextNotification_Handler func);\
\
#define IOServiceNotificationDispatchSource_KernelMethods \
\
protected:\
/* _Impl methods */\
\
static kern_return_t\
Create_Impl(IOServiceNotificationDispatchSource_Create_Args);\
\
kern_return_t\
SetHandler_Impl(IOServiceNotificationDispatchSource_SetHandler_Args);\
\
kern_return_t\
CopyNextNotification_Impl(IOServiceNotificationDispatchSource_CopyNextNotification_Args);\
\
#define IOServiceNotificationDispatchSource_VirtualMethods \
\
public:\
\
virtual bool\
init(\
) APPLE_KEXT_OVERRIDE;\
\
virtual void\
free(\
) APPLE_KEXT_OVERRIDE;\
\
class IOServiceNotificationDispatchSourceInterface : public OSInterface
{
public:
};
struct IOServiceNotificationDispatchSource_IVars;
struct IOServiceNotificationDispatchSource_LocalIVars;
class IOServiceNotificationDispatchSource : public IODispatchSource, public IOServiceNotificationDispatchSourceInterface
{
OSDeclareDefaultStructorsWithDispatch(IOServiceNotificationDispatchSource);
public:
#ifdef IOServiceNotificationDispatchSource_DECLARE_IVARS
IOServiceNotificationDispatchSource_DECLARE_IVARS
#else /* IOServiceNotificationDispatchSource_DECLARE_IVARS */
union
{
IOServiceNotificationDispatchSource_IVars * ivars;
IOServiceNotificationDispatchSource_LocalIVars * lvars;
};
#endif /* IOServiceNotificationDispatchSource_DECLARE_IVARS */
using super = IODispatchSource;
IOServiceNotificationDispatchSource_VirtualMethods
};
#endif /* !__DOCUMENTATION__ */
/* IOServiceNotificationDispatchSource.iig:130- */
#endif /* ! _IOKIT_UIOSERVICEDISPATCHSOURCE_H */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/DriverKit/OSBoundedPtrFwd.h | /*
* Copyright (c) 2019 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef XNU_LIBKERN_LIBKERN_CXX_OS_BOUNDED_PTR_FWD_H
#define XNU_LIBKERN_LIBKERN_CXX_OS_BOUNDED_PTR_FWD_H
#if !TAPI
#if DRIVERKIT_FRAMEWORK_INCLUDE
#include <DriverKit/IOLib.h>
#include <DriverKit/bounded_ptr_fwd.h>
#else
#include <kern/debug.h>
#include <libkern/c++/bounded_ptr_fwd.h>
#endif /* DRIVERKIT_FRAMEWORK_INCLUDE */
namespace os_detail {
struct panic_trapping_policy;
}
template <typename T>
using OSBoundedPtr = libkern::bounded_ptr<T, os_detail::panic_trapping_policy>;
#endif /* !TAPI */
#endif /* !XNU_LIBKERN_LIBKERN_CXX_OS_BOUNDED_PTR_FWD_H */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/DriverKit/IOTypes.h | /*
* Copyright (c) 1998-2012 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef __IOKIT_IOTYPES_H
#define __IOKIT_IOTYPES_H
#ifndef IOKIT
#define IOKIT 1
#endif /* !IOKIT */
#include <sys/cdefs.h>
#include <IOKit/system.h>
#include <IOKit/IOReturn.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef NULL
#if defined (__cplusplus)
#if __cplusplus >= 201103L && (defined(__arm__) || defined(__arm64__))
#define NULL nullptr
#else
#define NULL 0
#endif
#else
#define NULL ((void *)0)
#endif
#endif
/*
* Simple data types.
*/
#include <stdbool.h>
#include <libkern/OSTypes.h>
#include <libkern/OSBase.h>
typedef UInt32 IOOptionBits;
typedef SInt32 IOFixed;
typedef UInt32 IOVersion;
typedef UInt32 IOItemCount;
typedef UInt32 IOCacheMode;
typedef UInt32 IOByteCount32;
typedef UInt64 IOByteCount64;
typedef UInt32 IOPhysicalAddress32;
typedef UInt64 IOPhysicalAddress64;
typedef UInt32 IOPhysicalLength32;
typedef UInt64 IOPhysicalLength64;
#if !defined(__arm__) && !defined(__i386__)
typedef mach_vm_address_t IOVirtualAddress __kernel_ptr_semantics;
#else
typedef vm_address_t IOVirtualAddress __kernel_ptr_semantics;
#endif
#if !defined(__arm__) && !defined(__i386__) && !(defined(__x86_64__) && !defined(KERNEL)) && !(defined(__arm64__) && !defined(__LP64__))
typedef IOByteCount64 IOByteCount;
#define PRIIOByteCount PRIu64
#else
typedef IOByteCount32 IOByteCount;
#define PRIIOByteCount PRIu32
#endif
typedef IOVirtualAddress IOLogicalAddress;
#if !defined(__arm__) && !defined(__i386__) && !(defined(__x86_64__) && !defined(KERNEL))
typedef IOPhysicalAddress64 IOPhysicalAddress;
typedef IOPhysicalLength64 IOPhysicalLength;
#define IOPhysical32( hi, lo ) ((UInt64) lo + ((UInt64)(hi) << 32))
#define IOPhysSize 64
#else
typedef IOPhysicalAddress32 IOPhysicalAddress;
typedef IOPhysicalLength32 IOPhysicalLength;
#define IOPhysical32( hi, lo ) (lo)
#define IOPhysSize 32
#endif
typedef struct{
IOPhysicalAddress address;
IOByteCount length;
} IOPhysicalRange;
typedef struct{
IOVirtualAddress address;
IOByteCount length;
} IOVirtualRange;
#if !defined(__arm__) && !defined(__i386__)
typedef IOVirtualRange IOAddressRange;
#else
typedef struct{
mach_vm_address_t address;
mach_vm_size_t length;
} IOAddressRange;
#endif
/*
* Map between #defined or enum'd constants and text description.
*/
typedef struct {
int value;
const char *name;
} IONamedValue;
/*
* Memory alignment -- specified as a power of two.
*/
typedef unsigned int IOAlignment;
#define IO_NULL_VM_TASK ((vm_task_t)0)
/*
* Pull in machine specific stuff.
*/
//#include <IOKit/machine/IOTypes.h>
#ifndef MACH_KERNEL
#ifndef __IOKIT_PORTS_DEFINED__
#define __IOKIT_PORTS_DEFINED__
#ifdef __cplusplus
class OSObject;
typedef OSObject * io_object_t;
#else
typedef struct OSObject * io_object_t;
#endif
#endif /* __IOKIT_PORTS_DEFINED__ */
#include <device/device_types.h>
typedef io_object_t io_connect_t;
typedef io_object_t io_enumerator_t;
typedef io_object_t io_ident_t;
typedef io_object_t io_iterator_t;
typedef io_object_t io_registry_entry_t;
typedef io_object_t io_service_t;
typedef io_object_t uext_object_t;
#define IO_OBJECT_NULL ((io_object_t) 0)
#endif /* MACH_KERNEL */
#include <IOKit/IOMapTypes.h>
/*! @enum Scale Factors
* @discussion Used when a scale_factor parameter is required to define a unit of time.
* @constant kNanosecondScale Scale factor for nanosecond based times.
* @constant kMicrosecondScale Scale factor for microsecond based times.
* @constant kMillisecondScale Scale factor for millisecond based times.
* @constant kTickScale Scale factor for the standard (100Hz) tick.
* @constant kSecondScale Scale factor for second based times. */
enum {
kNanosecondScale = 1,
kMicrosecondScale = 1000,
kMillisecondScale = 1000 * 1000,
kSecondScale = 1000 * 1000 * 1000,
kTickScale = (kSecondScale / 100)
};
enum {
kIOConnectMethodVarOutputSize = -3
};
/* compatibility types */
#ifdef __cplusplus
}
#endif
enum {
kIOMaxBusStall40usec = 40000,
kIOMaxBusStall30usec = 30000,
kIOMaxBusStall25usec = 25000,
kIOMaxBusStall20usec = 20000,
kIOMaxBusStall10usec = 10000,
kIOMaxBusStall5usec = 5000,
kIOMaxBusStallNone = 0,
};
#endif /* ! __IOKIT_IOTYPES_H */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/DriverKit/IOUserServer.h | /* iig(DriverKit-191.30.2) generated from IOUserServer.iig */
/* IOUserServer.iig:1-36 */
/*
* Copyright (c) 2019-2019 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _IOKIT_UIOUSERSERVER_H
#define _IOKIT_UIOUSERSERVER_H
#include <DriverKit/OSObject.h> /* .iig include */
#include <DriverKit/OSAction.h> /* .iig include */
#include <DriverKit/IOService.h> /* .iig include */
/* source class IOUserServer IOUserServer.iig:37-67 */
#if __DOCUMENTATION__
#define KERNEL IIG_KERNEL
/*!
*/
class KERNEL IOUserServer : public IOService
{
public:
static kern_return_t
Create(
const char name[64],
uint64_t tag,
uint64_t options,
OSString * bundleID,
IOUserServer ** server);
virtual bool
init() override;
virtual void
free() override;
virtual kern_return_t
Exit(const char reason[1024]) LOCAL;
virtual kern_return_t
LoadModule(const char path[1024]) LOCAL;
virtual kern_return_t
RegisterService() override;
};
#undef KERNEL
#else /* __DOCUMENTATION__ */
/* generated class IOUserServer IOUserServer.iig:37-67 */
#define IOUserServer_Create_ID 0xc1dbaee5e75e22b9ULL
#define IOUserServer_Exit_ID 0xe949d58832ebe980ULL
#define IOUserServer_LoadModule_ID 0xd96f074a91a53982ULL
#define IOUserServer_Create_Args \
const char * name, \
uint64_t tag, \
uint64_t options, \
OSString * bundleID, \
IOUserServer ** server
#define IOUserServer_Exit_Args \
const char * reason
#define IOUserServer_LoadModule_Args \
const char * path
#define IOUserServer_RegisterService_Args \
#define IOUserServer_Methods \
\
public:\
\
virtual kern_return_t\
Dispatch(const IORPC rpc) APPLE_KEXT_OVERRIDE;\
\
static kern_return_t\
_Dispatch(IOUserServer * self, const IORPC rpc);\
\
static kern_return_t\
Create(\
const char * name,\
uint64_t tag,\
uint64_t options,\
OSString * bundleID,\
IOUserServer ** server);\
\
kern_return_t\
Exit(\
const char * reason,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
LoadModule(\
const char * path,\
OSDispatchMethod supermethod = NULL);\
\
\
protected:\
/* _Impl methods */\
\
kern_return_t\
Exit_Impl(IOUserServer_Exit_Args);\
\
kern_return_t\
LoadModule_Impl(IOUserServer_LoadModule_Args);\
\
\
public:\
/* _Invoke methods */\
\
typedef kern_return_t (*Create_Handler)(IOUserServer_Create_Args);\
static kern_return_t\
Create_Invoke(const IORPC rpc,\
Create_Handler func);\
\
typedef kern_return_t (*Exit_Handler)(OSMetaClassBase * target, IOUserServer_Exit_Args);\
static kern_return_t\
Exit_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
Exit_Handler func);\
\
typedef kern_return_t (*LoadModule_Handler)(OSMetaClassBase * target, IOUserServer_LoadModule_Args);\
static kern_return_t\
LoadModule_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
LoadModule_Handler func);\
\
#define IOUserServer_KernelMethods \
\
protected:\
/* _Impl methods */\
\
static kern_return_t\
Create_Impl(IOUserServer_Create_Args);\
\
kern_return_t\
RegisterService_Impl(IOService_RegisterService_Args);\
\
#define IOUserServer_VirtualMethods \
\
public:\
\
virtual bool\
init(\
) APPLE_KEXT_OVERRIDE;\
\
virtual void\
free(\
) APPLE_KEXT_OVERRIDE;\
\
#endif /* !__DOCUMENTATION__ */
/* IOUserServer.iig:69- */
#endif /* ! _IOKIT_UIOUSERSERVER_H */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/DriverKit/IOService.h | /* iig(DriverKit-191.30.2) generated from IOService.iig */
/* IOService.iig:1-71 */
/*
* Copyright (c) 2019-2019 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#if !__IIG
#include <IOKit/IOService.h>
#endif
#ifndef _IOKIT_UIOSERVICE_H
#define _IOKIT_UIOSERVICE_H
#include <DriverKit/OSObject.h> /* .iig include */
class IOMemoryDescriptor;
class IOBufferMemoryDescriptor;
class IOUserClient;
class OSAction;
class IOServiceStateNotificationDispatchSource;
typedef char IOServiceName[128];
typedef char IOPropertyName[128];
typedef char IORegistryPlaneName[128];
enum {
kIOServiceSearchPropertyParents = 0x00000001,
};
#define kIOServiceDefaultQueueName "Default"
enum {
kIOServicePowerCapabilityOff = 0x00000000,
kIOServicePowerCapabilityOn = 0x00000002,
kIOServicePowerCapabilityLow = 0x00010000,
};
enum {
_kIOPMWakeEventSource = 0x00000001,
};
// values for OSNumber kIOSystemStateHaltDescriptionKey:kIOSystemStateHaltDescriptionHaltStateKey
enum {
kIOServiceHaltStatePowerOff = 0x00000001,
kIOServiceHaltStateRestart = 0x00000002,
};
/* source class IOService IOService.iig:72-531 */
#if __DOCUMENTATION__
#define KERNEL IIG_KERNEL
/*!
* @class IOService
*
* @abstract
* IOService represents an device or OS service in IOKit and DriverKit.
*
* @discussion
* IOKit provides driver lifecycle management through the IOService APIs.
* Drivers and devices are represented as subclasses of IOService.
*
*/
class KERNEL IOService : public OSObject
{
public:
virtual bool
init() override;
virtual void
free() override;
/*!
* @brief First call made to a matched IOService.
* @discussion During matching IOKit will create an IOService object for successful matches.
* Start is the first call made to the new object.
* @param provider The IOService provider for the match. This should be OSRequiredCast to the expected class.
* The provider is retained by DriverKit for the duration of Start() and on successful Start() until
* IOService::Stop() is called.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
Start(IOService * provider) LOCAL;
/*!
* @brief Terminate access to provider.
* @discussion During termination IOKit will teardown any IOService objects attached to a terminated provider.
* Stop should quiesce all activity and when complete, pass the call to super. After calling super, the
* provider is no longer valid and this object will likely be freed.
* @param provider The IOService provider for being terminated, one previously passed to Start
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
Stop(IOService * provider) LOCAL;
/*! @function ClientCrashed
* @discussion Notification for kernel objects of a client crash.
* @param client Attached client.
* @param options No options are currently defined.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
ClientCrashed(IOService * client, uint64_t options);
/*!
* @brief Obtain IOKit IORegistryEntryID.
* @param registryEntryID IORegistryEntryID for the IOKit object.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
GetRegistryEntryID(uint64_t * registryEntryID) LOCAL;
/*!
* @brief Set the IORegistryEntry name.
* @param name Name for the IOKit object. The c-string will be copied.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
SetName(
const IOServiceName name);
/*!
* @brief Start the matching process on the IOService object.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
RegisterService();
/*!
* @brief Set the IODispatchQueue for a given name on the IOService.
* @param name Name for the queue. The name may be referenced by methods in the .iig class definition
* with the QUEUENAME() attribute to indicate the method must be invoked on that queue. If a method
* is invoked before the queue is set for the name, the default queue is used. A default queue is
* created by DriverKit for every new IOService object with the name kIOServiceDefaultQueueName.
* @param queue Queue to be associated with the name on this IOService.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
SetDispatchQueue(
const IODispatchQueueName name,
IODispatchQueue * queue) override LOCAL;
/*!
* @brief Obtain the IODispatchQueue for a given name on the IOService.
* @param name Name for the queue.
* @param queue Returned, retained queue or NULL. The caller should release this queue.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
CopyDispatchQueue(
const IODispatchQueueName name,
IODispatchQueue ** queue) override;
/*!
* @brief Create the default IODispatchQueue for an IOService. IOService::init()
* calls this to create its default queue.
* @param queue Returned, retained queue or NULL.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
CreateDefaultDispatchQueue(
IODispatchQueue ** queue) LOCAL;
/*!
* @brief Obtain the IOKit registry properties for the IOService.
* @param properties Returned, retained dictionary of properties or NULL. The caller should release this dictionary.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
CopyProperties(
OSDictionary ** properties);
/*!
* @brief Obtain the an IOKit registry properties from the service or one of its parents.
* @param name Name of the property as a c-string.
* @param plane Name of the registry plane to be searched, if the option kIOServiceSearchPropertyParents
* is used.
* @param options Pass kIOServiceSearchPropertyParents to search for the property in the IOService and all
* its parents in the IOKit registry.
* @param property Returned, retained property object or NULL. The caller should release this property.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
SearchProperty(
const IOPropertyName name,
const IORegistryPlaneName plane,
uint64_t options,
OSContainer ** property);
/*!
* @brief Send a dictionary of properties to an IOService.
* @discussion By default the method will fail. A DriverKit subclass or kernel class may implement this method.
* @param properties Dictionary of properties.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
SetProperties(
OSDictionary * properties);
/*!
* @brief Notification of change in power state of a provider.
* @discussion DriverKit notifies of changes in power of a provider. The driver should make itself safe for
* the new state before passing the call to super.
* @param powerFlags The power capabilities of the new state. The values possible are:
* kIOServicePowerCapabilityOff the system will be entering sleep state
* kIOServicePowerCapabilityOn the device and system are fully powered
* kIOServicePowerCapabilityLow the device is in a reduced power state while the system is running
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
SetPowerState(
uint32_t powerFlags) LOCAL;
/*!
* @brief Allow provider to enter a low power state.
* @discussion A driver may allow a device to enter a lower power state.
* @param powerFlags The power capabilities of the new state. The values possible are:
* kIOServicePowerCapabilityLow the device is in a reduced power state while the system is running
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
ChangePowerState(
uint32_t powerFlags);
/*!
* @brief Request create a new user client for a client process.
* @discussion An application may request an IOUserClient be opened with the IOKit framework
* IOServiceOpen() call. The type parameter of that call is passed here. The driver should respond to
* the call by calling IOService::Create() with a plist entry describing the new user client object.
* @param type The type passed to IOServiceOpen().
* @param userClient The object created by IOService::Create()
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
NewUserClient(
uint32_t type,
IOUserClient ** userClient);
/*!
* @brief Request to create an IOService object from a plist property.
* @discussion An IOService interface or IOUserClient subclass may be created from a plist property of the driver.
* The plist should contain the following IOKit matching keys:
* IOClass - kernel class of IOUserUserClient
* IOUserClass - DriverKit class to be instantiated
* IOServiceDEXTEntitlements - Array of entitlements to be checked against a user client owning task
* @param provider The provider of the new object.
* @param propertiesKey The name of the properties dictionary in this IOService
* @param result The created object retained, to be released by the caller.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
Create(
IOService * provider,
const IOPropertyName propertiesKey,
IOService ** result) LOCAL;
/*!
* @brief Start an IOService termination.
* @discussion An IOService object created with Create() may be removed by calling Terminate().
* The termination is asynchronous and will later call Stop() on the service.
* @param options No options are currently defined, pass zero.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
Terminate(
uint64_t options);
/*!
* @brief Obtain supportable properties describing the provider chain.
* @discussion Obtain supportable properties describing the provider chain. This will be a subset of registry
* properties the OS considers supportable.
* The array is ordered with a dictionary of properties for each entry in the provider chain from this
* service towards the root.
* @param propertyKeys If only certain property values are need, they may be passed in this array.
* @param properties Returned, retained array of dictionaries of properties or NULL. The caller should release
* this array.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
CopyProviderProperties(
OSArray * propertyKeys,
OSArray ** properties);
/*!
* @brief Reduce power saving modes in the system in order to provide decreased latency
* to hardware DMA requests.
* @discussion When the system enters lower power states DMA access to memory may be affected.
* The best way by far to handle this is to change how you schedule your time-critical DMA operations in
* your driver such that an occasional delay will not affect the proper functioning of your device.
* However, if this is not possible, your driver can inform power management when a time-critical transfer
* begins and ends so that the system will not enter the lowest power states during that time. To do this,
* pass a value to requireMaxBusStall that informs power management of the maximum memory access latency in
* nanoseconds that can be tolerated by the driver. This value is hardware dependent and is related to the
* amount of buffering available in the hardware.
* Supported values are given by the kIOMaxBusStall* enum in IOTypes.h
* Pass the largest value possible that works for your device. This will minimize power
* consumption and maximize battery life by still allowing some level of CPU power management.
* @param maxBusStall A value from the kIOMaxBusStall* enum in IOTypes.h
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
RequireMaxBusStall(
uint64_t maxBusStall);
/*! @function AdjustBusy
* @discussion Adjust the busy state of this service by applying a delta to the current busy state.
* Adjusting the busy state of a service to or from zero will change the provider's busy state by one, in the same direction.
* @param delta The delta value to apply to the busy state.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
AdjustBusy(int32_t delta);
/*! @function GetBusyState
* @discussion Get the busy state of this service.
* @param busyState The returned busy state.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
GetBusyState(uint32_t *busyState);
/*!
* @brief Post an event to CoreAnalytics.
* @discussion Post an event to CoreAnalytics. See the CoreAnalytics documentation for
* details.
* @param options No options currently defined pass zero.
* @param eventName See the CoreAnalytics documentation for details.
* @param eventPayload See the CoreAnalytics documentation for details.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
CoreAnalyticsSendEvent(
uint64_t options,
OSString * eventName,
OSDictionary * eventPayload);
/*! @function IOCreatePropertyMatchingDictionary
* @abstract Construct a matching dictionary for property matching.
*/
static OSDictionary *
CreatePropertyMatchingDictionary(const char * key, OSObjectPtr value, OSDictionary * matching) LOCALONLY;
/*! @function IOCreatePropertyMatchingDictionary
* @abstract Construct a matching dictionary for property matching.
*/
static OSDictionary *
CreatePropertyMatchingDictionary(const char * key, const char * stringValue, OSDictionary * matching) LOCALONLY;
/*! @function IOCreateKernelClassMatchingDictionary
* @abstract Construct a matching dictionary for kernel class matching.
*/
static OSDictionary *
CreateKernelClassMatchingDictionary(OSString * className, OSDictionary * matching) LOCALONLY;
/*! @function IOCreateKernelClassMatchingDictionary
* @abstract Construct a matching dictionary for kernel class matching.
*/
static OSDictionary *
CreateKernelClassMatchingDictionary(const char * className, OSDictionary * matching) LOCALONLY;
/*! @function IOCreateUserClassMatchingDictionary
* @abstract Construct a matching dictionary for user class matching.
*/
static OSDictionary *
CreateUserClassMatchingDictionary(OSString * className, OSDictionary * matching) LOCALONLY;
/*! @function IOCreateUserClassMatchingDictionary
* @abstract Construct a matching dictionary for user class matching.
*/
static OSDictionary *
CreateUserClassMatchingDictionary(const char * className, OSDictionary * matching) LOCALONLY;
/*! @function IOCreateNameMatchingDictionary
* @abstract Construct a matching dictionary for IOService name matching.
*/
static OSDictionary *
CreateNameMatchingDictionary(OSString * serviceName, OSDictionary * matching) LOCALONLY;
/*! @function IOCreateNameMatchingDictionary
* @abstract Construct a matching dictionary for IOService name matching.
*/
static OSDictionary *
CreateNameMatchingDictionary(const char * serviceName, OSDictionary * matching) LOCALONLY;
/*! @function UpdateReport
* @abstract update an IOReporting subscription by reading out channel data.
*/
virtual IOReturn UpdateReport(OSData *channels, uint32_t action,
uint32_t *outElementCount,
uint64_t offset, uint64_t capacity,
IOMemoryDescriptor *buffer);
/*! @function ConfigureReport
* @abstract Configure an IOReporting subscription
* @discussion outCount is counting channels for enable,disable. It is counting
* elements for getDimensions
*/
virtual IOReturn ConfigureReport(OSData *channels, uint32_t action, uint32_t *outCount);
/*! @function SetLegend
* @abstract set IORLegend and IORLegendPublic ioreg properties on this service.
* @discussion For use by DriverKit userspace services, since they can't set
* registry properties directly.
*/
virtual IOReturn SetLegend(OSArray *legend, bool is_public);
/*!
* @brief Get the IORegistryEntry name.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
CopyName(OSString ** name);
/*! @function StringFromReturn
* @abstract Get a string description for an IOReturn value.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
StringFromReturn(
IOReturn retval,
OSString ** str);
virtual kern_return_t
_ClaimSystemWakeEvent(
IOService * device,
uint64_t flags,
const IOPropertyName reason,
OSContainer * details);
#if PRIVATE_WIFI_ONLY
/*!
* @brief Optionally supported external method to set properties in this service.
* @param properties The properties to set.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
UserSetProperties(OSContainer * properties) LOCAL;
#endif /* PRIVATE_WIFI_ONLY */
/*! @function RemoveProperty
* @abstract Remove a property from the IOService.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
RemoveProperty(OSString * propertyName);
/*! @function GetProvider
* @abstract Get the provider of this IOService.
* @discussion The DriverKit runtime caches the provider passed to IOService::Start(IOService * provider).
* This method returns the cached object.
*/
IOService *
GetProvider() const LOCALONLY;
/*!
* @function CopySystemStateNotificationService
* @abstract Obtain the system state notification service.
* @param service Return IOService object with +1 retain count, to be released
* by the caller.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
CopySystemStateNotificationService(IOService ** service);
/*!
* @function StateNotificationItemCreate
* @abstract Create a state notification item.
* @param itemName name of the item.
* @param schema dictionary describing behaviors for the item. Keys are defined in
* IOKitKeys.h kIOStateNotification*
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
StateNotificationItemCreate(OSString * itemName, OSDictionary * schema);
/*!
* @function StateNotificationItemSet
* @abstract Set the value of a state notification item.
* @param itemName name of the item.
* @param value dictionary value for the item, item creator to define.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
StateNotificationItemSet(OSString * itemName, OSDictionary * value);
/*!
* @function StateNotificationItemCopy
* @abstract Set the value of a state notification item.
* @param itemName name of the item.
* @param value dictionary value for the item, item creator to define.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
StateNotificationItemCopy(OSString * itemName, OSDictionary ** value);
private:
virtual void
Stop_async(
IOService * provider) LOCAL;
virtual kern_return_t
_NewUserClient(
uint32_t type,
OSDictionary * entitlements,
IOUserClient ** userClient) LOCAL;
};
#undef KERNEL
#else /* __DOCUMENTATION__ */
/* generated class IOService IOService.iig:72-531 */
#define IOService_Start_ID 0xab6f76dde6d693f2ULL
#define IOService_Stop_ID 0x98e715041c459fa5ULL
#define IOService_ClientCrashed_ID 0xf608d8d479c824a3ULL
#define IOService_GetRegistryEntryID_ID 0x8a6f522f3894a0d7ULL
#define IOService_SetName_ID 0xff378dd57615eb9fULL
#define IOService_RegisterService_ID 0xe9722c2bb1347c28ULL
#define IOService_CreateDefaultDispatchQueue_ID 0x805bb452f0b44ef7ULL
#define IOService_CopyProperties_ID 0x833ec8f92f8b5362ULL
#define IOService_SearchProperty_ID 0xad751cdb94c8dcc8ULL
#define IOService_SetProperties_ID 0xd8a753ea156f9162ULL
#define IOService_SetPowerState_ID 0xd200fde7d57ecca6ULL
#define IOService_ChangePowerState_ID 0xdb75cfc3395484a0ULL
#define IOService_NewUserClient_ID 0xf669efffcb89ed9cULL
#define IOService_Create_ID 0xe1a46dbd68bbe09cULL
#define IOService_Terminate_ID 0xf7a595d9927810c8ULL
#define IOService_CopyProviderProperties_ID 0xc2a554959002c8e7ULL
#define IOService_RequireMaxBusStall_ID 0xc21228652ff536afULL
#define IOService_AdjustBusy_ID 0xde9f5ab8cc9758ebULL
#define IOService_GetBusyState_ID 0xf5e47b685861dee5ULL
#define IOService_CoreAnalyticsSendEvent_ID 0xedf64411b90d31caULL
#define IOService_UpdateReport_ID 0x8509eed786c7ff1aULL
#define IOService_ConfigureReport_ID 0x85d9def59e3f02beULL
#define IOService_SetLegend_ID 0xa32ee5222548afa2ULL
#define IOService_CopyName_ID 0xfe0617febc5b2cc4ULL
#define IOService_StringFromReturn_ID 0xf62cec3df59db769ULL
#define IOService__ClaimSystemWakeEvent_ID 0x845c18dfe6f75305ULL
#define IOService_UserSetProperties_ID 0xad8461d6bb5e656dULL
#define IOService_RemoveProperty_ID 0xdadeb06419d321b0ULL
#define IOService_CopySystemStateNotificationService_ID 0x9165d1fce9b2ca5aULL
#define IOService_StateNotificationItemCreate_ID 0xb35947bdab354e9eULL
#define IOService_StateNotificationItemSet_ID 0xb318c8fa26b5b891ULL
#define IOService_StateNotificationItemCopy_ID 0xad2e6404fde4b615ULL
#define IOService_Stop_async_ID 0xa8c93137712a16a2ULL
#define IOService__NewUserClient_ID 0x80b22dd60ee3abb6ULL
#define IOService_Start_Args \
IOService * provider
#define IOService_Stop_Args \
IOService * provider
#define IOService_ClientCrashed_Args \
IOService * client, \
uint64_t options
#define IOService_GetRegistryEntryID_Args \
uint64_t * registryEntryID
#define IOService_SetName_Args \
const char * name
#define IOService_RegisterService_Args \
#define IOService_SetDispatchQueue_Args \
const char * name, \
IODispatchQueue * queue
#define IOService_CopyDispatchQueue_Args \
const char * name, \
IODispatchQueue ** queue
#define IOService_CreateDefaultDispatchQueue_Args \
IODispatchQueue ** queue
#define IOService_CopyProperties_Args \
OSDictionary ** properties
#define IOService_SearchProperty_Args \
const char * name, \
const char * plane, \
uint64_t options, \
OSContainer ** property
#define IOService_SetProperties_Args \
OSDictionary * properties
#define IOService_SetPowerState_Args \
uint32_t powerFlags
#define IOService_ChangePowerState_Args \
uint32_t powerFlags
#define IOService_NewUserClient_Args \
uint32_t type, \
IOUserClient ** userClient
#define IOService_Create_Args \
IOService * provider, \
const char * propertiesKey, \
IOService ** result
#define IOService_Terminate_Args \
uint64_t options
#define IOService_CopyProviderProperties_Args \
OSArray * propertyKeys, \
OSArray ** properties
#define IOService_RequireMaxBusStall_Args \
uint64_t maxBusStall
#define IOService_AdjustBusy_Args \
int32_t delta
#define IOService_GetBusyState_Args \
uint32_t * busyState
#define IOService_CoreAnalyticsSendEvent_Args \
uint64_t options, \
OSString * eventName, \
OSDictionary * eventPayload
#define IOService_UpdateReport_Args \
OSData * channels, \
uint32_t action, \
uint32_t * outElementCount, \
uint64_t offset, \
uint64_t capacity, \
IOMemoryDescriptor * buffer
#define IOService_ConfigureReport_Args \
OSData * channels, \
uint32_t action, \
uint32_t * outCount
#define IOService_SetLegend_Args \
OSArray * legend, \
bool is_public
#define IOService_CopyName_Args \
OSString ** name
#define IOService_StringFromReturn_Args \
IOReturn retval, \
OSString ** str
#define IOService__ClaimSystemWakeEvent_Args \
IOService * device, \
uint64_t flags, \
const char * reason, \
OSContainer * details
#define IOService_UserSetProperties_Args \
OSContainer * properties
#define IOService_RemoveProperty_Args \
OSString * propertyName
#define IOService_CopySystemStateNotificationService_Args \
IOService ** service
#define IOService_StateNotificationItemCreate_Args \
OSString * itemName, \
OSDictionary * schema
#define IOService_StateNotificationItemSet_Args \
OSString * itemName, \
OSDictionary * value
#define IOService_StateNotificationItemCopy_Args \
OSString * itemName, \
OSDictionary ** value
#define IOService_Stop_async_Args \
IOService * provider
#define IOService__NewUserClient_Args \
uint32_t type, \
OSDictionary * entitlements, \
IOUserClient ** userClient
#define IOService_Methods \
\
public:\
\
virtual kern_return_t\
Dispatch(const IORPC rpc) APPLE_KEXT_OVERRIDE;\
\
static kern_return_t\
_Dispatch(IOService * self, const IORPC rpc);\
\
kern_return_t\
Start(\
IOService * provider,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
Stop(\
IOService * provider,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
ClientCrashed(\
IOService * client,\
uint64_t options,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
GetRegistryEntryID(\
uint64_t * registryEntryID,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
SetName(\
const IOServiceName name,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
RegisterService(\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
CreateDefaultDispatchQueue(\
IODispatchQueue ** queue,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
CopyProperties(\
OSDictionary ** properties,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
SearchProperty(\
const IOPropertyName name,\
const IORegistryPlaneName plane,\
uint64_t options,\
OSContainer ** property,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
SetProperties(\
OSDictionary * properties,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
SetPowerState(\
uint32_t powerFlags,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
ChangePowerState(\
uint32_t powerFlags,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
NewUserClient(\
uint32_t type,\
IOUserClient ** userClient,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
Create(\
IOService * provider,\
const IOPropertyName propertiesKey,\
IOService ** result,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
Terminate(\
uint64_t options,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
CopyProviderProperties(\
OSArray * propertyKeys,\
OSArray ** properties,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
RequireMaxBusStall(\
uint64_t maxBusStall,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
AdjustBusy(\
int32_t delta,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
GetBusyState(\
uint32_t * busyState,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
CoreAnalyticsSendEvent(\
uint64_t options,\
OSString * eventName,\
OSDictionary * eventPayload,\
OSDispatchMethod supermethod = NULL);\
\
static OSDictionary *\
CreatePropertyMatchingDictionary(\
const char * key,\
OSObjectPtr value,\
OSDictionary * matching);\
\
static OSDictionary *\
CreatePropertyMatchingDictionary(\
const char * key,\
const char * stringValue,\
OSDictionary * matching);\
\
static OSDictionary *\
CreateKernelClassMatchingDictionary(\
OSString * className,\
OSDictionary * matching);\
\
static OSDictionary *\
CreateKernelClassMatchingDictionary(\
const char * className,\
OSDictionary * matching);\
\
static OSDictionary *\
CreateUserClassMatchingDictionary(\
OSString * className,\
OSDictionary * matching);\
\
static OSDictionary *\
CreateUserClassMatchingDictionary(\
const char * className,\
OSDictionary * matching);\
\
static OSDictionary *\
CreateNameMatchingDictionary(\
OSString * serviceName,\
OSDictionary * matching);\
\
static OSDictionary *\
CreateNameMatchingDictionary(\
const char * serviceName,\
OSDictionary * matching);\
\
IOReturn\
UpdateReport(\
OSData * channels,\
uint32_t action,\
uint32_t * outElementCount,\
uint64_t offset,\
uint64_t capacity,\
IOMemoryDescriptor * buffer,\
OSDispatchMethod supermethod = NULL);\
\
IOReturn\
ConfigureReport(\
OSData * channels,\
uint32_t action,\
uint32_t * outCount,\
OSDispatchMethod supermethod = NULL);\
\
IOReturn\
SetLegend(\
OSArray * legend,\
bool is_public,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
CopyName(\
OSString ** name,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
StringFromReturn(\
IOReturn retval,\
OSString ** str,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
_ClaimSystemWakeEvent(\
IOService * device,\
uint64_t flags,\
const IOPropertyName reason,\
OSContainer * details,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
UserSetProperties(\
OSContainer * properties,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
RemoveProperty(\
OSString * propertyName,\
OSDispatchMethod supermethod = NULL);\
\
IOService *\
GetProvider(\
) const;\
\
kern_return_t\
CopySystemStateNotificationService(\
IOService ** service,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
StateNotificationItemCreate(\
OSString * itemName,\
OSDictionary * schema,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
StateNotificationItemSet(\
OSString * itemName,\
OSDictionary * value,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
StateNotificationItemCopy(\
OSString * itemName,\
OSDictionary ** value,\
OSDispatchMethod supermethod = NULL);\
\
void\
Stop_async(\
IOService * provider,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
_NewUserClient(\
uint32_t type,\
OSDictionary * entitlements,\
IOUserClient ** userClient,\
OSDispatchMethod supermethod = NULL);\
\
\
protected:\
/* _Impl methods */\
\
kern_return_t\
Start_Impl(IOService_Start_Args);\
\
kern_return_t\
Stop_Impl(IOService_Stop_Args);\
\
kern_return_t\
GetRegistryEntryID_Impl(IOService_GetRegistryEntryID_Args);\
\
kern_return_t\
SetDispatchQueue_Impl(OSObject_SetDispatchQueue_Args);\
\
kern_return_t\
CreateDefaultDispatchQueue_Impl(IOService_CreateDefaultDispatchQueue_Args);\
\
kern_return_t\
SetPowerState_Impl(IOService_SetPowerState_Args);\
\
kern_return_t\
Create_Impl(IOService_Create_Args);\
\
kern_return_t\
UserSetProperties_Impl(IOService_UserSetProperties_Args);\
\
void\
Stop_async_Impl(IOService_Stop_async_Args);\
\
kern_return_t\
_NewUserClient_Impl(IOService__NewUserClient_Args);\
\
\
public:\
/* _Invoke methods */\
\
typedef kern_return_t (*Start_Handler)(OSMetaClassBase * target, IOService_Start_Args);\
static kern_return_t\
Start_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
Start_Handler func);\
\
typedef kern_return_t (*Stop_Handler)(OSMetaClassBase * target, IOService_Stop_Args);\
static kern_return_t\
Stop_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
Stop_Handler func);\
\
typedef kern_return_t (*ClientCrashed_Handler)(OSMetaClassBase * target, IOService_ClientCrashed_Args);\
static kern_return_t\
ClientCrashed_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
ClientCrashed_Handler func);\
\
typedef kern_return_t (*GetRegistryEntryID_Handler)(OSMetaClassBase * target, IOService_GetRegistryEntryID_Args);\
static kern_return_t\
GetRegistryEntryID_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
GetRegistryEntryID_Handler func);\
\
typedef kern_return_t (*SetName_Handler)(OSMetaClassBase * target, IOService_SetName_Args);\
static kern_return_t\
SetName_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
SetName_Handler func);\
\
typedef kern_return_t (*RegisterService_Handler)(OSMetaClassBase * targetIOService_RegisterService_Args);\
static kern_return_t\
RegisterService_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
RegisterService_Handler func);\
\
typedef kern_return_t (*CreateDefaultDispatchQueue_Handler)(OSMetaClassBase * target, IOService_CreateDefaultDispatchQueue_Args);\
static kern_return_t\
CreateDefaultDispatchQueue_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
CreateDefaultDispatchQueue_Handler func);\
\
typedef kern_return_t (*CopyProperties_Handler)(OSMetaClassBase * target, IOService_CopyProperties_Args);\
static kern_return_t\
CopyProperties_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
CopyProperties_Handler func);\
\
typedef kern_return_t (*SearchProperty_Handler)(OSMetaClassBase * target, IOService_SearchProperty_Args);\
static kern_return_t\
SearchProperty_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
SearchProperty_Handler func);\
\
typedef kern_return_t (*SetProperties_Handler)(OSMetaClassBase * target, IOService_SetProperties_Args);\
static kern_return_t\
SetProperties_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
SetProperties_Handler func);\
\
typedef kern_return_t (*SetPowerState_Handler)(OSMetaClassBase * target, IOService_SetPowerState_Args);\
static kern_return_t\
SetPowerState_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
SetPowerState_Handler func);\
\
typedef kern_return_t (*ChangePowerState_Handler)(OSMetaClassBase * target, IOService_ChangePowerState_Args);\
static kern_return_t\
ChangePowerState_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
ChangePowerState_Handler func);\
\
typedef kern_return_t (*NewUserClient_Handler)(OSMetaClassBase * target, IOService_NewUserClient_Args);\
static kern_return_t\
NewUserClient_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
NewUserClient_Handler func);\
\
typedef kern_return_t (*Create_Handler)(OSMetaClassBase * target, IOService_Create_Args);\
static kern_return_t\
Create_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
Create_Handler func);\
\
typedef kern_return_t (*Terminate_Handler)(OSMetaClassBase * target, IOService_Terminate_Args);\
static kern_return_t\
Terminate_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
Terminate_Handler func);\
\
typedef kern_return_t (*CopyProviderProperties_Handler)(OSMetaClassBase * target, IOService_CopyProviderProperties_Args);\
static kern_return_t\
CopyProviderProperties_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
CopyProviderProperties_Handler func);\
\
typedef kern_return_t (*RequireMaxBusStall_Handler)(OSMetaClassBase * target, IOService_RequireMaxBusStall_Args);\
static kern_return_t\
RequireMaxBusStall_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
RequireMaxBusStall_Handler func);\
\
typedef kern_return_t (*AdjustBusy_Handler)(OSMetaClassBase * target, IOService_AdjustBusy_Args);\
static kern_return_t\
AdjustBusy_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
AdjustBusy_Handler func);\
\
typedef kern_return_t (*GetBusyState_Handler)(OSMetaClassBase * target, IOService_GetBusyState_Args);\
static kern_return_t\
GetBusyState_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
GetBusyState_Handler func);\
\
typedef kern_return_t (*CoreAnalyticsSendEvent_Handler)(OSMetaClassBase * target, IOService_CoreAnalyticsSendEvent_Args);\
static kern_return_t\
CoreAnalyticsSendEvent_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
CoreAnalyticsSendEvent_Handler func);\
\
typedef IOReturn (*UpdateReport_Handler)(OSMetaClassBase * target, IOService_UpdateReport_Args);\
static kern_return_t\
UpdateReport_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
UpdateReport_Handler func);\
\
typedef IOReturn (*ConfigureReport_Handler)(OSMetaClassBase * target, IOService_ConfigureReport_Args);\
static kern_return_t\
ConfigureReport_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
ConfigureReport_Handler func);\
\
typedef IOReturn (*SetLegend_Handler)(OSMetaClassBase * target, IOService_SetLegend_Args);\
static kern_return_t\
SetLegend_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
SetLegend_Handler func);\
\
typedef kern_return_t (*CopyName_Handler)(OSMetaClassBase * target, IOService_CopyName_Args);\
static kern_return_t\
CopyName_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
CopyName_Handler func);\
\
typedef kern_return_t (*StringFromReturn_Handler)(OSMetaClassBase * target, IOService_StringFromReturn_Args);\
static kern_return_t\
StringFromReturn_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
StringFromReturn_Handler func);\
\
typedef kern_return_t (*_ClaimSystemWakeEvent_Handler)(OSMetaClassBase * target, IOService__ClaimSystemWakeEvent_Args);\
static kern_return_t\
_ClaimSystemWakeEvent_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
_ClaimSystemWakeEvent_Handler func);\
\
typedef kern_return_t (*UserSetProperties_Handler)(OSMetaClassBase * target, IOService_UserSetProperties_Args);\
static kern_return_t\
UserSetProperties_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
UserSetProperties_Handler func);\
\
typedef kern_return_t (*RemoveProperty_Handler)(OSMetaClassBase * target, IOService_RemoveProperty_Args);\
static kern_return_t\
RemoveProperty_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
RemoveProperty_Handler func);\
\
typedef kern_return_t (*CopySystemStateNotificationService_Handler)(OSMetaClassBase * target, IOService_CopySystemStateNotificationService_Args);\
static kern_return_t\
CopySystemStateNotificationService_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
CopySystemStateNotificationService_Handler func);\
\
typedef kern_return_t (*StateNotificationItemCreate_Handler)(OSMetaClassBase * target, IOService_StateNotificationItemCreate_Args);\
static kern_return_t\
StateNotificationItemCreate_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
StateNotificationItemCreate_Handler func);\
\
typedef kern_return_t (*StateNotificationItemSet_Handler)(OSMetaClassBase * target, IOService_StateNotificationItemSet_Args);\
static kern_return_t\
StateNotificationItemSet_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
StateNotificationItemSet_Handler func);\
\
typedef kern_return_t (*StateNotificationItemCopy_Handler)(OSMetaClassBase * target, IOService_StateNotificationItemCopy_Args);\
static kern_return_t\
StateNotificationItemCopy_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
StateNotificationItemCopy_Handler func);\
\
typedef void (*Stop_async_Handler)(OSMetaClassBase * target, IOService_Stop_async_Args);\
static kern_return_t\
Stop_async_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
Stop_async_Handler func);\
\
typedef kern_return_t (*_NewUserClient_Handler)(OSMetaClassBase * target, IOService__NewUserClient_Args);\
static kern_return_t\
_NewUserClient_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
_NewUserClient_Handler func);\
\
#define IOService_KernelMethods \
\
protected:\
/* _Impl methods */\
\
kern_return_t\
ClientCrashed_Impl(IOService_ClientCrashed_Args);\
\
kern_return_t\
SetName_Impl(IOService_SetName_Args);\
\
kern_return_t\
RegisterService_Impl(IOService_RegisterService_Args);\
\
kern_return_t\
CopyDispatchQueue_Impl(OSObject_CopyDispatchQueue_Args);\
\
kern_return_t\
CopyProperties_Impl(IOService_CopyProperties_Args);\
\
kern_return_t\
SearchProperty_Impl(IOService_SearchProperty_Args);\
\
kern_return_t\
SetProperties_Impl(IOService_SetProperties_Args);\
\
kern_return_t\
ChangePowerState_Impl(IOService_ChangePowerState_Args);\
\
kern_return_t\
NewUserClient_Impl(IOService_NewUserClient_Args);\
\
kern_return_t\
Terminate_Impl(IOService_Terminate_Args);\
\
kern_return_t\
CopyProviderProperties_Impl(IOService_CopyProviderProperties_Args);\
\
kern_return_t\
RequireMaxBusStall_Impl(IOService_RequireMaxBusStall_Args);\
\
kern_return_t\
AdjustBusy_Impl(IOService_AdjustBusy_Args);\
\
kern_return_t\
GetBusyState_Impl(IOService_GetBusyState_Args);\
\
kern_return_t\
CoreAnalyticsSendEvent_Impl(IOService_CoreAnalyticsSendEvent_Args);\
\
IOReturn\
UpdateReport_Impl(IOService_UpdateReport_Args);\
\
IOReturn\
ConfigureReport_Impl(IOService_ConfigureReport_Args);\
\
IOReturn\
SetLegend_Impl(IOService_SetLegend_Args);\
\
kern_return_t\
CopyName_Impl(IOService_CopyName_Args);\
\
kern_return_t\
StringFromReturn_Impl(IOService_StringFromReturn_Args);\
\
kern_return_t\
_ClaimSystemWakeEvent_Impl(IOService__ClaimSystemWakeEvent_Args);\
\
kern_return_t\
RemoveProperty_Impl(IOService_RemoveProperty_Args);\
\
kern_return_t\
CopySystemStateNotificationService_Impl(IOService_CopySystemStateNotificationService_Args);\
\
kern_return_t\
StateNotificationItemCreate_Impl(IOService_StateNotificationItemCreate_Args);\
\
kern_return_t\
StateNotificationItemSet_Impl(IOService_StateNotificationItemSet_Args);\
\
kern_return_t\
StateNotificationItemCopy_Impl(IOService_StateNotificationItemCopy_Args);\
\
#define IOService_VirtualMethods \
\
public:\
\
virtual bool\
init(\
) APPLE_KEXT_OVERRIDE;\
\
virtual void\
free(\
) APPLE_KEXT_OVERRIDE;\
\
#endif /* !__DOCUMENTATION__ */
/* IOService.iig:533- */
#endif /* ! _IOKIT_UIOSERVICE_H */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/DriverKit/IOKernelReportStructs.h | /*
* Copyright (c) 2012-2014 Apple Computer, Inc. All Rights Reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
// Internal data structures to be used by IOReporters and User Space Observers
#ifndef _IOKERNELREPORTSTRUCTS_H_
#define _IOKERNELREPORTSTRUCTS_H_
#include <stdint.h>
#include <IOKit/IOReportTypes.h>
#ifdef __cplusplus
extern "C" {
#endif
// Drivers participating in IOReporting can advertise channels by
// publishing properties in the I/O Kit registry. Various helper
// mechanisms exist to produce correctly-formatted legends.
// 12836893 tracks advertising channels in user space.
#define kIOReportLegendPublicKey "IOReportLegendPublic" // bool
#define kIOReportLegendKey "IOReportLegend" // arr
#define kIOReportLegendChannelsKey "IOReportChannels" // arr
#define kIOReportLegendGroupNameKey "IOReportGroupName" // str
#define kIOReportLegendSubGroupNameKey "IOReportSubGroupName" // str
#define kIOReportLegendInfoKey "IOReportChannelInfo" // dict
#define kIOReportLegendUnitKey "IOReportChannelUnit" // num
#define kIOReportLegendConfigKey "IOReportChannelConfig" // data
#define kIOReportLegendStateNamesKey "IOReportChannelStateNames" // str[]
// in an I/O Kit registry legend, a small "array struct" represents a channel
#define kIOReportChannelIDIdx 0 // required
#define kIOReportChannelTypeIdx 1 // required
#define kIOReportChannelNameIdx 2 // optional
/* Histogram Segment Configuration
* Currently supports 2 types of scaling to compute bucket upper bounds,
* linear or exponential.
* scale_flag = 0 -> linear scale
* 1 -> exponential scale
* upper_bound[n] = (scale_flag) ? pow(base,(n+1)) : base * (n+1);
*/
#define kIOHistogramScaleLinear 0
#define kIOHistogramScaleExponential 1
typedef struct {
uint32_t base_bucket_width;// segment[0].bucket[0] = [0, base_width]
uint32_t scale_flag; // bit 0 only in current use (see #defs)
uint32_t segment_idx; // for multiple segments histograms
uint32_t segment_bucket_count;// number of buckets in this segment
} __attribute((packed)) IOHistogramSegmentConfig;
// "normalized distribution"(FIXME?) internal format (unused?)
typedef struct {
uint64_t samples;
uint64_t mean;
uint64_t variance;
uint64_t reserved;
} __attribute((packed)) IONormDistReportValues;
#ifdef __cplusplus
}
#endif
#endif // _IOKERNELREPORTSTRUCTS_H_
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/DriverKit/IODispatchQueue.h | /* iig(DriverKit-191.30.2) generated from IODispatchQueue.iig */
/* IODispatchQueue.iig:1-54 */
/*
* Copyright (c) 2019-2019 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _IOKIT_UIODISPATCHQUEUE_H
#define _IOKIT_UIODISPATCHQUEUE_H
#include <DriverKit/OSObject.h> /* .iig include */
#include <DriverKit/OSAction.h> /* .iig include */
#include <DriverKit/IODispatchSource.h> /* .iig include */
typedef int (*IODispatchLogFunction)(const char *format, ...);
typedef void (^IODispatchBlock)(void);
typedef void (*IODispatchFunction)(void * context);
typedef kern_return_t (^IODispatchAction)(void);
typedef void (^IODispatchQueueCancelHandler)(void);
// options for Create()
enum {
kIODispatchQueueReentrant = 0x00000001,
kIODispatchQueueMethodsNotSynchronized = 0x00000002,
};
// options for WakeupWithOptions()
enum {
kIODispatchQueueWakeupAll = 0x00000001,
};
/* source class IODispatchQueue IODispatchQueue.iig:55-212 */
#if __DOCUMENTATION__
#define KERNEL IIG_KERNEL
/*!
* @class IODispatchQueue
*
* @abstract
* IODispatchQueue provides a queue for ordered execution of blocks.
*
* @discussion
* All blocks submitted to dispatch queues are dequeued in FIFO order.
* By default the queue is serial and will execute one block at a time.
*/
class NATIVE KERNEL IODispatchQueue : public OSObject
{
public:
/*!
* @brief Creates a new dispatch queue object.
* @discussion Creates a new dispatch queue object. All queues are currently serial, executing one block at time
* FIFO order. The new object has retain count 1 and should be released by the caller.
* @param options
kIODispatchQueueReentrant Creates a queue that allows release with the Sleep
method, so that other threads and callers may acquire the queue.
* @param priority No priorities are currently defined, pass zero.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
static kern_return_t
Create(
const IODispatchQueueName name,
uint64_t options,
uint64_t priority,
IODispatchQueue ** queue) LOCAL;
virtual bool
init() override;
virtual void
free() override;
/*!
* @brief Determines if the current thread is running on the queue.
* @discussion Determines if the current thread is running on the queue, including if the queue invoked a
* second queue (ie. OnQueue can return true for more than one queue in a given context.)
* @return bool true if current thread is running on this queue.
*/
bool
OnQueue() LOCALONLY;
/*!
* @brief Return the name the queue was created with.
* @discussion Returns a pointer to the queues name. Only valid while the queue is retained.
* @return C-string pointer in the queues internal storage.
*/
const char *
GetName() LOCALONLY;
/*!
* @brief Stop the queue from executing futher work.
* @discussion Stops the queue from dequeuing work, and on completion of any block currently being executed,
* invokes a callback block. Canceling is asynchronous.
* @param handler Block that will executed when the queue has completed any inflight work
* and will not execute further work.
* @return C-string pointer in the queues internal storage.
*/
kern_return_t
Cancel(IODispatchQueueCancelHandler handler) LOCALONLY;
/*!
* @brief Schedule a block to be executed on the queue asynchronously.
* @discussion Schedules work to be done on the queue without waiting for it to complete. The queue will be
* retained until the block completes.
* @param block Block that will executed on the queue, not in the context of the caller.
*/
void
DispatchAsync(IODispatchBlock block) LOCALONLY;
/*!
* @brief C-function callback version of DispatchAsync.
*/
void
DispatchAsync_f(void * context, IODispatchFunction function) LOCALONLY;
/*!
* @brief Schedule a block to be executed concurrently & asynchronously.
* @discussion Schedules work to be done on the queue without waiting for it to complete, and
* concurrently with other blocks executed with DispatchConcurrent. The queue will be
* retained until the block completes. May only be used with a queue created with
* the kIODispatchQueueReentrant option.
* @param block Block that will executed on the queue, not in the context of the caller.
*/
void
DispatchConcurrent(IODispatchBlock block) LOCALONLY;
/*!
* @brief C-function callback version of DispatchConcurrent.
*/
void
DispatchConcurrent_f(void * context, IODispatchFunction function) LOCALONLY;
/*!
* @brief Execute a block on the queue synchronously.
* @discussion Execute a block on the queue synchronously.
* @param block Block that will executed on the queue.
*/
void
DispatchSync(IODispatchBlock block) LOCALONLY;
/*!
* @brief C-function callback version of DispatchSync.
*/
void
DispatchSync_f(void * context, IODispatchFunction function) LOCALONLY;
/*!
* @brief Log the current execution context with respect to any queues the current thread holds.
* @param output printf like output function. The address of IOLog is suitable to be used.
*/
static void
Log(const char * message, IODispatchLogFunction output) LOCALONLY;
/*!
* @brief Version of DispatchSync that returns a kern_return_t status.
*/
kern_return_t
RunAction(IODispatchAction action) LOCALONLY;
/*!
* @brief Put a thread that is currently ruuning the queue to sleep, releasing the queue.
* @discussion Put a thread to sleep waiting for an event but release the queue first.
* In all cases (signal, timeout or error), the caller resumes running on the queue.
* The caller must be currently running on the queue to call Sleep().
* @param event A unique token matching one later passed to Wakeup().
* @param deadline Clock deadline to timeout the sleep.
* @return kIOReturnSuccess or kIOReturnTimeout
*/
kern_return_t
Sleep(void * event, uint64_t deadline) LOCALONLY;
/*!
* @brief Wakes a thread that is blocked in Sleep().
* @discussion Signals a thread that gave up the queue with Sleep() to continue running.
* The caller must be currently running on the queue.
* @param event A unique token matching one passed to Sleep().
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
kern_return_t
Wakeup(void * event) LOCALONLY;
/*!
* @brief Wakes a thread that is blocked in Sleep().
* @discussion Signals a thread that gave up the queue with Sleep() to continue running.
* The caller must be currently running on the queue.
* @param event A unique token matching one passed to Sleep().
* @param options
kIODispatchQueueWakeupAll wake all threads waiting in Sleep().
The default is to wake only one of any waiting threads.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
kern_return_t
WakeupWithOptions(void * event, uint64_t options) LOCALONLY;
};
#undef KERNEL
#else /* __DOCUMENTATION__ */
/* generated class IODispatchQueue IODispatchQueue.iig:55-212 */
#define IODispatchQueue_SetPort_ID 0xc437e970b5609767ULL
#define IODispatchQueue_Create_ID 0xac000428df2a91d0ULL
#define IODispatchQueue_SetPort_Args \
mach_port_t port
#define IODispatchQueue_Create_Args \
const char * name, \
uint64_t options, \
uint64_t priority, \
IODispatchQueue ** queue
#define IODispatchQueue_Methods \
\
public:\
\
virtual kern_return_t\
Dispatch(const IORPC rpc) APPLE_KEXT_OVERRIDE;\
\
static kern_return_t\
_Dispatch(IODispatchQueue * self, const IORPC rpc);\
\
kern_return_t\
SetPort(\
mach_port_t port,\
OSDispatchMethod supermethod = NULL);\
\
static kern_return_t\
Create(\
const IODispatchQueueName name,\
uint64_t options,\
uint64_t priority,\
IODispatchQueue ** queue);\
\
bool\
OnQueue(\
);\
\
const char *\
GetName(\
);\
\
kern_return_t\
Cancel(\
IODispatchQueueCancelHandler handler);\
\
void\
DispatchAsync(\
IODispatchBlock block);\
\
void\
DispatchAsync_f(\
void * context,\
IODispatchFunction function);\
\
void\
DispatchConcurrent(\
IODispatchBlock block);\
\
void\
DispatchConcurrent_f(\
void * context,\
IODispatchFunction function);\
\
void\
DispatchSync(\
IODispatchBlock block);\
\
void\
DispatchSync_f(\
void * context,\
IODispatchFunction function);\
\
static void\
Log(\
const char * message,\
IODispatchLogFunction output);\
\
kern_return_t\
RunAction(\
IODispatchAction action);\
\
kern_return_t\
Sleep(\
void * event,\
uint64_t deadline);\
\
kern_return_t\
Wakeup(\
void * event);\
\
kern_return_t\
WakeupWithOptions(\
void * event,\
uint64_t options);\
\
\
protected:\
/* _Impl methods */\
\
static kern_return_t\
Create_Call(IODispatchQueue_Create_Args);\
\
\
public:\
/* _Invoke methods */\
\
typedef kern_return_t (*SetPort_Handler)(OSMetaClassBase * target, IODispatchQueue_SetPort_Args);\
static kern_return_t\
SetPort_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
SetPort_Handler func);\
\
typedef kern_return_t (*Create_Handler)(IODispatchQueue_Create_Args);\
static kern_return_t\
Create_Invoke(const IORPC rpc,\
Create_Handler func);\
\
#define IODispatchQueue_KernelMethods \
\
protected:\
/* _Impl methods */\
\
kern_return_t\
SetPort_Impl(IODispatchQueue_SetPort_Args);\
\
static kern_return_t\
Create_Impl(IODispatchQueue_Create_Args);\
\
#define IODispatchQueue_VirtualMethods \
\
public:\
\
virtual bool\
init(\
) APPLE_KEXT_OVERRIDE;\
\
virtual void\
free(\
) APPLE_KEXT_OVERRIDE;\
\
class IODispatchQueueInterface : public OSInterface
{
public:
};
struct IODispatchQueue_IVars;
struct IODispatchQueue_LocalIVars;
class IODispatchQueue : public OSObject, public IODispatchQueueInterface
{
OSDeclareDefaultStructorsWithDispatch(IODispatchQueue);
public:
#ifdef IODispatchQueue_DECLARE_IVARS
IODispatchQueue_DECLARE_IVARS
#else /* IODispatchQueue_DECLARE_IVARS */
union
{
IODispatchQueue_IVars * ivars;
IODispatchQueue_LocalIVars * lvars;
};
#endif /* IODispatchQueue_DECLARE_IVARS */
using super = OSObject;
IODispatchQueue_VirtualMethods
};
#endif /* !__DOCUMENTATION__ */
/* IODispatchQueue.iig:214-215 */
#if DRIVERKIT_PRIVATE
/* IODispatchQueue.iig:222- */
#endif
#endif /* ! _IOKIT_UIODISPATCH_H */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/DriverKit/IOUserClient.h | /* iig(DriverKit-191.30.2) generated from IOUserClient.iig */
/* IOUserClient.iig:1-156 */
/*
* Copyright (c) 2019-2019 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#if !__IIG
#include <IOKit/IOUserClient.h>
#endif
#ifndef _IOKIT_UIOUSERCLIENT_H
#define _IOKIT_UIOUSERCLIENT_H
#include <DriverKit/OSAction.h> /* .iig include */
#include <DriverKit/IOService.h> /* .iig include */
#include <DriverKit/IOBufferMemoryDescriptor.h> /* .iig include */
enum {
kIOUserClientScalarArrayCountMax = 16,
};
typedef uint64_t IOUserClientScalarArray[kIOUserClientScalarArrayCountMax];
enum {
kIOUserClientAsyncReferenceCountMax = 16,
};
typedef uint64_t IOUserClientAsyncReferenceArray[kIOUserClientAsyncReferenceCountMax];
enum {
kIOUserClientAsyncArgumentsCountMax = 16,
};
typedef uint64_t IOUserClientAsyncArgumentsArray[kIOUserClientAsyncArgumentsCountMax];
// CopyClientMemoryForType options
enum {
kIOUserClientMemoryReadOnly = 0x00000001,
};
#define kIOUserClientQueueNameExternalMethod "IOUserClientQueueExternalMethod"
/*! @enum
* @abstract Constant to denote a variable length structure argument to IOUserClient.
* @constant kIOUserClientVariableStructureSize Use in the structures IOUserClientMethodDispatch to specify the size of the structure is variable.
*/
enum {
kIOUserClientVariableStructureSize = 0xffffffff
};
enum {
#define IO_USER_CLIENT_METHOD_ARGUMENTS_CURRENT_VERSION 2
kIOUserClientMethodArgumentsCurrentVersion = IO_USER_CLIENT_METHOD_ARGUMENTS_CURRENT_VERSION
};
/*!
* @struct IOUserClientMethodArguments
* @brief Holds arguments from IOKit.framework IOConnectMethod calls.
* @discussion Any argument may be passed as NULL if not passed by the caller.
* @field selector Selector argument to IOConnectMethod.
* @field scalarInput Array of scalars from caller.
* @field scalarInputCount Count of valid scalars in scalarInput.
* @field structureInput OSData object containing structure input from IOConnectMethod.
* @field structureInputDescriptor IOMemoryDescriptor containing structure input from IOConnectMethod.
* This parameter is only set for large structures, and if set structureInput will be NULL.
* @field scalarOutput Array of scalars to return to the caller.
* @field scalarOutputCount Count of scalars to return to the caller in scalarOutput.
* @field structureOutput An OSData to be returned to the caller as structure output.
* This field should be set by the driver to an OSData object it created with
* the data to be returned, and the OSData instance will be released by the OS.
* It is an error for the driver to set this field if structureOutputDescriptor was passed in
* @field structureOutputDescriptor A IOMemoryDescriptor specified by the caller for structure output.
* @field structureOutputMaximumSize Maximum size of structure output specified by caller
* or kIOUserClientVariableStructureSize.
* @field completion For IOConnectAsyncMethod, an OSAction used to deliver async data to the caller.
* It is only retained during the invocation of ExternalMethod and should be retained if
* used beyond then.
*/
struct IOUserClientMethodArguments {
uint64_t version;
uint64_t selector;
OSAction * completion;
const uint64_t * scalarInput;
uint32_t scalarInputCount;
OSData * structureInput;
IOMemoryDescriptor * structureInputDescriptor;
uint64_t * scalarOutput;
uint32_t scalarOutputCount;
OSData * structureOutput;
IOMemoryDescriptor * structureOutputDescriptor;
uint64_t structureOutputMaximumSize;
uint64_t __reserved[30];
};
typedef kern_return_t (*IOUserClientMethodFunction)(
OSObject * target,
void * reference,
IOUserClientMethodArguments * arguments);
/*!
* @struct IOUserClientMethodDispatch
* @brief Used to check fields in IOUserClientMethodArguments
* @field function to invoke after making the checks specified below. If NULL and all checks pass,
* kIOReturnNoCompletion will be returned for the caller to implement the method.
* @field checkCompletionExists
* if true completion field must be set,
* if false must be zero,
* if -1U don't care
* @field checkScalarInputCount
* if has value kIOUserClientVariableStructureSize don't care,
* otherwise must equal args->scalarInputCount
* @field checkStructureInputSize
* if has value kIOUserClientVariableStructureSize don't care,
* otherwise must equal length of structureInput or structureInputDescriptor
* @field checkScalarOutputCount
* if has value kIOUserClientVariableStructureSize don't care,
* otherwise must equal args->scalarOutputCount
* @field checkStructureOutputSize
* if has value kIOUserClientVariableStructureSize don't care,
* otherwise must equal length of structureOutputMaximumSize
*/
struct IOUserClientMethodDispatch {
IOUserClientMethodFunction function;
uint32_t checkCompletionExists;
uint32_t checkScalarInputCount;
uint32_t checkStructureInputSize;
uint32_t checkScalarOutputCount;
uint32_t checkStructureOutputSize;
};
/* source class IOUserClient IOUserClient.iig:157-300 */
#if __DOCUMENTATION__
#define KERNEL IIG_KERNEL
/*!
* @class IOUserClient
*
* @abstract
* IOUserClient represents a connection opened by IOServiceOpen in the IOKit.framework.
*
* @discussion
* An application may open an IOUserClient by calling IOServiceOpen(). This results in a call
* to the IOService::NewUserClient API to create an instance representing the connection.
* and to receive untyped data via IOConnectMethod/IOConnectAsyncMethod.
* As an IOService subclass, IOUserClient receives the normal Start()/Stop() lifecyle calls.
*
*/
class KERNEL IOUserClient : public IOService
{
public:
virtual bool
init() override;
virtual void
free() override;
/*!
* @brief Receive arguments from IOKit.framework IOConnectMethod calls.
* @discussion IOConnectMethod calls from the owner of the connection come here.
* Any argument may be passed as NULL if not passed by the caller.
* The method runs on a queue set by IOService::SetDispatchQueuue()
* with the name kIOUserClientQueueNameExternalMethod, or the default
* queue for the IOUserClient object if one was not set.
* @param selector Selector argument to IOConnectMethod.
* @param arguments Structure describing all arguments being passed to IOConnectMethod.
* See the IOUserClientMethodArguments definition.
* @param dispatch NULL when called in the driver. The IOUserClient::ExternalMethod()
* implementation may be called with a non-NULL argument to check
* certain fields of the arguments structure before calling a target procedure
* specified by the dispatch structure 'function' field, and the
* 'target' and 'reference' parameters to this method.
* See the IOUserClientMethodDispatch definition.
* @param target Target for the dispatch function
* @param reference Reference constant for the dispatch function
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
ExternalMethod(
uint64_t selector,
IOUserClientMethodArguments * arguments,
const IOUserClientMethodDispatch * dispatch,
OSObject * target,
void * reference) LOCALONLY
QUEUENAME(IOUserClientQueueExternalMethod);
/*!
* @brief Send asynchronous arguments to a completion supplied by ExternalMethod().
* @discussion IOConnectAsyncMethod calls from the owner of the connection come will pass an OSAction instance.
* To deliver the asynchronous results the driver calls AsyncCompletion().
* @param action OSAction passed to IOExternalMethod().
* @param status An IOReturn status value to be sent.
* @param asyncData An array of scalar data to be sent.
* @param asyncDataCount Count of valid data in asyncData.
*/
virtual void
AsyncCompletion(
OSAction * action TARGET,
IOReturn status,
const IOUserClientAsyncArgumentsArray asyncData,
uint32_t asyncDataCount) = 0;
/*!
* @brief Return an IOMemoryDescriptor to be mapped into the client task.
* @discussion IOConnectMapMemory()/UnmapMemory() will result in a call to this method to obtain
* an IOMemoryDescriptor instance for shared memory. For a given IOUserClient instance, calling
* CopyClientMemoryForType() with a given type, should return the same IOMemoryDescriptor instance.
* @param type Type parameter IOConnectMapMemory()/UnmapMemory().
* @param options Set kIOUserClientMemoryReadOnly for memory to be mapped read only in the client.
* @param memory An instance of IOMemoryDescriptor on success. One reference will be consumed by the caller
* of this method.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
CopyClientMemoryForType(
uint64_t type,
uint64_t * options,
IOMemoryDescriptor ** memory) = 0;
/*!
* @brief Create a memory descriptor that describes a set of virtual ranges in
* the client task of the user client.
* @param memoryDescriptorCreateOptions
* kIOMemoryDirectionIn memory described will be writable
* kIOMemoryDirectionOut memory described will be readable
* @param segmentsCount Number of valid address ranges being passed
* in the segments array.
* @param segments Array of address ranges.
* @param memory Returned IOMemoryDescriptor object with +1 retain count.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
CreateMemoryDescriptorFromClient(
uint64_t memoryDescriptorCreateOptions,
uint32_t segmentsCount,
const IOAddressSegment segments[32],
IOMemoryDescriptor ** memory) __attribute__((availability(driverkit,introduced=20.0)));
/*!
* @function CopyClientEntitlements
* @abstract Return owning task's entitlements dictionary.
* @param entitlements Dictionary of entitlements given to the owning task. To be released by caller.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
CopyClientEntitlements(OSDictionary ** entitlements) LOCAL;
private:
virtual kern_return_t
_ExternalMethod(
uint64_t selector,
const IOUserClientScalarArray scalarInput,
uint32_t scalarInputCount,
OSData * structureInput,
IOMemoryDescriptor * structureInputDescriptor,
IOUserClientScalarArray scalarOutput,
uint32_t * scalarOutputCount,
uint64_t structureOutputMaximumSize,
OSData ** structureOutput,
IOMemoryDescriptor * structureOutputDescriptor,
OSAction * completion TYPE(IOUserClient::AsyncCompletion)) LOCAL
QUEUENAME(IOUserClientQueueExternalMethod);
virtual void
KernelCompletion(
OSAction * action TARGET,
IOReturn status,
const IOUserClientAsyncArgumentsArray asyncData,
uint32_t asyncDataCount)
KERNEL
TYPE(IOUserClient::AsyncCompletion);
};
#undef KERNEL
#else /* __DOCUMENTATION__ */
/* generated class IOUserClient IOUserClient.iig:157-300 */
#define IOUserClient_AsyncCompletion_ID 0xdbc5b2e5d2b446f4ULL
#define IOUserClient_CopyClientMemoryForType_ID 0x8399bdb3d0b4f474ULL
#define IOUserClient_CreateMemoryDescriptorFromClient_ID 0xf2fa2faa5cc11191ULL
#define IOUserClient_CopyClientEntitlements_ID 0xcaf3bd8932c8486fULL
#define IOUserClient__ExternalMethod_ID 0xcfe0c99e739d92f9ULL
#define IOUserClient_KernelCompletion_ID 0xf609f134c9046444ULL
#define IOUserClient_AsyncCompletion_Args \
OSAction * action, \
IOReturn status, \
const unsigned long long * asyncData, \
uint32_t asyncDataCount
#define IOUserClient_CopyClientMemoryForType_Args \
uint64_t type, \
uint64_t * options, \
IOMemoryDescriptor ** memory
#define IOUserClient_CreateMemoryDescriptorFromClient_Args \
uint64_t memoryDescriptorCreateOptions, \
uint32_t segmentsCount, \
const IOAddressSegment * segments, \
IOMemoryDescriptor ** memory
#define IOUserClient_CopyClientEntitlements_Args \
OSDictionary ** entitlements
#define IOUserClient__ExternalMethod_Args \
uint64_t selector, \
const unsigned long long * scalarInput, \
uint32_t scalarInputCount, \
OSData * structureInput, \
IOMemoryDescriptor * structureInputDescriptor, \
unsigned long long * scalarOutput, \
uint32_t * scalarOutputCount, \
uint64_t structureOutputMaximumSize, \
OSData ** structureOutput, \
IOMemoryDescriptor * structureOutputDescriptor, \
OSAction * completion
#define IOUserClient_KernelCompletion_Args \
OSAction * action, \
IOReturn status, \
const unsigned long long * asyncData, \
uint32_t asyncDataCount
#define IOUserClient_Methods \
\
public:\
\
virtual kern_return_t\
Dispatch(const IORPC rpc) APPLE_KEXT_OVERRIDE;\
\
static kern_return_t\
_Dispatch(IOUserClient * self, const IORPC rpc);\
\
void\
AsyncCompletion(\
OSAction * action,\
IOReturn status,\
const IOUserClientAsyncArgumentsArray asyncData,\
uint32_t asyncDataCount,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
CopyClientMemoryForType(\
uint64_t type,\
uint64_t * options,\
IOMemoryDescriptor ** memory,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
CreateMemoryDescriptorFromClient(\
uint64_t memoryDescriptorCreateOptions,\
uint32_t segmentsCount,\
const IOAddressSegment * segments,\
IOMemoryDescriptor ** memory,\
OSDispatchMethod supermethod = NULL) __attribute__((availability(driverkit,introduced=20.0)));\
\
kern_return_t\
CopyClientEntitlements(\
OSDictionary ** entitlements,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
_ExternalMethod(\
uint64_t selector,\
const IOUserClientScalarArray scalarInput,\
uint32_t scalarInputCount,\
OSData * structureInput,\
IOMemoryDescriptor * structureInputDescriptor,\
IOUserClientScalarArray scalarOutput,\
uint32_t * scalarOutputCount,\
uint64_t structureOutputMaximumSize,\
OSData ** structureOutput,\
IOMemoryDescriptor * structureOutputDescriptor,\
OSAction * completion,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
CreateActionKernelCompletion(size_t referenceSize, OSAction ** action);\
\
\
protected:\
/* _Impl methods */\
\
kern_return_t\
CopyClientEntitlements_Impl(IOUserClient_CopyClientEntitlements_Args);\
\
kern_return_t\
_ExternalMethod_Impl(IOUserClient__ExternalMethod_Args);\
\
\
public:\
/* _Invoke methods */\
\
typedef void (*AsyncCompletion_Handler)(OSMetaClassBase * target, IOUserClient_AsyncCompletion_Args);\
static kern_return_t\
AsyncCompletion_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
AsyncCompletion_Handler func,\
const OSMetaClass * targetActionClass);\
\
static kern_return_t\
AsyncCompletion_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
AsyncCompletion_Handler func);\
\
typedef kern_return_t (*CopyClientMemoryForType_Handler)(OSMetaClassBase * target, IOUserClient_CopyClientMemoryForType_Args);\
static kern_return_t\
CopyClientMemoryForType_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
CopyClientMemoryForType_Handler func);\
\
typedef kern_return_t (*CreateMemoryDescriptorFromClient_Handler)(OSMetaClassBase * target, IOUserClient_CreateMemoryDescriptorFromClient_Args);\
static kern_return_t\
CreateMemoryDescriptorFromClient_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
CreateMemoryDescriptorFromClient_Handler func);\
\
typedef kern_return_t (*CopyClientEntitlements_Handler)(OSMetaClassBase * target, IOUserClient_CopyClientEntitlements_Args);\
static kern_return_t\
CopyClientEntitlements_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
CopyClientEntitlements_Handler func);\
\
typedef kern_return_t (*_ExternalMethod_Handler)(OSMetaClassBase * target, IOUserClient__ExternalMethod_Args);\
static kern_return_t\
_ExternalMethod_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
_ExternalMethod_Handler func);\
\
#define IOUserClient_KernelMethods \
\
protected:\
/* _Impl methods */\
\
kern_return_t\
CreateMemoryDescriptorFromClient_Impl(IOUserClient_CreateMemoryDescriptorFromClient_Args);\
\
void\
KernelCompletion_Impl(IOUserClient_KernelCompletion_Args);\
\
#define IOUserClient_VirtualMethods \
\
public:\
\
virtual bool\
init(\
) APPLE_KEXT_OVERRIDE;\
\
virtual void\
free(\
) APPLE_KEXT_OVERRIDE;\
\
virtual kern_return_t\
ExternalMethod(\
uint64_t selector,\
IOUserClientMethodArguments * arguments,\
const IOUserClientMethodDispatch * dispatch,\
OSObject * target,\
void * reference) APPLE_KEXT_OVERRIDE;\
\
#define OSAction_IOUserClient_KernelCompletion_Methods \
\
public:\
\
virtual kern_return_t\
Dispatch(const IORPC rpc) APPLE_KEXT_OVERRIDE;\
\
static kern_return_t\
_Dispatch(OSAction_IOUserClient_KernelCompletion * self, const IORPC rpc);\
\
\
protected:\
/* _Impl methods */\
\
\
public:\
/* _Invoke methods */\
\
#define OSAction_IOUserClient_KernelCompletion_KernelMethods \
\
protected:\
/* _Impl methods */\
\
#define OSAction_IOUserClient_KernelCompletion_VirtualMethods \
\
public:\
\
class OSAction_IOUserClient_KernelCompletionInterface : public OSInterface
{
public:
};
struct OSAction_IOUserClient_KernelCompletion_IVars;
struct OSAction_IOUserClient_KernelCompletion_LocalIVars;
class __attribute__((availability(driverkit,introduced=20,message="Type-safe OSAction factory methods are available in DriverKit 20 and newer"))) OSAction_IOUserClient_KernelCompletion : public OSAction, public OSAction_IOUserClient_KernelCompletionInterface
{
OSDeclareDefaultStructorsWithDispatch(OSAction_IOUserClient_KernelCompletion);
public:
#ifdef OSAction_IOUserClient_KernelCompletion_DECLARE_IVARS
OSAction_IOUserClient_KernelCompletion_DECLARE_IVARS
#else /* OSAction_IOUserClient_KernelCompletion_DECLARE_IVARS */
union
{
OSAction_IOUserClient_KernelCompletion_IVars * ivars;
OSAction_IOUserClient_KernelCompletion_LocalIVars * lvars;
};
#endif /* OSAction_IOUserClient_KernelCompletion_DECLARE_IVARS */
using super = OSAction;
OSAction_IOUserClient_KernelCompletion_VirtualMethods
};
#endif /* !__DOCUMENTATION__ */
/* IOUserClient.iig:302- */
#endif /* ! _IOKIT_UIOUSERCLIENT_H */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/DriverKit/IOReportTypes.h | /*
* Copyright (c) 2012-2014 Apple Computer, Inc. All Rights Reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _IOREPORT_TYPES_H_
#define _IOREPORT_TYPES_H_
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#define IOR_VALUES_PER_ELEMENT 4
/*! @const kIOReportInvalidValue
* @const kIOReportInvalidIntValue
* @abstract cardinal value used to indicate data errors
*
* @discussion
* kIOReportInvalidValue and kIOReportInvalidIntValue have the
* same bit pattern so that clients checking for one or the other
* don't have to worry about getting the signedness right.
*/
#define kIOReportInvalidIntValue INT64_MIN
#define kIOReportInvalidValue (uint64_t)kIOReportInvalidIntValue
/*! @typedef IOReportCategories
* @abstract encapsulate important, multi-purpose "tags" for channels
*
* @discussion
* IOReportCategories is the type for the .categories field of
* IOReportChanelType. These categories are inteded to empower a
* limited number of clients to retrieve a broad range of channels
* without knowing much about them. They can be OR'd together as
* needed. Groups and subgroups are a more extensible mechanism
* for aggregating channels produced by different drivers.
*/
typedef uint16_t IOReportCategories;
#define kIOReportCategoryPower (1 << 1) // and energy
#define kIOReportCategoryTraffic (1 << 2) // I/O at any level
#define kIOReportCategoryPerformance (1 << 3) // e.g. cycles/byte
#define kIOReportCategoryPeripheral (1 << 4) // not built-in
#define kIOReportCategoryField (1 << 8) // consider logging
// future categories TBD
#define kIOReportCategoryDebug (1 << 15)
#define kIOReportInvalidCategory UINT16_MAX
// IOReportChannelType.report_format
typedef uint8_t IOReportFormat;
enum {
kIOReportInvalidFormat = 0,
kIOReportFormatSimple = 1,
kIOReportFormatState = 2,
kIOReportFormatHistogram = 3,
kIOReportFormatSimpleArray = 4
};
// simple report values
typedef struct {
int64_t simple_value;
uint64_t reserved1;
uint64_t reserved2;
uint64_t reserved3;
} __attribute((packed)) IOSimpleReportValues;
// simple value array
typedef struct {
int64_t simple_values[IOR_VALUES_PER_ELEMENT];
} __attribute((packed)) IOSimpleArrayReportValues;
// state report values
typedef struct {
uint64_t state_id; // 0..N-1 or 8-char code (see MAKEID())
uint64_t intransitions; // number of transitions into this state
uint64_t upticks; // ticks spent in state (local timebase)
uint64_t last_intransition;// ticks at last in-transition
} __attribute((packed)) IOStateReportValues;
// histogram report values
typedef struct {
uint64_t bucket_hits;
int64_t bucket_min;
int64_t bucket_max;
int64_t bucket_sum;
} __attribute((packed)) IOHistogramReportValues;
// configuration actions generally change future behavior
typedef uint32_t IOReportConfigureAction;
enum {
// basics (in common operational order)
kIOReportEnable = 0x01,
kIOReportGetDimensions = 0x02,
kIOReportDisable = 0x00,
// Enable/disable modifiers
kIOReportNotifyHubOnChange = 0x10, // triggered polling
kIOReportTraceOnChange = 0x20 // kdebug.h tracing
};
// update actions should not have observable side effects
typedef uint32_t IOReportUpdateAction;
enum {
kIOReportCopyChannelData = 1,
kIOReportTraceChannelData = 2
};
typedef struct {
uint8_t report_format; // Histogram, StateResidency, etc.
uint8_t reserved; // must be zero
uint16_t categories; // power, traffic, etc (omnibus obs.)
uint16_t nelements; // internal size of channel
// only meaningful in the data pipeline
int16_t element_idx; // 0..nelements-1
// -1..-(nelements) = invalid (13127884)
} __attribute((packed)) IOReportChannelType;
/*!
* @define IOREPORT_MAKECHID
* @abstract convert up to 8 printable characters into a 64-bit channel ID
* @param <char0..char7> - printable chars to be packed into a channel ID
* @result a 64-bit channel ID with an implicit ASCII name
* @discussion A simple example:
* IOREPORT_MAKECHID('H', 'i', ' ', 'w', 'o', 'r', 'l', 'd');
* will evaluate to 0x686920776f726c64. Any NUL bytes are
* ignored (by libIOReport) for naming purposes, but will
* appear in the channel ID. Using a non-NUL non-printable
* character will disable the implicit name. Putting NUL
* bytes first eliminates trailing zeros when the channel
* ID is printed as hex. For example:
* IORERPORT_MAKECHID('\0','\0','n','x','f','e','r','s');
* To see the text, use xxd -r -p # not -rp; see 12976241
*/
#define __IOR_lshiftchr(c, chshift) ((uint64_t)(c) << (8*(chshift)))
#define IOREPORT_MAKEID(A, B, C, D, E, F, G, H) \
(__IOR_lshiftchr(A, 7) | __IOR_lshiftchr(B, 6) | __IOR_lshiftchr(C, 5) \
| __IOR_lshiftchr(D, 4) | __IOR_lshiftchr(E, 3) | __IOR_lshiftchr(F, 2) \
| __IOR_lshiftchr(G, 1) | __IOR_lshiftchr(H, 0))
typedef struct {
uint64_t channel_id;
IOReportChannelType channel_type;
} IOReportChannel;
typedef struct {
uint32_t nchannels;
IOReportChannel channels[];
} IOReportChannelList;
typedef struct {
uint64_t provider_id;
IOReportChannel channel;
} IOReportInterest;
typedef struct {
uint32_t ninterests;
IOReportInterest interests[];
} IOReportInterestList;
typedef struct {
uint64_t v[IOR_VALUES_PER_ELEMENT];
} __attribute((packed)) IOReportElementValues;
typedef struct {
uint64_t provider_id;
uint64_t channel_id;
IOReportChannelType channel_type;
uint64_t timestamp;// mach_absolute_time()
IOReportElementValues values;
} __attribute((packed)) IOReportElement;
/*
* IOReporting unit type and constants
*/
// 1. Mechanism
// Assume encoded units could be stored in binary format: don't
// change existing values.
typedef uint64_t IOReportUnit;
typedef uint64_t IOReportUnits; // deprecated typo, please switch
#define __IOR_MAKEUNIT(quantity, scale) \
(((IOReportUnit)quantity << 56) | (uint64_t)scale)
#define IOREPORT_GETUNIT_QUANTITY(unit) \
((IOReportQuantity)((uint64_t)unit >> 56) & 0xff)
#define IOREPORT_GETUNIT_SCALE(unit) \
((IOReportScaleFactor)unit & 0x00ffffffffffffff)
// 8b quantity ID | 32b const val + 8b*2^10 + 8b*2^n | 8b cardinal | 8b unused
typedef uint8_t IOReportQuantity; // SI "quantity" is what's measured
typedef uint64_t IOReportScaleFactor;
// See <http://en.wikipedia.org/wiki/SI_base_unit> for a list
// of quantities and their symbols.
enum {
// used by state reports, etc
kIOReportQuantityUndefined = 0,
kIOReportQuantityTime = 1,// Seconds
kIOReportQuantityPower = 2,// Watts
kIOReportQuantityEnergy = 3,// Joules
kIOReportQuantityCurrent = 4,// Amperes
kIOReportQuantityVoltage = 5,// Volts
kIOReportQuantityCapacitance = 6,// Farad
kIOReportQuantityInductance = 7,// Henry
kIOReportQuantityFrequency = 8,// Hertz
kIOReportQuantityData = 9,// bits/bytes (see scale)
kIOReportQuantityTemperature = 10,// Celsius (not Kelvin :)
kIOReportQuantityEventCount = 100,
kIOReportQuantityPacketCount = 101,
kIOReportQuantityCPUInstrs = 102
};
/* A number of units end up with both IEC (2^n) and SI (10^n) scale factors.
* For example, the "MB" of a 1.44 MB floppy or a 1024MHz clock. We
* thus support separate 2^n and 10^n factors. The exponent encoding
* scheme is modeled loosely on single-precision IEEE 754.
*/
#define kIOReportScaleConstMask 0x000000007fffffff // constant ("uint31")
#define kIOReportScaleOneOver (1LL << 31) // 1/constant
#define kIOReportExpBase (-127) // support base^(-n)
#define kIOReportExpZeroOffset -(kIOReportExpBase) // max exponent = 128
#define kIOReportScaleSIShift 32 // * 10^n
#define kIOReportScaleSIMask 0x000000ff00000000
#define kIOReportScaleIECShift 40 // * 2^n
#define kIOReportScaleIECMask 0x0000ff0000000000
#define kIOReportCardinalShift 48 // placeholders
#define kIOReportCardinalMask 0x00ff000000000000
/*
* Scales are described as a factor times unity:
* 1ms = kIOReportScaleMilli * s
*
* A value expressed in a scaled unit can be scaled to unity via
* multiplication by the constant:
* 100ms * kIOReportScaleMilli [1e-3] = 0.1s.
*/
// SI / decimal
#define kIOReportScalePico ((-12LL + kIOReportExpZeroOffset) \
<< kIOReportScaleSIShift)
#define kIOReportScaleNano ((-9LL + kIOReportExpZeroOffset) \
<< kIOReportScaleSIShift)
#define kIOReportScaleMicro ((-6LL + kIOReportExpZeroOffset) \
<< kIOReportScaleSIShift)
#define kIOReportScaleMilli ((-3LL + kIOReportExpZeroOffset) \
<< kIOReportScaleSIShift)
#define kIOReportScaleUnity 0 // 10^0 = 2^0 = 1
// unity = 0 is a special case for which we give up exp = -127
#define kIOReportScaleKilo ((3LL + kIOReportExpZeroOffset) \
<< kIOReportScaleSIShift)
#define kIOReportScaleMega ((6LL + kIOReportExpZeroOffset) \
<< kIOReportScaleSIShift)
#define kIOReportScaleGiga ((9LL + kIOReportExpZeroOffset) \
<< kIOReportScaleSIShift)
#define kIOReportScaleTera ((12LL + kIOReportExpZeroOffset) \
<< kIOReportScaleSIShift)
// IEC / computer / binary
// It's not clear we'll ever use 2^(-n), but 1..2^~120 should suffice.
#define kIOReportScaleBits kIOReportScaleUnity
#define kIOReportScaleBytes ((3LL + kIOReportExpZeroOffset) \
<< kIOReportScaleIECShift)
// (bytes have to be added to the exponents up front, can't just OR in)
#define kIOReportScaleKibi ((10LL + kIOReportExpZeroOffset) \
<< kIOReportScaleIECShift)
#define kIOReportScaleKiBytes ((13LL + kIOReportExpZeroOffset) \
<< kIOReportScaleIECShift)
#define kIOReportScaleMebi ((20LL + kIOReportExpZeroOffset) \
<< kIOReportScaleIECShift)
#define kIOReportScaleMiBytes ((23LL + kIOReportExpZeroOffset) \
<< kIOReportScaleIECShift)
#define kIOReportScaleGibi ((30LL + kIOReportExpZeroOffset) \
<< kIOReportScaleIECShift)
#define kIOReportScaleGiBytes ((33LL + kIOReportExpZeroOffset) \
<< kIOReportScaleIECShift)
#define kIOReportScaleTebi ((40LL + kIOReportExpZeroOffset) \
<< kIOReportScaleIECShift)
#define kIOReportScaleTiBytes ((43LL + kIOReportExpZeroOffset) \
<< kIOReportScaleIECShift)
// can't encode more than 2^125 (keeping bits & bytes inside -126..128)
// Also, IOReportScaleValue() is currently limited internally by uint64_t.
// Cardinal values, to be filled in appropriately.
// Add values in increasing order.
#define kIOReportScaleMachHWTicks (1LL << kIOReportCardinalShift)
#define kIOReportScaleHWPageSize (2LL << kIOReportCardinalShift)
// page scales: 2 pages * 4ikB/page = 8096 bytes
#define kIOReportScale4KiB (4 | kIOReportScaleKiBytes)
#define kIOReportScale8KiB (8 | kIOReportScaleKiBytes)
#define kIOReportScale16KiB (16 | kIOReportScaleKiBytes)
// Clock frequency scales (units add seconds).
// 1 GHz ticks are 1 ns: 1000 ticks * 1e-6 = 1e-3s
// This '1' is a no-op for scaling, but allows a custom label.
#define kIOReportScale1GHz (1 | kIOReportScaleNano)
// 24MHz ticks are 1/24 of a microsecond: (1/24 * kIOReportScaleMicro [1e-6])s
// So for example, 240 24Mticks * 1/24 * 1e-6 = .00001s [1e-5]s
#define kIOReportScale24MHz (kIOReportScaleOneOver|24 |kIOReportScaleMicro)
// --- END: units mechanism
// 2. Unit constants
#define kIOReportUnitNone __IOR_MAKEUNIT(kIOReportQuantityUndefined, \
kIOReportScaleUnity)
#define kIOReportUnit_s __IOR_MAKEUNIT(kIOReportQuantityTime, \
kIOReportScaleUnity)
#define kIOReportUnit_ms __IOR_MAKEUNIT(kIOReportQuantityTime, \
kIOReportScaleMilli)
#define kIOReportUnit_us __IOR_MAKEUNIT(kIOReportQuantityTime, \
kIOReportScaleMicro)
#define kIOReportUnit_ns __IOR_MAKEUNIT(kIOReportQuantityTime, \
kIOReportScaleNano)
#define kIOReportUnit_J __IOR_MAKEUNIT(kIOReportQuantityEnergy, \
kIOReportScaleUnity)
#define kIOReportUnit_mJ __IOR_MAKEUNIT(kIOReportQuantityEnergy, \
kIOReportScaleMilli)
#define kIOReportUnit_uJ __IOR_MAKEUNIT(kIOReportQuantityEnergy, \
kIOReportScaleMicro)
#define kIOReportUnit_nJ __IOR_MAKEUNIT(kIOReportQuantityEnergy, \
kIOReportScaleNano)
#define kIOReportUnit_pJ __IOR_MAKEUNIT(kIOReportQuantityEnergy, \
kIOReportScalePico)
#define kIOReportUnitHWTicks __IOR_MAKEUNIT(kIOReportQuantityTime, \
kIOReportScaleMachHWTicks)
#define kIOReportUnit24MHzTicks __IOR_MAKEUNIT(kIOReportQuantityTime, \
kIOReportScale24MHz)
#define kIOReportUnit1GHzTicks __IOR_MAKEUNIT(kIOReportQuantityTime, \
kIOReportScale1GHz)
#define kIOReportUnitBits __IOR_MAKEUNIT(kIOReportQuantityData, \
kIOReportScaleBits)
#define kIOReportUnitBytes __IOR_MAKEUNIT(kIOReportQuantityData, \
kIOReportScaleBytes)
#define kIOReportUnit_KiB __IOR_MAKEUNIT(kIOReportQuantityData, \
kIOReportScaleKiBytes)
#define kIOReportUnit_MiB __IOR_MAKEUNIT(kIOReportQuantityData, \
kIOReportScaleMiBytes)
#define kIOReportUnit_GiB __IOR_MAKEUNIT(kIOReportQuantityData, \
kIOReportScaleGiBytes)
#define kIOReportUnit_TiB __IOR_MAKEUNIT(kIOReportQuantityData, \
kIOReportScaleTiBytes)
#define kIOReportUnitEvents __IOR_MAKEUNIT(kIOReportQuantityEventCount, \
kIOReportScaleUnity)
#define kIOReportUnitPackets __IOR_MAKEUNIT(kIOReportQuantityPacketCount, \
kIOReportScaleUnity)
#define kIOReportUnitInstrs __IOR_MAKEUNIT(kIOReportQuantityCPUInstrs, \
kIOReportScaleUnity)
#define kIOReportUnit_KI __IOR_MAKEUNIT(kIOReportQuantityCPUInstrs, \
kIOReportScaleKilo)
#define kIOReportUnit_MI __IOR_MAKEUNIT(kIOReportQuantityCPUInstrs, \
kIOReportScaleMega)
#define kIOReportUnit_GI __IOR_MAKEUNIT(kIOReportQuantityCPUInstrs, \
kIOReportScaleGiga)
// Please file bugs (xnu | IOReporting) for additional units.
// --- END: unit constants
#ifdef __cplusplus
}
#endif
#endif // _IOREPORT_TYPES_H_
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/DriverKit/IORPC.h | /*
* Copyright (c) 2018 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _IORPC_H
#define _IORPC_H
#include <stdint.h>
#include <mach/message.h>
class IOUserServer;
typedef uint64_t OSObjectRef;
enum {
kIORPCVersion190615 = (mach_msg_id_t) 0x4da2b68c,
kIORPCVersion190615Reply = (mach_msg_id_t) 0x4da2b68d,
#if DRIVERKIT_PRIVATE
kIORPCVersion190501 = (mach_msg_id_t) 0xfe316a7a,
kIORPCVersion190501Reply = (mach_msg_id_t) 0xfe316a7b,
kIORPCVersionCurrent = kIORPCVersion190615,
kIORPCVersionCurrentReply = kIORPCVersion190615Reply
#endif /* DRIVERKIT_PRIVATE */
};
enum{
kIORPCMessageRemote = 0x00000001,
kIORPCMessageLocalHost = 0x00000002,
kIORPCMessageKernel = 0x00000004,
kIORPCMessageOneway = 0x00000008,
kIORPCMessageObjectRefs = 0x00000010,
kIORPCMessageOnqueue = 0x00000020,
kIORPCMessageError = 0x00000040,
kIORPCMessageSimpleReply = 0x00000080,
};
enum{
kIORPCMessageIDKernel = (1ULL << 63),
};
struct IORPCMessageMach {
mach_msg_header_t msgh;
mach_msg_body_t msgh_body;
mach_msg_port_descriptor_t objects[0];
};
typedef struct IORPCMessageMach IORPCMessageMach;
struct IORPCMessage {
uint64_t msgid;
uint64_t flags;
uint64_t objectRefs;
OSObjectRef objects[0];
};
typedef struct IORPCMessage IORPCMessage;
#if defined(__cplusplus)
extern "C"
#else
extern
#endif
IORPCMessage *
IORPCMessageFromMach(IORPCMessageMach * msg, bool reply);
struct IORPCMessageErrorReturnContent {
IORPCMessage hdr;
kern_return_t result;
uint32_t pad;
};
typedef struct IORPCMessageErrorReturnContent IORPCMessageErrorReturnContent;
#pragma pack(4)
struct IORPCMessageErrorReturn {
IORPCMessageMach mach;
IORPCMessageErrorReturnContent content;
};
#pragma pack()
#if defined(__cplusplus)
class OSMetaClassBase;
struct IORPC;
typedef kern_return_t (*OSDispatchMethod)(OSMetaClassBase * self, const IORPC rpc);
#endif
struct IORPC {
IORPCMessageMach * message;
IORPCMessageMach * reply;
uint32_t sendSize;
uint32_t replySize;
};
typedef struct IORPC IORPC;
enum {
kOSClassCanRemote = 0x00000001,
};
struct OSClassDescription {
uint32_t descriptionSize;
char name[96];
char superName[96];
uint32_t methodOptionsSize;
uint32_t methodOptionsOffset;
uint32_t metaMethodOptionsSize;
uint32_t metaMethodOptionsOffset;
uint32_t queueNamesSize;
uint32_t queueNamesOffset;
uint32_t methodNamesSize;
uint32_t methodNamesOffset;
uint32_t metaMethodNamesSize;
uint32_t metaMethodNamesOffset;
uint64_t flags;
uint64_t resv1[8];
uint64_t methodOptions[0];
uint64_t metaMethodOptions[0];
char dispatchNames[0];
char methodNames[0];
char metaMethodNames[0];
};
#endif /* _IORPC_H */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/DriverKit/bounded_array.h | //
// Copyright (c) 2019 Apple, Inc. All rights reserved.
//
// @APPLE_OSREFERENCE_LICENSE_HEADER_START@
//
// This file contains Original Code and/or Modifications of Original Code
// as defined in and that are subject to the Apple Public Source License
// Version 2.0 (the 'License'). You may not use this file except in
// compliance with the License. The rights granted to you under the License
// may not be used to create, or enable the creation or redistribution of,
// unlawful or unlicensed copies of an Apple operating system, or to
// circumvent, violate, or enable the circumvention or violation of, any
// terms of an Apple operating system software license agreement.
//
// Please obtain a copy of the License at
// http://www.opensource.apple.com/apsl/ and read it before using this file.
//
// The Original Code and all software distributed under the License are
// distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
// EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
// INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
// Please see the License for the specific language governing rights and
// limitations under the License.
//
// @APPLE_OSREFERENCE_LICENSE_HEADER_END@
//
#ifndef XNU_LIBKERN_LIBKERN_CXX_BOUNDED_ARRAY_H
#define XNU_LIBKERN_LIBKERN_CXX_BOUNDED_ARRAY_H
#if !TAPI
#if DRIVERKIT_FRAMEWORK_INCLUDE
#include <DriverKit/bounded_ptr.h>
#else
#include <libkern/c++/bounded_ptr.h>
#endif /* DRIVERKIT_FRAMEWORK_INCLUDE */
#include <stddef.h>
#include <os/base.h>
namespace libkern {
// `bounded_array` is a simple abstraction for a C-style array.
//
// Unlike C-style arrays, however, it ensures that the array is not accessed
// outside of its bounds. Furthermore, the iterators of the `bounded_array`
// are `bounded_ptr`, which track the range they're allowed to access.
//
// TODO:
// - Should we provide deep comparison operators?
// - Document individual methods
template <typename T, size_t N, typename TrappingPolicy>
struct bounded_array {
// DO NOT USE THIS MEMBER DIRECTLY OR WE WILL BREAK YOUR CODE IN THE FUTURE.
// THIS HAS TO BE PUBLIC FOR THIS TYPE TO SUPPORT AGGREGATE-INITIALIZATION.
T data_[N];
using iterator = bounded_ptr<T, TrappingPolicy>;
using const_iterator = bounded_ptr<T const, TrappingPolicy>;
iterator
begin() noexcept
{
return iterator(data_, data_, data_ + N);
}
const_iterator
begin() const noexcept
{
return const_iterator(data_, data_, data_ + N);
}
iterator
end() noexcept
{
return iterator(data_ + N, data_, data_ + N);
}
const_iterator
end() const noexcept
{
return const_iterator(data_ + N, data_, data_ + N);
}
constexpr size_t
size() const
{
return N;
}
constexpr T*
data() noexcept
{
return data_;
}
constexpr T const*
data() const noexcept
{
return data_;
}
OS_ALWAYS_INLINE T&
operator[](ptrdiff_t n)
{
return begin()[n];
}
OS_ALWAYS_INLINE T const&
operator[](ptrdiff_t n) const
{
return begin()[n];
}
};
} // end namespace libkern
#endif /* !TAPI */
#endif // !XNU_LIBKERN_LIBKERN_CXX_BOUNDED_ARRAY_H
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/DriverKit/IOInterruptDispatchSource.h | /* iig(DriverKit-191.30.2) generated from IOInterruptDispatchSource.iig */
/* IOInterruptDispatchSource.iig:1-50 */
/*
* Copyright (c) 2019-2019 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _IOKIT_UIOINTERRUPTDISPATCHSOURCE_H
#define _IOKIT_UIOINTERRUPTDISPATCHSOURCE_H
#include <DriverKit/IODispatchQueue.h> /* .iig include */
#include <DriverKit/IOService.h> /* .iig include */
struct IOInterruptDispatchSourcePayload {
uint64_t time;
uint64_t count;
};
enum {
kIOInterruptDispatchSourceTypeEdge = 0x00000000,
kIOInterruptDispatchSourceTypeLevel = 0x00000001
};
enum {
kIOInterruptSourceIndexMask = 0x0000FFFF,
kIOInterruptSourceAbsoluteTime = 0x00000000,
kIOInterruptSourceContinuousTime = 0x00010000
};
/* source class IOInterruptDispatchSource IOInterruptDispatchSource.iig:51-143 */
#if __DOCUMENTATION__
#define KERNEL IIG_KERNEL
/*!
* @class IOInterruptDispatchSource
*
* @abstract
* IOInterruptDispatchSource delivers interrupts to a handler block on a dispatch queue.
*
* @discussion
* A driver can run code in response to an interrupt from a device, specified as an IOService
* and index. The code runs at normal thread level, but is notified with the mach_absolute_time
* the primary interrupt fired. For IOPCIDevices, only MSI interrupt sources are supported.
*/
class NATIVE KERNEL IOInterruptDispatchSource : public IODispatchSource
{
public:
/*!
* @brief Create an IOInterruptDispatchSource for an interrupt by index from an IOService provider.
* @param provider The IOService object representing the HW device producing the interrupt.
* @param index Index for the interrupt, optionally or'ed with one of the following constants:
kIOInterruptSourceContinuousTime time values sent to the InterruptOccurred() method will be in mach_continuous_time() units.
* @param queue Target queue to run the handler block.
* @param source Created source with +1 retain count to be released by the caller.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
static kern_return_t
Create(IOService * provider,
uint32_t index,
IODispatchQueue * queue,
IOInterruptDispatchSource ** source) LOCAL;
/*!
* @brief Returns the type of interrupt used for a device supplying hardware interrupts, by index from an IOService provider.
* @param provider The IOService object representing the HW device producing the interrupt.
* @param index Index for the interrupt.
* @param interruptType The interrupt type for the interrupt source will be stored here.
* kIOInterruptTypeEdge will be returned for edge-trigggered sources.
* kIOInterruptTypeLevel will be returned for level-trigggered sources.
* Other flags may be returned depending on the provider, for example PCI flags for messaged interrupts.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
static kern_return_t
GetInterruptType(IOService * provider,
uint32_t index,
uint64_t * interruptType);
virtual bool
init() override;
virtual void
free() override;
/*!
* @brief Set the handler block to run when the interupt fires.
* @param action OSAction instance specifying the callback method. The OSAction object will be retained
* until SetHandler is called again or the event source is cancelled.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
SetHandler(
OSAction * action TYPE(InterruptOccurred)) LOCAL;
/*!
* @brief Control the enable state of the interrupt source.
* @param enable Pass true to enable the source or false to disable.
* @param handler Optional block to be executed after the interrupt has been disabled and any pending
* interrupt handlers completed.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
SetEnableWithCompletion(
bool enable,
IODispatchSourceCancelHandler handler) override LOCAL;
/*!
* @brief Cancel all callbacks from the event source.
* @discussion After cancellation, the source can only be freed. It cannot be reactivated.
* @param handler Handler block to be invoked after any callbacks have completed.
* @return kIOReturnSuccess on success. See IOReturn.h for error codes.
*/
virtual kern_return_t
Cancel(IODispatchSourceCancelHandler handler) override LOCAL;
private:
virtual kern_return_t
CheckForWork(bool synchronous) override LOCAL;
virtual void
InterruptOccurred(
OSAction * action TARGET,
uint64_t count,
uint64_t time) REPLY LOCAL;
};
#undef KERNEL
#else /* __DOCUMENTATION__ */
/* generated class IOInterruptDispatchSource IOInterruptDispatchSource.iig:51-143 */
#define IOInterruptDispatchSource_Create_ID 0xb6a948b1585fc259ULL
#define IOInterruptDispatchSource_GetInterruptType_ID 0x846d2df6b6bef33bULL
#define IOInterruptDispatchSource_SetHandler_ID 0xfcc79b0928501bb1ULL
#define IOInterruptDispatchSource_InterruptOccurred_ID 0xce0513291cfa1ee1ULL
#define IOInterruptDispatchSource_Create_Args \
IOService * provider, \
uint32_t index, \
IODispatchQueue * queue, \
IOInterruptDispatchSource ** source
#define IOInterruptDispatchSource_GetInterruptType_Args \
IOService * provider, \
uint32_t index, \
uint64_t * interruptType
#define IOInterruptDispatchSource_SetHandler_Args \
OSAction * action
#define IOInterruptDispatchSource_SetEnableWithCompletion_Args \
bool enable, \
IODispatchSourceCancelHandler handler
#define IOInterruptDispatchSource_Cancel_Args \
IODispatchSourceCancelHandler handler
#define IOInterruptDispatchSource_CheckForWork_Args \
const IORPC rpc, \
bool synchronous
#define IOInterruptDispatchSource_InterruptOccurred_Args \
OSAction * action, \
uint64_t count, \
uint64_t time
#define IOInterruptDispatchSource_Methods \
\
public:\
\
virtual kern_return_t\
Dispatch(const IORPC rpc) APPLE_KEXT_OVERRIDE;\
\
static kern_return_t\
_Dispatch(IOInterruptDispatchSource * self, const IORPC rpc);\
\
static kern_return_t\
Create(\
IOService * provider,\
uint32_t index,\
IODispatchQueue * queue,\
IOInterruptDispatchSource ** source);\
\
static kern_return_t\
GetInterruptType(\
IOService * provider,\
uint32_t index,\
uint64_t * interruptType);\
\
kern_return_t\
SetHandler(\
OSAction * action,\
OSDispatchMethod supermethod = NULL);\
\
kern_return_t\
InterruptOccurred(\
IORPC rpc,\
OSAction * action,\
uint64_t count,\
uint64_t time,\
OSDispatchMethod supermethod = NULL);\
\
\
protected:\
/* _Impl methods */\
\
static kern_return_t\
Create_Call(IOInterruptDispatchSource_Create_Args);\
\
kern_return_t\
SetHandler_Impl(IOInterruptDispatchSource_SetHandler_Args);\
\
kern_return_t\
SetEnableWithCompletion_Impl(IODispatchSource_SetEnableWithCompletion_Args);\
\
kern_return_t\
Cancel_Impl(IODispatchSource_Cancel_Args);\
\
kern_return_t\
CheckForWork_Impl(IODispatchSource_CheckForWork_Args);\
\
void\
InterruptOccurred_Impl(IOInterruptDispatchSource_InterruptOccurred_Args);\
\
\
public:\
/* _Invoke methods */\
\
typedef kern_return_t (*Create_Handler)(IOInterruptDispatchSource_Create_Args);\
static kern_return_t\
Create_Invoke(const IORPC rpc,\
Create_Handler func);\
\
typedef kern_return_t (*GetInterruptType_Handler)(IOInterruptDispatchSource_GetInterruptType_Args);\
static kern_return_t\
GetInterruptType_Invoke(const IORPC rpc,\
GetInterruptType_Handler func);\
\
typedef kern_return_t (*SetHandler_Handler)(OSMetaClassBase * target, IOInterruptDispatchSource_SetHandler_Args);\
static kern_return_t\
SetHandler_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
SetHandler_Handler func);\
\
typedef void (*InterruptOccurred_Handler)(OSMetaClassBase * target, IOInterruptDispatchSource_InterruptOccurred_Args);\
static kern_return_t\
InterruptOccurred_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
InterruptOccurred_Handler func,\
const OSMetaClass * targetActionClass);\
\
static kern_return_t\
InterruptOccurred_Invoke(const IORPC rpc,\
OSMetaClassBase * target,\
InterruptOccurred_Handler func);\
\
#define IOInterruptDispatchSource_KernelMethods \
\
protected:\
/* _Impl methods */\
\
static kern_return_t\
Create_Impl(IOInterruptDispatchSource_Create_Args);\
\
static kern_return_t\
GetInterruptType_Impl(IOInterruptDispatchSource_GetInterruptType_Args);\
\
#define IOInterruptDispatchSource_VirtualMethods \
\
public:\
\
virtual bool\
init(\
) APPLE_KEXT_OVERRIDE;\
\
virtual void\
free(\
) APPLE_KEXT_OVERRIDE;\
\
class IOInterruptDispatchSourceInterface : public OSInterface
{
public:
};
struct IOInterruptDispatchSource_IVars;
struct IOInterruptDispatchSource_LocalIVars;
class IOInterruptDispatchSource : public IODispatchSource, public IOInterruptDispatchSourceInterface
{
OSDeclareDefaultStructorsWithDispatch(IOInterruptDispatchSource);
public:
#ifdef IOInterruptDispatchSource_DECLARE_IVARS
IOInterruptDispatchSource_DECLARE_IVARS
#else /* IOInterruptDispatchSource_DECLARE_IVARS */
union
{
IOInterruptDispatchSource_IVars * ivars;
IOInterruptDispatchSource_LocalIVars * lvars;
};
#endif /* IOInterruptDispatchSource_DECLARE_IVARS */
using super = IODispatchSource;
IOInterruptDispatchSource_VirtualMethods
};
#endif /* !__DOCUMENTATION__ */
/* IOInterruptDispatchSource.iig:145- */
#endif /* ! _IOKIT_UIOINTERRUPTDISPATCHSOURCE_H */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/DriverKit/IOReturn.h | /*
* Copyright (c) 1998-2002 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* HISTORY
*/
/*
* Core IOReturn values. Others may be family defined.
*/
#ifndef __IOKIT_IORETURN_H
#define __IOKIT_IORETURN_H
#ifdef __cplusplus
extern "C" {
#endif
#include <mach/error.h>
typedef kern_return_t IOReturn;
#ifndef sys_iokit
#define sys_iokit err_system(0x38)
#endif /* sys_iokit */
#define sub_iokit_common err_sub(0)
#define sub_iokit_usb err_sub(1)
#define sub_iokit_firewire err_sub(2)
#define sub_iokit_block_storage err_sub(4)
#define sub_iokit_graphics err_sub(5)
#define sub_iokit_networking err_sub(6)
#define sub_iokit_bluetooth err_sub(8)
#define sub_iokit_pmu err_sub(9)
#define sub_iokit_acpi err_sub(10)
#define sub_iokit_smbus err_sub(11)
#define sub_iokit_ahci err_sub(12)
#define sub_iokit_powermanagement err_sub(13)
#define sub_iokit_hidsystem err_sub(14)
#define sub_iokit_scsi err_sub(16)
#define sub_iokit_usbaudio err_sub(17)
#define sub_iokit_wirelesscharging err_sub(18)
//#define sub_iokit_pccard err_sub(21)
#define sub_iokit_thunderbolt err_sub(29)
#define sub_iokit_graphics_acceleration err_sub(30)
#define sub_iokit_keystore err_sub(31)
#define sub_iokit_apfs err_sub(33)
#define sub_iokit_acpiec err_sub(34)
#define sub_iokit_timesync_avb err_sub(35)
#define sub_iokit_platform err_sub(0x2A)
#define sub_iokit_audio_video err_sub(0x45)
#define sub_iokit_cec err_sub(0x46)
#define sub_iokit_baseband err_sub(0x80)
#define sub_iokit_HDA err_sub(0xFE)
#define sub_iokit_hsic err_sub(0x147)
#define sub_iokit_sdio err_sub(0x174)
#define sub_iokit_wlan err_sub(0x208)
#define sub_iokit_appleembeddedsleepwakehandler err_sub(0x209)
#define sub_iokit_appleppm err_sub(0x20A)
#define sub_iokit_vendor_specific err_sub(-2)
#define sub_iokit_reserved err_sub(-1)
#define iokit_common_err(return ) (sys_iokit|sub_iokit_common|return)
#define iokit_family_err(sub, return ) (sys_iokit|sub|return)
#define iokit_vendor_specific_err(return ) (sys_iokit|sub_iokit_vendor_specific|return)
#define kIOReturnSuccess KERN_SUCCESS // OK
#define kIOReturnError iokit_common_err(0x2bc) // general error
#define kIOReturnNoMemory iokit_common_err(0x2bd) // can't allocate memory
#define kIOReturnNoResources iokit_common_err(0x2be) // resource shortage
#define kIOReturnIPCError iokit_common_err(0x2bf) // error during IPC
#define kIOReturnNoDevice iokit_common_err(0x2c0) // no such device
#define kIOReturnNotPrivileged iokit_common_err(0x2c1) // privilege violation
#define kIOReturnBadArgument iokit_common_err(0x2c2) // invalid argument
#define kIOReturnLockedRead iokit_common_err(0x2c3) // device read locked
#define kIOReturnLockedWrite iokit_common_err(0x2c4) // device write locked
#define kIOReturnExclusiveAccess iokit_common_err(0x2c5) // exclusive access and
// device already open
#define kIOReturnBadMessageID iokit_common_err(0x2c6) // sent/received messages
// had different msg_id
#define kIOReturnUnsupported iokit_common_err(0x2c7) // unsupported function
#define kIOReturnVMError iokit_common_err(0x2c8) // misc. VM failure
#define kIOReturnInternalError iokit_common_err(0x2c9) // internal error
#define kIOReturnIOError iokit_common_err(0x2ca) // General I/O error
//#define kIOReturn???Error iokit_common_err(0x2cb) // ???
#define kIOReturnCannotLock iokit_common_err(0x2cc) // can't acquire lock
#define kIOReturnNotOpen iokit_common_err(0x2cd) // device not open
#define kIOReturnNotReadable iokit_common_err(0x2ce) // read not supported
#define kIOReturnNotWritable iokit_common_err(0x2cf) // write not supported
#define kIOReturnNotAligned iokit_common_err(0x2d0) // alignment error
#define kIOReturnBadMedia iokit_common_err(0x2d1) // Media Error
#define kIOReturnStillOpen iokit_common_err(0x2d2) // device(s) still open
#define kIOReturnRLDError iokit_common_err(0x2d3) // rld failure
#define kIOReturnDMAError iokit_common_err(0x2d4) // DMA failure
#define kIOReturnBusy iokit_common_err(0x2d5) // Device Busy
#define kIOReturnTimeout iokit_common_err(0x2d6) // I/O Timeout
#define kIOReturnOffline iokit_common_err(0x2d7) // device offline
#define kIOReturnNotReady iokit_common_err(0x2d8) // not ready
#define kIOReturnNotAttached iokit_common_err(0x2d9) // device not attached
#define kIOReturnNoChannels iokit_common_err(0x2da) // no DMA channels left
#define kIOReturnNoSpace iokit_common_err(0x2db) // no space for data
//#define kIOReturn???Error iokit_common_err(0x2dc) // ???
#define kIOReturnPortExists iokit_common_err(0x2dd) // port already exists
#define kIOReturnCannotWire iokit_common_err(0x2de) // can't wire down
// physical memory
#define kIOReturnNoInterrupt iokit_common_err(0x2df) // no interrupt attached
#define kIOReturnNoFrames iokit_common_err(0x2e0) // no DMA frames enqueued
#define kIOReturnMessageTooLarge iokit_common_err(0x2e1) // oversized msg received
// on interrupt port
#define kIOReturnNotPermitted iokit_common_err(0x2e2) // not permitted
#define kIOReturnNoPower iokit_common_err(0x2e3) // no power to device
#define kIOReturnNoMedia iokit_common_err(0x2e4) // media not present
#define kIOReturnUnformattedMedia iokit_common_err(0x2e5)// media not formatted
#define kIOReturnUnsupportedMode iokit_common_err(0x2e6) // no such mode
#define kIOReturnUnderrun iokit_common_err(0x2e7) // data underrun
#define kIOReturnOverrun iokit_common_err(0x2e8) // data overrun
#define kIOReturnDeviceError iokit_common_err(0x2e9) // the device is not working properly!
#define kIOReturnNoCompletion iokit_common_err(0x2ea) // a completion routine is required
#define kIOReturnAborted iokit_common_err(0x2eb) // operation aborted
#define kIOReturnNoBandwidth iokit_common_err(0x2ec) // bus bandwidth would be exceeded
#define kIOReturnNotResponding iokit_common_err(0x2ed) // device not responding
#define kIOReturnIsoTooOld iokit_common_err(0x2ee) // isochronous I/O request for distant past!
#define kIOReturnIsoTooNew iokit_common_err(0x2ef) // isochronous I/O request for distant future
#define kIOReturnNotFound iokit_common_err(0x2f0) // data was not found
#define kIOReturnInvalid iokit_common_err(0x1) // should never be seen
#ifdef __cplusplus
}
#endif
#endif /* ! __IOKIT_IORETURN_H */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/DriverKit/macro_help.h | /*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or [email protected]
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
*/
/*
* File: kern/macro_help.h
*
* Provide help in making lint-free macro routines
*
*/
#ifndef _KERN_MACRO_HELP_H_
#define _KERN_MACRO_HELP_H_
#if DRIVERKIT_FRAMEWORK_INCLUDE
#define NEVER false
#define ALWAYS true
#else
#include <mach/boolean.h>
#ifdef lint
boolean_t NEVER;
boolean_t ALWAYS;
#else /* lint */
#define NEVER FALSE
#define ALWAYS TRUE
#endif /* lint */
#endif /* DRIVERKIT_FRAMEWORK_INCLUDE */
#define MACRO_BEGIN do {
#define MACRO_END } while (NEVER)
#define MACRO_RETURN if (ALWAYS) return
#endif /* _KERN_MACRO_HELP_H_ */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/DriverKit/OSBoundedPtr.h | /*
* Copyright (c) 2019 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef XNU_LIBKERN_LIBKERN_CXX_OS_BOUNDED_PTR_H
#define XNU_LIBKERN_LIBKERN_CXX_OS_BOUNDED_PTR_H
#if !TAPI
#if DRIVERKIT_FRAMEWORK_INCLUDE
#include <DriverKit/IOLib.h>
#include <DriverKit/OSBoundedPtrFwd.h>
#if __cplusplus >= 201703L
#include <DriverKit/bounded_ptr.h>
#endif /* __cplusplus >= 201703L */
#else
#include <kern/debug.h>
#include <libkern/c++/OSBoundedPtrFwd.h>
#if __cplusplus >= 201703L
#include <libkern/c++/bounded_ptr.h>
#endif /* __cplusplus >= 201703L */
#endif /* DRIVERKIT_FRAMEWORK_INCLUDE */
namespace os_detail {
struct panic_trapping_policy {
[[noreturn]] static void
trap(char const* message)
{
panic("%s", message);
}
};
}
// OSBoundedPtr alias is defined in the fwd decl header
#endif /* !TAPI */
#endif /* !XNU_LIBKERN_LIBKERN_CXX_OS_BOUNDED_PTR_H */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/DriverKit/bounded_ptr_fwd.h | //
// Copyright (c) 2019 Apple, Inc. All rights reserved.
//
// @APPLE_OSREFERENCE_LICENSE_HEADER_START@
//
// This file contains Original Code and/or Modifications of Original Code
// as defined in and that are subject to the Apple Public Source License
// Version 2.0 (the 'License'). You may not use this file except in
// compliance with the License. The rights granted to you under the License
// may not be used to create, or enable the creation or redistribution of,
// unlawful or unlicensed copies of an Apple operating system, or to
// circumvent, violate, or enable the circumvention or violation of, any
// terms of an Apple operating system software license agreement.
//
// Please obtain a copy of the License at
// http://www.opensource.apple.com/apsl/ and read it before using this file.
//
// The Original Code and all software distributed under the License are
// distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
// EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
// INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
// Please see the License for the specific language governing rights and
// limitations under the License.
//
// @APPLE_OSREFERENCE_LICENSE_HEADER_END@
//
#ifndef XNU_LIBKERN_LIBKERN_CXX_BOUNDED_PTR_FWD_H
#define XNU_LIBKERN_LIBKERN_CXX_BOUNDED_PTR_FWD_H
#if !TAPI
namespace libkern {
template <typename T, typename TrappingPolicy>
struct __attribute__((trivial_abi)) bounded_ptr;
} // end namespace libkern
#endif /* !TAPI */
#endif // !XNU_LIBKERN_LIBKERN_CXX_BOUNDED_PTR_FWD_H
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/arm/atomic.h | /*
* Copyright (c) 2015-2018 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _MACHINE_ATOMIC_H
#error "Do not include <arm/atomic.h> directly, use <machine/atomic.h>"
#endif
#ifndef _ARM_ATOMIC_H_
#define _ARM_ATOMIC_H_
#include <mach/boolean.h>
// Parameter for __builtin_arm_dmb
#define DMB_OSHLD 0x1
#define DMB_OSHST 0x2
#define DMB_OSH 0x3
#define DMB_NSHLD 0x5
#define DMB_NSHST 0x6
#define DMB_NSH 0x7
#define DMB_ISHLD 0x9
#define DMB_ISHST 0xa
#define DMB_ISH 0xb
#define DMB_LD 0xd
#define DMB_ST 0xe
#define DMB_SY 0xf
// Parameter for __builtin_arm_dsb
#define DSB_OSHLD 0x1
#define DSB_OSHST 0x2
#define DSB_OSH 0x3
#define DSB_NSHLD 0x5
#define DSB_NSHST 0x6
#define DSB_NSH 0x7
#define DSB_ISHLD 0x9
#define DSB_ISHST 0xa
#define DSB_ISH 0xb
#define DSB_LD 0xd
#define DSB_ST 0xe
#define DSB_SY 0xf
// Parameter for __builtin_arm_isb
#define ISB_SY 0xf
#endif // _ARM_ATOMIC_H_
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/arm/types.h | /*
* Copyright (c) 2000-2008 Apple Inc. All rights reserved.
*/
/*
* Copyright 1995 NeXT Computer, Inc. All rights reserved.
*/
/*
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)types.h 8.3 (Berkeley) 1/5/94
*/
#ifndef _ARM_MACHTYPES_H_
#define _ARM_MACHTYPES_H_
#define _MACHTYPES_H_
#if defined (__arm__) || defined (__arm64__)
#ifndef __ASSEMBLER__
#include <arm/_types.h>
#include <sys/cdefs.h>
/*
* Basic integral types. Omit the typedef if
* not possible for a machine/compiler combination.
*/
#include <sys/_types/_int8_t.h>
#include <sys/_types/_int16_t.h>
#include <sys/_types/_int32_t.h>
#include <sys/_types/_int64_t.h>
#include <sys/_types/_u_int8_t.h>
#include <sys/_types/_u_int16_t.h>
#include <sys/_types/_u_int32_t.h>
#include <sys/_types/_u_int64_t.h>
#if __LP64__
typedef int64_t register_t;
#else
typedef int32_t register_t;
#endif
#include <sys/_types/_intptr_t.h>
#include <sys/_types/_uintptr_t.h>
#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
/* These types are used for reserving the largest possible size. */
#ifdef __arm64__
typedef u_int64_t user_addr_t;
typedef u_int64_t user_size_t;
typedef int64_t user_ssize_t;
typedef int64_t user_long_t;
typedef u_int64_t user_ulong_t;
typedef int64_t user_time_t;
typedef int64_t user_off_t;
#else
typedef u_int32_t user_addr_t;
typedef u_int32_t user_size_t;
typedef int32_t user_ssize_t;
typedef int32_t user_long_t;
typedef u_int32_t user_ulong_t;
typedef int32_t user_time_t;
typedef int64_t user_off_t;
#endif
#define USER_ADDR_NULL ((user_addr_t) 0)
#define CAST_USER_ADDR_T(a_ptr) ((user_addr_t)((uintptr_t)(a_ptr)))
/*
* These types are used when you know the word size of the target
* user process. They can be used to create struct layouts independent
* of the types and alignment requirements of the current running
* kernel.
*/
/*
* The user64_ types are not used on the ARM platform, but exist
* so that APIs that conditionalize their behavior based on the
* size of an input structure (like many ioctl(2) implementations)
* can differentiate those structures without a duplicate case
* value.
*/
/*
* The default ABI for the ARM platform aligns fundamental integral
* data types to their natural boundaries, with a maximum alignment
* of 4, even for 8-byte quantites.
*/
typedef __uint64_t user64_addr_t;
typedef __uint64_t user64_size_t;
typedef __int64_t user64_ssize_t;
typedef __int64_t user64_long_t;
typedef __uint64_t user64_ulong_t;
typedef __int64_t user64_time_t;
typedef __int64_t user64_off_t;
typedef __uint32_t user32_addr_t;
typedef __uint32_t user32_size_t;
typedef __int32_t user32_ssize_t;
typedef __int32_t user32_long_t;
typedef __uint32_t user32_ulong_t;
typedef __int32_t user32_time_t;
/*
* This alignment is required to ensure symmetry between userspace and kernelspace
* when the kernel is 64-bit and the user application is 32-bit. All currently
* supported ARM slices (arm64/armv7k/arm64_32) contain the same type alignment
* ABI so this alignment isn't needed for ARM.
*/
#if defined(__x86_64__)
typedef __int64_t user32_off_t __attribute__((aligned(4)));
#else
typedef __int64_t user32_off_t;
#endif
#endif /* !_ANSI_SOURCE && (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
/* This defines the size of syscall arguments after copying into the kernel: */
#if defined(__arm__)
typedef u_int32_t syscall_arg_t;
#elif defined(__arm64__)
typedef u_int64_t syscall_arg_t;
#else
#error Unknown architecture.
#endif
#endif /* __ASSEMBLER__ */
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _ARM_MACHTYPES_H_ */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/arm/signal.h | /*
* Copyright (c) 2000-2009 Apple, Inc. All rights reserved.
*/
/*
* Copyright (c) 1992 NeXT Computer, Inc.
*
*/
#ifndef _ARM_SIGNAL_
#define _ARM_SIGNAL_ 1
#if defined (__arm__) || defined (__arm64__)
#include <sys/cdefs.h>
#ifndef _ANSI_SOURCE
typedef int sig_atomic_t;
#endif /* ! _ANSI_SOURCE */
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _ARM_SIGNAL_ */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/arm/endian.h | /*
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
*/
/*
* Copyright 1995 NeXT Computer, Inc. All rights reserved.
*/
/*
* Copyright (c) 1987, 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)endian.h 8.1 (Berkeley) 6/11/93
*/
#ifndef _ARM__ENDIAN_H_
#define _ARM__ENDIAN_H_
#if defined (__arm__) || defined (__arm64__)
#include <sys/cdefs.h>
/*
* Define _NOQUAD if the compiler does NOT support 64-bit integers.
*/
/* #define _NOQUAD */
/*
* Define the order of 32-bit words in 64-bit words.
*/
#define _QUAD_HIGHWORD 1
#define _QUAD_LOWWORD 0
/*
* Definitions for byte order, according to byte significance from low
* address to high.
*/
#define __DARWIN_LITTLE_ENDIAN 1234 /* LSB first: i386, vax */
#define __DARWIN_BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */
#define __DARWIN_PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */
#define __DARWIN_BYTE_ORDER __DARWIN_LITTLE_ENDIAN
#define LITTLE_ENDIAN __DARWIN_LITTLE_ENDIAN
#define BIG_ENDIAN __DARWIN_BIG_ENDIAN
#define PDP_ENDIAN __DARWIN_PDP_ENDIAN
#define BYTE_ORDER __DARWIN_BYTE_ORDER
#include <sys/_endian.h>
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* !_ARM__ENDIAN_H_ */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/arm/vmparam.h | /*
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
*/
#ifndef _BSD_ARM_VMPARAM_H_
#define _BSD_ARM_VMPARAM_H_ 1
#if defined (__arm__) || defined (__arm64__)
#include <sys/resource.h>
#define USRSTACK (0x27E00000) /* ASLR slides stack down by up to 1MB */
#define USRSTACK64 (0x000000016FE00000ULL)
/*
* Virtual memory related constants, all in bytes
*/
#ifndef DFLDSIZ
#define DFLDSIZ (RLIM_INFINITY) /* initial data size limit */
#endif
#ifndef MAXDSIZ
#define MAXDSIZ (RLIM_INFINITY) /* max data size */
#endif
#ifndef DFLSSIZ
/* XXX stack size default is a platform property: use getrlimit(2) */
#if (defined(TARGET_OS_OSX) && (TARGET_OS_OSX != 0)) || \
(defined(KERNEL) && XNU_TARGET_OS_OSX)
#define DFLSSIZ (8*1024*1024 - 16*1024)
#else
#define DFLSSIZ (1024*1024 - 16*1024) /* initial stack size limit */
#endif /* TARGET_OS_OSX .. || XNU_KERNEL_PRIVATE .. */
#endif /* DFLSSIZ */
#ifndef MAXSSIZ
/* XXX stack size limit is a platform property: use getrlimit(2) */
#if (defined(TARGET_OS_OSX) && (TARGET_OS_OSX != 0)) || \
(defined(KERNEL) && XNU_TARGET_OS_OSX)
#define MAXSSIZ (64*1024*1024) /* max stack size */
#else
#define MAXSSIZ (1024*1024) /* max stack size */
#endif /* TARGET_OS_OSX .. || XNU_KERNEL_PRIVATE .. */
#endif /* MAXSSIZ */
#ifndef DFLCSIZ
#define DFLCSIZ (0) /* initial core size limit */
#endif
#ifndef MAXCSIZ
#define MAXCSIZ (RLIM_INFINITY) /* max core size */
#endif /* MAXCSIZ */
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _BSD_ARM_VMPARAM_H_ */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/arm/_limits.h | /*
* Copyright (c) 2004-2007 Apple Inc. All rights reserved.
*/
#ifndef _ARM__LIMITS_H_
#define _ARM__LIMITS_H_
#if defined (__arm__) || defined (__arm64__)
#define __DARWIN_CLK_TCK 100 /* ticks per second */
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _ARM__LIMITS_H_ */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/arm/thread.h | /*
* Copyright (c) 2007 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or [email protected]
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
*/
#ifndef _ARM_THREAD_H_
#define _ARM_THREAD_H_
#include <mach/mach_types.h>
#include <mach/boolean.h>
#include <mach/arm/vm_types.h>
#include <mach/thread_status.h>
struct perfcontrol_state {
uint64_t opaque[8] __attribute__((aligned(8)));
};
/*
* Maps state flavor to number of words in the state:
*/
extern unsigned int _MachineStateCount[];
extern struct arm_saved_state * get_user_regs(thread_t);
extern struct arm_saved_state * find_user_regs(thread_t);
extern struct arm_saved_state * find_kern_regs(thread_t);
extern struct arm_vfpsaved_state * find_user_vfp(thread_t);
#if defined(__arm__)
extern arm_debug_state_t * find_debug_state(thread_t);
#elif defined(__arm64__)
extern arm_debug_state32_t * find_debug_state32(thread_t);
extern arm_debug_state32_t * find_or_allocate_debug_state32(thread_t);
extern arm_debug_state64_t * find_debug_state64(thread_t);
extern arm_debug_state64_t * find_or_allocate_debug_state64(thread_t);
extern arm_neon_saved_state_t * get_user_neon_regs(thread_t);
#if __ARM_VHE__
extern const arm_saved_state_t * get_vcpu_user_regs(thread_t);
#endif
#else
#error unknown arch
#endif
#define FIND_PERFCONTROL_STATE(th) (&th->machine.perfctrl_state)
extern void *act_thread_csave(void);
extern void act_thread_catt(void *ctx);
extern void act_thread_cfree(void *ctx);
/*
* Return address of the function that called current function, given
* address of the first parameter of current function.
*/
#define GET_RETURN_PC(addr) (__builtin_return_address(0))
#endif /* _ARM_THREAD_H_ */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/arm/_mcontext.h | /*
* Copyright (c) 2003-2012 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef __ARM_MCONTEXT_H_
#define __ARM_MCONTEXT_H_
#if defined (__arm__) || defined (__arm64__)
#include <sys/cdefs.h> /* __DARWIN_UNIX03 */
#include <sys/appleapiopts.h>
#include <mach/machine/_structs.h>
#ifndef _STRUCT_MCONTEXT32
#if __DARWIN_UNIX03
#define _STRUCT_MCONTEXT32 struct __darwin_mcontext32
_STRUCT_MCONTEXT32
{
_STRUCT_ARM_EXCEPTION_STATE __es;
_STRUCT_ARM_THREAD_STATE __ss;
_STRUCT_ARM_VFP_STATE __fs;
};
#else /* !__DARWIN_UNIX03 */
#define _STRUCT_MCONTEXT32 struct mcontext32
_STRUCT_MCONTEXT32
{
_STRUCT_ARM_EXCEPTION_STATE es;
_STRUCT_ARM_THREAD_STATE ss;
_STRUCT_ARM_VFP_STATE fs;
};
#endif /* __DARWIN_UNIX03 */
#endif /* _STRUCT_MCONTEXT32 */
#ifndef _STRUCT_MCONTEXT64
#if __DARWIN_UNIX03
#define _STRUCT_MCONTEXT64 struct __darwin_mcontext64
_STRUCT_MCONTEXT64
{
_STRUCT_ARM_EXCEPTION_STATE64 __es;
_STRUCT_ARM_THREAD_STATE64 __ss;
_STRUCT_ARM_NEON_STATE64 __ns;
};
#else /* !__DARWIN_UNIX03 */
#define _STRUCT_MCONTEXT64 struct mcontext64
_STRUCT_MCONTEXT64
{
_STRUCT_ARM_EXCEPTION_STATE64 es;
_STRUCT_ARM_THREAD_STATE64 ss;
_STRUCT_ARM_NEON_STATE64 ns;
};
#endif /* __DARWIN_UNIX03 */
#endif /* _STRUCT_MCONTEXT32 */
#ifndef _MCONTEXT_T
#define _MCONTEXT_T
#if defined(__arm64__)
typedef _STRUCT_MCONTEXT64 *mcontext_t;
#define _STRUCT_MCONTEXT _STRUCT_MCONTEXT64
#else
typedef _STRUCT_MCONTEXT32 *mcontext_t;
#define _STRUCT_MCONTEXT _STRUCT_MCONTEXT32
#endif
#endif /* _MCONTEXT_T */
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* __ARM_MCONTEXT_H_ */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/arm/trap.h | /*
* Copyright (c) 2007 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or [email protected]
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
*/
#ifndef _ARM_TRAP_H_
#define _ARM_TRAP_H_
/*
* Hardware trap vectors for ARM.
*/
#define T_RESET 0
#define T_UNDEF 1
#define T_SWI 2
#define T_PREFETCH_ABT 3
#define T_DATA_ABT 4
#define T_IRQ 6
#define T_FIQ 7
#define T_PMU 8
#define TRAP_NAMES "reset", "undefined instruction", "software interrupt", \
"prefetch abort", "data abort", "irq interrupt", \
"fast interrupt", "perfmon"
/*
* Page-fault trap codes.
*/
#define T_PF_PROT 0x1 /* protection violation */
#define T_PF_WRITE 0x2 /* write access */
#define T_PF_USER 0x4 /* from user state */
#endif /* _ARM_TRAP_H_ */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/arm/cpuid_internal.h | /*
* Copyright (c) 2011 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _ARM_CPUID_INTERNAL_H_
#define _ARM_CPUID_INTERNAL_H_
#include <arm/cpuid.h>
#include <machine/machine_cpuid.h>
void machine_do_debugid(void);
arm_debug_info_t *machine_arm_debug_info(void);
void machine_do_mvfpid(void);
arm_mvfp_info_t *machine_arm_mvfp_info(void);
uint32_t machine_read_midr(void);
uint32_t machine_read_clidr(void);
uint32_t machine_read_ccsidr(void);
typedef enum {
CSSELR_L1 = 0x0,
CSSELR_L2 = 0x2,
CSSELR_L3 = 0x4
} csselr_cache_level;
typedef enum {
CSSELR_DATA_UNIFIED = 0x0,
CSSELR_INSTR = 0x1
} csselr_cache_type;
void machine_write_csselr(csselr_cache_level level, csselr_cache_type type);
#endif /* _ARM_CPUID_INTERNAL_H_ */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/arm/pal_routines.h | /*
* Copyright (c) 2009 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _ARM_PAL_ROUTINES_H
#define _ARM_PAL_ROUTINES_H
#include <stdint.h>
#include <string.h>
#if defined(__cplusplus)
extern "C" {
#endif
/* Allows us to set a property on the IOResources object. Unused on ARM. */
static inline void
pal_get_resource_property(const char **property_name,
int *property_value)
{
*property_name = NULL;
(void) property_value;
}
#if defined(__cplusplus)
}
#endif
#endif /* _ARM_PAL_ROUTINES_H */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/arm/memory_types.h | /*
* Copyright (c) 2018 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _ARM_MEMORY_TYPES_H_
#define _ARM_MEMORY_TYPES_H_
#include <machine/config.h>
/*
* WIMG control
*/
#define VM_MEM_INNER 0x10
#define VM_MEM_RT 0x10 // intentionally alias VM_MEM_INNER; will be used with mutually exclusive caching policies
#define VM_MEM_EARLY_ACK 0x20
#define VM_WIMG_DEFAULT (VM_MEM_COHERENT) // 0x2
#define VM_WIMG_COPYBACK (VM_MEM_COHERENT) // 0x2
#define VM_WIMG_INNERWBACK (VM_MEM_COHERENT | VM_MEM_INNER) // 0x12
#define VM_WIMG_IO (VM_MEM_COHERENT | VM_MEM_NOT_CACHEABLE | VM_MEM_GUARDED) // 0x7
#define VM_WIMG_POSTED (VM_MEM_COHERENT | VM_MEM_NOT_CACHEABLE | VM_MEM_GUARDED | VM_MEM_EARLY_ACK) // 0x27
#define VM_WIMG_WTHRU (VM_MEM_WRITE_THROUGH | VM_MEM_COHERENT | VM_MEM_GUARDED) // 0xb
#define VM_WIMG_WCOMB (VM_MEM_NOT_CACHEABLE | VM_MEM_COHERENT) // 0x6
#if HAS_UCNORMAL_MEM
#define VM_WIMG_RT (VM_WIMG_WCOMB | VM_MEM_RT) // 0x16
#else
#define VM_WIMG_RT (VM_WIMG_IO | VM_MEM_RT) // 0x17
#endif
#define VM_WIMG_POSTED_REORDERED (VM_MEM_NOT_CACHEABLE | VM_MEM_COHERENT | VM_MEM_WRITE_THROUGH | VM_MEM_EARLY_ACK) // 0x2e
#define VM_WIMG_POSTED_COMBINED_REORDERED (VM_MEM_NOT_CACHEABLE | VM_MEM_COHERENT | VM_MEM_EARLY_ACK) // 0x26
#endif /* _ARM_MEMORY_TYPES_H_ */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/arm/limits.h | /*
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
*/
/*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)limits.h 8.3 (Berkeley) 1/4/94
*/
#ifndef _ARM_LIMITS_H_
#define _ARM_LIMITS_H_
#if defined (__arm__) || defined (__arm64__)
#include <sys/cdefs.h>
#include <arm/_limits.h>
#define CHAR_BIT 8 /* number of bits in a char */
#define MB_LEN_MAX 6 /* Allow 31 bit UTF2 */
#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
#define CLK_TCK __DARWIN_CLK_TCK /* ticks per second */
#endif /* !_ANSI_SOURCE && (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
/*
* According to ANSI (section 2.2.4.2), the values below must be usable by
* #if preprocessing directives. Additionally, the expression must have the
* same type as would an expression that is an object of the corresponding
* type converted according to the integral promotions. The subtraction for
* INT_MIN and LONG_MIN is so the value is not unsigned; 2147483648 is an
* unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
* These numbers work for pcc as well. The UINT_MAX and ULONG_MAX values
* are written as hex so that GCC will be quiet about large integer constants.
*/
#define SCHAR_MAX 127 /* min value for a signed char */
#define SCHAR_MIN (-128) /* max value for a signed char */
#define UCHAR_MAX 255 /* max value for an unsigned char */
#define CHAR_MAX 127 /* max value for a char */
#define CHAR_MIN (-128) /* min value for a char */
#define USHRT_MAX 65535 /* max value for an unsigned short */
#define SHRT_MAX 32767 /* max value for a short */
#define SHRT_MIN (-32768) /* min value for a short */
#define UINT_MAX 0xffffffff /* max value for an unsigned int */
#define INT_MAX 2147483647 /* max value for an int */
#define INT_MIN (-2147483647-1) /* min value for an int */
#ifdef __LP64__
#define ULONG_MAX 0xffffffffffffffffUL /* max unsigned long */
#define LONG_MAX 0x7fffffffffffffffL /* max signed long */
#define LONG_MIN (-0x7fffffffffffffffL-1) /* min signed long */
#else /* !__LP64__ */
#define ULONG_MAX 0xffffffffUL /* max unsigned long */
#define LONG_MAX 2147483647L /* max signed long */
#define LONG_MIN (-2147483647L-1) /* min signed long */
#endif /* __LP64__ */
#define ULLONG_MAX 0xffffffffffffffffULL /* max unsigned long long */
#define LLONG_MAX 0x7fffffffffffffffLL /* max signed long long */
#define LLONG_MIN (-0x7fffffffffffffffLL-1) /* min signed long long */
#if !defined(_ANSI_SOURCE)
#ifdef __LP64__
#define LONG_BIT 64
#else /* !__LP64__ */
#define LONG_BIT 32
#endif /* __LP64__ */
#define SSIZE_MAX LONG_MAX /* max value for a ssize_t */
#define WORD_BIT 32
#if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE)
#define SIZE_T_MAX ULONG_MAX /* max value for a size_t */
#define UQUAD_MAX ULLONG_MAX
#define QUAD_MAX LLONG_MAX
#define QUAD_MIN LLONG_MIN
#endif /* (!_POSIX_C_SOURCE && !_XOPEN_SOURCE) || _DARWIN_C_SOURCE */
#endif /* !_ANSI_SOURCE */
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _ARM_LIMITS_H_ */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/arm/cpuid.h | /*
* Copyright (c) 2007-2016 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* ARM CPU identification
*/
#ifndef _MACHINE_CPUID_H_
#define _MACHINE_CPUID_H_
#include <stdint.h>
#include <mach/boolean.h>
#include <machine/machine_cpuid.h>
#include <machine/machine_routines.h>
typedef struct {
uint32_t arm_rev : 4, /* 00:03 revision number */
arm_part : 12,/* 04:15 primary part number */
arm_arch : 4,/* 16:19 architecture */
arm_variant : 4,/* 20:23 variant */
arm_implementor : 8;/* 24:31 implementor (0x41) */
} arm_cpuid_bits_t;
typedef union {
arm_cpuid_bits_t arm_info; /* ARM9xx, ARM11xx, and later processors */
uint32_t value;
} arm_cpu_info_t;
/* Implementor codes */
#define CPU_VID_ARM 0x41 // ARM Limited
#define CPU_VID_DEC 0x44 // Digital Equipment Corporation
#define CPU_VID_MOTOROLA 0x4D // Motorola - Freescale Semiconductor Inc.
#define CPU_VID_MARVELL 0x56 // Marvell Semiconductor Inc.
#define CPU_VID_INTEL 0x69 // Intel ARM parts.
#define CPU_VID_APPLE 0x61 // Apple Inc.
/* ARM Architecture Codes */
#define CPU_ARCH_ARMv4 0x1 /* ARMv4 */
#define CPU_ARCH_ARMv4T 0x2 /* ARMv4 + Thumb */
#define CPU_ARCH_ARMv5 0x3 /* ARMv5 */
#define CPU_ARCH_ARMv5T 0x4 /* ARMv5 + Thumb */
#define CPU_ARCH_ARMv5TE 0x5 /* ARMv5 + Thumb + Extensions(?) */
#define CPU_ARCH_ARMv5TEJ 0x6 /* ARMv5 + Thumb + Extensions(?) + //Jazelle(?) XXX */
#define CPU_ARCH_ARMv6 0x7 /* ARMv6 */
#define CPU_ARCH_ARMv7 0x8 /* ARMv7 */
#define CPU_ARCH_ARMv7f 0x9 /* ARMv7 for Cortex A9 */
#define CPU_ARCH_ARMv7s 0xa /* ARMv7 for Swift */
#define CPU_ARCH_ARMv7k 0xb /* ARMv7 for Cortex A7 */
#define CPU_ARCH_ARMv8 0xc /* Subtype for CPU_TYPE_ARM64 */
#define CPU_ARCH_ARMv8E 0xd /* ARMv8.3a + Apple Private ISA Subtype for CPU_TYPE_ARM64 */
/* special code indicating we need to look somewhere else for the architecture version */
#define CPU_ARCH_EXTENDED 0xF
/* ARM Part Numbers */
/*
* XXX: ARM Todo
* Fill out these part numbers more completely
*/
/* ARM9 (ARMv4T architecture) */
#define CPU_PART_920T 0x920
#define CPU_PART_926EJS 0x926 /* ARM926EJ-S */
/* ARM11 (ARMv6 architecture) */
#define CPU_PART_1136JFS 0xB36 /* ARM1136JF-S or ARM1136J-S */
#define CPU_PART_1176JZFS 0xB76 /* ARM1176JZF-S */
/* G1 (ARMv7 architecture) */
#define CPU_PART_CORTEXA5 0xC05
/* M7 (ARMv7 architecture) */
#define CPU_PART_CORTEXA7 0xC07
/* H2 H3 (ARMv7 architecture) */
#define CPU_PART_CORTEXA8 0xC08
/* H4 (ARMv7 architecture) */
#define CPU_PART_CORTEXA9 0xC09
/* H7 (ARMv8 architecture) */
#define CPU_PART_TYPHOON 0x2
/* H7G (ARMv8 architecture) */
#define CPU_PART_TYPHOON_CAPRI 0x3
/* H8 (ARMv8 architecture) */
#define CPU_PART_TWISTER 0x4
/* H8G H8M (ARMv8 architecture) */
#define CPU_PART_TWISTER_ELBA_MALTA 0x5
/* H9 (ARMv8 architecture) */
#define CPU_PART_HURRICANE 0x6
/* H9G (ARMv8 architecture) */
#define CPU_PART_HURRICANE_MYST 0x7
/* H10 p-Core (ARMv8 architecture) */
#define CPU_PART_MONSOON 0x8
/* H10 e-Core (ARMv8 architecture) */
#define CPU_PART_MISTRAL 0x9
/* H11 p-Core (ARMv8 architecture) */
#define CPU_PART_VORTEX 0xB
/* H11 e-Core (ARMv8 architecture) */
#define CPU_PART_TEMPEST 0xC
/* M9 e-Core (ARMv8 architecture) */
#define CPU_PART_TEMPEST_M9 0xF
/* H11G p-Core (ARMv8 architecture) */
#define CPU_PART_VORTEX_ARUBA 0x10
/* H11G e-Core (ARMv8 architecture) */
#define CPU_PART_TEMPEST_ARUBA 0x11
/* H12 p-Core (ARMv8 architecture) */
#define CPU_PART_LIGHTNING 0x12
/* H12 e-Core (ARMv8 architecture) */
#define CPU_PART_THUNDER 0x13
/*
* Whilst this is a Thunder-based SoC, it
* hasn't been released and should remain
* hidden in 2020 seeds.
*/
/* M10 e-Core (ARMv8 architecture) */
#define CPU_PART_THUNDER_M10 0x26
/* H13 e-Core */
#define CPU_PART_ICESTORM 0x20
/* H13 p-Core */
#define CPU_PART_FIRESTORM 0x21
/* H13G e-Core */
#define CPU_PART_ICESTORM_TONGA 0x22
/* H13G p-Core */
#define CPU_PART_FIRESTORM_TONGA 0x23
/* H13J e-Core */
#define CPU_PART_ICESTORM_JADE_CHOP 0x24
#define CPU_PART_ICESTORM_JADE_DIE 0x28
/* H13J p-Core */
#define CPU_PART_FIRESTORM_JADE_CHOP 0x25
#define CPU_PART_FIRESTORM_JADE_DIE 0x29
/* H14 e-Core */
#define CPU_PART_BLIZZARD 0x30
/* H14 p-Core */
#define CPU_PART_AVALANCHE 0x31
/* Cache type identification */
/* Supported Cache Types */
typedef enum {
CACHE_WRITE_THROUGH,
CACHE_WRITE_BACK,
CACHE_READ_ALLOCATION,
CACHE_WRITE_ALLOCATION,
CACHE_UNKNOWN
} cache_type_t;
typedef struct {
boolean_t c_unified; /* unified I & D cache? */
uint32_t c_isize; /* in Bytes (ARM caches can be 0.5 KB) */
boolean_t c_i_ppage; /* protected page restriction for I cache
* (see B6-11 in ARM DDI 0100I document). */
uint32_t c_dsize; /* in Bytes (ARM caches can be 0.5 KB) */
boolean_t c_d_ppage; /* protected page restriction for I cache
* (see B6-11 in ARM DDI 0100I document). */
cache_type_t c_type; /* WB or WT */
uint32_t c_linesz; /* number of bytes */
uint32_t c_assoc; /* n-way associativity */
uint32_t c_l2size; /* L2 size, if present */
uint32_t c_bulksize_op; /* bulk operation size limit. 0 if disabled */
uint32_t c_inner_cache_size; /* inner dache size */
} cache_info_t;
typedef struct {
uint32_t
RB:4, /* 3:0 - 32x64-bit media register bank supported: 0x2 */
SP:4, /* 7:4 - Single precision supported in VFPv3: 0x2 */
DP:4, /* 8:11 - Double precision supported in VFPv3: 0x2 */
TE:4, /* 12-15 - Only untrapped exception handling can be selected: 0x0 */
D:4, /* 19:16 - VFP hardware divide supported: 0x1 */
SR:4, /* 23:20 - VFP hardware square root supported: 0x1 */
SV:4, /* 27:24 - VFP short vector supported: 0x1 */
RM:4; /* 31:28 - All VFP rounding modes supported: 0x1 */
} arm_mvfr0_t;
typedef union {
arm_mvfr0_t bits;
uint32_t value;
} arm_mvfr0_info_t;
typedef struct {
uint32_t
FZ:4, /* 3:0 - Full denormal arithmetic supported for VFP: 0x1 */
DN:4, /* 7:4 - Propagation of NaN values supported for VFP: 0x1 */
LS:4, /* 11:8 - Load/store instructions supported for NEON: 0x1 */
I:4, /* 15:12 - Integer instructions supported for NEON: 0x1 */
SP:4, /* 19:16 - Single precision floating-point instructions supported for NEON: 0x1 */
HPFP:4, /* 23:20 - Half precision floating-point instructions supported */
RSVP:8; /* 31:24 - Reserved */
} arm_mvfr1_t;
typedef union {
arm_mvfr1_t bits;
uint32_t value;
} arm_mvfr1_info_t;
typedef struct {
uint32_t neon;
uint32_t neon_hpfp;
uint32_t neon_fp16;
} arm_mvfp_info_t;
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
extern void do_cpuid(void);
extern arm_cpu_info_t *cpuid_info(void);
extern int cpuid_get_cpufamily(void);
extern int cpuid_get_cpusubfamily(void);
extern void do_debugid(void);
extern arm_debug_info_t *arm_debug_info(void);
extern void do_cacheid(void);
extern cache_info_t *cache_info(void);
extern cache_info_t *cache_info_type(cluster_type_t cluster_type);
extern void do_mvfpid(void);
extern arm_mvfp_info_t *arm_mvfp_info(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif // _MACHINE_CPUID_H_
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/arm/_types.h | /*
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
*/
#ifndef _BSD_ARM__TYPES_H_
#define _BSD_ARM__TYPES_H_
#if defined (__arm__) || defined (__arm64__)
/*
* This header file contains integer types. It's intended to also contain
* flotaing point and other arithmetic types, as needed, later.
*/
#ifdef __GNUC__
typedef __signed char __int8_t;
#else /* !__GNUC__ */
typedef char __int8_t;
#endif /* !__GNUC__ */
typedef unsigned char __uint8_t;
typedef short __int16_t;
typedef unsigned short __uint16_t;
typedef int __int32_t;
typedef unsigned int __uint32_t;
typedef long long __int64_t;
typedef unsigned long long __uint64_t;
typedef long __darwin_intptr_t;
typedef unsigned int __darwin_natural_t;
/*
* The rune type below is declared to be an ``int'' instead of the more natural
* ``unsigned long'' or ``long''. Two things are happening here. It is not
* unsigned so that EOF (-1) can be naturally assigned to it and used. Also,
* it looks like 10646 will be a 31 bit standard. This means that if your
* ints cannot hold 32 bits, you will be in trouble. The reason an int was
* chosen over a long is that the is*() and to*() routines take ints (says
* ANSI C), but they use __darwin_ct_rune_t instead of int. By changing it
* here, you lose a bit of ANSI conformance, but your programs will still
* work.
*
* NOTE: rune_t is not covered by ANSI nor other standards, and should not
* be instantiated outside of lib/libc/locale. Use wchar_t. wchar_t and
* rune_t must be the same type. Also wint_t must be no narrower than
* wchar_t, and should also be able to hold all members of the largest
* character set plus one extra value (WEOF). wint_t must be at least 16 bits.
*/
typedef int __darwin_ct_rune_t; /* ct_rune_t */
/*
* mbstate_t is an opaque object to keep conversion state, during multibyte
* stream conversions. The content must not be referenced by user programs.
*/
typedef union {
char __mbstate8[128];
long long _mbstateL; /* for alignment */
} __mbstate_t;
typedef __mbstate_t __darwin_mbstate_t; /* mbstate_t */
#if defined(__PTRDIFF_TYPE__)
typedef __PTRDIFF_TYPE__ __darwin_ptrdiff_t; /* ptr1 - ptr2 */
#elif defined(__LP64__)
typedef long __darwin_ptrdiff_t; /* ptr1 - ptr2 */
#else
typedef int __darwin_ptrdiff_t; /* ptr1 - ptr2 */
#endif /* __GNUC__ */
#if defined(__SIZE_TYPE__)
typedef __SIZE_TYPE__ __darwin_size_t; /* sizeof() */
#else
typedef unsigned long __darwin_size_t; /* sizeof() */
#endif
#if (__GNUC__ > 2)
typedef __builtin_va_list __darwin_va_list; /* va_list */
#else
typedef void * __darwin_va_list; /* va_list */
#endif
#if defined(__WCHAR_TYPE__)
typedef __WCHAR_TYPE__ __darwin_wchar_t; /* wchar_t */
#else
typedef __darwin_ct_rune_t __darwin_wchar_t; /* wchar_t */
#endif
typedef __darwin_wchar_t __darwin_rune_t; /* rune_t */
#if defined(__WINT_TYPE__)
typedef __WINT_TYPE__ __darwin_wint_t; /* wint_t */
#else
typedef __darwin_ct_rune_t __darwin_wint_t; /* wint_t */
#endif
typedef unsigned long __darwin_clock_t; /* clock() */
typedef __uint32_t __darwin_socklen_t; /* socklen_t (duh) */
typedef long __darwin_ssize_t; /* byte count or error */
typedef long __darwin_time_t; /* time() */
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _BSD_ARM__TYPES_H_ */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/arm/locks.h | /*
* Copyright (c) 2007-2017 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _ARM_LOCKS_H_
#define _ARM_LOCKS_H_
#include <kern/kern_types.h>
typedef struct __lck_spin_t__ lck_spin_t;
typedef struct __lck_mtx_t__ lck_mtx_t;
#endif /* _ARM_LOCKS_H_ */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/arm/machine_routines.h | /*
* Copyright (c) 2007-2020 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
#ifndef _ARM_MACHINE_ROUTINES_H_
#define _ARM_MACHINE_ROUTINES_H_
#include <mach/mach_types.h>
#include <mach/vm_types.h>
#include <mach/boolean.h>
#include <kern/kern_types.h>
#include <pexpert/pexpert.h>
#include <sys/cdefs.h>
#include <sys/appleapiopts.h>
#include <stdarg.h>
__BEGIN_DECLS
/* Interrupt handling */
void ml_cpu_signal(unsigned int cpu_id);
void ml_cpu_signal_deferred_adjust_timer(uint64_t nanosecs);
uint64_t ml_cpu_signal_deferred_get_timer(void);
void ml_cpu_signal_deferred(unsigned int cpu_id);
void ml_cpu_signal_retract(unsigned int cpu_id);
bool ml_cpu_signal_is_enabled(void);
/* Initialize Interrupts */
void ml_init_interrupt(void);
/* Get Interrupts Enabled */
boolean_t ml_get_interrupts_enabled(void);
/* Set Interrupts Enabled */
#if __has_feature(ptrauth_calls)
uint64_t ml_pac_safe_interrupts_disable(void);
void ml_pac_safe_interrupts_restore(uint64_t);
#endif /* __has_feature(ptrauth_calls) */
boolean_t ml_set_interrupts_enabled(boolean_t enable);
boolean_t ml_early_set_interrupts_enabled(boolean_t enable);
/* Check if running at interrupt context */
boolean_t ml_at_interrupt_context(void);
/* Generate a fake interrupt */
void ml_cause_interrupt(void);
#if HAS_SIQ
void siq_init(void);
void siq_cpu_init(void);
#endif
/* Type for the Time Base Enable function */
typedef void (*time_base_enable_t)(cpu_id_t cpu_id, boolean_t enable);
#define CacheConfig 0x00000000UL
#define CacheControl 0x00000001UL
#define CacheClean 0x00000002UL
#define CacheCleanRegion 0x00000003UL
#define CacheCleanFlush 0x00000004UL
#define CacheCleanFlushRegion 0x00000005UL
#define CacheShutdown 0x00000006UL
#define CacheControlEnable 0x00000000UL
#define CacheConfigCCSIDR 0x00000001UL
#define CacheConfigSize 0x00000100UL
/* Type for the Processor Idle function */
typedef void (*processor_idle_t)(cpu_id_t cpu_id, boolean_t enter, uint64_t *new_timeout_ticks);
/* Type for the Idle Tickle function */
typedef void (*idle_tickle_t)(void);
/* Type for the Idle Timer function */
typedef void (*idle_timer_t)(void *refcon, uint64_t *new_timeout_ticks);
/* Type for the IPI Hander */
typedef void (*ipi_handler_t)(void);
/* Type for the Lockdown Hander */
typedef void (*lockdown_handler_t)(void *);
/* Type for the Platform specific Error Handler */
typedef void (*platform_error_handler_t)(void *refcon, vm_offset_t fault_addr);
/*
* The exception callback (ex_cb) module allows kernel drivers to
* register and receive callbacks for exceptions, and indicate
* actions to be taken by the platform kernel
* Currently this is supported for ARM64 but extending support for ARM32
* should be straightforward
*/
/* Supported exception classes for callbacks */
typedef enum{
EXCB_CLASS_ILLEGAL_INSTR_SET,
#ifdef CONFIG_XNUPOST
EXCB_CLASS_TEST1,
EXCB_CLASS_TEST2,
EXCB_CLASS_TEST3,
#endif
EXCB_CLASS_MAX // this must be last
}
ex_cb_class_t;
/* Actions indicated by callbacks to be taken by platform kernel */
typedef enum{
EXCB_ACTION_RERUN, // re-run the faulting instruction
EXCB_ACTION_NONE, // continue normal exception handling
#ifdef CONFIG_XNUPOST
EXCB_ACTION_TEST_FAIL,
#endif
}
ex_cb_action_t;
/*
* Exception state
* We cannot use a private kernel data structure such as arm_saved_state_t
* The CPSR and ESR are not clobbered when the callback function is invoked so
* those registers can be examined by the callback function;
* the same is done in the platform error handlers
*/
typedef struct{
vm_offset_t far;
}
ex_cb_state_t;
/* callback type definition */
typedef ex_cb_action_t (*ex_cb_t) (
ex_cb_class_t cb_class,
void *refcon,// provided at registration
const ex_cb_state_t *state // exception state
);
/*
* Callback registration
* Currently we support only one registered callback per class but
* it should be possible to support more callbacks
*/
kern_return_t ex_cb_register(
ex_cb_class_t cb_class,
ex_cb_t cb,
void *refcon );
/*
* Called internally by platform kernel to invoke the registered callback for class
*/
ex_cb_action_t ex_cb_invoke(
ex_cb_class_t cb_class,
vm_offset_t far);
typedef enum {
CLUSTER_TYPE_SMP,
CLUSTER_TYPE_E,
CLUSTER_TYPE_P,
MAX_CPU_TYPES,
} cluster_type_t;
void ml_parse_cpu_topology(void);
unsigned int ml_get_cpu_count(void);
unsigned int ml_get_cpu_number_type(cluster_type_t cluster_type, bool logical, bool available);
unsigned int ml_cpu_cache_sharing(unsigned int level, cluster_type_t cluster_type, bool include_all_cpu_types);
unsigned int ml_get_cpu_types(void);
unsigned int ml_get_cluster_count(void);
int ml_get_boot_cpu_number(void);
int ml_get_cpu_number(uint32_t phys_id);
unsigned int ml_get_cpu_number_local(void);
int ml_get_cluster_number(uint32_t phys_id);
int ml_get_max_cpu_number(void);
int ml_get_max_cluster_number(void);
unsigned int ml_get_first_cpu_id(unsigned int cluster_id);
#ifdef __arm64__
int ml_get_cluster_number_local(void);
#endif /* __arm64__ */
/* Struct for ml_cpu_get_info */
struct ml_cpu_info {
unsigned long vector_unit;
unsigned long cache_line_size;
unsigned long l1_icache_size;
unsigned long l1_dcache_size;
unsigned long l2_settings;
unsigned long l2_cache_size;
unsigned long l3_settings;
unsigned long l3_cache_size;
};
typedef struct ml_cpu_info ml_cpu_info_t;
cluster_type_t ml_get_boot_cluster_type(void);
typedef struct ml_topology_cpu {
unsigned int cpu_id;
uint32_t phys_id;
unsigned int cluster_id;
unsigned int reserved;
cluster_type_t cluster_type;
uint32_t l2_access_penalty;
uint32_t l2_cache_size;
uint32_t l2_cache_id;
uint32_t l3_cache_size;
uint32_t l3_cache_id;
vm_offset_t cpu_IMPL_regs;
uint64_t cpu_IMPL_pa;
uint64_t cpu_IMPL_len;
vm_offset_t cpu_UTTDBG_regs;
uint64_t cpu_UTTDBG_pa;
uint64_t cpu_UTTDBG_len;
vm_offset_t coresight_regs;
uint64_t coresight_pa;
uint64_t coresight_len;
unsigned int die_cluster_id;
unsigned int cluster_core_id;
} ml_topology_cpu_t;
/*!
* @typedef ml_topology_cluster_t
* @brief Describes one cluster in the topology.
*
* @field cluster_id Cluster ID (EDT: cluster-id)
* @field cluster_type The type of CPUs found in this cluster.
* @field num_cpus Total number of usable CPU cores in this cluster.
* @field first_cpu_id The cpu_id of the first CPU in the cluster.
* @field cpu_mask A bitmask representing the cpu_id's that belong to the cluster. Example:
* If the cluster contains CPU4 and CPU5, cpu_mask will be 0x30.
* @field acc_IMPL_regs IO-mapped virtual address of acc_IMPL (implementation-defined) register block.
* @field acc_IMPL_pa Physical address of acc_IMPL register block.
* @field acc_IMPL_len Length of acc_IMPL register block.
* @field cpm_IMPL_regs IO-mapped virtual address of cpm_IMPL (implementation-defined) register block.
* @field cpm_IMPL_pa Physical address of cpm_IMPL register block.
* @field cpm_IMPL_len Length of cpm_IMPL register block.
*/
typedef struct ml_topology_cluster {
unsigned int cluster_id;
cluster_type_t cluster_type;
unsigned int num_cpus;
unsigned int first_cpu_id;
uint64_t cpu_mask;
vm_offset_t acc_IMPL_regs;
uint64_t acc_IMPL_pa;
uint64_t acc_IMPL_len;
vm_offset_t cpm_IMPL_regs;
uint64_t cpm_IMPL_pa;
uint64_t cpm_IMPL_len;
} ml_topology_cluster_t;
// Bump this version number any time any ml_topology_* struct changes, so
// that KPI users can check whether their headers are compatible with
// the running kernel.
#define CPU_TOPOLOGY_VERSION 1
/*!
* @typedef ml_topology_info_t
* @brief Describes the CPU topology for all APs in the system. Populated from EDT and read-only at runtime.
* @discussion This struct only lists CPU cores that are considered usable by both iBoot and XNU. Some
* physically present CPU cores may be considered unusable due to configuration options like
* the "cpus=" boot-arg. Cores that are disabled in hardware will not show up in EDT at all, so
* they also will not be present in this struct.
*
* @field version Version of the struct (set to CPU_TOPOLOGY_VERSION).
* @field num_cpus Total number of usable CPU cores.
* @field max_cpu_id The highest usable logical CPU ID.
* @field num_clusters Total number of AP CPU clusters on the system (usable or not).
* @field max_cluster_id The highest cluster ID found in EDT.
* @field cpus List of |num_cpus| entries.
* @field clusters List of |num_clusters| entries.
* @field boot_cpu Points to the |cpus| entry for the boot CPU.
* @field boot_cluster Points to the |clusters| entry which contains the boot CPU.
* @field chip_revision Silicon revision reported by iBoot, which comes from the
* SoC-specific fuse bits. See CPU_VERSION_xx macros for definitions.
*/
typedef struct ml_topology_info {
unsigned int version;
unsigned int num_cpus;
unsigned int max_cpu_id;
unsigned int num_clusters;
unsigned int max_cluster_id;
unsigned int reserved;
ml_topology_cpu_t *cpus;
ml_topology_cluster_t *clusters;
ml_topology_cpu_t *boot_cpu;
ml_topology_cluster_t *boot_cluster;
unsigned int chip_revision;
unsigned int cluster_types;
unsigned int cluster_type_num_cpus[MAX_CPU_TYPES];
} ml_topology_info_t;
/*!
* @function ml_get_topology_info
* @result A pointer to the read-only topology struct. Does not need to be freed. Returns NULL
* if the struct hasn't been initialized or the feature is unsupported.
*/
const ml_topology_info_t *ml_get_topology_info(void);
/*!
* @function ml_map_cpu_pio
* @brief Maps per-CPU and per-cluster PIO registers found in EDT. This needs to be
* called after arm_vm_init() so it can't be part of ml_parse_cpu_topology().
*/
void ml_map_cpu_pio(void);
/* Struct for ml_processor_register */
struct ml_processor_info {
cpu_id_t cpu_id;
vm_offset_t start_paddr;
boolean_t supports_nap;
void *platform_cache_dispatch;
time_base_enable_t time_base_enable;
processor_idle_t processor_idle;
idle_tickle_t *idle_tickle;
idle_timer_t idle_timer;
void *idle_timer_refcon;
vm_offset_t powergate_stub_addr;
uint32_t powergate_stub_length;
uint32_t powergate_latency;
platform_error_handler_t platform_error_handler;
uint64_t regmap_paddr;
uint32_t phys_id;
uint32_t log_id;
uint32_t l2_access_penalty;
uint32_t cluster_id;
cluster_type_t cluster_type;
uint32_t l2_cache_id;
uint32_t l2_cache_size;
uint32_t l3_cache_id;
uint32_t l3_cache_size;
};
typedef struct ml_processor_info ml_processor_info_t;
/*!
* @function ml_processor_register
*
* @abstract callback from platform kext to register processor
*
* @discussion This function is called by the platform kext when a processor is
* being registered. This is called while running on the CPU itself, as part of
* its initialization.
*
* @param ml_processor_info provides machine-specific information about the
* processor to xnu.
*
* @param processor is set as an out-parameter to an opaque handle that should
* be used by the platform kext when referring to this processor in the future.
*
* @param ipi_handler is set as an out-parameter to the function that should be
* registered as the IPI handler.
*
* @param pmi_handler is set as an out-parameter to the function that should be
* registered as the PMI handler.
*
* @returns KERN_SUCCESS on success and an error code, otherwise.
*/
kern_return_t ml_processor_register(ml_processor_info_t *ml_processor_info,
processor_t *processor, ipi_handler_t *ipi_handler,
perfmon_interrupt_handler_func *pmi_handler);
/* Register a lockdown handler */
kern_return_t ml_lockdown_handler_register(lockdown_handler_t, void *);
/* Initialize Interrupts */
void ml_install_interrupt_handler(
void *nub,
int source,
void *target,
IOInterruptHandler handler,
void *refCon);
vm_offset_t
ml_static_vtop(
vm_offset_t);
kern_return_t
ml_static_verify_page_protections(
uint64_t base, uint64_t size, vm_prot_t prot);
vm_offset_t
ml_static_ptovirt(
vm_offset_t);
vm_offset_t ml_static_slide(
vm_offset_t vaddr);
vm_offset_t ml_static_unslide(
vm_offset_t vaddr);
/* Offset required to obtain absolute time value from tick counter */
uint64_t ml_get_abstime_offset(void);
/* Offset required to obtain continuous time value from tick counter */
uint64_t ml_get_conttime_offset(void);
#ifdef __APPLE_API_UNSTABLE
/* PCI config cycle probing */
boolean_t ml_probe_read(
vm_offset_t paddr,
unsigned int *val);
boolean_t ml_probe_read_64(
addr64_t paddr,
unsigned int *val);
/* Read physical address byte */
unsigned int ml_phys_read_byte(
vm_offset_t paddr);
unsigned int ml_phys_read_byte_64(
addr64_t paddr);
/* Read physical address half word */
unsigned int ml_phys_read_half(
vm_offset_t paddr);
unsigned int ml_phys_read_half_64(
addr64_t paddr);
/* Read physical address word*/
unsigned int ml_phys_read(
vm_offset_t paddr);
unsigned int ml_phys_read_64(
addr64_t paddr);
unsigned int ml_phys_read_word(
vm_offset_t paddr);
unsigned int ml_phys_read_word_64(
addr64_t paddr);
/* Read physical address double word */
unsigned long long ml_phys_read_double(
vm_offset_t paddr);
unsigned long long ml_phys_read_double_64(
addr64_t paddr);
/* Write physical address byte */
void ml_phys_write_byte(
vm_offset_t paddr, unsigned int data);
void ml_phys_write_byte_64(
addr64_t paddr, unsigned int data);
/* Write physical address half word */
void ml_phys_write_half(
vm_offset_t paddr, unsigned int data);
void ml_phys_write_half_64(
addr64_t paddr, unsigned int data);
/* Write physical address word */
void ml_phys_write(
vm_offset_t paddr, unsigned int data);
void ml_phys_write_64(
addr64_t paddr, unsigned int data);
void ml_phys_write_word(
vm_offset_t paddr, unsigned int data);
void ml_phys_write_word_64(
addr64_t paddr, unsigned int data);
/* Write physical address double word */
void ml_phys_write_double(
vm_offset_t paddr, unsigned long long data);
void ml_phys_write_double_64(
addr64_t paddr, unsigned long long data);
void ml_static_mfree(
vm_offset_t,
vm_size_t);
kern_return_t
ml_static_protect(
vm_offset_t start,
vm_size_t size,
vm_prot_t new_prot);
/* virtual to physical on wired pages */
vm_offset_t ml_vtophys(
vm_offset_t vaddr);
/* Get processor cache info */
void ml_cpu_get_info(ml_cpu_info_t *ml_cpu_info);
void ml_cpu_get_info_type(ml_cpu_info_t * ml_cpu_info, cluster_type_t cluster_type);
#endif /* __APPLE_API_UNSTABLE */
#ifdef __APPLE_API_PRIVATE
/* Zero bytes starting at a physical address */
void bzero_phys(
addr64_t phys_address,
vm_size_t length);
void bzero_phys_nc(addr64_t src64, vm_size_t bytes);
void ml_thread_policy(
thread_t thread,
unsigned policy_id,
unsigned policy_info);
#define MACHINE_GROUP 0x00000001
#define MACHINE_NETWORK_GROUP 0x10000000
#define MACHINE_NETWORK_WORKLOOP 0x00000001
#define MACHINE_NETWORK_NETISR 0x00000002
/* Set the maximum number of CPUs */
void ml_set_max_cpus(
unsigned int max_cpus);
/* Return the maximum number of CPUs set by ml_set_max_cpus(), waiting if necessary */
unsigned int ml_wait_max_cpus(
void);
/* Return the maximum memory size */
unsigned int ml_get_machine_mem(void);
extern void ml_cpu_init_completed(void);
extern void ml_cpu_up(void);
extern void ml_cpu_down(void);
extern void ml_arm_sleep(void);
extern uint64_t ml_get_wake_timebase(void);
extern uint64_t ml_get_conttime_wake_time(void);
/* Time since the system was reset (as part of boot/wake) */
uint64_t ml_get_time_since_reset(void);
/*
* Called by ApplePMGR to set wake time. Units and epoch are identical
* to mach_continuous_time(). Has no effect on !HAS_CONTINUOUS_HWCLOCK
* chips. If wake_time == UINT64_MAX, that means the wake time is
* unknown and calls to ml_get_time_since_reset() will return UINT64_MAX.
*/
void ml_set_reset_time(uint64_t wake_time);
/* Bytes available on current stack */
vm_offset_t ml_stack_remaining(void);
extern uint32_t arm_debug_read_dscr(void);
extern int set_be_bit(void);
extern int clr_be_bit(void);
extern int be_tracing(void);
/* Please note that cpu_broadcast_xcall is not as simple is you would like it to be.
* It will sometimes put the calling thread to sleep, and it is up to your callback
* to wake it up as needed, where "as needed" is defined as "all other CPUs have
* called the broadcast func". Look around the kernel for examples, or instead use
* cpu_broadcast_xcall_simple() which does indeed act like you would expect, given
* the prototype. cpu_broadcast_immediate_xcall has the same caveats and has a similar
* _simple() wrapper
*/
typedef void (*broadcastFunc) (void *);
unsigned int cpu_broadcast_xcall(uint32_t *, boolean_t, broadcastFunc, void *);
unsigned int cpu_broadcast_xcall_simple(boolean_t, broadcastFunc, void *);
kern_return_t cpu_xcall(int, broadcastFunc, void *);
unsigned int cpu_broadcast_immediate_xcall(uint32_t *, boolean_t, broadcastFunc, void *);
unsigned int cpu_broadcast_immediate_xcall_simple(boolean_t, broadcastFunc, void *);
kern_return_t cpu_immediate_xcall(int, broadcastFunc, void *);
boolean_t machine_timeout_suspended(void);
void ml_get_power_state(boolean_t *, boolean_t *);
uint32_t get_arm_cpu_version(void);
boolean_t user_cont_hwclock_allowed(void);
uint8_t user_timebase_type(void);
boolean_t ml_thread_is64bit(thread_t thread);
#ifdef __arm64__
bool ml_feature_supported(uint32_t feature_bit);
void ml_set_align_checking(void);
extern void wfe_timeout_configure(void);
extern void wfe_timeout_init(void);
#endif /* __arm64__ */
void ml_timer_evaluate(void);
boolean_t ml_timer_forced_evaluation(void);
uint64_t ml_energy_stat(thread_t);
void ml_gpu_stat_update(uint64_t);
uint64_t ml_gpu_stat(thread_t);
#endif /* __APPLE_API_PRIVATE */
extern uint32_t phy_read_panic;
extern uint32_t phy_write_panic;
#if DEVELOPMENT || DEBUG
extern uint64_t simulate_stretched_io;
#endif
void ml_hibernate_active_pre(void);
void ml_hibernate_active_post(void);
__END_DECLS
#endif /* _ARM_MACHINE_ROUTINES_H_ */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/arm/param.h | /*
* Copyright (c) 2000-2010 Apple Inc. All rights reserved.
*/
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)param.h 8.1 (Berkeley) 4/4/95
*/
/*
* Machine dependent constants for ARM
*/
#ifndef _ARM_PARAM_H_
#define _ARM_PARAM_H_
#if defined (__arm__) || defined (__arm64__)
#include <arm/_param.h>
/*
* Round p (pointer or byte index) up to a correctly-aligned value for all
* data types (int, long, ...). The result is unsigned int and must be
* cast to any desired pointer type.
*/
#define ALIGNBYTES __DARWIN_ALIGNBYTES
#define ALIGN(p) __DARWIN_ALIGN(p)
#define NBPG 4096 /* bytes/page */
#define PGOFSET (NBPG-1) /* byte offset into page */
#define PGSHIFT 12 /* LOG2(NBPG) */
#define DEV_BSIZE 512
#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
#define BLKDEV_IOSIZE 2048
#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
#define CLSIZE 1
#define CLSIZELOG2 0
/*
* Constants related to network buffer management.
* MCLBYTES must be no larger than CLBYTES (the software page size), and,
* on machines that exchange pages of input or output buffers with mbuf
* clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
* of the hardware page size.
*/
#define MSIZESHIFT 8 /* 256 */
#define MSIZE (1 << MSIZESHIFT) /* size of an mbuf */
#define MCLSHIFT 11 /* 2048 */
#define MCLBYTES (1 << MCLSHIFT) /* size of an mbuf cluster */
#define MBIGCLSHIFT 12 /* 4096 */
#define MBIGCLBYTES (1 << MBIGCLSHIFT) /* size of a big cluster */
#define M16KCLSHIFT 14 /* 16384 */
#define M16KCLBYTES (1 << M16KCLSHIFT) /* size of a jumbo cluster */
#define MCLOFSET (MCLBYTES - 1)
#ifndef NMBCLUSTERS
#define NMBCLUSTERS CONFIG_NMBCLUSTERS /* cl map size */
#endif
/*
* Some macros for units conversion
*/
/* Core clicks (NeXT_page_size bytes) to segments and vice versa */
#define ctos(x) (x)
#define stoc(x) (x)
/* Core clicks (4096 bytes) to disk blocks */
#define ctod(x) ((x)<<(PGSHIFT-DEV_BSHIFT))
#define dtoc(x) ((x)>>(PGSHIFT-DEV_BSHIFT))
#define dtob(x) ((x)<<DEV_BSHIFT)
/* clicks to bytes */
#define ctob(x) ((x)<<PGSHIFT)
/* bytes to clicks */
#define btoc(x) (((unsigned)(x)+(NBPG-1))>>PGSHIFT)
#ifdef __APPLE__
#define btodb(bytes, devBlockSize) \
((unsigned)(bytes) / devBlockSize)
#define dbtob(db, devBlockSize) \
((unsigned)(db) * devBlockSize)
#else
#define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \
((unsigned)(bytes) >> DEV_BSHIFT)
#define dbtob(db) /* calculates (db * DEV_BSIZE) */ \
((unsigned)(db) << DEV_BSHIFT)
#endif
/*
* Map a ``block device block'' to a file system block.
* This should be device dependent, and will be if we
* add an entry to cdevsw/bdevsw for that purpose.
* For now though just use DEV_BSIZE.
*/
#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
/*
* Macros to decode (and encode) processor status word.
*/
#define STATUS_WORD(rpl, ipl) (((ipl) << 8) | (rpl))
#define USERMODE(x) (((x) & 3) == 3)
#define BASEPRI(x) (((x) & (255 << 8)) == 0)
#define DELAY(n) delay(n)
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _ARM_PARAM_H_ */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/arm/arch.h | /*
* Copyright (c) 2007 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _ARM_ARCH_H
#define _ARM_ARCH_H
#if defined (__arm__) || defined (__arm64__)
/* Collect the __ARM_ARCH_*__ compiler flags into something easier to use. */
#if defined (__ARM_ARCH_7A__) || defined (__ARM_ARCH_7S__) || defined (__ARM_ARCH_7F__) || defined (__ARM_ARCH_7K__)
#define _ARM_ARCH_7
#endif
#if defined (_ARM_ARCH_7) || defined (__ARM_ARCH_6K__) || defined (__ARM_ARCH_6ZK__)
#define _ARM_ARCH_6K
#endif
#if defined (_ARM_ARCH_7) || defined (__ARM_ARCH_6Z__) || defined (__ARM_ARCH_6ZK__)
#define _ARM_ARCH_6Z
#endif
#if defined (__ARM_ARCH_6__) || defined (__ARM_ARCH_6J__) || \
defined (_ARM_ARCH_6Z) || defined (_ARM_ARCH_6K)
#define _ARM_ARCH_6
#endif
#if defined (_ARM_ARCH_6) || defined (__ARM_ARCH_5E__) || \
defined (__ARM_ARCH_5TE__) || defined (__ARM_ARCH_5TEJ__)
#define _ARM_ARCH_5E
#endif
#if defined (_ARM_ARCH_5E) || defined (__ARM_ARCH_5__) || \
defined (__ARM_ARCH_5T__)
#define _ARM_ARCH_5
#endif
#if defined (_ARM_ARCH_5) || defined (__ARM_ARCH_4T__)
#define _ARM_ARCH_4T
#endif
#if defined (_ARM_ARCH_4T) || defined (__ARM_ARCH_4__)
#define _ARM_ARCH_4
#endif
#endif /* defined (__arm__) || defined (__arm64__) */
#endif
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/arm/profile.h | /*
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
*/
/*
* Copyright (c) 1997, Apple Computer, Inc. All rights reserved.
*
*/
#ifndef _BSD_ARM_PROFILE_H_
#define _BSD_ARM_PROFILE_H_
#if defined (__arm__) || defined (__arm64__)
#include <sys/appleapiopts.h>
#ifdef __APPLE_API_UNSTABLE
/*
* Block interrupts during mcount so that those interrupts can also be
* counted (as soon as we get done with the current counting). On the
* arm platfom, can't do splhigh/splx as those are C routines and can
* recursively invoke mcount.
*/
#warning MCOUNT_* not implemented yet.
#define MCOUNT_INIT
#define MCOUNT_ENTER /* s = splhigh(); */ /* XXX TODO */
#define MCOUNT_EXIT /* (void) splx(s); */ /* XXX TODO */
#endif /* __APPLE_API_UNSTABLE */
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _BSD_ARM_PROFILE_H_ */
|
0 | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers | repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/arm/_param.h | /*
* Copyright (c) 2006-2007 Apple Inc. All rights reserved.
*/
#ifndef _ARM__PARAM_H_
#define _ARM__PARAM_H_
#if defined (__arm__) || defined (__arm64__)
#include <arm/_types.h>
/*
* Round p (pointer or byte index) up to a correctly-aligned value for all
* data types (int, long, ...). The result is unsigned int and must be
* cast to any desired pointer type.
*/
#define __DARWIN_ALIGNBYTES (sizeof(__darwin_size_t) - 1)
#define __DARWIN_ALIGN(p) ((__darwin_size_t)((__darwin_size_t)(p) + __DARWIN_ALIGNBYTES) &~ __DARWIN_ALIGNBYTES)
#define __DARWIN_ALIGNBYTES32 (sizeof(__uint32_t) - 1)
#define __DARWIN_ALIGN32(p) ((__darwin_size_t)((__darwin_size_t)(p) + __DARWIN_ALIGNBYTES32) &~ __DARWIN_ALIGNBYTES32)
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _ARM__PARAM_H_ */
|
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.