]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
39236c6e | 2 | * Copyright (c) 2000-2005, 2012 Apple Inc. All rights reserved. |
5d5c5d0d | 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 */ | |
52 | struct 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 | */ | |
66 | struct ctl_cb; | |
67 | struct socket; | |
68 | ||
69 | struct 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 */ | |
39236c6e | 89 | ctl_rcvd_func rcvd; /* Notify nke when client reads data */ |
0c530ab8 A |
90 | |
91 | TAILQ_HEAD(, ctl_cb) kcb_head; | |
92 | u_int32_t lastunit; | |
93 | }; | |
94 | ||
95 | struct ctl_cb { | |
96 | TAILQ_ENTRY(ctl_cb) next; /* controller chain */ | |
97 | lck_mtx_t *mtx; | |
98 | struct socket *so; /* controlling socket */ | |
99 | struct kctl *kctl; /* back pointer to controller */ | |
0c530ab8 | 100 | void *userdata; |
6d2010ae A |
101 | u_int32_t unit; |
102 | u_int32_t usecount; | |
0c530ab8 A |
103 | }; |
104 | ||
39236c6e | 105 | extern struct domain *systemdomain; |
9bccf70c A |
106 | |
107 | /* built in system domain protocols init function */ | |
91447636 | 108 | __BEGIN_DECLS |
39236c6e A |
109 | void kern_event_init(struct domain *); |
110 | void kern_control_init(struct domain *); | |
91447636 | 111 | __END_DECLS |
9bccf70c | 112 | |
91447636 | 113 | #endif /* KERNEL_PRIVATE */ |
9bccf70c A |
114 | |
115 | #endif /* _SYSTEM_DOMAIN_H_ */ | |
116 | ||
117 |