summaryrefslogtreecommitdiff
path: root/security/nss/cmd/modutil/install-ds.h
blob: 9af6144377688c10edc23b9e044aad29f9907606 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
/* ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is the Netscape security libraries.
 *
 * The Initial Developer of the Original Code is
 * Netscape Communications Corporation.
 * Portions created by the Initial Developer are Copyright (C) 1994-2000
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *
 * Alternatively, the contents of this file may be used under the terms of
 * either the GNU General Public License Version 2 or later (the "GPL"), or
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 * in which case the provisions of the GPL or the LGPL are applicable instead
 * of those above. If you wish to allow use of your version of this file only
 * under the terms of either the GPL or the LGPL, and not to allow others to
 * use your version of this file under the terms of the MPL, indicate your
 * decision by deleting the provisions above and replace them with the notice
 * and other provisions required by the GPL or the LGPL. If you do not delete
 * the provisions above, a recipient may use your version of this file under
 * the terms of any one of the MPL, the GPL or the LGPL.
 *
 * ***** END LICENSE BLOCK ***** */

#ifndef INSTALL_DS_H
#define INSTALL_DS_H

#include <stdio.h>
#include <prio.h>
#include <prmem.h>

extern PRFileDesc *Pk11Install_FD;
extern int Pk11Install_yylex();
extern int Pk11Install_yylinenum;
extern char *Pk11Install_yyerrstr;

typedef enum { STRING_VALUE, PAIR_VALUE } ValueType;

typedef struct Pk11Install_Pair_str Pk11Install_Pair;
typedef union Pk11Install_Pointer_str Pk11Install_Pointer;
typedef struct Pk11Install_Value_str Pk11Install_Value;
typedef struct Pk11Install_ValueList_str Pk11Install_ValueList;
typedef struct Pk11Install_ListIter_str Pk11Install_ListIter;
typedef struct Pk11Install_File_str Pk11Install_File;
typedef struct Pk11Install_PlatformName_str Pk11Install_PlatformName;
typedef struct Pk11Install_Platform_str Pk11Install_Platform;
typedef struct Pk11Install_Info_str Pk11Install_Info;

extern Pk11Install_Pointer Pk11Install_yylval;
extern Pk11Install_ValueList* Pk11Install_valueList;

/*
//////////////////////////////////////////////////////////////////////////
// Pk11Install_Pair
//////////////////////////////////////////////////////////////////////////
*/

struct Pk11Install_Pair_str {
	char * key;
	Pk11Install_ValueList *list;

};

Pk11Install_Pair* 
Pk11Install_Pair_new_default();
Pk11Install_Pair* 
Pk11Install_Pair_new( char* _key, Pk11Install_ValueList* _list);
void 
Pk11Install_Pair_delete(Pk11Install_Pair* _this);
void
Pk11Install_Pair_Print(Pk11Install_Pair* _this, int pad);

/*
//////////////////////////////////////////////////////////////////////////
// Pk11Install_Pointer
//////////////////////////////////////////////////////////////////////////
*/
union Pk11Install_Pointer_str {
	Pk11Install_ValueList *list;
	Pk11Install_Value *value;
	Pk11Install_Pair *pair;
	char *string;
};

/*
//////////////////////////////////////////////////////////////////////////
// Pk11Install_Value
//////////////////////////////////////////////////////////////////////////
*/
struct Pk11Install_Value_str {

	ValueType type;
	char *string;	
	Pk11Install_Pair *pair;
	struct Pk11Install_Value_str *next;
};

Pk11Install_Value* 
Pk11Install_Value_new_default();
Pk11Install_Value*
Pk11Install_Value_new(ValueType _type, Pk11Install_Pointer ptr);
void
Pk11Install_Value_delete(Pk11Install_Value* _this);
void
Pk11Install_Value_Print(Pk11Install_Value* _this, int pad);

/*
//////////////////////////////////////////////////////////////////////////
// Pk11Install_ValueList
//////////////////////////////////////////////////////////////////////////
*/
struct Pk11Install_ValueList_str {
	int numItems;
	int numPairs;
	int numStrings;
	Pk11Install_Value *head;
};

Pk11Install_ValueList* 
Pk11Install_ValueList_new();
void
Pk11Install_ValueList_delete(Pk11Install_ValueList* _this);
void
Pk11Install_ValueList_AddItem(Pk11Install_ValueList* _this,
                              Pk11Install_Value* item);
void
Pk11Install_ValueList_Print(Pk11Install_ValueList* _this, int pad);


/*
//////////////////////////////////////////////////////////////////////////
// Pk11Install_ListIter
//////////////////////////////////////////////////////////////////////////
*/
struct Pk11Install_ListIter_str {
	const Pk11Install_ValueList *list;
	Pk11Install_Value *current;
};

