⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pkcsslotd.h

📁 IBM的Linux上的PKCS#11实现
💻 H
📖 第 1 页 / 共 2 页
字号:
             States of America. No party to this Agreement will bring a             legal action under this Agreement more than one year after             the cause of action arose. Each party waives its rights to             a jury trial in any resulting litigation. *//* (C) COPYRIGHT International Business Machines Corp. 2001          *//*********************************************************************** *  *  Slot Manager Daemon header file *  ***********************************************************************/#pragma info(none)#ifndef _PKCSSLOTMGR_H#define _PKCSSLOTMGR_H 1#ifndef TEST_MUTEXES  #define TEST_MUTEXES 0#endif /* TEST_MUTEXES *//***************** * Include Files * *****************//********************************************************************************************************** * According to: http://www.rs6000.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/genprogc/multi-thread_prg.htm *  * The pthread.h header file must be the first included file of each source file using the threads library, * because it defines some important macros that affect other header files. Having the pthread.h header * file as the first included file ensures the usage of thread-safe subroutines.  **********************************************************************************************************/#include <pthread.h>#include <ctype.h>#ifndef NODAE#include <dae.h> // SAB XXX remove dependency on libdae#endif#include <dlfcn.h>#include <errno.h>#include <libgen.h>#include <local_types.h>#include <memory.h>#ifndef NOODM  // SAB XXX removed ODM dependency#include <odmi.h>#endif#include <pkcs11types.h> #ifdef AIX#include <procinfo.h>#endif#include <signal.h>#include <stdarg.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <syslog.h>#include <time.h>#include <unistd.h>#include <locale.h>#include <nl_types.h>#include <sys/ipc.h>#if defined(AIX)#include <sys/limits.h>#include <sys/mode.h>#else#if defined(LINUX)#include <linux/limits.h>#endif#endif#include <sys/shm.h>#include <sys/stat.h>#include <sys/types.h>#include "log.h"#include <slotmgr.h>/* include err.h last because it needs to see variables defined in order for it to work properly */#include "err.h" /*******  * NLS *  *******/#include "slotd_msg.h"#if !defined(NOGARBAGE)#if (AIX)int getprocs (struct procsinfo64 *ProcessBuffer, int ProcessSize, struct fdsinfo *FileBuffer, int FileSize, pid_t *IndexPointer, int Count);#endif#endif#define MSG_SET MS_SLOTDnl_catd catd;#define SLOTD_MSG(n,s) catgets(catd,MSG_SET,n,s)/*********** * Defines * ***********/#ifdef DEV    #ifndef BECOME_DAEMON        #define BECOME_DAEMON          FALSE    #endif /* BECOME_DAEMON */    #ifndef DEFAULT_LOG_FILE        #define DEFAULT_LOG_FILE   (TOK_PATH ".log")    #endif /* DEFAULT_LOG_FILE */    #ifndef DEFAULT_DEBUG_LEVEL      #define DEFAULT_DEBUG_LEVEL DEBUG_LEVEL0    #endif /* DEFAULT_DEBUG_LEVEL */#else /* DEV not defined */    #define BECOME_DAEMON          TRUE    #define DEFAULT_DEBUG_LEVEL    DEBUG_NONE#endif /* DEV */#ifndef PER_PROCESS_MUTEXES  #define PER_PROCESS_MUTEXES 0#endif/******************** * Global Variables * ********************/#ifdef SLOTD_DECLARE_VARS    FILE                         *logfile;  // global variable for the logger    Slot_Mgr_Shr_t               *shmp;     // pointer to the shared memory region.    int                          shmid;    key_t                        tok;    pthread_mutexattr_t          mtxattr;   // Mutex attribute for the shared memory Mutex#if 1#ifdef PKCS64    Slot_Info_t_64               sinfo[NUMBER_SLOTS_MANAGED];#else    Slot_Info_t                  sinfo[NUMBER_SLOTS_MANAGED];#endif#else    // Temporarily hardcode the entries into the sinfo table#ifdef PKCS64    Slot_Info_t_64    sinfo[NUMBER_SLOTS_MANAGED] = {#else    Slot_Info_t    sinfo[NUMBER_SLOTS_MANAGED] = {#endif      {0,TRUE,       {"IBM AIX Proto Slot 0",        "DEEP",        CKF_TOKEN_PRESENT, {0,0},{1,1} },        "/usr/lib/pkcs11/stdll/PKCS11_4758.so","SC_Initialize","0",0},      {1,TRUE,       {"IBM AIX Proto Slot 0",        "DEEP",        CKF_TOKEN_PRESENT, {0,0},{1,1} },        "/usr/lib/pkcs11/stdll/PKCS11_4758.so","SC_Initialize","1",0},      //{1,TRUE,      // {"IBM AIX Proto Slot 1",      //  "SHALLOW",      //  CKF_TOKEN_PRESENT, {0,0},{1,1} },      //  "/usr/lib/pkcs11/stdll/PKCS11_LW.so","LW_Initialize","0",0},             // Last entry....      {0,FALSE,         {"0", "0", 0, {0,0},{0,0} }, NULL,NULL,NULL,0 }    }; #endif    unsigned char                NumberSlotsInDB = 0;#else    extern FILE                  *logfile;  // global variable for the logger    extern Slot_Mgr_Shr_t        *shmp;     // pointer to the shared memory region.    extern int                    shmid;    extern key_t                  tok;    extern pthread_mutexattr_t    mtxattr;  // Mutex attribute for the shared memory Mutex#ifdef PKCS64    extern Slot_Info_t_64            sinfo[NUMBER_SLOTS_MANAGED];#else    extern Slot_Info_t            sinfo[NUMBER_SLOTS_MANAGED];#endif    extern unsigned char          NumberSlotsInDB;#endif /* SLOTD_DECLARE_VARS *//*********************** * Function Prototypes * ***********************//* System non-prototyped functions causing warnings *//* Still throws a warning; sigh - SCM *//* int             *_Errno();*/   /* pointer to function which returns int *//* daemon.c */BOOL                   IsDaemon ( void );BOOL                   GetStartDirectory ( char *Buffer, u_int32 BufSize );BOOL                   SaveStartupDirectory ( char *Arg0 );/* garbage.c */BOOL                   StopGCThread    ( void *Ptr );BOOL                   StartGCThread   ( Slot_Mgr_Shr_t *MemPtr );BOOL                   CheckForGarbage ( Slot_Mgr_Shr_t *MemPtr );/* mutex.c */int                    InitializeMutexes ( void );int                    DestroyMutexes ( void );#if TEST_COND_VARS  BOOL                 DestroyConditionVariables ( void );  BOOL                 InitializeConditionVariables ( void );#endif /* TEST_COND_VARS *//* shmem.c */int                    CreateSharedMemory ( void );int                    AttachToSharedMemeory ( void );int                    InitSharedMemory ( Slot_Mgr_Shr_t *sp );void                   DetachFromSharedMemory ( void );void                   DestroySharedMemory ( void );/* signal.c */int                    SetupSignalHandlers ( void );void                   slotdGenericSignalHandler( int Signal );/* odm.c */BOOL                   ReadSlotInfoDB ( void );/* Cross Process locking */int  XProcLock(void *);int  XProcUnLock(void *);int  CreateXProcLock(void *);int  DestroyXProcLock(void *);#endif /* _SLOTMGR_H */#pragma info(restore)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -