00001 /* Dazuko Transport. Types shared between userspace and kernelspace. 00002 Written by John Ogness <jogness@antivir.de> 00003 00004 Copyright (c) 2004, 2005 H+BEDV Datentechnik GmbH 00005 All rights reserved. 00006 00007 Redistribution and use in source and binary forms, with or without 00008 modification, are permitted provided that the following conditions 00009 are met: 00010 00011 1. Redistributions of source code must retain the above copyright notice, 00012 this list of conditions and the following disclaimer. 00013 00014 2. Redistributions in binary form must reproduce the above copyright notice, 00015 this list of conditions and the following disclaimer in the documentation 00016 and/or other materials provided with the distribution. 00017 00018 3. Neither the name of Dazuko nor the names of its contributors may be used 00019 to endorse or promote products derived from this software without specific 00020 prior written permission. 00021 00022 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00023 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00024 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00025 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00026 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00027 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00028 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00029 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00030 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00031 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00032 POSSIBILITY OF SUCH DAMAGE. 00033 */ 00034 00035 #ifndef DAZUKOIO_TRANSPORT_H 00036 #define DAZUKOIO_TRANSPORT_H 00037 00038 /* various requests */ 00039 #define SET_ACCESS_MASK 0 00040 #define ADD_INCLUDE_PATH 1 00041 #define ADD_EXCLUDE_PATH 2 00042 #define REGISTER 3 00043 #define REMOVE_ALL_PATHS 4 00044 #define UNREGISTER 5 00045 #define GET_AN_ACCESS 6 00046 #define RETURN_AN_ACCESS 7 00047 #define INITIALIZE_CACHE 8 00048 #define REGISTER_TRUSTED 9 00049 #define UNREGISTER_TRUSTED 10 00050 #define REMOVE_ALL_TRUSTED 11 00051 #define REMOVE_TRUSTED 12 00052 00053 /* this is the hard-limit file length restriction from 00054 the 1.x series */ 00055 #define DAZUKO_FILENAME_MAX_LENGTH_COMPAT1 4095 00056 00057 struct dazuko_request 00058 { 00059 char type[2]; 00060 int buffer_size; 00061 char *buffer; 00062 int reply_buffer_size; 00063 char *reply_buffer; 00064 int reply_buffer_size_used; 00065 }; 00066 00067 /* get the size a low level representation can use in maximum */ 00068 int dazuko_reqstream_dim_chunk0(int size_chr, int size_int, int size_ptr); 00069 00070 /* get the chunksize for the given low level representation (represented in the first 4 bytes) */ 00071 int dazuko_reqstream_chunksize(unsigned char *ll, int *size); 00072 00073 /* convert from high level to low level and vice versa */ 00074 int dazuko_reqstream_hl2ll(struct dazuko_request *req, unsigned char *ll); 00075 int dazuko_reqstream_ll2hl(unsigned char *ll, struct dazuko_request *req, int strict); 00076 00077 /* update (patch) a low level stream from its high level template */ 00078 int dazuko_reqstream_updll(struct dazuko_request *req, unsigned char *ll); 00079 00080 /* compat1 ioctls */ 00081 00082 #define IOCTL_SET_OPTION 0 00083 #define IOCTL_GET_AN_ACCESS 1 00084 #define IOCTL_RETURN_ACCESS 2 00085 00086 /* compat1 structures */ 00087 00088 struct access_compat1 00089 { 00090 int deny; /* set to deny file access */ 00091 int event; /* ON_OPEN, etc */ 00092 int o_flags; /* access flags */ 00093 int o_mode; /* access mode */ 00094 int uid; /* user id */ 00095 int pid; /* user process id */ 00096 char filename[DAZUKO_FILENAME_MAX_LENGTH_COMPAT1]; /* accessed file */ 00097 }; 00098 00099 struct option_compat1 00100 { 00101 int command; 00102 int buffer_length; 00103 char buffer[DAZUKO_FILENAME_MAX_LENGTH_COMPAT1]; 00104 }; 00105 00106 #endif