nss: import at 3.0.1 beta 1
[mozilla-nss.git] / security / nss / cmd / pk11util / pk11util.h
blob8a2f4d59215245c565f7a48e586b905688f68e07
2 /*
3 * Supported functions..
4 */
5 #include <pkcs11.h>
6 #include "nspr.h"
7 #include "prtypes.h"
9 typedef enum {
10 F_No_Function,
11 #undef CK_NEED_ARG_LIST
12 #define CK_PKCS11_FUNCTION_INFO(func) F_##func,
13 #include "pkcs11f.h"
14 #undef CK_NEED_ARG_LISt
15 #undef CK_PKCS11_FUNCTION_INFO
16 F_SetVar,
17 F_SetStringVar,
18 F_NewArray,
19 F_NewInitializeArgs,
20 F_NewTemplate,
21 F_NewMechanism,
22 F_BuildTemplate,
23 F_SetTemplate,
24 F_Print,
25 F_SaveVar,
26 F_RestoreVar,
27 F_Increment,
28 F_Decrement,
29 F_Delete,
30 F_List,
31 F_Run,
32 F_Load,
33 F_Unload,
34 F_System,
35 F_Loop,
36 F_Time,
37 F_Help,
38 F_Quit,
39 F_QuitIf,
40 F_QuitIfString,
41 } FunctionType;
44 * Supported Argument Types
46 typedef enum {
47 ArgNone,
48 ArgVar,
49 ArgULong,
50 ArgChar,
51 ArgUTF8,
52 ArgInfo,
53 ArgSlotInfo,
54 ArgTokenInfo,
55 ArgSessionInfo,
56 ArgAttribute,
57 ArgMechanism,
58 ArgMechanismInfo,
59 ArgInitializeArgs,
60 ArgFunctionList,
61 /* Modifier Flags */
62 ArgMask = 0xff,
63 ArgOut = 0x100,
64 ArgArray = 0x200,
65 ArgNew = 0x400,
66 ArgFile = 0x800,
67 ArgStatic = 0x1000,
68 ArgOpt = 0x2000,
69 ArgFull = 0x4000,
70 } ArgType;
72 typedef enum _constType
74 ConstNone,
75 ConstBool,
76 ConstInfoFlags,
77 ConstSlotFlags,
78 ConstTokenFlags,
79 ConstSessionFlags,
80 ConstMechanismFlags,
81 ConstInitializeFlags,
82 ConstUsers,
83 ConstSessionState,
84 ConstObject,
85 ConstHardware,
86 ConstKeyType,
87 ConstCertType,
88 ConstAttribute,
89 ConstMechanism,
90 ConstResult,
91 ConstTrust,
92 ConstAvailableSizes,
93 ConstCurrentSize
94 } ConstType;
96 typedef struct _constant {
97 const char *name;
98 CK_ULONG value;
99 ConstType type;
100 ConstType attrType;
101 } Constant ;
104 * Values structures.
106 typedef struct _values {
107 ArgType type;
108 ConstType constType;
109 int size;
110 char *filename;
111 void *data;
112 int reference;
113 int arraySize;
114 } Value;
117 * Variables
119 typedef struct _variable Variable;
120 struct _variable {
121 Variable *next;
122 char *vname;
123 Value *value;
126 /* NOTE: if you change MAX_ARGS, you need to change the commands array
127 * below as well.
130 #define MAX_ARGS 10
132 * structure for master command array
134 typedef struct _commands {
135 char *fname;
136 FunctionType fType;
137 char *helpString;
138 ArgType args[MAX_ARGS];
139 } Commands;
141 typedef struct _module {
142 PRLibrary *library;
143 CK_FUNCTION_LIST *functionList;
144 } Module;
146 typedef struct _topics {
147 char *name;
148 char *helpString;
149 } Topics;
152 * the command array itself. Make name to function and it's arguments
155 extern const char **valueString;
156 extern const int valueCount;
157 extern const char **constTypeString;
158 extern const int constTypeCount;
159 extern const Constant *consts;
160 extern const int constCount;
161 extern const Commands *commands;
162 extern const int commandCount;
163 extern const Topics *topics;
164 extern const int topicCount;