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.6 $     
00018  *
00019  *      $Date: 2008/07/01 08:32:49 $
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 SafGetInstPath(char *Path, size_t MaxLen);
00113 SafRet SafLog(int Num, enum SafMsgLvl, const char *DefaultText, ...);
00114 SafRet SafLogLit(int Num, enum SafMsgLvl Level, const char *Text);
00115 SafRet SafAceeAlloc(const char *Name, const char *Group,
00116                     struct SafACEE **AceeP, int *IsNew);
00117 SafRet SafAceeIterate(void *Data, int (*Callback)(struct SafACEE *Acee,
00118                                                   void *Data));
00119 
00120 SafLockRet SafLockEnq(const char *QName, const char *RName, int Type,
00121                       int Exclusive, int Lifetime);
00122 SafLockRet SafThrLock(const char *Name, int Exclusive);
00123 SafLockRet SafShmLock(const char *Name, int Exclusive);
00124 SafLockRet SafLockDeq(const char *QName, const char *RName);
00125 SafLockRet SafThrUnlock(const char *Name);
00126 SafLockRet SafShmUnlock(const char *Name);
00127 
00128 int SafIsMT(void);
00129 int SafIsSharedMemory(void);
00130 int SafStrcmpCI(const char *, const char *);
00131 int SafStrcmpCIN(const char *, const char *, size_t);
00132 
00133 /* Associative Store Functions (saf-store.c) */
00134 SafRet SafAllocStore(struct SafStore **StoreP);
00135 SafRet SafFreeStore(struct SafStore *Store);
00136 SafRet SafClearStore(struct SafStore *Store);
00137 SafRet SafStoreRemove(struct SafStore *Store, const char *C, const char *N);
00138 SafRet SafStoreIterate(struct SafStore *Store, const char *Class,
00139                        SafRet (*Visitor)(const char *Class, const char *Name,
00140                                          void *Value, void *Data),
00141                        void *Data, SafRet *VisitorErrP);
00142 SafRet SafStoreAdd(struct SafStore *S, const char *C, const char *N, void *P);
00143 SafRet SafStoreFind(struct SafStore *S, const char *C, const char *N, void **P);
00144 SafRet SafStoreLoad(struct SafStore *Store, const char *Text);
00145 
00146 
00147 /* Utility functions */
00148 int SafVSnprintf(char *Buffer, size_t BufLen, const char *Format, va_list Args);
00149 int SafSnprintf(char *Buffer, size_t BufLen, const char *Format, ...);
00150 
00151 
00152 /* Internal Environment Functions */
00153 SafRet SafGetEnvFunc(int (**FuncP)(), const char *Name, const char *Env);
00154 
00155 #endif
00156 
00157 /* End of saf-env.h */
00158