]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
43866e37 | 6 | * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. |
1c79356b | 7 | * |
43866e37 A |
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 | |
1c79356b A |
17 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
18 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
43866e37 A |
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. | |
1c79356b A |
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 | ||
9bccf70c | 31 | #include <sys/appleapiopts.h> |
1c79356b | 32 | #include <sys/ioccom.h> |
9bccf70c | 33 | #include <sys/sys_domain.h> |
1c79356b A |
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 | |
9bccf70c | 56 | #define KEV_SYSTEM_CLASS 3 |
1c79356b A |
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 | |
9bccf70c | 84 | #ifdef __APPLE_API_UNSTABLE |
1c79356b A |
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 | ||
9bccf70c | 103 | int kev_post_msg(struct kev_msg *event); |
1c79356b | 104 | |
9bccf70c A |
105 | #endif /* ___APPLE_API_UNSTABLE */ |
106 | #ifdef __APPLE_API_PRIVATE | |
1c79356b A |
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 | ||
9bccf70c | 120 | #endif /* __APPLE_API_PRIVATE */ |
1c79356b A |
121 | #endif |
122 | ||
123 | #endif |