]> git.saurik.com Git - apple/xnu.git/blame - bsd/sys/sys_domain.h
xnu-1504.3.12.tar.gz
[apple/xnu.git] / bsd / sys / sys_domain.h
CommitLineData
1c79356b 1/*
5d5c5d0d
A
2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
3 *
2d21ac55 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
1c79356b 5 *
2d21ac55
A
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
8f6c56a5 14 *
2d21ac55
A
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
8f6c56a5
A
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2d21ac55
A
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
8f6c56a5 25 *
2d21ac55 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
1c79356b 27 */
1c79356b 28
9bccf70c
A
29
30#ifndef _SYSTEM_DOMAIN_H_
31#define _SYSTEM_DOMAIN_H_
32
33
34#include <sys/appleapiopts.h>
91447636 35#include <sys/cdefs.h>
0c530ab8
A
36#include <sys/types.h>
37
38#ifdef KERNEL_PRIVATE
39#include <sys/queue.h>
40#include <libkern/locks.h>
41#include <sys/kern_control.h>
42#endif /* KERNEL_PRIVATE */
9bccf70c
A
43
44/* Kernel Events Protocol */
45#define SYSPROTO_EVENT 1 /* kernel events protocol */
46
47/* Kernel Control Protocol */
48#define SYSPROTO_CONTROL 2 /* kernel control protocol */
49#define AF_SYS_CONTROL 2 /* corresponding sub address type */
50
51/* System family socket address */
52struct sockaddr_sys
1c79356b 53{
0c530ab8
A
54 u_char ss_len; /* sizeof(struct sockaddr_sys) */
55 u_char ss_family; /* AF_SYSTEM */
56 u_int16_t ss_sysaddr; /* protocol address in AF_SYSTEM */
57 u_int32_t ss_reserved[7]; /* reserved to the protocol use */
9bccf70c
A
58};
59
60
91447636 61#ifdef KERNEL_PRIVATE
9bccf70c 62
0c530ab8
A
63/*
64 * internal structure maintained for each register controller
65 */
66struct ctl_cb;
67struct socket;
68
69struct kctl
70{
71 TAILQ_ENTRY(kctl) next; /* controller chain */
72
73 /* controller information provided when registering */
74 char name[MAX_KCTL_NAME]; /* unique nke identifier, provided by DTS */
75 u_int32_t id;
76 u_int32_t reg_unit;
77
78 /* misc communication information */
79 u_int32_t flags; /* support flags */
80 u_int32_t recvbufsize; /* request more than the default buffer size */
81 u_int32_t sendbufsize; /* request more than the default buffer size */
82
83 /* Dispatch functions */
84 ctl_connect_func connect; /* Make contact */
85 ctl_disconnect_func disconnect; /* Break contact */
86 ctl_send_func send; /* Send data to nke */
87 ctl_setopt_func setopt; /* set kctl configuration */
88 ctl_getopt_func getopt; /* get kctl configuration */
89
90 TAILQ_HEAD(, ctl_cb) kcb_head;
91 u_int32_t lastunit;
92};
93
94struct ctl_cb {
95 TAILQ_ENTRY(ctl_cb) next; /* controller chain */
96 lck_mtx_t *mtx;
97 struct socket *so; /* controlling socket */
98 struct kctl *kctl; /* back pointer to controller */
99 u_int32_t unit;
100 void *userdata;
101};
102
103
9bccf70c
A
104extern struct domain systemdomain;
105
106/* built in system domain protocols init function */
91447636 107__BEGIN_DECLS
2d21ac55
A
108int kern_event_init(void) __attribute__((section("__TEXT, initcode")));
109int kern_control_init(void) __attribute__((section("__TEXT, initcode")));
91447636 110__END_DECLS
9bccf70c 111
91447636 112#endif /* KERNEL_PRIVATE */
9bccf70c
A
113
114#endif /* _SYSTEM_DOMAIN_H_ */
115
116