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