comparison src/gpf/ccd/asn1_seq_ext.c @ 0:4e78acac3d88

src/{condat,cs,gpf,nucleus}: import from Selenite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 06:23:26 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4e78acac3d88
1 /*
2 +-----------------------------------------------------------------------------
3 | Project :
4 | Modul : asn1_seq_ext.c
5 +-----------------------------------------------------------------------------
6 | Copyright 2002 Texas Instruments Berlin, AG
7 | All rights reserved.
8 |
9 | This file is confidential and a trade secret of Texas
10 | Instruments Berlin, AG
11 | The receipt of or possession of this file does not convey
12 | any rights to reproduce or disclose its contents or to
13 | manufacture, use, or sell anything it may describe, in
14 | whole, or in part, without the specific written consent of
15 | Texas Instruments Berlin, AG.
16 +-----------------------------------------------------------------------------
17 | Purpose : Encoding and decoding functions for ASN1_SEQ_EXTENSIBLE type
18 | This module has some issues in common with asn1_seq.c.
19 +-----------------------------------------------------------------------------
20 */
21
22 /*
23 * Standard definitions like UCHAR, ERROR etc.
24 */
25 #include "typedefs.h"
26 #include "header.h"
27
28 /*
29 * Prototypes of ccd (USE_DRIVER EQ undef) for prototypes only
30 * look at ccdapi.h
31 */
32 #undef USE_DRIVER
33 #include "ccdapi.h"
34
35 /*
36 * Types and functions for bit access and manipulation
37 */
38 #include "ccd_globs.h"
39 #include "bitfun.h"
40
41 /*
42 * Prototypes and constants in the common part of ccd
43 */
44 #include "ccd.h"
45 #include "ccd_codingtypes.h"
46
47 /*
48 * Declaration of coder/decoder tables
49 */
50 #include "ccdtable.h"
51 #include "ccddata.h"
52
53 EXTERN T_FUNC_POINTER codec[MAX_CODEC_ID+1][2];
54
55 #ifndef RUN_INT_RAM
56 /*
57 +------------------------------------------------------------------------+
58 | PROJECT : CCD (6144) MODULE : asn1_seq_ext |
59 | STATE : code ROUTINE : cdc_asn1_seq_ext_decode |
60 +------------------------------------------------------------------------+
61
62 PURPOSE : Decode basic UNALIGNED PER for extensible SEQUENCE type and
63 SEQUENCE OF.
64
65 The element can be a field of fixed or variable length.
66 It can contain OPTIONAL elements or integer elements with
67 a DEFAULT value. The so called nonCriticalExtensions or empty
68 sequences belong to the category of bit strings of fixed length
69 which is set to 0.
70
71 First the extension bit is decoded, then the elements of the
72 extension root. Finally the elements of the extension addition.
73 See also comments to the encoding function.
74 */
75
76 SHORT cdc_asn1_seq_ext_decode (const ULONG c_ref, const ULONG e_ref, T_CCD_Globs *globs)
77 {
78 ULONG repeat=1, max_rep=1, first_elem, last_elem, elem, ext_begin;
79 ULONG c_size;
80 UBYTE *old_pstruct;
81 BOOL extPresent=FALSE;
82 ULONG calc_ref = calcidx[melem[e_ref].calcIdxRef].condCalcRef;
83
84 #ifdef DEBUG_CCD
85 #ifndef CCD_SYMBOLS
86 TRACE_CCD (globs, "cdc_asn1_seq_ext_decode()");
87 #else
88 TRACE_CCD (globs, "cdc_asn1_seq_ext_decode() %s", mcomp[melem[e_ref].elemRef].name);
89 #endif
90 #endif
91
92 /*
93 * This function is called as an equivalent to ccd_decodeComposition.
94 * Hence the increment on globs->ccd_recurs_level.
95 */
96 globs->ccd_recurs_level ++;
97
98 /*
99 * Set pstrcutOffs and max_rep.
100 * Check the valid flag in case of optional elements.
101 */
102 if (PER_CommonBegin (e_ref, &max_rep, globs) NEQ ccdOK)
103 {
104 globs->ccd_recurs_level --;
105 return 1;
106 }
107
108 /*
109 * Prepare for decoding of the same sequence type up to max_rep times.
110 * Set the upper and lower bound of elemRef for processing of each repeatition.
111 * Read the C-size to go ahead in the C-structure after each repeatition.
112 */
113 switch (melem[e_ref].elemType)
114 {
115 case 'C':
116 case 'D':
117 case 'E':
118 case 'P':
119 case 'Q':
120 elem = (ULONG) melem[e_ref].elemRef;
121 first_elem = (ULONG) mcomp[elem].componentRef;
122 last_elem = first_elem + mcomp[elem].numOfComponents;
123 c_size = (ULONG) mcomp[elem].cSize;
124 break;
125 case 'F':
126 case 'R':
127 first_elem = e_ref;
128 last_elem = e_ref + 1;
129 c_size = mvar[e_ref].cSize;
130 break;
131 default:
132 ccd_setError (globs, ERR_DEFECT_CCDDATA, BREAK,
133 (USHORT) (globs->bitpos), (USHORT) -1);
134 return 1;
135
136 };
137
138 #ifdef WIN32
139 if (calc_ref EQ NO_REF OR calc[calc_ref].operation NEQ 'P')
140 {
141 ccd_recordFault (globs, ERR_DEFECT_CCDDATA, BREAK, (USHORT) e_ref,
142 globs->pstruct+globs->pstructOffs);
143 return 0;
144 }
145 #endif
146
147 /*
148 * Get max index for elements within the extension root.
149 */
150 ext_begin = (ULONG) calc[calc_ref].operand;
151
152 /*
153 * Store the current value of the C-structure pointer.
154 * After decoding the SEQUENCE component we will set the pointer
155 * to this stored value. Then we will use pstructOffs for pointing
156 * to the next element.
157 */
158 old_pstruct = globs->pstruct;
159 #ifdef DYNAMIC_ARRAYS
160 /*
161 * Allocate memory for this whole composition, if elemType is
162 * one of the pointer types.
163 */
164 if ( is_pointer_type(e_ref))
165 {
166 if ( PER_allocmem_and_update(e_ref, max_rep, globs) NEQ ccdOK )
167 {
168 /* No memory - Return. Error already set in function call above. */
169 globs->ccd_recurs_level --;
170 return 1;
171 }
172
173 }
174 #endif
175 globs->pstruct += globs->pstructOffs;
176
177 /*
178 * Decode all elements of the field for SEQUENCE (SIZE) OF .
179 */
180 while (repeat <= max_rep)
181 {
182 /*
183 * Read the extensinon bit for each array SEQUENCE.
184 */
185 if (bf_readBit (globs) EQ 1)
186 {
187 extPresent = TRUE;
188 }
189
190 /*
191 * Decode the bit-map preamble for the extension root.
192 */
193 Read_SEQ_BitMap (first_elem, ext_begin, globs);
194
195
196 /*
197 * Decode elements in the extension root for each array SEQUENCE.
198 */
199 for (elem = first_elem; elem < ext_begin; elem++)
200 {
201 #ifdef ERR_TRC_STK_CCD
202 /*
203 * Save the value for tracing in error case.
204 */
205 globs->error_stack[globs->ccd_recurs_level] = (USHORT) elem;
206 #endif /* ERR_TRC_STK_CCD */
207
208 #ifdef DEBUG_CCD
209 #ifndef CCD_SYMBOLS
210 TRACE_CCD (globs, "decoding level %d element %d", globs->ccd_recurs_level, elem - first_elem);
211 #else
212 TRACE_CCD (globs, "decoding level %d element %d '%s'",globs->ccd_recurs_level, elem - first_elem, ccddata_get_alias((USHORT) elem, 1));
213 #endif
214 #endif
215 /*
216 * Use the jump-table for selecting the decode function.
217 * Possible types are 0, BITSTRING, ASN1_OCTET, ASN1_INTEGER(_EXTENSIBLE),
218 * ASN1_CHOICE(_EXTENSIBLE) andASN1_SEQUENCE(_EXTENSIBLE).
219 * In case of 0 function cdc_STD_decode will be called.
220 */
221 (void) codec[melem[elem].codingType][DECODE_FUN]
222 (c_ref, elem, globs);
223 }
224 /* ############################################### */
225 /*
226 * Decode extension elements if anyone present
227 */
228 if (extPresent)
229 {
230 int unknownExt_nr=0;
231 ULONG bmp_len=0;
232
233 /*
234 * Read length of bit-map for the encoded extension additions.
235 */
236 bmp_len = Read_NormallySmallNonNegativeWholeNr (globs) + 1;
237
238 /*
239 * Decode the bit-map for the encoded extension additions.
240 */
241 for (elem = ext_begin; elem < last_elem AND unknownExt_nr < (int)bmp_len; elem++)
242 {
243 if (melem[elem].optional)
244 {
245 unknownExt_nr++;
246 if (melem[elem].elemType < 'P' OR melem[elem].elemType > 'R')
247 {
248 globs->pstruct[melem[elem].structOffs] = (UBYTE) bf_readBit(globs);
249 }
250 else
251 {
252 if(bf_readBit(globs)) /*elemType P, Q or R*/
253 {
254 *(void**) &globs->pstruct[melem[elem].structOffs] = (void *) 0xFFFF;
255 }
256 else /*Not present set the pointer to NULL*/
257 *(void**) &globs->pstruct[melem[elem].structOffs] = NULL;
258 }
259 }
260 else if (melem[elem].codingType EQ CCDTYPE_ASN1_INTEGER)
261 {
262 if (mval[mvar[melem[elem].elemRef].valueDefs+1].isDefault EQ 2)
263 {
264 unknownExt_nr++;
265 globs->pstruct[melem[elem].structOffs] = (UBYTE) bf_readBit(globs);
266 }
267 }
268 }
269
270 /*
271 * Decode the bit-map part for unknown extension additions.
272 */
273 if ((unknownExt_nr = (int) bmp_len - (last_elem - ext_begin)) > 0)
274 {
275 UBYTE tmp_bmp_len=0;
276 while (unknownExt_nr--)
277 {
278 if (bf_readBit(globs))
279 tmp_bmp_len++;
280 }
281 unknownExt_nr = (int)tmp_bmp_len;
282 }
283
284 /*
285 * Decode elements in the extension root for each array SEQUENCE
286 */
287 for (elem = ext_begin; elem < last_elem; elem ++)
288 {
289 U32 finalBP;
290 #ifdef ERR_TRC_STK_CCD
291 /*
292 * Save the value for tracing in error case.
293 */
294 globs->error_stack[globs->ccd_recurs_level] = (USHORT) elem;
295 #endif /* ERR_TRC_STK_CCD */
296
297 #ifdef DEBUG_CCD
298 #ifndef CCD_SYMBOLS
299 TRACE_CCD (globs, "decoding level %d element %d", globs->ccd_recurs_level, elem - first_elem);
300 #else
301 TRACE_CCD (globs, "decoding level %d element %d '%s'",globs->ccd_recurs_level, elem - first_elem, ccddata_get_alias((USHORT) elem, 1));
302 #endif
303 #endif
304
305 /* Decode only present extensions. */
306 globs->pstructOffs = melem[elem].structOffs;
307 if ( cdc_isPresent(elem, globs) )
308 {
309 finalBP = 8*Read_OpenTpye_Length (globs);
310 finalBP += globs->bitpos;
311
312 /*
313 * Use the jump-table for selecting the decode function.
314 * Possible types are 0, BITSTRING, ASN1_OCTET, ASN1_INTEGER(_EXTENSIBLE),
315 * ASN1_CHOICE(_EXTENSIBLE) andASN1_SEQUENCE(_EXTENSIBLE).
316 * In case of 0 function cdc_STD_decode will be called.
317 */
318 (void) codec[melem[elem].codingType][DECODE_FUN]
319 (c_ref, elem, globs);
320 if (globs->bitpos > finalBP)
321 {
322 /* ccd_recordFault (globs, ERR_ASN1_ENCODING, BREAK, (USHORT) e_ref,
323 globs->pstruct+melem[e_ref].structOffs);*/
324 }
325 bf_setBitpos (finalBP, globs);
326 }
327 } /* for: SEQUENCE extensions */
328
329 /* For unknown extensions skip over open type and its length determinant */
330 while (unknownExt_nr--)
331 {
332 U32 opLen = Read_OpenTpye_Length (globs);
333 bf_incBitpos (8 * opLen, globs);
334 #ifdef DEBUG_CCD
335 TRACE_CCD (globs, "Unknown extension for SEQUENCE type...skipped over %ld bytes", opLen);
336 #endif
337 } /*if: unknown extension */
338 } /*if: extPresent*/
339
340 /*
341 * Set the pointer of the C-structure on the next element.
342 */
343 globs->pstruct += c_size;
344
345 extPresent = FALSE;
346 repeat ++;
347 } /* while: SEQUENCE field*/
348
349 /*
350 * Prepare for decoding the next element.
351 */
352 globs->pstruct = old_pstruct;
353 globs->ccd_recurs_level--;
354
355 return 1;
356 }
357 #endif /* !RUN_INT_RAM */
358
359 #ifndef RUN_INT_RAM
360 /*
361 +------------------------------------------------------------------------+
362 | PROJECT : CCD (6144) MODULE : asn1_seq_ext |
363 | STATE : code ROUTINE : cdc_asn1_seq_ext_encode |
364 +------------------------------------------------------------------------+
365
366 PURPOSE : Encode basic UNALIGNED PER for extensible SEQUENCE type and
367 SEQUENCE OF.
368
369 The element can be a field of fixed or variable length.
370 It can contain OPTIONAL elements or integer elements with
371 a DEFAULT value. The so called nonCriticalExtensions or empty
372 sequences belong to the category of bit strings of fixed length
373 which is set to 0.
374
375 First the extension bit is encoded, then the elements of the
376 extension root, finally the elements of the extension addition.
377 One of the following scenarios is possible:
378
379 ----------------------------------------
380 | extension | encoded extension root of |
381 | bit = 0 | including bitmap preamble |
382 ----------------------------------------
383 -----------------------------------------------------------------------------
384 | extension | | encoded | encoded elment | encoded elment | |
385 | bit = 1 | | bitmap | x of the | y of the | |
386 | | | including | extension part | extension part | |
387 | | | its | as an open type | as an open type | ... |
388 | | | length | including | including | |
389 | | | | its length | its length | |
390 -----------------------------------------------------------------------------
391 -----------------------------------------------------------------------------
392 | extension | encoded | encoded | encoded elment | encoded elment | |
393 | bit = 1 | extension | bitmap | x of the | y of the | |
394 | | root | including | extension part | extension part | |
395 | | including | its | as an open type | as an open type | ... |
396 | | bitmap | length | including | including | |
397 | | preamble | | its length | its length | |
398 -----------------------------------------------------------------------------
399 */
400 SHORT cdc_asn1_seq_ext_encode (const ULONG c_ref, const ULONG e_ref, T_CCD_Globs *globs)
401 {
402 ULONG repeat=1, max_rep=1, first_elem, last_elem, elem, ext_begin;
403 U16 ext_BitPos, ext_bmpLenBP, ext_bmpEndBP;
404 ULONG c_size, Len;
405 UBYTE *old_pstruct;
406 ULONG calc_ref = calcidx[melem[e_ref].calcIdxRef].condCalcRef;
407
408 #ifdef DEBUG_CCD
409 #ifndef CCD_SYMBOLS
410 TRACE_CCD (globs, "cdc_asn1_seq_ext_encode()");
411 #else
412 TRACE_CCD (globs, "cdc_asn1_seq_ext_encode() %s", mcomp[melem[e_ref].elemRef].name);
413 #endif
414 #endif
415
416 /*
417 * SEQUENCE contains nested elements.
418 */
419 globs->ccd_recurs_level ++;
420
421 /*
422 * Set pstrcutOffs and max_rep.
423 * Check the valid flag in case of optional elements.
424 */
425 if (PER_CommonBegin (e_ref, &max_rep, globs) NEQ ccdOK)
426 {
427 globs->ccd_recurs_level --;
428 return 1;
429 }
430
431 /*
432 * Prepare for encoding of the same sequence type up to max_rep times.
433 * Set the upper and lower bound of elemRef for processing of each repeatition.
434 * Read the C-size to go ahead in the C-structure after each repeatition.
435 */
436 switch (melem[e_ref].elemType)
437 {
438 case 'C':
439 case 'D':
440 case 'E':
441 case 'P':
442 case 'Q':
443 {
444 elem = (ULONG) melem[e_ref].elemRef;
445 first_elem = (ULONG) mcomp[elem].componentRef;
446 last_elem = first_elem + mcomp[elem].numOfComponents;
447 c_size = (ULONG) mcomp[elem].cSize;
448 break;
449 }
450 case 'F':
451 case 'R':
452 {
453 first_elem = e_ref;
454 last_elem = e_ref + 1;
455 c_size = mvar[e_ref].cSize;
456 break;
457 }
458 default:
459 ccd_setError (globs, ERR_DEFECT_CCDDATA, BREAK,
460 (USHORT) (globs->bitpos), (USHORT) -1);
461 return 1;
462 }
463 /*
464 * Store the current value of the C-structure pointer.
465 * After encoding the SEQUENCE component we will set the pointer
466 * to this stored value. Then we will use pstructOffs for pointing
467 * to the next element.
468 */
469 old_pstruct = globs->pstruct;
470 globs->pstruct += globs->pstructOffs;
471
472 #ifdef DYNAMIC_ARRAYS
473 if ( is_pointer_type(e_ref) ) {
474 if ( ccd_check_pointer(*(U8 **)globs->pstruct) == ccdOK )
475 globs->pstruct = *(U8 **) globs->pstruct;
476 else
477 {
478 ccd_recordFault (globs, ERR_INVALID_PTR, BREAK, (USHORT) e_ref,
479 &globs->pstruct[globs->pstructOffs]);
480 return 1;
481 }
482 }
483 #endif
484
485 #ifdef WIN32
486 if (calc_ref EQ NO_REF OR calc[calc_ref].operation NEQ 'P')
487 {
488 ccd_recordFault (globs, ERR_DEFECT_CCDDATA, BREAK, (USHORT) e_ref,
489 globs->pstruct+globs->pstructOffs);
490 return 0;
491 }
492 #endif
493
494 /*
495 * Get max index for elements within the extension root.
496 */
497 ext_begin = (ULONG) calc[calc_ref].operand;
498
499 /*
500 * Decode all elements of the field for SEQUENCE (SIZE) OF.
501 */
502 while (repeat <= max_rep)
503 {
504 /*
505 * Prepare for a later encoding of the extension bit.
506 */
507 ext_BitPos = globs->bitpos;
508 bf_incBitpos (1, globs);
509
510 /*
511 * Encode the bit-map preamble for elements with the extension root.
512 */
513 Write_SEQ_BitMap (first_elem, ext_begin, globs);
514
515 /*
516 * Encode present elements of the extension root.
517 */
518 for (elem = first_elem; elem < ext_begin; elem++)
519 {
520 #ifdef ERR_TRC_STK_CCD
521 /*
522 * Save the value for tracing in error case.
523 */
524 globs->error_stack[globs->ccd_recurs_level] = (USHORT) elem;
525 #endif /* ERR_TRC_STK_CCD */
526 #ifdef DEBUG_CCD
527 #ifndef CCD_SYMBOLS
528 TRACE_CCD (globs, "encoding level %d element %d", globs->ccd_recurs_level, elem - first_elem);
529 #else
530 TRACE_CCD (globs, "encoding level %d element %d '%s'", globs->ccd_recurs_level, elem - first_elem ,ccddata_get_alias((USHORT) elem, 1));
531 #endif
532 #endif
533
534 #if defined _TOOLS_
535 if (!ccd_patch (globs, 0))
536 #endif /* _TOOLS_ */
537 /*
538 * Use the jump-table for selecting the code function.
539 * Possible types are 0, ASN1_INTEGER, BITSTRING, ASN1_CHOICE and
540 * ASN1_SEQUENCE. In case of 0 function cdc_STD_encode will be called.
541 */
542 (void) codec[melem[elem].codingType][ENCODE_FUN]
543 (c_ref, elem, globs);
544 }
545
546 ext_bmpLenBP = globs->bitpos;
547 /*
548 * Set the extension bit to 0, if extension part is empty.
549 */
550 if (ext_begin EQ last_elem)
551 {
552 bf_setBitpos (ext_BitPos, globs);
553 bf_writeBit (0, globs);
554 bf_setBitpos (ext_bmpLenBP, globs);
555 }
556 else
557 {
558 /*
559 * Prepare for a later encoding of the bitmap length.
560 */
561
562 bf_incBitpos (7, globs);
563
564 /*
565 * Write the bitmap preamble for the extension part.
566 */
567 Write_SEQ_BitMap (ext_begin, last_elem, globs);
568 ext_bmpEndBP = globs->bitpos;
569 Len = last_elem - ext_begin; // equivalent to: globs->bitpos - ext_bmpLenBP -7;
570
571 /* Check any of the extension elements is present. */
572 bf_setBitpos (ext_bmpLenBP+7, globs);
573 if (bf_getBits (Len, globs) EQ 0)
574 { /* Hint: the following two lines can be deleted because of ccd general memset. */
575 bf_setBitpos (ext_BitPos, globs);
576 bf_writeBit (0, globs);
577 bf_setBitpos (ext_bmpLenBP, globs);
578 }
579 else
580 {
581 /*
582 * Write the extension bit.
583 */
584 bf_setBitpos (ext_BitPos, globs);
585 bf_writeBit (1, globs);
586
587 /*
588 * Write the bitmap length assuming small bitmaps as common case.
589 * Lower bound of the length is 1.
590 /
591 if (Len < 64)
592 { */
593 bf_setBitpos (ext_bmpLenBP, globs);
594 Write_NormallySmallNonNegativeWholeNr (Len-1, globs);
595 bf_setBitpos (ext_bmpEndBP, globs);
596 /*
597 } else
598 {
599 encode_bmp_len_as_NormallySmallNonNegativeWholeNr (...);
600 shift_the_bitStr (...);
601 }*/
602
603 /*
604 * Encode present elements of the extension part.
605 */
606 for (elem = ext_begin; elem < last_elem; elem++)
607 {
608 U16 startBitPos, endBitPos;
609 #ifdef ERR_TRC_STK_CCD
610 /*
611 * Save the value for tracing in error case.
612 */
613 globs->error_stack[globs->ccd_recurs_level] = (USHORT) elem;
614 #endif /* ERR_TRC_STK_CCD */
615 #ifdef DEBUG_CCD
616 #ifndef CCD_SYMBOLS
617 TRACE_CCD (globs, "encoding level %d element %d", globs->ccd_recurs_level, elem - first_elem);
618 #else
619 TRACE_CCD (globs, "encoding level %d element %d '%s'", globs->ccd_recurs_level, elem - first_elem ,ccddata_get_alias((USHORT) elem, 1));
620 #endif
621 #endif
622 /* Decode only present extensions. */
623 globs->pstructOffs = melem[elem].structOffs;
624 if ( cdc_isPresent(elem, globs) )
625 {
626 /*
627 * Prepare for a later encoding of the length for each open type
628 */
629 bf_incBitpos (8, globs);
630 startBitPos = globs->bitpos;
631
632 #if defined _TOOLS_
633 if (!ccd_patch (globs, 0))
634 #endif /* _TOOLS_ */
635
636 /*
637 * Use the jump-table for selecting the code function.
638 * Possible types are 0, ASN1_INTEGER, BITSTRING, ASN1_CHOICE and
639 * ASN1_SEQUENCE. In case of 0 function cdc_STD_encode will be called.
640 */
641 (void) codec[melem[elem].codingType][ENCODE_FUN]
642 (c_ref, elem, globs);
643
644 /*
645 * Complete open type encoding. Check if zero padding bits
646 * are necessary. If encoding consumed no bits, insert a
647 * zero-octet in the bit string.
648 * Then calculate length of the encoded open type in octets.
649 */
650 if ((Len = globs->bitpos - startBitPos) EQ 0)
651 {
652 bf_writeVal (0, 8, globs);
653 Len = 1;
654 }
655 else
656 {
657 if ((Len&7) NEQ 0)
658 bf_incBitpos (8 - (Len&7), globs);
659 Len = (U32)(globs->bitpos - startBitPos) >> 3;
660 }
661
662 endBitPos = globs->bitpos;
663
664 /*
665 * Encode the length determinant.
666 */
667 if (Len < 128)
668 {
669 bf_setBitpos (startBitPos-8, globs);
670 Write_OpenTpye_Length ((U32)Len, globs);
671 }
672 /*
673 * This case does not seem to happen very often.
674 * We could let an error report lead us to the need for total implementation.
675 */
676 else
677 {
678 /*ccd_recordFault (globs, ERR_ASN1_ENCODING, BREAK,(USHORT) e_ref,
679 globs->pstruct+globs->pstructOffs);*/
680 }
681 /*
682 * Encoding for the sequence sub element is finished. For further encoding
683 * set the bit position pointer to the end of the encoded open type.
684 */
685 bf_setBitpos (endBitPos, globs);
686 }
687 }
688 }/* if ext present or not */
689 } /* if any extension defined or not*/
690
691 /*
692 * Set the pointer of the C-structure on the next element.
693 */
694 globs->pstruct += c_size;
695
696 repeat ++;
697 } /* while: SEQUENCE field*/
698
699 /*
700 * Prepare for encoding the next element.
701 */
702 globs->pstruct = old_pstruct;
703 globs->ccd_recurs_level--;
704 return 1;
705 }
706 #endif /* !RUN_INT_RAM */