michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: #ifndef _PK11_TABLE_H_ michael@0: #define _PK11_TABLE_H_ michael@0: michael@0: /* michael@0: * Supported functions.. michael@0: */ michael@0: #include michael@0: #include "nspr.h" michael@0: #include "prtypes.h" michael@0: michael@0: typedef enum { michael@0: F_No_Function, michael@0: #undef CK_NEED_ARG_LIST michael@0: #define CK_PKCS11_FUNCTION_INFO(func) F_##func, michael@0: #include "pkcs11f.h" michael@0: #undef CK_NEED_ARG_LISt michael@0: #undef CK_PKCS11_FUNCTION_INFO michael@0: F_SetVar, michael@0: F_SetStringVar, michael@0: F_NewArray, michael@0: F_NewInitializeArgs, michael@0: F_NewTemplate, michael@0: F_NewMechanism, michael@0: F_BuildTemplate, michael@0: F_SetTemplate, michael@0: F_Print, michael@0: F_SaveVar, michael@0: F_RestoreVar, michael@0: F_Increment, michael@0: F_Decrement, michael@0: F_Delete, michael@0: F_List, michael@0: F_Run, michael@0: F_Load, michael@0: F_Unload, michael@0: F_System, michael@0: F_Loop, michael@0: F_Time, michael@0: F_Help, michael@0: F_Quit, michael@0: F_QuitIf, michael@0: F_QuitIfString michael@0: } FunctionType; michael@0: michael@0: /* michael@0: * Supported Argument Types michael@0: */ michael@0: typedef enum { michael@0: ArgNone, michael@0: ArgVar, michael@0: ArgULong, michael@0: ArgChar, michael@0: ArgUTF8, michael@0: ArgInfo, michael@0: ArgSlotInfo, michael@0: ArgTokenInfo, michael@0: ArgSessionInfo, michael@0: ArgAttribute, michael@0: ArgMechanism, michael@0: ArgMechanismInfo, michael@0: ArgInitializeArgs, michael@0: ArgFunctionList, michael@0: /* Modifier Flags */ michael@0: ArgMask = 0xff, michael@0: ArgOut = 0x100, michael@0: ArgArray = 0x200, michael@0: ArgNew = 0x400, michael@0: ArgFile = 0x800, michael@0: ArgStatic = 0x1000, michael@0: ArgOpt = 0x2000, michael@0: ArgFull = 0x4000 michael@0: } ArgType; michael@0: michael@0: typedef enum _constType michael@0: { michael@0: ConstNone, michael@0: ConstBool, michael@0: ConstInfoFlags, michael@0: ConstSlotFlags, michael@0: ConstTokenFlags, michael@0: ConstSessionFlags, michael@0: ConstMechanismFlags, michael@0: ConstInitializeFlags, michael@0: ConstUsers, michael@0: ConstSessionState, michael@0: ConstObject, michael@0: ConstHardware, michael@0: ConstKeyType, michael@0: ConstCertType, michael@0: ConstAttribute, michael@0: ConstMechanism, michael@0: ConstResult, michael@0: ConstTrust, michael@0: ConstAvailableSizes, michael@0: ConstCurrentSize michael@0: } ConstType; michael@0: michael@0: typedef struct _constant { michael@0: const char *name; michael@0: CK_ULONG value; michael@0: ConstType type; michael@0: ConstType attrType; michael@0: } Constant ; michael@0: michael@0: /* michael@0: * Values structures. michael@0: */ michael@0: typedef struct _values { michael@0: ArgType type; michael@0: ConstType constType; michael@0: int size; michael@0: char *filename; michael@0: void *data; michael@0: int reference; michael@0: int arraySize; michael@0: } Value; michael@0: michael@0: /* michael@0: * Variables michael@0: */ michael@0: typedef struct _variable Variable; michael@0: struct _variable { michael@0: Variable *next; michael@0: char *vname; michael@0: Value *value; michael@0: }; michael@0: michael@0: /* NOTE: if you change MAX_ARGS, you need to change the commands array michael@0: * below as well. michael@0: */ michael@0: michael@0: #define MAX_ARGS 10 michael@0: /* michael@0: * structure for master command array michael@0: */ michael@0: typedef struct _commands { michael@0: char *fname; michael@0: FunctionType fType; michael@0: char *helpString; michael@0: ArgType args[MAX_ARGS]; michael@0: } Commands; michael@0: michael@0: typedef struct _module { michael@0: PRLibrary *library; michael@0: CK_FUNCTION_LIST *functionList; michael@0: } Module; michael@0: michael@0: typedef struct _topics { michael@0: char *name; michael@0: char *helpString; michael@0: } Topics; michael@0: michael@0: /* michael@0: * the command array itself. Make name to function and it's arguments michael@0: */ michael@0: michael@0: extern const char **valueString; michael@0: extern const int valueCount; michael@0: extern const char **constTypeString; michael@0: extern const int constTypeCount; michael@0: extern const Constant *consts; michael@0: extern const int constCount; michael@0: extern const Commands *commands; michael@0: extern const int commandCount; michael@0: extern const Topics *topics; michael@0: extern const int topicCount; michael@0: michael@0: extern const char * michael@0: getName(CK_ULONG value, ConstType type); michael@0: michael@0: extern const char * michael@0: getNameFromAttribute(CK_ATTRIBUTE_TYPE type); michael@0: michael@0: extern int totalKnownType(ConstType type); michael@0: michael@0: #endif /* _PK11_TABLE_H_ */ michael@0: