]> git.saurik.com Git - apple/xnu.git/blob - bsd/sys/kern_event.h
xnu-517.tar.gz
[apple/xnu.git] / bsd / sys / kern_event.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25 /* Copyright (c) 1998, 1999 Apple Computer, Inc. All Rights Reserved */
26
27
28 #ifndef SYS_KERN_EVENT_H
29 #define SYS_KERN_EVENT_H
30
31 #include <sys/appleapiopts.h>
32 #include <sys/ioccom.h>
33 #include <sys/sys_domain.h>
34
35 #define KEVENTS_ON 1
36 #define KEV_SNDSPACE (4 * 1024)
37 #define KEV_RECVSPACE (8 * 1024)
38
39 #define KEV_ANY_VENDOR 0
40 #define KEV_ANY_CLASS 0
41 #define KEV_ANY_SUBCLASS 0
42
43 /*
44 * Vendor Code
45 */
46
47 #define KEV_VENDOR_APPLE 1
48
49
50 /*
51 * Definition of top-level classifications
52 */
53
54 #define KEV_NETWORK_CLASS 1
55 #define KEV_IOKIT_CLASS 2
56 #define KEV_SYSTEM_CLASS 3
57
58
59 struct kern_event_msg {
60 u_long total_size; /* Size of entire event msg */
61 u_long vendor_code; /* For non-Apple extensibility */
62 u_long kev_class; /* Layer of event source */
63 u_long kev_subclass; /* Component within layer */
64 u_long id; /* Monotonically increasing value */
65 u_long event_code; /* unique code */
66 u_long event_data[1]; /* One or more data longwords */
67
68 };
69
70 #define KEV_MSG_HEADER_SIZE (6 * sizeof(u_long))
71
72
73 struct kev_request {
74 u_long vendor_code;
75 u_long kev_class;
76 u_long kev_subclass;
77 };
78
79 #define SIOCGKEVID _IOR('e', 1, u_long)
80 #define SIOCSKEVFILT _IOW('e', 2, struct kev_request)
81 #define SIOCGKEVFILT _IOR('e', 3, struct kev_request)
82
83 #ifdef KERNEL
84 #ifdef __APPLE_API_UNSTABLE
85
86 #define N_KEV_VECTORS 5
87
88 struct kev_d_vectors {
89
90 u_long data_length; /* Length of the event data */
91 void *data_ptr; /* Pointer to event data */
92 };
93
94
95 struct kev_msg {
96 u_long vendor_code; /* For non-Apple extensibility */
97 u_long kev_class; /* Layer of event source */
98 u_long kev_subclass; /* Component within layer */
99 u_long event_code; /* The event code */
100 struct kev_d_vectors dv[N_KEV_VECTORS]; /* Up to n data vectors */
101 };
102
103 int kev_post_msg(struct kev_msg *event);
104
105 #endif /* ___APPLE_API_UNSTABLE */
106 #ifdef __APPLE_API_PRIVATE
107
108 LIST_HEAD(kern_event_head, kern_event_pcb);
109
110 struct kern_event_pcb {
111 LIST_ENTRY(kern_event_pcb) ev_link; /* glue on list of all PCBs */
112 struct socket *ev_socket; /* pointer back to socket */
113 u_long vendor_code_filter;
114 u_long class_filter;
115 u_long subclass_filter;
116 };
117
118 #define sotoevpcb(so) ((struct kern_event_pcb *)((so)->so_pcb))
119
120 #endif /* __APPLE_API_PRIVATE */
121 #endif
122
123 #endif