Pk11Install_ListIter* 
Pk11Install_ListIter_new_default();
void
Pk11Install_ListIter_init(Pk11Install_ListIter* _this);
Pk11Install_ListIter*
Pk11Install_ListIter_new(const Pk11Install_ValueList* _list);
void
Pk11Install_ListIter_delete(Pk11Install_ListIter* _this);
void
Pk11Install_ListIter_reset(Pk11Install_ListIter* _this);
Pk11Install_Value*
Pk11Install_ListIter_nextItem(Pk11Install_ListIter* _this);

/************************************************************************
 *
 * Pk11Install_File
 */
struct Pk11Install_File_str {
	char *jarPath;
	char *relativePath;
	char *absolutePath;
	PRBool executable;
	int permissions;
};

Pk11Install_File*
Pk11Install_File_new();
void
Pk11Install_File_init(Pk11Install_File* _this);
void
Pk11Install_file_delete(Pk11Install_File* _this);
/*// Parses a syntax tree to obtain all attributes.
// Returns NULL for success, error message if parse error.*/
char*
Pk11Install_File_Generate(Pk11Install_File* _this, 
                          const Pk11Install_Pair* pair);
void
Pk11Install_File_Print(Pk11Install_File* _this, int pad);
void
Pk11Install_File_Cleanup(Pk11Install_File* _this);

/************************************************************************
 *
 * Pk11Install_PlatformName
 */
struct Pk11Install_PlatformName_str {
	char *OS;
	char **verString;
	int numDigits;
	char *arch;
};

Pk11Install_PlatformName*
Pk11Install_PlatformName_new();
void
Pk11Install_PlatformName_init(Pk11Install_PlatformName* _this);
void
Pk11Install_PlatformName_delete(Pk11Install_PlatformName* _this);
char*
Pk11Install_PlatformName_Generate(Pk11Install_PlatformName* _this,
                                  const char* str);
char*
Pk11Install_PlatformName_GetString(Pk11Install_PlatformName* _this);
char*
Pk11Install_PlatformName_GetVerString(Pk11Install_PlatformName* _this);
void
Pk11Install_PlatformName_Print(Pk11Install_PlatformName* _this, int pad);
void
Pk11Install_PlatformName_Cleanup(Pk11Install_PlatformName* _this);
PRBool
Pk11Install_PlatformName_equal(Pk11Install_PlatformName* _this,
                               Pk11Install_PlatformName* cmp);
PRBool
Pk11Install_PlatformName_lteq(Pk11Install_PlatformName* _this,
                              Pk11Install_PlatformName* cmp);
PRBool
Pk11Install_PlatformName_lt(Pk11Install_PlatformName* _this,
                            Pk11Install_PlatformName* cmp);

/************************************************************************
 *
 * Pk11Install_Platform
 */
struct Pk11Install_Platform_str {
	Pk11Install_PlatformName name;
	Pk11Install_PlatformName equivName;
	struct Pk11Install_Platform_str *equiv;
	PRBool usesEquiv;
	char *moduleFile;
	char *moduleName;
	int modFile;
	unsigned long mechFlags;
	unsigned long cipherFlags;
	Pk11Install_File *files;
	int numFiles;
};

Pk11Install_Platform*
Pk11Install_Platform_new();
void
Pk11Install_Platform_init(Pk11Install_Platform* _this);
void
Pk11Install_Platform_delete(Pk11Install_Platform* _this);
/*// Returns NULL for success, error message if parse error.*/
char* 
Pk11Install_Platform_Generate(Pk11Install_Platform* _this,
                              const Pk11Install_Pair *pair);
void 
Pk11Install_Platform_Print(Pk11Install_Platform* _this, int pad);
void 
Pk11Install_Platform_Cleanup(Pk11Install_Platform* _this);

/************************************************************************
 *
 * Pk11Install_Info
 */
struct Pk11Install_Info_str {
	Pk11Install_Platform *platforms;
	int numPlatforms;
	Pk11Install_PlatformName *forwardCompatible;
	int numForwardCompatible;
};

Pk11Install_Info*
Pk11Install_Info_new();
void
Pk11Install_Info_init();
void
Pk11Install_Info_delete(Pk11Install_Info* _this);
/*// Returns NULL for success, error message if parse error.*/
char* 
Pk11Install_Info_Generate(Pk11Install_Info* _this, 
                          const Pk11Install_ValueList *list);
	/*// Returns NULL if there is no matching platform*/
Pk11Install_Platform* 
Pk11Install_Info_GetBestPlatform(Pk11Install_Info* _this, char* myPlatform);
void 
Pk11Install_Info_Print(Pk11Install_Info* _this, int pad);
void 
Pk11Install_Info_Cleanup(Pk11Install_Info* _this);

#endif /* INSTALL_DS_H */