|
|
1.1 root 1: -- sa-dec.py - Seleted Attributes
2:
3: -- $Header: /f/osi/dsap/x500as/RCS/sa-dec.py,v 7.0 89/11/23 21:50:49 mrose Rel $
4: --
5: --
6: -- $Log: sa-dec.py,v $
7: -- Revision 7.0 89/11/23 21:50:49 mrose
8: -- Release 6.0
9: --
10:
11: --
12: -- NOTICE
13: --
14: -- Acquisition, use, and distribution of this module and related
15: -- materials are subject to the restrictions of a license agreement.
16: -- Consult the Preface in the User's Manual for the full terms of
17: -- this agreement.
18: --
19: --
20:
21:
22: SA
23: {
24: joint-iso-ccitt
25: ds(5)
26: modules(1)
27: selectedAttributeTypes(5)
28: }
29:
30: DEFINITIONS ::=
31:
32: %{
33: #include <stdio.h>
34: #include "quipu/util.h"
35: #include "quipu/entry.h"
36:
37: extern LLog * log_dsap;
38:
39: #define decode_UNIV_PrintableString parse_UNIV_PrintableString
40: #define decode_UNIV_TeletexString parse_UNIV_TeletexString
41: #define decode_UNIV_OctetString parse_UNIV_OctetString
42: #define decode_UNIV_IA5String parse_UNIV_IA5String
43: #define decode_UNIV_T61String parse_UNIV_T61String
44:
45: %}
46:
47: PREFIXES encode decode print
48:
49: BEGIN
50:
51: IMPORTS
52: AttributeType
53: FROM IF
54: {
55: joint-iso-ccitt
56: ds(5)
57: modules(1)
58: informationFramework(1)
59: };
60:
61: DECODER decode
62:
63: FacsimileTelephoneNumber [[P struct fax *]]
64: ::=
65: %{
66: DLOG(log_dsap, LLOG_PDUS, ("About to decode FacsimileTelephoneNumber"));
67: parm -> bits = NULLPE;
68: %}
69: SEQUENCE
70: {
71: telephoneNumber
72: PrintableString [[s parm->number]]
73: %{
74: if ( strlen (parm->number) > UB_TELEPHONE_NUMBER) {
75: advise (NULLCP, "fax/phone number too long");
76: return NOTOK;
77: }
78: %},
79: parameters
80: BIT STRING
81: %{
82: if ((parm -> bits = pe_cpy ($$)) == NULLPE) {
83: advise (NULLCP, "out of memory");
84: return NOTOK;
85: }
86: %}
87: OPTIONAL
88: }
89: %{
90: DLOG(log_dsap, LLOG_PDUS, ("Done decode FacsimileTelephoneNumber"));
91: %}
92:
93: PostalAddress [[P struct postaddr **]]
94: %{
95: struct postaddr ** tmp;
96: int pa_count;
97: %}
98: ::=
99: %{
100: DLOG(log_dsap, LLOG_PDUS, ("About to decode PostalAddress"));
101: (*parm) = (struct postaddr *) NULL;
102: tmp = parm;
103: %}
104: SEQUENCE OF
105: %{
106: (*tmp) = (struct postaddr *) smalloc (sizeof (struct postaddr));
107: pa_count = 0;
108: %}
109: CHOICE
110: {
111: T61String [[s (*tmp)->addrcomp]]
112: %{
113: pa_count++;
114: (*tmp)->addrtype = 1;
115: if ( strlen ((*tmp)->addrcomp) > UB_POSTAL_STRING) {
116: advise (NULLCP, "postal string too long");
117: return NOTOK;
118: }
119: %} ,
120: PrintableString [[s (*tmp)->addrcomp]]
121: %{
122: pa_count++;
123: (*tmp)->addrtype = 2;
124: if ( strlen ((*tmp)->addrcomp) > UB_POSTAL_STRING) {
125: advise (NULLCP, "postal string too long");
126: return NOTOK;
127: }
128: %}
129: }
130: %{
131: tmp = & ((*tmp)->pa_next);
132: %}
133:
134: %{
135: if (pa_count > UB_POSTAL_LINE) {
136: advise (NULLCP, "too many addr components");
137: return NOTOK;
138: }
139: (*tmp) = (struct postaddr *) NULL;
140: DLOG(log_dsap, LLOG_PDUS, ("Done decode PostalAddress"));
141: %}
142:
143: TelexNumber [[P struct telex *]]
144: ::=
145: %{
146: DLOG(log_dsap, LLOG_PDUS, ("About to decode TeletexTerminalIdentifier"));
147: %}
148: SEQUENCE
149: {
150: telexNumber PrintableString [[s parm->telexnumber]]
151: %{
152: if ( strlen (parm->telexnumber) > UB_TELEX_NUMBER) {
153: advise (NULLCP, "telex number too long");
154: return NOTOK;
155: }
156: %},
157: countryCode PrintableString [[s parm->countrycode]]
158: %{
159: if ( strlen (parm->countrycode) > UB_COUNTRY_CODE) {
160: advise (NULLCP, "countrycode too long");
161: return NOTOK;
162: }
163: %},
164: answerback PrintableString [[s parm->answerback]]
165: %{
166: if ( strlen (parm->answerback) > UB_ANSWERBACK) {
167: advise (NULLCP, "answerback number too long");
168: return NOTOK;
169: }
170: %}
171: }
172: %{
173: DLOG(log_dsap, LLOG_PDUS, ("Done decode FacsimileTelephoneNumber"));
174: %}
175:
176: TeletexTerminalIdentifier [[P struct teletex *]]
177: ::=
178: %{
179: DLOG(log_dsap, LLOG_PDUS, ("About to decode TeletexTerminalIdentifier"));
180: %}
181: SEQUENCE
182: {
183: teletexTerminal
184: PrintableString [[s parm->terminal]]
185: %{
186: if ( strlen (parm->terminal) > UB_TELETEX_TERMINAL_ID) {
187: advise (NULLCP, "teletex string too long");
188: return NOTOK;
189: }
190: %},
191: parameters
192: SET {
193: graphic-character-sets [0] TeletexString
194: [[s parm->graphic]] OPTIONAL ,
195: control-character-sets [1] TeletexString
196: [[s parm->control]] OPTIONAL,
197: page-formats [2] OCTET STRING
198: [[s parm->page]] OPTIONAL,
199: miscellaneous-terminal-capabilities [3] TeletexString
200: [[s parm->misc]] OPTIONAL,
201: private-use [4] OCTET STRING
202: [[s parm->t_private]] OPTIONAL
203: }
204: OPTIONAL
205: }
206: %{
207: DLOG(log_dsap, LLOG_PDUS, ("Done decode TeletexTerminalIdentifier"));
208: %}
209:
210: PreferredDeliveryMethod [[P struct pref_deliv **]]
211: %{
212: struct pref_deliv ** tmp;
213: %}
214: ::=
215: %{
216: DLOG(log_dsap, LLOG_PDUS, ("About to decode PreferredDeliveryMethod"));
217: (*parm) = (struct pref_deliv *) NULL;
218: tmp = parm;
219: %}
220: SEQUENCE OF
221: %{
222: (*tmp) = (struct pref_deliv *) smalloc (sizeof (struct pref_deliv));
223: %}
224: INTEGER [[i (*tmp)->deliv ]]
225: {
226: any-delivery-method (0),
227: mhs-delivery (1),
228: physical-delivery (2),
229: telex-delivery (3),
230: teletex-delivery (4),
231: g3-facsimilie-delivery (5),
232: g4-facsimilie-delivery (6),
233: ia5-terminal-delivery (7),
234: videotex-delivery (8),
235: telephone-delivery (9)
236: }
237: %{
238: tmp = & ((*tmp)->pd_next);
239: %}
240:
241: %{
242: DLOG(log_dsap, LLOG_PDUS, ("Done decode PreferredDeliveryMethod"));
243: (*tmp) = (struct pref_deliv *) NULL;
244: %}
245:
246:
247: CriteriaItem [[P struct CriteriaItem **]]
248: ::=
249: %{
250: if ((*(parm) = (struct CriteriaItem *)
251: calloc (1, sizeof **(parm))) == ((struct CriteriaItem *) 0)) {
252: advise (NULLCP, "out of memory");
253: return NOTOK;
254: }
255: %}
256: CHOICE
257: {
258: equality[0]
259: AttributeType
260: [[p &(*parm) -> attrib]]
261: %{ (*parm) -> offset = choice_equality; %},
262:
263: substrings[1]
264: AttributeType
265: [[p &(*parm) -> attrib]]
266: %{ (*parm) -> offset = choice_substrings; %},
267:
268: greaterOrEqual[2]
269: AttributeType
270: [[p &(*parm) -> attrib]]
271: %{ (*parm) -> offset = choice_greaterOrEqual; %},
272:
273: lessOrEqual[3]
274: AttributeType
275: [[p &(*parm) -> attrib]]
276: %{ (*parm) -> offset = choice_lessOrEqual; %},
277:
278: approximateMatch[4]
279: AttributeType
280: [[p &(*parm) -> attrib]]
281: %{ (*parm) -> offset = choice_approximateMatch; %}
282: }
283:
284:
285: Criteria [[P struct Criteria **]]
286: %{
287: struct and_or_set **and_or_set;
288: %}
289: ::=
290: %{
291: if ((*parm = (struct Criteria *)
292: calloc (1, sizeof **parm)) == ((struct Criteria *) 0)) {
293: advise (NULLCP, "out of memory");
294: return NOTOK;
295: }
296: and_or_set = &((*parm) -> un.and_or);
297: %}
298: CHOICE
299: %{
300: and_or_set = &((*parm) -> un.and_or);
301: %}
302: {
303: type[0]
304: CriteriaItem
305: [[p &((*parm) -> un.type)]]
306: %{ (*parm) -> offset = Criteria_type; %},
307:
308: and[1]
309: SET OF
310: %{
311: if ((*(and_or_set) = (struct and_or_set *)
312: calloc (1, sizeof **(and_or_set))) == ((struct and_or_set *) 0)) {
313: advise (NULLCP, "out of memory");
314: return NOTOK;
315: }
316: %}
317: Criteria
318: [[p &((*and_or_set) -> and_or_comp)]]
319: %{ and_or_set = &((*and_or_set) -> and_or_next); (*parm) -> offset = Criteria_and; %},
320:
321: or[2]
322: SET OF
323: %{
324: if ((*(and_or_set) = (struct and_or_set *)
325: calloc (1, sizeof **(and_or_set))) == ((struct and_or_set *) 0)) {
326: advise (NULLCP, "out of memory");
327: return NOTOK;
328: }
329: %}
330: Criteria
331: [[p &((*and_or_set) -> and_or_comp)]]
332: %{ and_or_set = &((*and_or_set) -> and_or_next); (*parm) -> offset = Criteria_or; %},
333:
334: not[3]
335: Criteria
336: [[p &((*parm) -> un.not)]]
337: %{ (*parm) -> offset = Criteria_not; %}
338: }
339:
340:
341: Guide [[ P struct Guide **]]
342: ::=
343: %{
344: *parm = (struct Guide *) smalloc (sizeof (struct Guide ));
345: (*parm)->objectClass = NULLOID;
346: %}
347:
348: SET {
349: objectClass [0]
350: OBJECT IDENTIFIER
351: [[O ((*parm) -> objectClass)]]
352: OPTIONAL,
353: criteria [1]
354: Criteria [[p &((*parm) -> criteria)]]
355: }
356:
357:
358: END
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.