xace.h revision 05b261ec
1/************************************************************ 2 3Author: Eamon Walsh <ewalsh@epoch.ncsc.mil> 4 5Permission to use, copy, modify, distribute, and sell this software and its 6documentation for any purpose is hereby granted without fee, provided that 7this permission notice appear in supporting documentation. This permission 8notice shall be included in all copies or substantial portions of the 9Software. 10 11THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 12IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 14AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 15AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 16CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 18********************************************************/ 19 20#ifndef _XACE_H 21#define _XACE_H 22 23/* Hook return codes */ 24#define XaceErrorOperation 0 25#define XaceAllowOperation 1 26#define XaceIgnoreOperation 2 27 28#ifdef XACE 29 30#define XACE_EXTENSION_NAME "XAccessControlExtension" 31#define XACE_MAJOR_VERSION 1 32#define XACE_MINOR_VERSION 0 33 34#include "pixmap.h" /* for DrawablePtr */ 35#include "regionstr.h" /* for RegionPtr */ 36 37#define XaceNumberEvents 0 38#define XaceNumberErrors 0 39 40/* security hooks */ 41/* Constants used to identify the available security hooks 42 */ 43#define XACE_CORE_DISPATCH 0 44#define XACE_EXT_DISPATCH 1 45#define XACE_RESOURCE_ACCESS 2 46#define XACE_DEVICE_ACCESS 3 47#define XACE_PROPERTY_ACCESS 4 48#define XACE_DRAWABLE_ACCESS 5 49#define XACE_MAP_ACCESS 6 50#define XACE_BACKGRND_ACCESS 7 51#define XACE_EXT_ACCESS 8 52#define XACE_HOSTLIST_ACCESS 9 53#define XACE_SITE_POLICY 10 54#define XACE_DECLARE_EXT_SECURE 11 55#define XACE_AUTH_AVAIL 12 56#define XACE_KEY_AVAIL 13 57#define XACE_WINDOW_INIT 14 58#define XACE_AUDIT_BEGIN 15 59#define XACE_AUDIT_END 16 60#define XACE_NUM_HOOKS 17 61 62extern CallbackListPtr XaceHooks[XACE_NUM_HOOKS]; 63 64/* Entry point for hook functions. Called by Xserver. 65 */ 66extern int XaceHook( 67 int /*hook*/, 68 ... /*appropriate args for hook*/ 69 ); 70 71/* Register a callback for a given hook. 72 */ 73#define XaceRegisterCallback(hook,callback,data) \ 74 AddCallback(XaceHooks+(hook), callback, data) 75 76/* Unregister an existing callback for a given hook. 77 */ 78#define XaceDeleteCallback(hook,callback,data) \ 79 DeleteCallback(XaceHooks+(hook), callback, data) 80 81 82/* From the original Security extension... 83 */ 84 85extern void XaceCensorImage( 86 ClientPtr client, 87 RegionPtr pVisibleRegion, 88 long widthBytesLine, 89 DrawablePtr pDraw, 90 int x, int y, int w, int h, 91 unsigned int format, 92 char * pBuf 93 ); 94 95#else /* XACE */ 96 97/* Define calls away when XACE is not being built. */ 98 99#ifdef __GNUC__ 100#define XaceHook(args...) XaceAllowOperation 101#define XaceCensorImage(args...) { ; } 102#else 103#define XaceHook(...) XaceAllowOperation 104#define XaceCensorImage(...) { ; } 105#endif 106 107#endif /* XACE */ 108 109#endif /* _XACE_H */ 110