saf-env.h

Go to the documentation of this file.
00001 /****************************************************************************
00002  *
00003  * Copyright (C) 2006-2007 Micro Focus (IP) Limited.
00004  * All rights reserved.
00005  *
00006  * The software and information contained herein are proprietary to, and
00007  * comprise valuable trade secrets of, Micro Focus International Ltd., 
00008  * which intends to preserve as trade secrets such software and 
00009  * information. This software is an unpublished copyright of Micro Focus  
00010  * and may not be used, copied, transmitted, or stored in any manner.  
00011  * This software and information or any other copies thereof may not be
00012  * provided or otherwise made available to any other person.
00013  *
00014  *      Enterprise Server SAF (Security) Manager
00015  *      Processing Environment
00016  *
00017  *      @(#)saf-env.h   $Revision: 1.8 $     
00018  *
00019  *      $Date: 2009/04/07 14:56:53 $
00020  *
00021  ****************************************************************************/
00022 
00023 /* Start of source module saf-env.h */
00024 #if !defined(SafENV_H)
00025 #define SafENV_H
00026 
00027 #include <stdarg.h>
00028 
00038 /* Declare structures defined elsewhere */
00039 struct SafInit;
00040 struct SafPTab;
00041 struct SafACEE;
00042 struct SafStore;
00043 
00044 
00051 enum SafMsgLvl
00052 {
00053    SafMsgINFO,       
00054    SafMsgWARN,       
00055    SafMsgERR,        
00056    SafMsgCRIT,       
00057    SafMsgInvalid
00058 };
00059 
00060 
00063 #define SafESM_LCK_CHG    0  
00064 #define SafESM_LCK_HAVE   1  
00065 #define SafESM_LCK_TEST   2  
00066 #define SafESM_LCK_USE    3  
00067 #define SafESM_LCK_NOWAIT 3  
00068 #define SafESM_LCK_NONE   4  
00070 
00071 
00073 #define SafESM_LCK_UOW    11 
00074 #define SafESM_LCK_TASK   12 
00075 #define SafESM_LCK_PROC   13 
00077 
00078 
00080 #define SafESM_LCK_SHR   0   
00081 #define SafESM_LCK_EXCL  1   
00083 
00084 
00090 typedef enum
00091 {
00092    SafLockOK      =  0,    
00093    SafLockOWN     =  1,    
00094    SafLockHELD    =  2,    
00096    SafLockNHELD   =  3,    
00097    SafLockNEXIST  =  4,    
00098    SafLockDENY    =  5,    
00099    SafLockERR     =  6,    
00100    SafLockPARAM   =  7,    
00101    SafLockInvalid
00102 } SafLockRet;
00103 
00104 
00105 /* Processing Environment Interface */
00106 mf_uns32 SafEnvInit(struct SafInit *);
00107 
00108 
00109 /* Processing Environment Functions */
00110 SafRet SafShmOpen(const char *Name, size_t *Size, void **Area);
00111 SafRet SafModLoad(const char *ModPath, struct SafPTab * (**Entry)(void));
00112 SafRet SafModUnload(const char *ModPath);
00113 SafRet SafGetInstPath(char *Path, size_t MaxLen);
00114 SafRet SafLog(int Num, enum SafMsgLvl, const char *DefaultText, ...);
00115 SafRet SafLogLit(int Num, enum SafMsgLvl Level, const char *Text);
00116 SafRet SafAceeAlloc(const char *Name, const char *Group,
00117                     struct SafACEE **AceeP, int *IsNew);
00118 SafRet SafAceeIterate(void *Data, int (*Callback)(struct SafACEE *Acee,
00119                                                   void *Data));
00120 
00121 SafLockRet SafLockEnq(const char *QName, const char *RName, int Type,
00122                       int Exclusive, int Lifetime);
00123 SafLockRet SafThrLock(const char *Name, int Exclusive);
00124 SafLockRet SafShmLock(const char *Name, int Exclusive);
00125 SafLockRet SafLockDeq(const char *QName, const char *RName);
00126 SafLockRet SafThrUnlock(const char *Name);
00127 SafLockRet SafShmUnlock(const char *Name);
00128 
00129 int SafIsMT(void);
00130 int SafIsSharedMemory(void);
00131 int SafStrcmpCI(const char *, const char *);
00132 int SafStrcmpCIN(const char *, const char *, size_t);
00133 char *SafDupStr(const char *);
00134 
00135 /* Associative Store Functions (saf-store.c) */
00136 SafRet SafAllocStore(struct SafStore **StoreP);
00137 SafRet SafFreeStore(struct SafStore *Store);
00138 SafRet SafClearStore(struct SafStore *Store);
00139 SafRet SafStoreRemove(struct SafStore *Store, const char *C, const char *N);
00140 SafRet SafStoreIterate(struct SafStore *Store, const char *Class,
00141                        SafRet (*Visitor)(const char *Class, const char *Name,
00142                                          void *Value, void *Data),
00143                        void *Data, SafRet *VisitorErrP);
00144 SafRet SafStoreAdd(struct SafStore *S, const char *C, const char *N, void *P);
00145 SafRet SafStoreFind(struct SafStore *S, const char *C, const char *N, void **P);
00146 SafRet SafStoreLoad(struct SafStore *Store, const char *Text);
00147 
00148 
00149 /* Utility functions */
00150 int SafVSnprintf(char *Buffer, size_t BufLen, const char *Format, va_list Args);
00151 int SafSnprintf(char *Buffer, size_t BufLen, const char *Format, ...);
00152 
00153 
00154 /* Internal Environment Functions */
00155 SafRet SafGetEnvFunc(int (**FuncP)(), const char *Name, const char *Env);
00156 
00157 #endif
00158 
00159 /* End of saf-env.h */
00160