2  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. 
   4  * @APPLE_LICENSE_HEADER_START@ 
   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. 
  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 
  20  * @APPLE_LICENSE_HEADER_END@ 
  22 /* Copyright (c) 1998, 1999 Apple Computer, Inc. All Rights Reserved */ 
  25 #ifndef SYS_KERN_EVENT_H 
  26 #define SYS_KERN_EVENT_H 
  28 #define SYSPROTO_EVENT 1 
  30 #include <sys/ioccom.h> 
  33 #define KEV_SNDSPACE (4 * 1024) 
  34 #define KEV_RECVSPACE (8 * 1024) 
  36 #define KEV_ANY_VENDOR    0 
  37 #define KEV_ANY_CLASS     0 
  38 #define KEV_ANY_SUBCLASS  0 
  44 #define KEV_VENDOR_APPLE        1 
  48  * Definition of top-level classifications 
  51 #define KEV_NETWORK_CLASS 1 
  52 #define KEV_IOKIT_CLASS   2 
  55 struct 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      */ 
  66 #define KEV_MSG_HEADER_SIZE   (6 * sizeof(u_long)) 
  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) 
  81 #define N_KEV_VECTORS     5 
  83 struct kev_d_vectors 
{ 
  85      u_long     data_length
;    /* Length of the event data */ 
  86      void       *data_ptr
;    /* Pointer to event data */ 
  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  */ 
 100 LIST_HEAD(kern_event_head
, kern_event_pcb
); 
 102 struct  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
; 
 107      u_long         subclass_filter
; 
 110 #define sotoevpcb(so)   ((struct kern_event_pcb *)((so)->so_pcb)) 
 113 int  kev_post_msg(struct kev_msg 
*event
);