Main Page | Modules | Namespace List | Class Hierarchy | Data Structures | Directories | File List | Namespace Members | Data Fields | Globals

lsm_dev.h

Go to the documentation of this file.
00001 /* lsm_dev.h
00002 
00003 Copyright 2006, ACCESS Systems Americas, Inc. All rights reserved.
00004 
00005 The contents of this file are subject to the Mozilla Public License Version
00006 1.1 (the "License"); you may not use this file except in compliance with
00007 the License. You may obtain a copy of the License at
00008 http://www.mozilla.org/MPL/
00009 
00010 Software distributed under the License is distributed on an "AS IS" basis,
00011 WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012 for the specific language governing rights and limitations under the
00013 License.
00014 
00015 The Original Code is the entire contents of this file.
00016 
00017 The Initial Developer of the Original Code is ACCESS Systems Americas, Inc.
00018 
00019 Portions created by ACCESS Systems Americas, Inc. are Copyright © 2006. All
00020 Rights Reserved.
00021 
00022 Contributor(s): none.
00023 
00024  * 
00025  * This header file contains the common structures for
00026  * Kernel Module access to /dev/Security device
00027  * portions of this code comes from the book "Linux Device
00028  * Drivers" by Alessandro Rubini and Jonathan Corbet, published
00029  * by O'Reilly & Associates. licensed under BSD/GPL.
00030 */
00031 
00032 #ifndef _LSM_DEV_H_
00033 #define _LSM_DEV_H_
00034 
00035 #ifdef __cplusplus
00036 extern "C" {
00037 #endif /* __cplusplus */
00038 
00039 #undef PDEBUG             /* undef it, just in case */
00040 #ifdef LSMDEV_DEBUG
00041 #  ifdef __KERNEL__
00042      /* This one if debugging is on, and kernel space */
00043 #    define PDEBUG(fmt, args...) printk( KERN_DEBUG "scull: " fmt, ## args)
00044 #  else
00045      /* This one for user space */
00046 #    define PDEBUG(fmt, args...) fprintf(stderr, fmt, ## args)
00047 #  endif
00048 #else
00049 #  define PDEBUG(fmt, args...) /* not debugging: nothing */
00050 #endif
00051 
00052 
00053 #ifndef LSMDEV_MAJOR
00054 #define LSMDEV_MAJOR 0
00055 #endif
00056 
00057 #ifndef LSMDEV_IN_MINOR
00058 #define LSMDEV_IN_MINOR  0
00059 #endif
00060 
00061 #ifndef LSMDEV_OUT_MINOR
00062 #define LSMDEV_OUT_MINOR (LSMDEV_IN_MINOR + 1)
00063 #endif
00064 
00065 #ifndef LSMDEV_UID
00066 #define LSMDEV_UID 105
00067 #endif
00068 
00069 #define SPF_LSM_DEV_OUT                 "/dev/security_out"
00070 
00071 /* Resource Types for UI requests (bit mask) */
00072 #define LSMSPF_OBJTYPE_INODE    0x00000001      /* Inode ACL Set */
00073 #define LSMSPF_OBJTYPE_IPV4             0x00000002      /* IPv4 ACL Set */
00074 #define LSMSPF_OBJTYPE_INET             0x00000004      /* AF_INET SFlag Modifier */
00075 #define LSMSPF_OBJTYPE_IRDA             0x00000008      /* IRDA SFlag Modifier */
00076 #define LSMSPF_OBJTYPE_BLUE             0x00000010      /* BLUETOOTH SFlag Modifier */
00077 #define LSMSPF_OBJTYPE_UNIX             0x00000020      /* IPC SFlag Modifier */
00078 #define LSMSPF_OBJTYPE_CONNECT  0x00000040      /* Socket Connect SFlag */
00079 #define LSMSPF_OBJTYPE_LISTEN   0x00000080      /* Socket Listen SFlag */
00080 
00081 /* standard UI request message structure */
00082 typedef struct Alp_lsmUI_unit {
00083         u_int32_t       app_id;         /* Application Identifier */
00084         u_int32_t       policy_id;      /* ACL Set Identifier */
00085         u_int32_t       uid_id;         /* UID of process thread */
00086         u_int32_t       process_id;     /* PID thread process identifier */
00087         u_int32_t       obj_type;       /* Resource Type */
00088         u_int32_t       object_id1;     /* identifier 1 (if applicable) */
00089         u_int32_t       object_id2;     /* identifier 2 (if applicable) */
00090 } Alp_lsmUI_unit;
00091 
00092 #  ifdef __KERNEL__
00093 extern wait_queue_head_t perm_validatee_q;
00094 
00095 /* lsmDev_add_to_outq
00096  * This call will add a UI request message to the Out Queue
00097  *
00098  * Inputs:
00099  * uint32_t app_id:     Application Package Identifier
00100  * uint32_t policy_id:  Policy ID that is being applied
00101  * uint32_t obj_type:   Resource type in question
00102  * uint32_t object_id1: First Object identifier
00103  * uint32_t object_id2: Second Object Identifier
00104  * pid_t pid_id:        PID of the process
00105  * uid_t uid_id         UID of the proces
00106  *
00107  * Side-effects
00108  * Writes to Module output buffer, sets up for User Space Read of queue
00109  *
00110  * Returns int
00111  */
00112 int lsmDev_add_to_outq(
00113                 uint32_t app_id,                /* App Pkg Identifier */
00114                 uint32_t policy_id,             /* ACL Set ID */
00115                 uint32_t obj_type,              /* Inode? Network? */
00116                 uint32_t object_id1,    /* First object identifier */
00117                 uint32_t object_id2,    /* Sec object identifier */
00118                 pid_t pid_id,                   /* PID of thread */
00119                 uid_t uid_id);                  /* UID of thread */
00120 
00121 int prv_lsmDev_init_module(void);
00122 void prv_lsmDev_cleanup(void);
00123 
00124 
00125 #endif /* __KERNEL__ */
00126 
00127 #ifdef __cplusplus
00128 }
00129 #endif /* __cplusplus */
00130 
00131 #endif /* LSM_DEV */

Generated on Sat Dec 16 20:29:47 2006 for hiker-0.9 by  doxygen 1.4.4