]> git.saurik.com Git - apple/xnu.git/blame - bsd/sys/kern_event.h
xnu-201.42.3.tar.gz
[apple/xnu.git] / bsd / sys / kern_event.h
CommitLineData
1c79356b
A
1/*
2 * Copyright (c) 2000 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/* Copyright (c) 1998, 1999 Apple Computer, Inc. All Rights Reserved */
23
24
25#ifndef SYS_KERN_EVENT_H
26#define SYS_KERN_EVENT_H
27
28#define SYSPROTO_EVENT 1
29
30#include <sys/ioccom.h>
31
32#define KEVENTS_ON 1
33#define KEV_SNDSPACE (4 * 1024)
34#define KEV_RECVSPACE (8 * 1024)
35
36#define KEV_ANY_VENDOR 0
37#define KEV_ANY_CLASS 0
38#define KEV_ANY_SUBCLASS 0
39
40/*
41 * Vendor Code
42 */
43
44#define KEV_VENDOR_APPLE 1
45
46
47/*
48 * Definition of top-level classifications
49 */
50
51#define KEV_NETWORK_CLASS 1
52#define KEV_IOKIT_CLASS 2
53
54
55struct kern_event_msg {
56 u_long total_size; /* Size of entire event msg */
57 u_long vendor_code; /* For non-Apple extensibility */
58 u_long kev_class; /* Layer of event source */
59 u_long kev_subclass; /* Component within layer */
60 u_long id; /* Monotonically increasing value */
61 u_long event_code; /* unique code */
62 u_long event_data[1]; /* One or more data longwords */
63
64};
65
66#define KEV_MSG_HEADER_SIZE (6 * sizeof(u_long))
67
68
69struct kev_request {
70 u_long vendor_code;
71 u_long kev_class;
72 u_long kev_subclass;
73};
74
75#define SIOCGKEVID _IOR('e', 1, u_long)
76#define SIOCSKEVFILT _IOW('e', 2, struct kev_request)
77#define SIOCGKEVFILT _IOR('e', 3, struct kev_request)
78
79#ifdef KERNEL
80
81#define N_KEV_VECTORS 5
82
83struct kev_d_vectors {
84
85 u_long data_length; /* Length of the event data */
86 void *data_ptr; /* Pointer to event data */
87};
88
89
90struct kev_msg {
91 u_long vendor_code; /* For non-Apple extensibility */
92 u_long kev_class; /* Layer of event source */
93 u_long kev_subclass; /* Component within layer */
94 u_long event_code; /* The event code */
95 struct kev_d_vectors dv[N_KEV_VECTORS]; /* Up to n data vectors */
96};
97
98
99
100LIST_HEAD(kern_event_head, kern_event_pcb);
101
102struct kern_event_pcb {
103 LIST_ENTRY(kern_event_pcb) ev_link; /* glue on list of all PCBs */
104 struct socket *ev_socket; /* pointer back to socket */
105 u_long vendor_code_filter;
106 u_long class_filter;
107 u_long subclass_filter;
108};
109
110#define sotoevpcb(so) ((struct kern_event_pcb *)((so)->so_pcb))
111
112
113int kev_post_msg(struct kev_msg *event);
114
115#endif
116
117#endif