Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

677 lines
29 KiB

  1. /* Copyright (C) Boris Nikolaus, Germany, 1996-1997. All rights reserved. */
  2. /* Copyright (C) Microsoft Corporation, 1997-1998. All rights reserved. */
  3. #include "precomp.h"
  4. Type_t *Builtin_Type_Null;
  5. Type_t *Builtin_Type_Boolean;
  6. Type_t *Builtin_Type_Integer;
  7. Type_t *Builtin_Type_PositiveInteger;
  8. Type_t *Builtin_Type_ObjectIdentifier;
  9. Type_t *Builtin_Type_ObjectDescriptor;
  10. Type_t *Builtin_Type_Open;
  11. Type_t *Builtin_Type_BitString;
  12. Type_t *Builtin_Type_OctetString;
  13. Type_t *Builtin_Type_UTF8String;
  14. Type_t *Builtin_Type_BMPString;
  15. Type_t *Builtin_Type_GeneralString;
  16. Type_t *Builtin_Type_GraphicString;
  17. Type_t *Builtin_Type_IA5String;
  18. Type_t *Builtin_Type_ISO646String;
  19. Type_t *Builtin_Type_NumericString;
  20. Type_t *Builtin_Type_PrintableString;
  21. Type_t *Builtin_Type_TeletexString;
  22. Type_t *Builtin_Type_T61String;
  23. Type_t *Builtin_Type_UniversalString;
  24. Type_t *Builtin_Type_VideotexString;
  25. Type_t *Builtin_Type_VisibleString;
  26. Type_t *Builtin_Type_CharacterString;
  27. Type_t *Builtin_Type_GeneralizedTime;
  28. Type_t *Builtin_Type_UTCTime;
  29. Type_t *Builtin_Type_Real;
  30. Type_t *Builtin_Type_External;
  31. Type_t *Builtin_Type_EmbeddedPdv;
  32. Value_t *Builtin_Value_Null;
  33. Value_t *Builtin_Value_Integer_0;
  34. Value_t *Builtin_Value_Integer_1;
  35. Value_t *Builtin_Value_Integer_2;
  36. Value_t *Builtin_Value_Integer_10;
  37. ObjectClass_t *Builtin_ObjectClass_AbstractSyntax;
  38. ObjectClass_t *Builtin_ObjectClass_TypeIdentifier;
  39. ModuleIdentifier_t *Builtin_Module;
  40. AssignmentList_t Builtin_Assignments;
  41. AssignedObjIdList_t Builtin_ObjIds;
  42. /* create a type with a given tag */
  43. static Type_t *
  44. NewTaggedType(Type_e type, TagType_e tag, uint32_t val)
  45. {
  46. Type_t *ty;
  47. Tag_t *ta;
  48. Value_t *va;
  49. ty = NewType(type);
  50. ty->Tags = ta = NewTag(tag);
  51. ta->Tag = va = NewValue(NULL, Builtin_Type_Integer);
  52. intx_setuint32(&va->U.Integer.Value, val);
  53. return ty;
  54. }
  55. /* create a type with a given permitted alphabet constraint */
  56. /* n is the number of character ranges, the lower and upper characters */
  57. /* of these ranges will follow in the vararg list */
  58. static Type_t *
  59. NewTypeWithPermittedAlphabetConstraint(Type_e type, int n, ...)
  60. {
  61. va_list args;
  62. Type_t *ty;
  63. Value_t *va;
  64. Constraint_t **cc;
  65. ElementSetSpec_t *s, **ss;
  66. char32_t lo, up;
  67. int i;
  68. va_start(args, n);
  69. /* create type with permitted alphabet constraint */
  70. ty = NewType(type);
  71. cc = &ty->Constraints;
  72. *cc = NewConstraint();
  73. (*cc)->Root = NewElementSetSpec(eElementSetSpec_SubtypeElement);
  74. (*cc)->Root->U.SubtypeElement.SubtypeElement =
  75. NewSubtypeElement(eSubtypeElement_PermittedAlphabet);
  76. cc = &(*cc)->Root->U.SubtypeElement.SubtypeElement->
  77. U.PermittedAlphabet.Constraints;
  78. *cc = NewConstraint();
  79. ss = &(*cc)->Root;
  80. /* n character ranges will be needed */
  81. for (i = 0; i < n; i++) {
  82. /* get the lower and upper character of one range */
  83. lo = va_arg(args, char32_t);
  84. up = va_arg(args, char32_t);
  85. /* create an element set spec for this range */
  86. s = NewElementSetSpec(eElementSetSpec_SubtypeElement);
  87. s->U.SubtypeElement.SubtypeElement =
  88. NewSubtypeElement(eSubtypeElement_ValueRange);
  89. s->U.SubtypeElement.SubtypeElement->U.ValueRange.Lower.Flags = 0;
  90. s->U.SubtypeElement.SubtypeElement->U.ValueRange.Lower.Value = va =
  91. NewValue(NULL, ty);
  92. va->U.RestrictedString.Value.length = 1;
  93. va->U.RestrictedString.Value.value =
  94. (char32_t *)malloc(sizeof(char32_t));
  95. *va->U.RestrictedString.Value.value = lo;
  96. s->U.SubtypeElement.SubtypeElement->U.ValueRange.Upper.Flags = 0;
  97. s->U.SubtypeElement.SubtypeElement->U.ValueRange.Upper.Value = va =
  98. NewValue(NULL, ty);
  99. va->U.RestrictedString.Value.length = 1;
  100. va->U.RestrictedString.Value.value =
  101. (char32_t *)malloc(sizeof(char32_t));
  102. *va->U.RestrictedString.Value.value = up;
  103. /* setup for next range or last range */
  104. if (i < n - 1) {
  105. *ss = NewElementSetSpec(eElementSetSpec_Union);
  106. (*ss)->U.Union.Elements1 = s;
  107. ss = &(*ss)->U.Union.Elements2;
  108. } else {
  109. *ss = s;
  110. }
  111. }
  112. return ty;
  113. }
  114. /* initialize internally needed builtin types, values, information object */
  115. /* classes and object identifier components */
  116. void
  117. InitBuiltin()
  118. {
  119. Type_t *ty;
  120. Component_t *co1, *co2, *co3, *co4, *co5, *co6;
  121. Assignment_t *a;
  122. AssignedObjId_t *oi0, *oi1, *oi2, *oi0_0, *oi0_1, *oi0_2, *oi0_3, *oi0_4,
  123. *oi1_0, *oi1_2, *oi1_3, **oi;
  124. String_t *s1, *s2;
  125. int i;
  126. FieldSpec_t *fs1, *fs2, *fs3;
  127. Constraint_t *c;
  128. SubtypeElement_t *s;
  129. SyntaxSpec_t *sy1, *sy2, *sy3, *sy4, *sy5, *sy6, *sy7, *sy8;
  130. /* allocate a builtin module name */
  131. Builtin_Assignments = NULL;
  132. Builtin_Module = NewModuleIdentifier();
  133. Builtin_Module->Identifier = "<Internal>";
  134. /* allocate basic ASN.1 types */
  135. Builtin_Type_Null = NewType(eType_Null);
  136. Builtin_Type_Boolean = NewType(eType_Boolean);
  137. Builtin_Type_Integer = NewType(eType_Integer);
  138. Builtin_Type_ObjectIdentifier = NewType(eType_ObjectIdentifier);
  139. Builtin_Type_Open = NewType(eType_Open);
  140. Builtin_Type_BitString = NewType(eType_BitString);
  141. Builtin_Type_OctetString = NewType(eType_OctetString);
  142. Builtin_Type_UTF8String = NewType(eType_UTF8String);
  143. Builtin_Type_ObjectDescriptor = NewTypeWithPermittedAlphabetConstraint(
  144. eType_ObjectDescriptor, 1, 0x00, 0xff);
  145. Builtin_Type_BMPString = NewTypeWithPermittedAlphabetConstraint(
  146. eType_BMPString, 1, 0x0000, 0xffff);
  147. Builtin_Type_GeneralString = NewTypeWithPermittedAlphabetConstraint(
  148. eType_GeneralString, 1, 0x00, 0xff);
  149. Builtin_Type_GraphicString = NewTypeWithPermittedAlphabetConstraint(
  150. eType_GraphicString, 1, 0x00, 0xff);
  151. Builtin_Type_IA5String = NewTypeWithPermittedAlphabetConstraint(
  152. eType_IA5String, 1, 0x00, 0x7f);
  153. Builtin_Type_ISO646String = NewTypeWithPermittedAlphabetConstraint(
  154. eType_ISO646String, 1, 0x20, 0x7e);
  155. Builtin_Type_NumericString = NewTypeWithPermittedAlphabetConstraint(
  156. eType_NumericString, 2, 0x20, 0x20, 0x30, 0x39);
  157. Builtin_Type_PrintableString = NewTypeWithPermittedAlphabetConstraint(
  158. eType_PrintableString, 7, 0x20, 0x20, 0x27, 0x29, 0x2b, 0x3a,
  159. 0x3d, 0x3d, 0x3f, 0x3f, 0x41, 0x5a, 0x61, 0x7a);
  160. Builtin_Type_TeletexString = NewTypeWithPermittedAlphabetConstraint(
  161. eType_TeletexString, 1, 0x00, 0xff);
  162. Builtin_Type_T61String = NewTypeWithPermittedAlphabetConstraint(
  163. eType_T61String, 1, 0x00, 0xff);
  164. Builtin_Type_UniversalString = NewTypeWithPermittedAlphabetConstraint(
  165. eType_UniversalString, 1, 0x00000000, 0xffffffff);
  166. Builtin_Type_VideotexString = NewTypeWithPermittedAlphabetConstraint(
  167. eType_VideotexString, 1, 0x00, 0xff);
  168. Builtin_Type_VisibleString = NewTypeWithPermittedAlphabetConstraint(
  169. eType_VisibleString, 1, 0x20, 0x7e);
  170. Builtin_Type_GeneralizedTime = NewTypeWithPermittedAlphabetConstraint(
  171. eType_GeneralizedTime, 1, 0x20, 0x7e);
  172. Builtin_Type_UTCTime = NewTypeWithPermittedAlphabetConstraint(
  173. eType_UTCTime, 1, 0x20, 0x7e);
  174. /* allocate basic ASN.1 values */
  175. Builtin_Value_Null = NewValue(NULL, Builtin_Type_Null);
  176. Builtin_Value_Integer_0 = NewValue(NULL, Builtin_Type_Integer);
  177. intx_setuint32(&Builtin_Value_Integer_0->U.Integer.Value, 0);
  178. Builtin_Value_Integer_1 = NewValue(NULL, Builtin_Type_Integer);
  179. intx_setuint32(&Builtin_Value_Integer_1->U.Integer.Value, 1);
  180. Builtin_Value_Integer_2 = NewValue(NULL, Builtin_Type_Integer);
  181. intx_setuint32(&Builtin_Value_Integer_2->U.Integer.Value, 2);
  182. Builtin_Value_Integer_10 = NewValue(NULL, Builtin_Type_Integer);
  183. intx_setuint32(&Builtin_Value_Integer_10->U.Integer.Value, 10);
  184. /* allocate a positive integer type */
  185. Builtin_Type_PositiveInteger = NewType(eType_Integer);
  186. Builtin_Type_PositiveInteger->Constraints = c = NewConstraint();
  187. c->Root = NewElementSetSpec(eElementSetSpec_SubtypeElement);
  188. c->Root->U.SubtypeElement.SubtypeElement = s =
  189. NewSubtypeElement(eSubtypeElement_ValueRange);
  190. s->U.ValueRange.Lower.Flags = 0;
  191. s->U.ValueRange.Lower.Value = Builtin_Value_Integer_0;
  192. s->U.ValueRange.Upper.Flags = eEndPoint_Max;
  193. #ifndef NO_BUILTIN
  194. /* REAL */
  195. co1 = NewComponent(eComponent_Normal);
  196. co2 = co1->Next = NewComponent(eComponent_Normal);
  197. co3 = co2->Next = NewComponent(eComponent_Normal);
  198. ty = NewTaggedType(eType_Integer, eTagType_Implicit, 0);
  199. co1->U.Normal.NamedType = NewNamedType("mantissa", ty);
  200. ty = NewTaggedType(eType_Integer, eTagType_Implicit, 1);
  201. ty->Constraints = c = NewConstraint();
  202. c->Root = NewElementSetSpec(eElementSetSpec_Union);
  203. c->Root->U.Union.Elements1 =
  204. NewElementSetSpec(eElementSetSpec_SubtypeElement);
  205. c->Root->U.Union.Elements1->U.SubtypeElement.SubtypeElement = s =
  206. NewSubtypeElement(eSubtypeElement_SingleValue);
  207. s->U.SingleValue.Value = Builtin_Value_Integer_2;
  208. c->Root->U.Union.Elements2 =
  209. NewElementSetSpec(eElementSetSpec_SubtypeElement);
  210. c->Root->U.Union.Elements2->U.SubtypeElement.SubtypeElement = s =
  211. NewSubtypeElement(eSubtypeElement_SingleValue);
  212. s->U.SingleValue.Value = Builtin_Value_Integer_10;
  213. co2->U.Normal.NamedType = NewNamedType("base", ty);
  214. ty = NewTaggedType(eType_Integer, eTagType_Implicit, 2);
  215. co3->U.Normal.NamedType = NewNamedType("exponent", ty);
  216. Builtin_Type_Real = NewType(eType_Real);
  217. Builtin_Type_Real->U.Real.Components = co1;
  218. /* EXTERNAL.identification.syntaxes */
  219. co1 = NewComponent(eComponent_Normal);
  220. co2 = co1->Next = NewComponent(eComponent_Normal);
  221. ty = NewTaggedType(eType_ObjectIdentifier, eTagType_Implicit, 0);
  222. co1->U.Normal.NamedType = NewNamedType("abstract", ty);
  223. ty = NewTaggedType(eType_ObjectIdentifier, eTagType_Implicit, 1);
  224. co2->U.Normal.NamedType = NewNamedType("transfer", ty);
  225. ty = NewType(eType_Sequence);
  226. ty->U.Sequence.Components = co1;
  227. a = NewAssignment(eAssignment_Type);
  228. a->U.Type.Type = ty;
  229. a->Identifier = "<ASN1external_identification_syntaxes_t>";
  230. a->Module = Builtin_Module;
  231. a->Next = Builtin_Assignments;
  232. Builtin_Assignments = a;
  233. /* EXTERNAL.identification.context-negotiation */
  234. co1 = NewComponent(eComponent_Normal);
  235. co2 = co1->Next = NewComponent(eComponent_Normal);
  236. ty = NewTaggedType(eType_Integer, eTagType_Implicit, 0);
  237. co1->U.Normal.NamedType = NewNamedType("presentation-context-id", ty);
  238. ty = NewTaggedType(eType_ObjectIdentifier, eTagType_Implicit, 1);
  239. co2->U.Normal.NamedType = NewNamedType("transfer-syntax", ty);
  240. ty = NewType(eType_Sequence);
  241. ty->U.Sequence.Components = co1;
  242. a = NewAssignment(eAssignment_Type);
  243. a->U.Type.Type = ty;
  244. a->Identifier = "ASN1external_identification_context_negotiation_t";
  245. a->Module = Builtin_Module;
  246. a->Next = Builtin_Assignments;
  247. Builtin_Assignments = a;
  248. /* EXTERNAL.identification */
  249. co1 = NewComponent(eComponent_Normal);
  250. co2 = co1->Next = NewComponent(eComponent_Normal);
  251. co3 = co2->Next = NewComponent(eComponent_Normal);
  252. co4 = co3->Next = NewComponent(eComponent_Normal);
  253. co5 = co4->Next = NewComponent(eComponent_Normal);
  254. co6 = co5->Next = NewComponent(eComponent_Normal);
  255. ty = NewTaggedType(eType_Reference, eTagType_Explicit, 0);
  256. ty->U.Reference.Identifier = "<ASN1external_identification_syntaxes_t>";
  257. ty->U.Reference.Module = Builtin_Module;
  258. co1->U.Normal.NamedType = NewNamedType("<syntaxes>", ty);
  259. ty = NewTaggedType(eType_ObjectIdentifier, eTagType_Explicit, 1);
  260. co2->U.Normal.NamedType = NewNamedType("syntax", ty);
  261. ty = NewTaggedType(eType_Integer, eTagType_Explicit, 2);
  262. co3->U.Normal.NamedType = NewNamedType("presentation-context-id", ty);
  263. ty = NewTaggedType(eType_Reference, eTagType_Explicit, 3);
  264. ty->U.Reference.Identifier =
  265. "ASN1external_identification_context_negotiation_t";
  266. ty->U.Reference.Module = Builtin_Module;
  267. co4->U.Normal.NamedType = NewNamedType("context-negotiation", ty);
  268. ty = NewTaggedType(eType_ObjectIdentifier, eTagType_Explicit, 4);
  269. co5->U.Normal.NamedType = NewNamedType("<transfer-syntax>", ty);
  270. ty = NewTaggedType(eType_Null, eTagType_Explicit, 5);
  271. co6->U.Normal.NamedType = NewNamedType("<fixed>", ty);
  272. ty = NewType(eType_Choice);
  273. ty->U.Choice.Components = co1;
  274. a = NewAssignment(eAssignment_Type);
  275. a->U.Type.Type = ty;
  276. a->Identifier = "ASN1external_identification_t";
  277. a->Module = Builtin_Module;
  278. a->Next = Builtin_Assignments;
  279. Builtin_Assignments = a;
  280. /* EXTERNAL.data-value */
  281. co1 = NewComponent(eComponent_Normal);
  282. co2 = co1->Next = NewComponent(eComponent_Normal);
  283. ty = NewTaggedType(eType_Open, eTagType_Explicit, 0);
  284. co1->U.Normal.NamedType = NewNamedType("notation", ty);
  285. ty = NewTaggedType(eType_BitString, eTagType_Explicit, 1);
  286. co2->U.Normal.NamedType = NewNamedType("encoded", ty);
  287. ty = NewType(eType_Choice);
  288. ty->U.Choice.Components = co1;
  289. a = NewAssignment(eAssignment_Type);
  290. a->U.Type.Type = ty;
  291. a->Identifier = "ASN1external_data_value_t";
  292. a->Module = Builtin_Module;
  293. a->Next = Builtin_Assignments;
  294. Builtin_Assignments = a;
  295. /* EXTERNAL */
  296. co1 = NewComponent(eComponent_Normal);
  297. co2 = co1->Next = NewComponent(eComponent_Optional);
  298. co3 = co2->Next = NewComponent(eComponent_Normal);
  299. ty = NewTaggedType(eType_Reference, eTagType_Implicit, 0);
  300. ty->U.Reference.Identifier = "ASN1external_identification_t";
  301. ty->U.Reference.Module = Builtin_Module;
  302. co1->U.Normal.NamedType = NewNamedType("identification", ty);
  303. ty = NewTaggedType(eType_ObjectDescriptor, eTagType_Implicit, 1);
  304. co2->U.Optional.NamedType = NewNamedType("data-value-descriptor", ty);
  305. ty = NewTaggedType(eType_Reference, eTagType_Implicit, 2);
  306. ty->U.Reference.Identifier = "ASN1external_data_value_t";
  307. ty->U.Reference.Module = Builtin_Module;
  308. co3->U.Normal.NamedType = NewNamedType("data-value", ty);
  309. Builtin_Type_External = NewType(eType_External);
  310. Builtin_Type_External->U.External.Components = co1;
  311. Builtin_Type_External->U.External.Optionals = 1;
  312. /* EMBEDDED PDV.identification.syntaxes */
  313. co1 = NewComponent(eComponent_Normal);
  314. co2 = co1->Next = NewComponent(eComponent_Normal);
  315. ty = NewTaggedType(eType_ObjectIdentifier, eTagType_Implicit, 0);
  316. co1->U.Normal.NamedType = NewNamedType("abstract", ty);
  317. ty = NewTaggedType(eType_ObjectIdentifier, eTagType_Implicit, 1);
  318. co2->U.Normal.NamedType = NewNamedType("transfer", ty);
  319. ty = NewType(eType_Sequence);
  320. ty->U.Sequence.Components = co1;
  321. a = NewAssignment(eAssignment_Type);
  322. a->U.Type.Type = ty;
  323. a->Identifier = "ASN1embeddedpdv_identification_syntaxes_t";
  324. a->Module = Builtin_Module;
  325. a->Next = Builtin_Assignments;
  326. Builtin_Assignments = a;
  327. /* EMBEDDED PDV.identification.context-negotiation */
  328. co1 = NewComponent(eComponent_Normal);
  329. co2 = co1->Next = NewComponent(eComponent_Normal);
  330. ty = NewTaggedType(eType_Integer, eTagType_Implicit, 0);
  331. co1->U.Normal.NamedType = NewNamedType("presentation-context-id", ty);
  332. ty = NewTaggedType(eType_ObjectIdentifier, eTagType_Implicit, 1);
  333. co2->U.Normal.NamedType = NewNamedType("transfer-syntax", ty);
  334. ty = NewType(eType_Sequence);
  335. ty->U.Sequence.Components = co1;
  336. a = NewAssignment(eAssignment_Type);
  337. a->U.Type.Type = ty;
  338. a->Identifier = "ASN1embeddedpdv_identification_context_negotiation_t";
  339. a->Module = Builtin_Module;
  340. a->Next = Builtin_Assignments;
  341. Builtin_Assignments = a;
  342. /* EMBEDDED PDV.identification */
  343. co1 = NewComponent(eComponent_Normal);
  344. co2 = co1->Next = NewComponent(eComponent_Normal);
  345. co3 = co2->Next = NewComponent(eComponent_Normal);
  346. co4 = co3->Next = NewComponent(eComponent_Normal);
  347. co5 = co4->Next = NewComponent(eComponent_Normal);
  348. co6 = co5->Next = NewComponent(eComponent_Normal);
  349. ty = NewTaggedType(eType_Reference, eTagType_Explicit, 0);
  350. ty->U.Reference.Identifier = "ASN1embeddedpdv_identification_syntaxes_t";
  351. ty->U.Reference.Module = Builtin_Module;
  352. co1->U.Normal.NamedType = NewNamedType("syntaxes", ty);
  353. ty = NewTaggedType(eType_ObjectIdentifier, eTagType_Explicit, 1);
  354. co2->U.Normal.NamedType = NewNamedType("syntax", ty);
  355. ty = NewTaggedType(eType_Integer, eTagType_Explicit, 2);
  356. co3->U.Normal.NamedType = NewNamedType("presentation-context-id", ty);
  357. ty = NewTaggedType(eType_Reference, eTagType_Explicit, 3);
  358. ty->U.Reference.Identifier =
  359. "ASN1embeddedpdv_identification_context_negotiation_t";
  360. ty->U.Reference.Module = Builtin_Module;
  361. co4->U.Normal.NamedType = NewNamedType("context-negotiation", ty);
  362. ty = NewTaggedType(eType_ObjectIdentifier, eTagType_Explicit, 4);
  363. co5->U.Normal.NamedType = NewNamedType("transfer-syntax", ty);
  364. ty = NewTaggedType(eType_Null, eTagType_Explicit, 5);
  365. co6->U.Normal.NamedType = NewNamedType("fixed", ty);
  366. ty = NewType(eType_Choice);
  367. ty->U.Choice.Components = co1;
  368. a = NewAssignment(eAssignment_Type);
  369. a->U.Type.Type = ty;
  370. a->Identifier = "ASN1embeddedpdv_identification_t";
  371. a->Module = Builtin_Module;
  372. a->Next = Builtin_Assignments;
  373. Builtin_Assignments = a;
  374. /* EMBEDDED PDV.data-value */
  375. co1 = NewComponent(eComponent_Normal);
  376. co2 = co1->Next = NewComponent(eComponent_Normal);
  377. ty = NewTaggedType(eType_Open, eTagType_Explicit, 0);
  378. co1->U.Normal.NamedType = NewNamedType("notation", ty);
  379. ty = NewTaggedType(eType_BitString, eTagType_Explicit, 1);
  380. co2->U.Normal.NamedType = NewNamedType("encoded", ty);
  381. ty = NewType(eType_Choice);
  382. ty->U.Choice.Components = co1;
  383. a = NewAssignment(eAssignment_Type);
  384. a->U.Type.Type = ty;
  385. a->Identifier = "ASN1embeddedpdv_data_value_t";
  386. a->Module = Builtin_Module;
  387. a->Next = Builtin_Assignments;
  388. Builtin_Assignments = a;
  389. /* EMBEDDED PDV */
  390. co1 = NewComponent(eComponent_Normal);
  391. co2 = co1->Next = NewComponent(eComponent_Normal);
  392. ty = NewTaggedType(eType_Reference, eTagType_Implicit, 0);
  393. ty->U.Reference.Identifier = "ASN1embeddedpdv_identification_t";
  394. ty->U.Reference.Module = Builtin_Module;
  395. co1->U.Normal.NamedType = NewNamedType("identification", ty);
  396. ty = NewTaggedType(eType_Reference, eTagType_Implicit, 2);
  397. ty->U.Reference.Identifier = "ASN1embeddedpdv_data_value_t";
  398. ty->U.Reference.Module = Builtin_Module;
  399. co2->U.Normal.NamedType = NewNamedType("data-value", ty);
  400. Builtin_Type_EmbeddedPdv = NewType(eType_EmbeddedPdv);
  401. Builtin_Type_EmbeddedPdv->U.EmbeddedPdv.Components = co1;
  402. /* CHARACTER STRING.identification.syntaxes */
  403. co1 = NewComponent(eComponent_Normal);
  404. co2 = co1->Next = NewComponent(eComponent_Normal);
  405. ty = NewTaggedType(eType_ObjectIdentifier, eTagType_Implicit, 0);
  406. co1->U.Normal.NamedType = NewNamedType("abstract", ty);
  407. ty = NewTaggedType(eType_ObjectIdentifier, eTagType_Implicit, 1);
  408. co2->U.Normal.NamedType = NewNamedType("transfer", ty);
  409. ty = NewType(eType_Sequence);
  410. ty->U.Sequence.Components = co1;
  411. a = NewAssignment(eAssignment_Type);
  412. a->U.Type.Type = ty;
  413. a->Identifier = "ASN1characterstring_identification_syntaxes_t";
  414. a->Module = Builtin_Module;
  415. a->Next = Builtin_Assignments;
  416. Builtin_Assignments = a;
  417. /* CHARACTER STRING.identification.context-negotiation */
  418. co1 = NewComponent(eComponent_Normal);
  419. co2 = co1->Next = NewComponent(eComponent_Normal);
  420. ty = NewTaggedType(eType_Integer, eTagType_Implicit, 0);
  421. co1->U.Normal.NamedType = NewNamedType("presentation-context-id", ty);
  422. ty = NewTaggedType(eType_ObjectIdentifier, eTagType_Implicit, 1);
  423. co2->U.Normal.NamedType = NewNamedType("transfer-syntax", ty);
  424. ty = NewType(eType_Sequence);
  425. ty->U.Sequence.Components = co1;
  426. a = NewAssignment(eAssignment_Type);
  427. a->U.Type.Type = ty;
  428. a->Identifier = "ASN1characterstring_identification_context_negotiation_t";
  429. a->Module = Builtin_Module;
  430. a->Next = Builtin_Assignments;
  431. Builtin_Assignments = a;
  432. /* CHARACTER STRING.identification */
  433. co1 = NewComponent(eComponent_Normal);
  434. co2 = co1->Next = NewComponent(eComponent_Normal);
  435. co3 = co2->Next = NewComponent(eComponent_Normal);
  436. co4 = co3->Next = NewComponent(eComponent_Normal);
  437. co5 = co4->Next = NewComponent(eComponent_Normal);
  438. co6 = co5->Next = NewComponent(eComponent_Normal);
  439. ty = NewTaggedType(eType_Reference, eTagType_Explicit, 0);
  440. ty->U.Reference.Identifier = "ASN1characterstring_identification_syntaxes_t";
  441. ty->U.Reference.Module = Builtin_Module;
  442. co1->U.Normal.NamedType = NewNamedType("syntaxes", ty);
  443. ty = NewTaggedType(eType_ObjectIdentifier, eTagType_Explicit, 1);
  444. co2->U.Normal.NamedType = NewNamedType("syntax", ty);
  445. ty = NewTaggedType(eType_Integer, eTagType_Explicit, 2);
  446. co3->U.Normal.NamedType = NewNamedType("presentation-context-id", ty);
  447. ty = NewTaggedType(eType_Reference, eTagType_Explicit, 3);
  448. ty->U.Reference.Identifier =
  449. "ASN1characterstring_identification_context_negotiation_t";
  450. ty->U.Reference.Module = Builtin_Module;
  451. co4->U.Normal.NamedType = NewNamedType("context-negotiation", ty);
  452. ty = NewTaggedType(eType_ObjectIdentifier, eTagType_Explicit, 4);
  453. co5->U.Normal.NamedType = NewNamedType("transfer-syntax", ty);
  454. ty = NewTaggedType(eType_Null, eTagType_Explicit, 5);
  455. co6->U.Normal.NamedType = NewNamedType("fixed", ty);
  456. ty = NewType(eType_Choice);
  457. ty->U.Choice.Components = co1;
  458. a = NewAssignment(eAssignment_Type);
  459. a->U.Type.Type = ty;
  460. a->Identifier = "ASN1characterstring_identification_t";
  461. a->Module = Builtin_Module;
  462. a->Next = Builtin_Assignments;
  463. Builtin_Assignments = a;
  464. /* CHARACTER STRING.data-value */
  465. co1 = NewComponent(eComponent_Normal);
  466. co2 = co1->Next = NewComponent(eComponent_Normal);
  467. ty = NewTaggedType(eType_Open, eTagType_Explicit, 0);
  468. co1->U.Normal.NamedType = NewNamedType("notation", ty);
  469. ty = NewTaggedType(eType_OctetString, eTagType_Explicit, 1);
  470. co2->U.Normal.NamedType = NewNamedType("encoded", ty);
  471. ty = NewType(eType_Choice);
  472. ty->U.Choice.Components = co1;
  473. a = NewAssignment(eAssignment_Type);
  474. a->U.Type.Type = ty;
  475. a->Identifier = "ASN1characterstring_data_value_t";
  476. a->Module = Builtin_Module;
  477. a->Next = Builtin_Assignments;
  478. Builtin_Assignments = a;
  479. /* CHARACTER STRING */
  480. co1 = NewComponent(eComponent_Normal);
  481. co2 = co1->Next = NewComponent(eComponent_Normal);
  482. ty = NewTaggedType(eType_Reference, eTagType_Implicit, 0);
  483. ty->U.Reference.Identifier = "ASN1characterstring_identification_t";
  484. ty->U.Reference.Module = Builtin_Module;
  485. co1->U.Normal.NamedType = NewNamedType("identification", ty);
  486. ty = NewTaggedType(eType_Reference, eTagType_Implicit, 2);
  487. ty->U.Reference.Identifier = "ASN1characterstring_data_value_t";
  488. ty->U.Reference.Module = Builtin_Module;
  489. co2->U.Normal.NamedType = NewNamedType("data-value", ty);
  490. Builtin_Type_CharacterString = NewType(eType_CharacterString);
  491. Builtin_Type_CharacterString->U.CharacterString.Components = co1;
  492. /* ABSTRACT-SYNTAX */
  493. fs1 = NewFieldSpec(eFieldSpec_FixedTypeValue);
  494. fs2 = fs1->Next = NewFieldSpec(eFieldSpec_Type);
  495. fs3 = fs2->Next = NewFieldSpec(eFieldSpec_FixedTypeValue);
  496. fs1->Identifier = "&id";
  497. fs1->U.FixedTypeValue.Type = Builtin_Type_ObjectIdentifier;
  498. fs1->U.FixedTypeValue.Unique = 1;
  499. fs1->U.FixedTypeValue.Optionality = NewOptionality(eOptionality_Normal);
  500. fs2->Identifier = "&Type";
  501. fs2->U.Type.Optionality = NewOptionality(eOptionality_Normal);
  502. fs3->U.FixedTypeValue.Type = ty = NewType(eType_BitString);
  503. ty->U.BitString.NamedNumbers = NewNamedNumber(eNamedNumber_Normal);
  504. ty->U.BitString.NamedNumbers->U.Normal.Identifier =
  505. "handles-invalid-encodings";
  506. ty->U.BitString.NamedNumbers->U.Normal.Value = Builtin_Value_Integer_0;
  507. fs3->U.FixedTypeValue.Optionality =
  508. NewOptionality(eOptionality_Default_Value);
  509. fs3->U.FixedTypeValue.Optionality->U.Value = NewValue(NULL, ty);
  510. sy1 = NewSyntaxSpec(eSyntaxSpec_Field);
  511. sy2 = sy1->Next = NewSyntaxSpec(eSyntaxSpec_Literal);
  512. sy3 = sy2->Next = NewSyntaxSpec(eSyntaxSpec_Literal);
  513. sy4 = sy3->Next = NewSyntaxSpec(eSyntaxSpec_Field);
  514. sy5 = sy4->Next = NewSyntaxSpec(eSyntaxSpec_Optional);
  515. sy6 = sy5->U.Optional.SyntaxSpec = NewSyntaxSpec(eSyntaxSpec_Literal);
  516. sy7 = sy6->Next = NewSyntaxSpec(eSyntaxSpec_Literal);
  517. sy8 = sy7->Next = NewSyntaxSpec(eSyntaxSpec_Field);
  518. sy1->U.Field.Field = "&Type";
  519. sy2->U.Literal.Literal = "IDENTIFIED";
  520. sy3->U.Literal.Literal = "BY";
  521. sy4->U.Field.Field = "&id";
  522. sy6->U.Literal.Literal = "HAS";
  523. sy7->U.Literal.Literal = "PROPERTY";
  524. sy8->U.Field.Field = "&property";
  525. Builtin_ObjectClass_AbstractSyntax =
  526. NewObjectClass(eObjectClass_ObjectClass);
  527. Builtin_ObjectClass_AbstractSyntax->U.ObjectClass.FieldSpec = fs1;
  528. Builtin_ObjectClass_AbstractSyntax->U.ObjectClass.SyntaxSpec = sy1;
  529. /* TYPE-IDENTIFIER */
  530. fs1 = NewFieldSpec(eFieldSpec_FixedTypeValue);
  531. fs2 = fs1->Next = NewFieldSpec(eFieldSpec_Type);
  532. fs1->Identifier = "&id";
  533. fs1->U.FixedTypeValue.Type = Builtin_Type_ObjectIdentifier;
  534. fs1->U.FixedTypeValue.Unique = 1;
  535. fs1->U.FixedTypeValue.Optionality = NewOptionality(eOptionality_Normal);
  536. fs2->Identifier = "&Type";
  537. fs2->U.Type.Optionality = NewOptionality(eOptionality_Normal);
  538. sy1 = NewSyntaxSpec(eSyntaxSpec_Field);
  539. sy2 = sy1->Next = NewSyntaxSpec(eSyntaxSpec_Literal);
  540. sy3 = sy2->Next = NewSyntaxSpec(eSyntaxSpec_Literal);
  541. sy4 = sy3->Next = NewSyntaxSpec(eSyntaxSpec_Field);
  542. sy1->U.Field.Field = "&Type";
  543. sy2->U.Literal.Literal = "IDENTIFIED";
  544. sy3->U.Literal.Literal = "BY";
  545. sy4->U.Field.Field = "&id";
  546. Builtin_ObjectClass_TypeIdentifier =
  547. NewObjectClass(eObjectClass_ObjectClass);
  548. Builtin_ObjectClass_TypeIdentifier->U.ObjectClass.FieldSpec = fs1;
  549. Builtin_ObjectClass_TypeIdentifier->U.ObjectClass.SyntaxSpec = sy1;
  550. #endif
  551. /* object identifiers components */
  552. #ifndef NO_OBJID
  553. Builtin_ObjIds = oi0 = NewAssignedObjId();
  554. oi0->Next = oi1 = NewAssignedObjId();
  555. oi1->Next = oi2 = NewAssignedObjId();
  556. /* { itu-t(0) }, { ccitt(0) } */
  557. oi0->Number = 0;
  558. oi0->Names = s1 = NewString();
  559. s1->Next = s2 = NewString();
  560. s1->String = "itu-t";
  561. s2->String = "ccitt";
  562. /* { iso(1) } */
  563. oi1->Number = 1;
  564. oi1->Names = s1 = NewString();
  565. s1->String = "iso";
  566. /* { joint-iso-itu-t(2) }, { joint-iso-ccitt(2) } */
  567. oi2->Number = 2;
  568. oi2->Names = s1 = NewString();
  569. s1->Next = s2 = NewString();
  570. s1->String = "joint-iso-itu-t";
  571. s2->String = "joint-iso-ccitt";
  572. oi0->Child = oi0_0 = NewAssignedObjId();
  573. oi0_0->Next = oi0_1 = NewAssignedObjId();
  574. oi0_1->Next = oi0_2 = NewAssignedObjId();
  575. oi0_2->Next = oi0_3 = NewAssignedObjId();
  576. oi0_3->Next = oi0_4 = NewAssignedObjId();
  577. /* { itu-t recommendation(0) } */
  578. oi0_0->Number = 0;
  579. oi0_0->Names = s1 = NewString();
  580. s1->String = "recommendation";
  581. /* { itu-t question(1) } */
  582. oi0_1->Number = 1;
  583. oi0_1->Names = s1 = NewString();
  584. s1->String = "question";
  585. /* { itu-t administration(2) } */
  586. oi0_2->Number = 2;
  587. oi0_2->Names = s1 = NewString();
  588. s1->String = "administration";
  589. /* { itu-t network-operator(3) } */
  590. oi0_3->Number = 3;
  591. oi0_3->Names = s1 = NewString();
  592. s1->String = "network-operator";
  593. /* { itu-t identified-organization(4) } */
  594. oi0_4->Number = 4;
  595. oi0_4->Names = s1 = NewString();
  596. s1->String = "identified-organization";
  597. /* { itu-t recommendation a(1) } .. { itu-t recommendation z(26) } */
  598. oi = &oi0_0->Child;
  599. for (i = 'a'; i <= 'z'; i++) {
  600. *oi = NewAssignedObjId();
  601. (*oi)->Number = i - 'a' + 1;
  602. (*oi)->Names = s1 = NewString();
  603. s1->String = (char *)malloc(2);
  604. s1->String[0] = (char)i;
  605. s1->String[1] = 0;
  606. oi = &(*oi)->Next;
  607. }
  608. oi1->Child = oi1_0 = NewAssignedObjId();
  609. oi1_0->Next = oi1_2 = NewAssignedObjId();
  610. oi1_2->Next = oi1_3 = NewAssignedObjId();
  611. /* { iso standard(0) } */
  612. oi1_0->Number = 0;
  613. oi1_0->Names = s1 = NewString();
  614. s1->String = "standard";
  615. /* { iso member-body(2) } */
  616. oi1_2->Number = 2;
  617. oi1_2->Names = s1 = NewString();
  618. s1->String = "member-body";
  619. /* { iso identified-organization(3) } */
  620. oi1_3->Number = 3;
  621. oi1_3->Names = s1 = NewString();
  622. s1->String = "identified-organization";
  623. #endif
  624. /* initialize ASN1-CHARACTER-MODULE */
  625. InitBuiltinASN1CharacterModule();
  626. }