]> git.saurik.com Git - apple/security.git/blob - SecuritySNACCRuntime/compiler/core/do-macros.c
Security-54.1.tar.gz
[apple/security.git] / SecuritySNACCRuntime / compiler / core / do-macros.c
1 /*
2 * compiler/core/do_macros.c
3 *
4 * Runs through type and value def lists and does any processing nec.
5 * for any macro encountered.
6 *
7 * Processing could consist of making stubs for OPERATION macro etc.
8 * What is done is very environment dependent.
9 *
10 * You should change this file to match your environment.
11 *
12 * Any Type Defs hidden in a MACRO Type are popped into the normal
13 * type def list and REFERENCED from the macro (instead of being
14 * defined there)
15 *
16 * SNMP Objectype macro fills the ANY Ref lists so the id to ANY
17 * type hash table is filled.
18 *
19 * Mike Sample
20 * 91/12/12
21 *
22 * Copyright (C) 1991, 1992 Michael Sample
23 * and the University of British Columbia
24 *
25 * This program is free software; you can redistribute it and/or modify
26 * it under the terms of the GNU General Public License as published by
27 * the Free Software Foundation; either version 2 of the License, or
28 * (at your option) any later version.
29 *
30 * $Header: /cvs/Darwin/Security/SecuritySNACCRuntime/compiler/core/do-macros.c,v 1.1 2001/06/20 21:27:56 dmitch Exp $
31 * $Log: do-macros.c,v $
32 * Revision 1.1 2001/06/20 21:27:56 dmitch
33 * Adding missing snacc compiler files.
34 *
35 * Revision 1.1.1.1 1999/03/16 18:06:47 aram
36 * Originals from SMIME Free Library.
37 *
38 * Revision 1.3 1995/07/25 19:41:23 rj
39 * changed `_' to `-' in file names.
40 *
41 * Revision 1.2 1994/09/01 00:32:28 rj
42 * snacc_config.h removed; do_macros.h includet.
43 *
44 * Revision 1.1 1994/08/28 09:49:03 rj
45 * first check-in. for a list of changes to the snacc-1.1 distribution please refer to the ChangeLog.
46 *
47 */
48
49 #include <stdio.h>
50 #include <ctype.h> /* for islower/toupper */
51
52 #include "asn-incl.h"
53 #include "mem.h"
54 #include "asn1module.h"
55 #include "define.h"
56 #include "str-util.h"
57 #include "normalize.h"
58 #include "snacc-util.h"
59 #include "do-macros.h"
60
61 void AddAnyRefByOid PROTO ((AnyRefList **arl, char *enumIdName, AsnOid *oid));
62
63 void AddAnyRefByInt PROTO ((AnyRefList **arl, char *enumIdName, AsnInt intId));
64
65
66 void ProcessMacrosInTypeDef PROTO ((Module *m, TypeDef *td));
67
68 void ProcessMacrosInValueDef PROTO ((Module *m, ValueDef *vd));
69
70 void ProcessMacrosInType PROTO ((Module *m, TypeDef *td, Type *t, ValueDef *v));
71
72 void ProcessMacrosInElmtTypes PROTO ((Module *m, TypeDef *td, NamedTypeList *e, ValueDef *v));
73
74 void ProcessMacrosInBasicType PROTO ((Module *m, TypeDef *td, Type *type, BasicType *bt, ValueDef *v));
75
76 void DefineType PROTO ((Module *m, TypeDef *td, Type *t, char *name));
77
78 void ProcessRosOperationMacroType PROTO ((Module *m, TypeDef *td, Type *t, BasicType *bt, RosOperationMacroType *op, ValueDef *v));
79
80 void ProcessRosErrorMacroType PROTO ((Module *m, TypeDef *td, Type *t, BasicType *bt, RosErrorMacroType *err, ValueDef *v));
81
82 void ProcessRosBindMacroType PROTO ((Module *m, TypeDef *td, Type *t, BasicType *bt, RosBindMacroType *bind, ValueDef *v));
83
84 void ProcessRosAseMacroType PROTO ((Module *m, TypeDef *td, Type *t, BasicType *bt, RosAseMacroType *ase, ValueDef *v));
85
86 void ProcessRosAcMacroType PROTO ((Module *m, TypeDef *td, Type *t, BasicType *bt, RosAcMacroType *ac, ValueDef *v));
87
88 void ProcessMtsasExtensionsMacroType PROTO ((Module *m, TypeDef *td, Type *t, BasicType *bt, MtsasExtensionsMacroType *exts, ValueDef *v));
89
90 void ProcessMtsasExtensionMacroType PROTO ((Module *m, TypeDef *td, Type *t, BasicType *bt, MtsasExtensionMacroType *ext, ValueDef *v));
91
92 void ProcessMtsasExtensionAttributeMacroType PROTO ((Module *m, TypeDef *td, Type *t, BasicType *bt, MtsasExtensionAttributeMacroType *ext, ValueDef *v));
93
94 void ProcessMtsasTokenMacroType PROTO ((Module *m, TypeDef *td, Type *t, BasicType *bt, MtsasTokenMacroType *tok, ValueDef *v));
95
96 void ProcessMtsasTokenDataMacroType PROTO ((Module *m, TypeDef *td, Type *t, BasicType *bt, MtsasTokenDataMacroType *tok, ValueDef *v));
97
98 void ProcessMtsasSecurityCategoryMacroType PROTO ((Module *m, TypeDef *td, Type *t, BasicType *bt, MtsasSecurityCategoryMacroType *sec, ValueDef *v));
99
100 void ProcessAsnObjectMacroType PROTO ((Module *m, TypeDef *td, Type *t, BasicType *bt, AsnObjectMacroType *obj, ValueDef *v));
101
102 void ProcessAsnPortMacroType PROTO ((Module *m, TypeDef *td, Type *t, BasicType *bt, AsnPortMacroType *p, ValueDef *v));
103
104 void ProcessAsnAbstractBindMacroType PROTO ((Module *m, TypeDef *td, Type *t, BasicType *bt, AsnAbstractBindMacroType *bind, ValueDef *v));
105
106 void ProcessSnmpObjectTypeMacroType PROTO ((Module *m, TypeDef *td, Type *t, BasicType *bt, SnmpObjectTypeMacroType *bind, ValueDef *v));
107
108 /*
109 static TypeDef *snmpObjectSyntaxesG = NULL;
110 */
111
112 /*
113 * Hunts for macros in TypeDefs or ValueDefs and
114 * might do something with them.
115 */
116 void
117 ProcessMacros PARAMS ((m),
118 Module *m)
119 {
120 TypeDef *td;
121 TypeDef **tmpTypeDefHndl;
122 ValueDef *vd;
123
124 /*
125 * go through each type in typeList
126 */
127 FOR_EACH_LIST_ELMT (td, m->typeDefs)
128 {
129 ProcessMacrosInTypeDef (m, td);
130 }
131
132 /*
133 * go through each value in valueList and link
134 */
135 FOR_EACH_LIST_ELMT (vd, m->valueDefs)
136 {
137 ProcessMacrosInValueDef (m, vd);
138 }
139
140 /* add snmp object syntaxes choice to typedef list */
141 /*
142 tmpTypeDefHndl = (TypeDef**) AsnListAppend (m->typeDefs);
143 *tmpTypeDefHndl = snmpObjectSyntaxesG;
144 snmpObjectSyntaxesG = NULL;
145 */
146
147
148 } /* ProcessMacros */
149
150 /*
151 * Given an AnyRefList, char string for an enum Id,
152 * and an OBJECT IDENTIFIER,
153 * this routine puts the id and oid into the AnyRefList.
154 * When the code is generated, the AnyInit routine for
155 * the module to which the typeDef that owns the given AnyRefList
156 * belongs, calls a routine that will cause the given oid to
157 * hash to the TypeDef that owns the AnyRefList.
158 * The enumId value at runtime is used for simple determination of
159 * the ANY type by the user.
160 */
161 void
162 AddAnyRefByOid PARAMS ((arl, enumId, oid),
163 AnyRefList **arl _AND_
164 char *enumId _AND_
165 AsnOid *oid)
166 {
167 AnyRef **anyRefHndl;
168
169 if (*arl == NULL)
170 *arl = AsnListNew (sizeof (void*));
171
172 anyRefHndl = (AnyRef**)AsnListAppend (*arl);
173 *anyRefHndl = MT (AnyRef);
174
175 (*anyRefHndl)->anyIdName = Malloc (strlen (enumId)+1);
176 strcpy ((*anyRefHndl)->anyIdName, enumId);
177
178 (*anyRefHndl)->id = MT (OidOrInt);
179 (*anyRefHndl)->id->choiceId = OIDORINT_OID;
180 (*anyRefHndl)->id->a.oid = MT (AsnOid);
181 (*anyRefHndl)->id->a.oid->octs = Malloc (oid->octetLen);
182 memcpy ((*anyRefHndl)->id->a.oid->octs, oid->octs, oid->octetLen);
183 (*anyRefHndl)->id->a.oid->octetLen = oid->octetLen;
184
185 } /* AddAnyRefByOid */
186
187 /*
188 * Like AddAnyRefByOid except that an int maps to the type def
189 * instead of an OBJECT IDENTIFIER
190 */
191 void
192 AddAnyRefByInt PARAMS ((arl, enumId, intId),
193 AnyRefList **arl _AND_
194 char *enumId _AND_
195 AsnInt intId)
196 {
197 AnyRef **anyRefHndl;
198
199 if (*arl == NULL)
200 *arl = AsnListNew (sizeof (void*));
201
202 anyRefHndl = (AnyRef**)AsnListAppend (*arl);
203 *anyRefHndl = MT (AnyRef);
204
205 (*anyRefHndl)->anyIdName = Malloc (strlen (enumId)+1);
206 strcpy ((*anyRefHndl)->anyIdName, enumId);
207 (*anyRefHndl)->id = MT (OidOrInt);
208 (*anyRefHndl)->id->choiceId = OIDORINT_INTID;
209 (*anyRefHndl)->id->a.intId = intId;
210
211 } /* AddAnyRefByInt */
212
213
214 void
215 ProcessMacrosInValueDef PARAMS ((m, vd),
216 Module *m _AND_
217 ValueDef *vd)
218 {
219 if (vd == NULL)
220 return;
221
222 /* turn linked oid's into encoded oids */
223 if (vd->value->basicValue->choiceId == BASICVALUE_LINKEDOID)
224 NormalizeValue (m, vd, vd->value, FALSE);
225
226 ProcessMacrosInType (m, NULL, vd->value->type, vd);
227
228 } /* ProcessMacrosInValueDef */
229
230
231
232 void
233 ProcessMacrosInTypeDef PARAMS ((m,td),
234 Module *m _AND_
235 TypeDef *td)
236 {
237 if (td == NULL)
238 return;
239
240 ProcessMacrosInType (m, td, td->type, NULL);
241
242 } /* ProcessMacrosInTypeDef */
243
244
245
246 void
247 ProcessMacrosInType PARAMS ((m, td,t, v),
248 Module *m _AND_
249 TypeDef *td _AND_
250 Type *t _AND_
251 ValueDef *v)
252 {
253 if (t == NULL)
254 return;
255
256 ProcessMacrosInBasicType (m, td, t, t->basicType, v);
257
258 } /* ProcessMacrosInTypeDef */
259
260
261
262 void
263 ProcessMacrosInElmtTypes PARAMS ((m, td, e, v),
264 Module *m _AND_
265 TypeDef *td _AND_
266 NamedTypeList *e _AND_
267 ValueDef *v)
268 {
269 NamedType *nt;
270 FOR_EACH_LIST_ELMT (nt, e)
271 {
272 ProcessMacrosInType (m, td, nt->type, v);
273 }
274 } /* ProcessElmtTypes */
275
276
277
278 void
279 ProcessMacrosInBasicType PARAMS ((m,td,type,bt, v),
280 Module *m _AND_
281 TypeDef *td _AND_
282 Type *type _AND_
283 BasicType *bt _AND_
284 ValueDef *v)
285 {
286
287 if (bt == NULL)
288 return;
289
290 switch (bt->choiceId)
291 {
292
293 case BASICTYPE_SEQUENCE:
294 case BASICTYPE_SET:
295 case BASICTYPE_CHOICE:
296 ProcessMacrosInElmtTypes (m, td, bt->a.set,v);
297 break;
298
299
300
301 case BASICTYPE_SEQUENCEOF:
302 case BASICTYPE_SETOF:
303 ProcessMacrosInType (m, td, bt->a.setOf, v);
304 break;
305
306
307
308 case BASICTYPE_MACROTYPE:
309 switch (bt->a.macroType->choiceId)
310 {
311 case MACROTYPE_ASNABSTRACTOPERATION:
312 case MACROTYPE_ROSOPERATION:
313
314 ProcessRosOperationMacroType (m, td, type, bt, bt->a.macroType->a.rosOperation, v);
315 break;
316
317 case MACROTYPE_ROSERROR:
318 case MACROTYPE_ASNABSTRACTERROR:
319 ProcessRosErrorMacroType (m, td, type, bt, bt->a.macroType->a.rosError, v);
320 break;
321
322 case MACROTYPE_ROSBIND:
323 case MACROTYPE_ROSUNBIND:
324 ProcessRosBindMacroType (m, td, type, bt, bt->a.macroType->a.rosBind,v);
325 break;
326
327 case MACROTYPE_ROSASE:
328 ProcessRosAseMacroType (m, td, type, bt, bt->a.macroType->a.rosAse,v);
329 break;
330
331 case MACROTYPE_MTSASEXTENSIONS:
332 ProcessMtsasExtensionsMacroType (m, td, type, bt, bt->a.macroType->a.mtsasExtensions,v);
333 break;
334
335 case MACROTYPE_MTSASEXTENSION:
336 ProcessMtsasExtensionMacroType (m, td, type, bt, bt->a.macroType->a.mtsasExtension,v);
337 break;
338
339 case MACROTYPE_MTSASEXTENSIONATTRIBUTE:
340 ProcessMtsasExtensionAttributeMacroType (m, td, type, bt, bt->a.macroType->a.mtsasExtensionAttribute,v);
341 break;
342
343 case MACROTYPE_MTSASTOKEN:
344 ProcessMtsasTokenMacroType (m, td, type, bt, bt->a.macroType->a.mtsasToken,v);
345 break;
346
347 case MACROTYPE_MTSASTOKENDATA:
348 ProcessMtsasTokenDataMacroType (m, td, type, bt, bt->a.macroType->a.mtsasTokenData,v);
349 break;
350
351 case MACROTYPE_MTSASSECURITYCATEGORY:
352 ProcessMtsasSecurityCategoryMacroType (m, td, type, bt, bt->a.macroType->a.mtsasSecurityCategory,v);
353 break;
354
355 case MACROTYPE_ASNOBJECT:
356 ProcessAsnObjectMacroType (m, td, type, bt, bt->a.macroType->a.asnObject,v);
357 break;
358
359 case MACROTYPE_ASNPORT:
360 ProcessAsnPortMacroType (m, td, type, bt, bt->a.macroType->a.asnPort,v);
361 break;
362
363 case MACROTYPE_ASNABSTRACTBIND:
364 case MACROTYPE_ASNABSTRACTUNBIND:
365 ProcessAsnAbstractBindMacroType (m, td, type, bt, bt->a.macroType->a.asnAbstractBind,v);
366 break;
367
368 case MACROTYPE_AFALGORITHM:
369 case MACROTYPE_AFENCRYPTED:
370 case MACROTYPE_AFPROTECTED:
371 case MACROTYPE_AFSIGNATURE:
372 case MACROTYPE_AFSIGNED:
373 break;
374
375 case MACROTYPE_SNMPOBJECTTYPE:
376 ProcessSnmpObjectTypeMacroType (m, td, type, bt, bt->a.macroType->a.snmpObjectType,v);
377 break;
378
379 default:
380 /* ignore any others */
381 break;
382 }
383
384 default:
385 /* the rest do not need processing */
386
387 break;
388 }
389 } /* ProcessMacrosInBasicType */
390
391
392 /*
393 * Given a Type referenced in a macro, makes up a name and defines
394 * the type iff the type is not a simple type ref or library type.
395 * Returns the typedef of the type given type. (may be new may
396 * be from the typeref if t was a local or import type ref)
397 */
398 void
399 DefineType PARAMS ((m, td, t, name),
400 Module *m _AND_
401 TypeDef *td _AND_
402 Type *t _AND_
403 char *name)
404 {
405 int digit;
406 TypeDef *newDef;
407 TypeDef **tmpTypeDefHndl;
408 Type *tmpType;
409 TypeDef *retVal;
410
411 if (IsNewType (t))
412 {
413 newDef = (TypeDef*)Malloc (sizeof (TypeDef));
414 newDef->exported = FALSE;
415 newDef->type = (Type*)Malloc (sizeof (Type));
416 memcpy (newDef->type, t, sizeof (Type));
417
418
419 newDef->definedName = Malloc (strlen (name)+4);
420 strcpy (newDef->definedName, name);
421
422 if (islower (newDef->definedName[0]))
423 newDef->definedName[0] =
424 toupper (newDef->definedName[0]);
425
426
427 /* set up unique type name for new type */
428 for (digit = 0;
429 (LookupType (m->typeDefs, newDef->definedName) != NULL);
430 digit++)
431 AppendDigit (newDef->definedName, digit);
432
433 /*
434 * now put new typedef at head of list
435 */
436 tmpTypeDefHndl = (TypeDef**)AsnListPrepend (m->typeDefs);
437 *tmpTypeDefHndl = newDef;
438
439 /* convert macro's type def into a ref */
440
441 SetupType (&tmpType, BASICTYPE_LOCALTYPEREF, 0);
442 memcpy (t, tmpType, sizeof (Type));
443 Free (tmpType);
444 t->implicit = FALSE;
445 t->basicType->a.localTypeRef = (TypeRef*)Malloc (sizeof (TypeRef));
446 t->basicType->a.localTypeRef->link = newDef;
447 t->basicType->a.localTypeRef->module = m;
448 t->basicType->a.localTypeRef->typeName =
449 newDef->definedName;
450
451 }
452 } /* DefineType */
453
454
455 void
456 ProcessRosOperationMacroType PARAMS ((m, td, t, bt, op, v),
457 Module *m _AND_
458 TypeDef *td _AND_
459 Type *t _AND_
460 BasicType *bt _AND_
461 RosOperationMacroType *op _AND_
462 ValueDef *v)
463 {
464
465 if (op->arguments != NULL)
466 DefineType (m, td, op->arguments->type, v->definedName);
467
468 if (op->result != NULL)
469 DefineType (m, td, op->result->type, v->definedName);
470
471 } /* ProcessRosOperationMacroType */
472
473
474
475 void
476 ProcessRosErrorMacroType PARAMS ((m, td, t, bt, err, v),
477 Module *m _AND_
478 TypeDef *td _AND_
479 Type *t _AND_
480 BasicType *bt _AND_
481 RosErrorMacroType *err _AND_
482 ValueDef *v)
483 {
484 if ((err != NULL) && (err->parameter != NULL))
485 DefineType (m, td, err->parameter->type, v->definedName);
486
487 } /* ProcessRosErrorMacroType */
488
489
490 void
491 ProcessRosBindMacroType PARAMS ((m, td, t, bt, bind, v),
492 Module *m _AND_
493 TypeDef *td _AND_
494 Type *t _AND_
495 BasicType *bt _AND_
496 RosBindMacroType *bind _AND_
497 ValueDef *v)
498 {
499 if (bind != NULL)
500 {
501 DefineType (m, td, bind->argument->type, v->definedName);
502 DefineType (m, td, bind->result->type, v->definedName);
503 DefineType (m, td, bind->error->type, v->definedName);
504 }
505 } /* ProcessRosBindMacroType */
506
507
508 void
509 ProcessRosAseMacroType PARAMS ((m, td, t, bt, ase, v),
510 Module *m _AND_
511 TypeDef *td _AND_
512 Type *t _AND_
513 BasicType *bt _AND_
514 RosAseMacroType *ase _AND_
515 ValueDef *v)
516 {
517
518 } /* ProcessRosAseMacroType */
519
520
521
522 void
523 ProcessRosAcMacroType PARAMS ((m, td, t, bt, ac, v),
524 Module *m _AND_
525 TypeDef *td _AND_
526 Type *t _AND_
527 BasicType *bt _AND_
528 RosAcMacroType *ac _AND_
529 ValueDef *v)
530 {
531
532 } /* ProcessRosAcMacroType */
533
534
535
536 void
537 ProcessMtsasExtensionsMacroType PARAMS ((m, td, t, bt, exts, v),
538 Module *m _AND_
539 TypeDef *td _AND_
540 Type *t _AND_
541 BasicType *bt _AND_
542 MtsasExtensionsMacroType *exts _AND_
543 ValueDef *v)
544 {
545
546 } /* ProcessMtsasExtensionsMacroType */
547
548
549 void
550 ProcessMtsasExtensionMacroType PARAMS ((m, td, t, bt, ext, v),
551 Module *m _AND_
552 TypeDef *td _AND_
553 Type *t _AND_
554 BasicType *bt _AND_
555 MtsasExtensionMacroType *ext _AND_
556 ValueDef *v)
557 {
558
559 } /* ProcessMtsasExtensionMacroType */
560
561
562 void
563 ProcessMtsasExtensionAttributeMacroType PARAMS ((m, td, t, bt, ext, v),
564 Module *m _AND_
565 TypeDef *td _AND_
566 Type *t _AND_
567 BasicType *bt _AND_
568 MtsasExtensionAttributeMacroType *ext _AND_
569 ValueDef *v)
570 {
571
572 } /* ProcessMtsasExtensionAttributeMacroType */
573
574
575 void
576 ProcessMtsasTokenMacroType PARAMS ((m, td, t, bt, tok, v),
577 Module *m _AND_
578 TypeDef *td _AND_
579 Type *t _AND_
580 BasicType *bt _AND_
581 MtsasTokenMacroType *tok _AND_
582 ValueDef *v)
583 {
584
585 } /* ProcessMtsasTokenMacroType */
586
587
588 void
589 ProcessMtsasTokenDataMacroType PARAMS ((m, td, t, bt, tok, v),
590 Module *m _AND_
591 TypeDef *td _AND_
592 Type *t _AND_
593 BasicType *bt _AND_
594 MtsasTokenDataMacroType *tok _AND_
595 ValueDef *v)
596 {
597
598
599 } /* ProcessMtsasTokenDataMacroType */
600
601
602 void
603 ProcessMtsasSecurityCategoryMacroType PARAMS ((m, td, t, bt, sec, v),
604 Module *m _AND_
605 TypeDef *td _AND_
606 Type *t _AND_
607 BasicType *bt _AND_
608 MtsasSecurityCategoryMacroType *sec _AND_
609 ValueDef *v)
610 {
611
612 } /* ProcessMtsasSecurityCategoryMacroType */
613
614
615
616 void
617 ProcessAsnObjectMacroType PARAMS ((m, td, t, bt, obj, v),
618 Module *m _AND_
619 TypeDef *td _AND_
620 Type *t _AND_
621 BasicType *bt _AND_
622 AsnObjectMacroType *obj _AND_
623 ValueDef *v)
624 {
625
626 } /* ProcessAsnObjectMacroType */
627
628
629 void
630 ProcessAsnPortMacroType PARAMS ((m, td, t, bt, p, v),
631 Module *m _AND_
632 TypeDef *td _AND_
633 Type *t _AND_
634 BasicType *bt _AND_
635 AsnPortMacroType *p _AND_
636 ValueDef *v)
637 {
638
639 } /* ProcessAsnPortMacroType */
640
641
642
643 void
644 ProcessAsnAbstractBindMacroType PARAMS ((m, td, t, bt, bind, v),
645 Module *m _AND_
646 TypeDef *td _AND_
647 Type *t _AND_
648 BasicType *bt _AND_
649 AsnAbstractBindMacroType *bind _AND_
650 ValueDef *v)
651 {
652
653 } /* ProcessAsnBindMacroType */
654
655
656 void
657 ProcessSnmpObjectTypeMacroType PARAMS ((m, td, t, bt, ot, v),
658 Module *m _AND_
659 TypeDef *td _AND_
660 Type *t _AND_
661 BasicType *bt _AND_
662 SnmpObjectTypeMacroType *ot _AND_
663 ValueDef *v)
664 {
665 NamedType *nt;
666 NamedType **tmpNtHndl;
667 char anyId[256];
668 AnyRefList **arlHndl;
669
670 if ((ot != NULL) && (ot->syntax != NULL))
671 DefineType (m, td, ot->syntax, v->definedName);
672
673 /*
674 * add ANY ref stuff to type ref'd by this macro so it is
675 * included in the ANY hash table.
676 */
677
678 /*
679 * do this since the SNMP spec doesn't have an ANY type
680 * but uses the mechanism. (SNMP uses an OCTET STRING
681 * where the 'ANY' value is
682 */
683 m->hasAnys = TRUE;
684
685 strcpy (anyId, v->definedName);
686 /* Str2UCase (anyId, strlen (anyId)); */
687 strcat (anyId, "_ANY_ID");
688
689 arlHndl = GetAnyRefListHndl (ot->syntax);
690
691
692 if (v->value->basicValue->choiceId == BASICVALUE_OID)
693 AddAnyRefByOid (arlHndl, anyId, v->value->basicValue->a.oid);
694
695 /* integer types are not allowed, but relax constraints anyway */
696 else
697 AddAnyRefByInt (arlHndl, anyId, v->value->basicValue->a.integer);
698
699
700
701 /* make a choice with all the object type elmts */
702 /* USING THE ANY HASH TABLE NOW
703 if (snmpObjectSyntaxesG == NULL)
704 {
705 snmpObjectSyntaxesG = (TypeDef*) Malloc (sizeof (TypeDef));
706 SetupType (&snmpObjectSyntaxesG->type, BASICTYPE_CHOICE, 0);
707 snmpObjectSyntaxesG->type->basicType->a.choice =
708 AsnListNew (sizeof (void*));
709 snmpObjectSyntaxesG->definedName = "SnmpOpaqueTypes";
710
711 }
712 */
713
714 /* NOT DONE ANYMORE
715 * make each field in the choice the same as the object
716 * types SYNTAX field type (adjusted by Define type)
717 * make choice field name same as OBJ-TYPE value Defs name
718 *
719 * NOTE - using ptrs to type/fieldname, not duplicating them
720 * this may cause freeing probs
721 */
722 /*
723 nt = MT (NamedType);
724 nt->fieldName = v->definedName;
725 nt->type = ot->syntax;
726
727 tmpNtHndl = (NamedType**)
728 AsnListAppend (snmpObjectSyntaxesG->type->basicType->a.choice);
729 *tmpNtHndl = nt;
730 */
731
732 } /* ProcessSnmpObjectTypeMacro */