]> git.saurik.com Git - apple/security.git/blob - SecuritySNACCRuntime/compiler/core/tblCompiler.c
Security-28.tar.gz
[apple/security.git] / SecuritySNACCRuntime / compiler / core / tblCompiler.c
1 /*
2 * tbl.c
3 *
4 * "TBL" ASN.1 module encode/decode/print/free C src.
5 *
6 * This file was generated by snacc on Mon Jun 2 11:23:51 1997
7 *
8 * UBC snacc written by Mike Sample
9 *
10 * NOTE: This is a machine generated file - editing not recommended
11 */
12
13
14
15 #include "asn-incl.h"
16 #include "tbl.h"
17
18
19 AsnLen
20 BEncTBLRangeContent PARAMS ((b, v),
21 BUF_TYPE b _AND_
22 TBLRange *v)
23 {
24 AsnLen totalLen = 0;
25 AsnLen itemLen;
26 AsnLen listLen;
27 void *component;
28
29 itemLen = BEncAsnIntContent (b, (&v->to));
30 BEncDefLenTo127 (b, itemLen);
31 itemLen++;
32 itemLen += BEncTag1 (b, CNTX, PRIM, 1);
33
34 totalLen += itemLen;
35
36 itemLen = BEncAsnIntContent (b, (&v->from));
37 BEncDefLenTo127 (b, itemLen);
38 itemLen++;
39 itemLen += BEncTag1 (b, CNTX, PRIM, 0);
40
41 totalLen += itemLen;
42
43 return totalLen;
44
45 } /* BEncTBLRangeContent */
46
47
48
49
50 AsnLen
51 BEncTBLNamedNumberContent PARAMS ((b, v),
52 BUF_TYPE b _AND_
53 TBLNamedNumber *v)
54 {
55 AsnLen totalLen = 0;
56 AsnLen itemLen;
57 AsnLen listLen;
58 void *component;
59
60 itemLen = BEncAsnIntContent (b, (&v->value));
61 BEncDefLenTo127 (b, itemLen);
62 itemLen++;
63 itemLen += BEncTag1 (b, CNTX, PRIM, 1);
64
65 totalLen += itemLen;
66
67 itemLen = BEncPrintableStringContent (b, (&v->name));
68 itemLen += BEncDefLen (b, itemLen);
69 itemLen += BEncTag1 (b, CNTX, PRIM, 0);
70
71 totalLen += itemLen;
72
73 return totalLen;
74
75 } /* BEncTBLNamedNumberContent */
76
77
78
79
80 AsnLen
81 BEncTBLNamedNumberListContent PARAMS ((b, v),
82 BUF_TYPE b _AND_
83 TBLNamedNumberList *v)
84 {
85 AsnLen totalLen = 0;
86 AsnLen itemLen;
87 AsnLen listLen;
88 void *component;
89
90 listLen = 0;
91 FOR_EACH_LIST_ELMT_RVS (component, v)
92 {
93 BEncEocIfNec (b);
94 itemLen = BEncTBLNamedNumberContent (b, component);
95 itemLen += BEncConsLen (b, itemLen);
96 itemLen += BEncTag1 (b, UNIV, CONS, 16);
97
98 listLen += itemLen;
99 }
100 return listLen;
101
102 } /* BEncTBLNamedNumberListContent */
103
104
105
106
107 AsnLen
108 BEncTBLTypeRefContent PARAMS ((b, v),
109 BUF_TYPE b _AND_
110 TBLTypeRef *v)
111 {
112 AsnLen totalLen = 0;
113 AsnLen itemLen;
114 AsnLen listLen;
115 void *component;
116
117 itemLen = BEncAsnBoolContent (b, (&v->implicit));
118 BEncDefLenTo127 (b, itemLen);
119 itemLen++;
120 itemLen += BEncTag1 (b, UNIV, PRIM, 1);
121
122 totalLen += itemLen;
123
124 itemLen = BEncTBLTypeDefIdContent (b, (&v->typeDef));
125 BEncDefLenTo127 (b, itemLen);
126 itemLen++;
127 itemLen += BEncTag1 (b, UNIV, PRIM, 2);
128
129 totalLen += itemLen;
130
131 return totalLen;
132
133 } /* BEncTBLTypeRefContent */
134
135
136
137
138 AsnLen
139 BEncTBLTagContent PARAMS ((b, v),
140 BUF_TYPE b _AND_
141 TBLTag *v)
142 {
143 AsnLen totalLen = 0;
144 AsnLen itemLen;
145 AsnLen listLen;
146 void *component;
147
148 itemLen = BEncAsnIntContent (b, (&v->code));
149 BEncDefLenTo127 (b, itemLen);
150 itemLen++;
151 itemLen += BEncTag1 (b, UNIV, PRIM, 2);
152
153 totalLen += itemLen;
154
155 itemLen = BEncTBLTagClassContent (b, (&v->tclass));
156 BEncDefLenTo127 (b, itemLen);
157 itemLen++;
158 itemLen += BEncTag1 (b, UNIV, PRIM, 10);
159
160 totalLen += itemLen;
161
162 return totalLen;
163
164 } /* BEncTBLTagContent */
165
166
167
168
169 AsnLen
170 BEncTBLTypeSeqOfContent PARAMS ((b, v),
171 BUF_TYPE b _AND_
172 TBLTypeSeqOf *v)
173 {
174 AsnLen totalLen = 0;
175 AsnLen itemLen;
176 AsnLen listLen;
177 void *component;
178
179 listLen = 0;
180 FOR_EACH_LIST_ELMT_RVS (component, v)
181 {
182 BEncEocIfNec (b);
183 itemLen = BEncTBLTagContent (b, component);
184 itemLen += BEncConsLen (b, itemLen);
185 itemLen += BEncTag1 (b, UNIV, CONS, 16);
186
187 listLen += itemLen;
188 }
189 return listLen;
190
191 } /* BEncTBLTypeSeqOfContent */
192
193
194
195
196 AsnLen
197 BEncTBLTypeContentSeqOfContent PARAMS ((b, v),
198 BUF_TYPE b _AND_
199 TBLTypeContentSeqOf *v)
200 {
201 AsnLen totalLen = 0;
202 AsnLen itemLen;
203 AsnLen listLen;
204 void *component;
205
206 listLen = 0;
207 FOR_EACH_LIST_ELMT_RVS (component, v)
208 {
209 BEncEocIfNec (b);
210 itemLen = BEncTBLTypeContent (b, component);
211 itemLen += BEncConsLen (b, itemLen);
212 itemLen += BEncTag1 (b, UNIV, CONS, 16);
213
214 listLen += itemLen;
215 }
216 return listLen;
217
218 } /* BEncTBLTypeContentSeqOfContent */
219
220
221
222
223 AsnLen
224 BEncTBLTypeContent PARAMS ((b, v),
225 BUF_TYPE b _AND_
226 TBLType *v)
227 {
228 AsnLen totalLen = 0;
229 AsnLen itemLen;
230 AsnLen listLen;
231 void *component;
232
233 if (NOT_NULL ((v->values)))
234 {
235 BEncEocIfNec (b);
236 itemLen = BEncTBLNamedNumberListContent (b, (v->values));
237 itemLen += BEncConsLen (b, itemLen);
238 itemLen += BEncTag1 (b, CNTX, CONS, 6);
239
240 totalLen += itemLen;
241 }
242
243 if (NOT_NULL ((v->constraint)))
244 {
245 BEncEocIfNec (b);
246 itemLen = BEncTBLRangeContent (b, (v->constraint));
247 itemLen += BEncConsLen (b, itemLen);
248 itemLen += BEncTag1 (b, CNTX, CONS, 5);
249
250 totalLen += itemLen;
251 }
252
253 if (ASNOCTS_PRESENT ((&v->fieldName)))
254 {
255 itemLen = BEncPrintableStringContent (b, (&v->fieldName));
256 itemLen += BEncDefLen (b, itemLen);
257 itemLen += BEncTag1 (b, CNTX, PRIM, 4);
258
259 totalLen += itemLen;
260 }
261
262 BEncEocIfNec (b);
263 itemLen = BEncTBLTypeContentContent (b, (v->content));
264 itemLen += BEncConsLen (b, itemLen);
265 itemLen += BEncTag1 (b, CNTX, CONS, 3);
266
267 totalLen += itemLen;
268
269 if (NOT_NULL ((v->tagList)))
270 {
271 BEncEocIfNec (b);
272 itemLen = BEncTBLTypeSeqOfContent (b, (v->tagList));
273 itemLen += BEncConsLen (b, itemLen);
274 itemLen += BEncTag1 (b, CNTX, CONS, 2);
275
276 totalLen += itemLen;
277 }
278
279 itemLen = BEncAsnBoolContent (b, (&v->optional));
280 BEncDefLenTo127 (b, itemLen);
281 itemLen++;
282 itemLen += BEncTag1 (b, CNTX, PRIM, 1);
283
284 totalLen += itemLen;
285
286 itemLen = BEncTBLTypeIdContent (b, (&v->typeId));
287 BEncDefLenTo127 (b, itemLen);
288 itemLen++;
289 itemLen += BEncTag1 (b, CNTX, PRIM, 0);
290
291 totalLen += itemLen;
292
293 return totalLen;
294
295 } /* BEncTBLTypeContent */
296
297
298
299
300 AsnLen
301 BEncTBLTypeContentContent PARAMS ((b, v),
302 BUF_TYPE b _AND_
303 TBLTypeContent *v)
304 {
305 AsnLen totalLen = 0;
306 AsnLen itemLen;
307 AsnLen listLen;
308 void *component;
309
310 switch (v->choiceId)
311 {
312 case TBLTYPECONTENT_PRIMTYPE:
313 itemLen = BEncAsnNullContent (b, (&v->a.primType));
314 BEncDefLenTo127 (b, itemLen);
315 itemLen++;
316 itemLen += BEncTag1 (b, CNTX, PRIM, 0);
317
318 totalLen += itemLen;
319
320 break;
321
322 case TBLTYPECONTENT_ELMTS:
323 BEncEocIfNec (b);
324 itemLen = BEncTBLTypeContentSeqOfContent (b, (v->a.elmts));
325 itemLen += BEncConsLen (b, itemLen);
326 itemLen += BEncTag1 (b, CNTX, CONS, 1);
327
328 totalLen += itemLen;
329
330 break;
331
332 case TBLTYPECONTENT_TYPEREF:
333 BEncEocIfNec (b);
334 itemLen = BEncTBLTypeRefContent (b, (v->a.typeRef));
335 itemLen += BEncConsLen (b, itemLen);
336 itemLen += BEncTag1 (b, CNTX, CONS, 2);
337
338 totalLen += itemLen;
339
340 break;
341
342 }
343 return totalLen;
344
345 } /* BEncTBLTypeContentContent */
346
347
348
349
350 AsnLen
351 BEncTBLTypeDefContent PARAMS ((b, v),
352 BUF_TYPE b _AND_
353 TBLTypeDef *v)
354 {
355 AsnLen totalLen = 0;
356 AsnLen itemLen;
357 AsnLen listLen;
358 void *component;
359
360 if (NOT_NULL ((v->isPdu)))
361 {
362 itemLen = BEncAsnNullContent (b, (v->isPdu));
363 BEncDefLenTo127 (b, itemLen);
364 itemLen++;
365 itemLen += BEncTag1 (b, UNIV, PRIM, 5);
366
367 totalLen += itemLen;
368 }
369
370 BEncEocIfNec (b);
371 itemLen = BEncTBLTypeContent (b, (v->type));
372 itemLen += BEncConsLen (b, itemLen);
373 itemLen += BEncTag1 (b, UNIV, CONS, 16);
374
375 totalLen += itemLen;
376
377 itemLen = BEncPrintableStringContent (b, (&v->typeName));
378 itemLen += BEncDefLen (b, itemLen);
379 itemLen += BEncTag1 (b, UNIV, PRIM, 19);
380
381 totalLen += itemLen;
382
383 itemLen = BEncTBLTypeDefIdContent (b, (&v->typeDefId));
384 BEncDefLenTo127 (b, itemLen);
385 itemLen++;
386 itemLen += BEncTag1 (b, UNIV, PRIM, 2);
387
388 totalLen += itemLen;
389
390 return totalLen;
391
392 } /* BEncTBLTypeDefContent */
393
394
395
396
397 AsnLen
398 BEncTBLModuleSeqOfContent PARAMS ((b, v),
399 BUF_TYPE b _AND_
400 TBLModuleSeqOf *v)
401 {
402 AsnLen totalLen = 0;
403 AsnLen itemLen;
404 AsnLen listLen;
405 void *component;
406
407 listLen = 0;
408 FOR_EACH_LIST_ELMT_RVS (component, v)
409 {
410 BEncEocIfNec (b);
411 itemLen = BEncTBLTypeDefContent (b, component);
412 itemLen += BEncConsLen (b, itemLen);
413 itemLen += BEncTag1 (b, UNIV, CONS, 16);
414
415 listLen += itemLen;
416 }
417 return listLen;
418
419 } /* BEncTBLModuleSeqOfContent */
420
421
422
423
424 AsnLen
425 BEncTBLModuleContent PARAMS ((b, v),
426 BUF_TYPE b _AND_
427 TBLModule *v)
428 {
429 AsnLen totalLen = 0;
430 AsnLen itemLen;
431 AsnLen listLen;
432 void *component;
433
434 BEncEocIfNec (b);
435 itemLen = BEncTBLModuleSeqOfContent (b, (v->typeDefs));
436 itemLen += BEncConsLen (b, itemLen);
437 itemLen += BEncTag1 (b, CNTX, CONS, 3);
438
439 totalLen += itemLen;
440
441 itemLen = BEncAsnBoolContent (b, (&v->isUseful));
442 BEncDefLenTo127 (b, itemLen);
443 itemLen++;
444 itemLen += BEncTag1 (b, CNTX, PRIM, 2);
445
446 totalLen += itemLen;
447
448 if (ASNOID_PRESENT ((&v->id)))
449 {
450 itemLen = BEncAsnOidContent (b, (&v->id));
451 itemLen += BEncDefLen (b, itemLen);
452 itemLen += BEncTag1 (b, CNTX, PRIM, 1);
453
454 totalLen += itemLen;
455 }
456
457 itemLen = BEncPrintableStringContent (b, (&v->name));
458 itemLen += BEncDefLen (b, itemLen);
459 itemLen += BEncTag1 (b, CNTX, PRIM, 0);
460
461 totalLen += itemLen;
462
463 return totalLen;
464
465 } /* BEncTBLModuleContent */
466
467
468
469
470 AsnLen
471 BEncTBLSeqOfContent PARAMS ((b, v),
472 BUF_TYPE b _AND_
473 TBLSeqOf *v)
474 {
475 AsnLen totalLen = 0;
476 AsnLen itemLen;
477 AsnLen listLen;
478 void *component;
479
480 listLen = 0;
481 FOR_EACH_LIST_ELMT_RVS (component, v)
482 {
483 BEncEocIfNec (b);
484 itemLen = BEncTBLModuleContent (b, component);
485 itemLen += BEncConsLen (b, itemLen);
486 itemLen += BEncTag1 (b, UNIV, CONS, 16);
487
488 listLen += itemLen;
489 }
490 return listLen;
491
492 } /* BEncTBLSeqOfContent */
493
494
495
496
497 AsnLen BEncTBL PARAMS ((b, v),
498 BUF_TYPE b _AND_
499 TBL *v)
500 {
501 AsnLen l;
502 BEncEocIfNec (b);
503 l = BEncTBLContent (b, v);
504 l += BEncConsLen (b, l);
505 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
506 return l;
507 } /* BEncTBL */
508
509 AsnLen
510 BEncTBLContent PARAMS ((b, v),
511 BUF_TYPE b _AND_
512 TBL *v)
513 {
514 AsnLen totalLen = 0;
515 AsnLen itemLen;
516 AsnLen listLen;
517 void *component;
518
519 BEncEocIfNec (b);
520 itemLen = BEncTBLSeqOfContent (b, (v->modules));
521 itemLen += BEncConsLen (b, itemLen);
522 itemLen += BEncTag1 (b, UNIV, CONS, 16);
523
524 totalLen += itemLen;
525
526 itemLen = BEncAsnIntContent (b, (&v->totalLenStrings));
527 BEncDefLenTo127 (b, itemLen);
528 itemLen++;
529 itemLen += BEncTag1 (b, UNIV, PRIM, 2);
530
531 totalLen += itemLen;
532
533 itemLen = BEncAsnIntContent (b, (&v->totalNumStrings));
534 BEncDefLenTo127 (b, itemLen);
535 itemLen++;
536 itemLen += BEncTag1 (b, UNIV, PRIM, 2);
537
538 totalLen += itemLen;
539
540 itemLen = BEncAsnIntContent (b, (&v->totalNumTags));
541 BEncDefLenTo127 (b, itemLen);
542 itemLen++;
543 itemLen += BEncTag1 (b, UNIV, PRIM, 2);
544
545 totalLen += itemLen;
546
547 itemLen = BEncAsnIntContent (b, (&v->totalNumTypes));
548 BEncDefLenTo127 (b, itemLen);
549 itemLen++;
550 itemLen += BEncTag1 (b, UNIV, PRIM, 2);
551
552 totalLen += itemLen;
553
554 itemLen = BEncAsnIntContent (b, (&v->totalNumTypeDefs));
555 BEncDefLenTo127 (b, itemLen);
556 itemLen++;
557 itemLen += BEncTag1 (b, UNIV, PRIM, 2);
558
559 totalLen += itemLen;
560
561 itemLen = BEncAsnIntContent (b, (&v->totalNumModules));
562 BEncDefLenTo127 (b, itemLen);
563 itemLen++;
564 itemLen += BEncTag1 (b, UNIV, PRIM, 2);
565
566 totalLen += itemLen;
567
568 return totalLen;
569
570 } /* BEncTBLContent */
571
572
573
574