security/nss/cmd/lib/pk11table.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/security/nss/cmd/lib/pk11table.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,180 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +#ifndef _PK11_TABLE_H_
     1.8 +#define _PK11_TABLE_H_
     1.9 +
    1.10 +/*
    1.11 + * Supported functions..
    1.12 + */
    1.13 +#include <pkcs11.h>
    1.14 +#include "nspr.h"
    1.15 +#include "prtypes.h"
    1.16 +
    1.17 +typedef enum {
    1.18 +    F_No_Function,
    1.19 +#undef CK_NEED_ARG_LIST
    1.20 +#define CK_PKCS11_FUNCTION_INFO(func) F_##func,
    1.21 +#include "pkcs11f.h"
    1.22 +#undef CK_NEED_ARG_LISt
    1.23 +#undef CK_PKCS11_FUNCTION_INFO
    1.24 +    F_SetVar,
    1.25 +    F_SetStringVar,
    1.26 +    F_NewArray,
    1.27 +    F_NewInitializeArgs,
    1.28 +    F_NewTemplate,
    1.29 +    F_NewMechanism,
    1.30 +    F_BuildTemplate,
    1.31 +    F_SetTemplate,
    1.32 +    F_Print,
    1.33 +    F_SaveVar,
    1.34 +    F_RestoreVar,
    1.35 +    F_Increment,
    1.36 +    F_Decrement,
    1.37 +    F_Delete,
    1.38 +    F_List,
    1.39 +    F_Run,
    1.40 +    F_Load,
    1.41 +    F_Unload,
    1.42 +    F_System,
    1.43 +    F_Loop,
    1.44 +    F_Time,
    1.45 +    F_Help,
    1.46 +    F_Quit,
    1.47 +    F_QuitIf,
    1.48 +    F_QuitIfString
    1.49 +} FunctionType;
    1.50 +
    1.51 +/*
    1.52 + * Supported Argument Types
    1.53 + */
    1.54 +typedef enum {
    1.55 +    ArgNone,
    1.56 +    ArgVar,
    1.57 +    ArgULong,
    1.58 +    ArgChar,
    1.59 +    ArgUTF8,
    1.60 +    ArgInfo,
    1.61 +    ArgSlotInfo,
    1.62 +    ArgTokenInfo,
    1.63 +    ArgSessionInfo,
    1.64 +    ArgAttribute,
    1.65 +    ArgMechanism,
    1.66 +    ArgMechanismInfo,
    1.67 +    ArgInitializeArgs,
    1.68 +    ArgFunctionList,
    1.69 +/* Modifier Flags */
    1.70 +    ArgMask = 0xff,
    1.71 +    ArgOut = 0x100,
    1.72 +    ArgArray = 0x200,
    1.73 +    ArgNew = 0x400,
    1.74 +    ArgFile = 0x800,
    1.75 +    ArgStatic = 0x1000,
    1.76 +    ArgOpt = 0x2000,
    1.77 +    ArgFull = 0x4000
    1.78 +} ArgType;
    1.79 +
    1.80 +typedef enum _constType
    1.81 +{
    1.82 +    ConstNone,
    1.83 +    ConstBool,
    1.84 +    ConstInfoFlags,
    1.85 +    ConstSlotFlags,
    1.86 +    ConstTokenFlags,
    1.87 +    ConstSessionFlags,
    1.88 +    ConstMechanismFlags,
    1.89 +    ConstInitializeFlags,
    1.90 +    ConstUsers,
    1.91 +    ConstSessionState,
    1.92 +    ConstObject,
    1.93 +    ConstHardware,
    1.94 +    ConstKeyType,
    1.95 +    ConstCertType,
    1.96 +    ConstAttribute,
    1.97 +    ConstMechanism,
    1.98 +    ConstResult,
    1.99 +    ConstTrust,
   1.100 +    ConstAvailableSizes,
   1.101 +    ConstCurrentSize
   1.102 +} ConstType;
   1.103 +
   1.104 +typedef struct _constant {
   1.105 +    const char *name;
   1.106 +    CK_ULONG value;
   1.107 +    ConstType type;
   1.108 +    ConstType attrType;
   1.109 +} Constant ;
   1.110 +
   1.111 +/*
   1.112 + * Values structures.
   1.113 + */
   1.114 +typedef struct _values {
   1.115 +    ArgType	type;
   1.116 +    ConstType	constType;
   1.117 +    int		size;
   1.118 +    char	*filename;
   1.119 +    void	*data;
   1.120 +    int 	reference;
   1.121 +    int		arraySize;
   1.122 +} Value;
   1.123 +
   1.124 +/*
   1.125 + * Variables
   1.126 + */
   1.127 +typedef struct _variable Variable;
   1.128 +struct _variable {
   1.129 +    Variable *next;
   1.130 +    char *vname;
   1.131 +    Value *value;
   1.132 +};
   1.133 +
   1.134 +/* NOTE: if you change MAX_ARGS, you need to change the commands array
   1.135 + * below as well.
   1.136 + */
   1.137 +
   1.138 +#define MAX_ARGS 10
   1.139 +/*
   1.140 + * structure for master command array
   1.141 + */
   1.142 +typedef struct _commands {
   1.143 +    char	*fname;
   1.144 +    FunctionType	fType;
   1.145 +    char	*helpString;
   1.146 +    ArgType	args[MAX_ARGS];
   1.147 +} Commands;
   1.148 +
   1.149 +typedef struct _module {
   1.150 +    PRLibrary *library;
   1.151 +    CK_FUNCTION_LIST *functionList;
   1.152 +} Module;
   1.153 +
   1.154 +typedef struct _topics {
   1.155 +    char	*name;
   1.156 +    char	*helpString;
   1.157 +} Topics;
   1.158 +
   1.159 +/*
   1.160 + * the command array itself. Make name to function and it's arguments
   1.161 + */
   1.162 +
   1.163 +extern const char **valueString;
   1.164 +extern const int valueCount;
   1.165 +extern const char **constTypeString;
   1.166 +extern const int constTypeCount;
   1.167 +extern const Constant *consts;
   1.168 +extern const int constCount;
   1.169 +extern const Commands *commands;
   1.170 +extern const int commandCount;
   1.171 +extern const Topics *topics;
   1.172 +extern const int topicCount;
   1.173 +
   1.174 +extern const char *
   1.175 +getName(CK_ULONG value, ConstType type);
   1.176 +
   1.177 +extern const char *
   1.178 +getNameFromAttribute(CK_ATTRIBUTE_TYPE type);
   1.179 +
   1.180 +extern int totalKnownType(ConstType type);
   1.181 +
   1.182 +#endif /* _PK11_TABLE_H_ */
   1.183 +

mercurial