🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.protocols.iso.dev-environ
Article #529

RE: OPTIONAL SEQUENCES and pepy

#529
From: Michel Deslauriers
Date: Wed, 20 Mar 1991 04:34
84 lines
2135 bytes
Hi, concerning your problem with OPTIONAL SEQUENCES. The following example
should give an answer. Isode 6.0 was used for it.

The ASN.1 definition (similar to yours) is
==========================================


X DEFINITIONS ::= BEGIN
 
Pdu  ::= SET { ele1 [0] T1 OPTIONAL,
               ele2 [1] T1 OPTIONAL
             }

T1  ::= SEQUENCE OF INTEGER

END


The "C" structures file generated is
====================================

/* automatically generated by posy 6.0 #1 (faucon), do not edit! */

#ifndef	_module_X_defined_
#define	_module_X_defined_

#include <isode/psap.h>
#include <isode/pepy/UNIV-types.h>

struct type_X_Pdu {
    struct type_X_T1 *ele1;

    struct type_X_T1 *ele2;
};
int	free_X_Pdu ();

struct type_X_T1 {
        integer    element_X_0;

        struct type_X_T1 *next;
};
int	free_X_T1 ();
#endif


The field element_X_0 must indicate the number of elements in the SEQUENCE OF.
So an empty one will have a non-NULL ele1 pointer to a type_X_T1 structure but
will have the field element_X_0 to 0. An a NULL ele1 pointer will indicate that 
ele1 wasn't present in the encoding.

I build a small application that decode a stream and that print it using the
Isode pretty print. I send two streams, the first one with ele1 an empty
SEQUENCE OF and the second with no ele1.

Pretty print of the first decoded stream
========================================
{
   ele1 {},
   ele2 {
      1,
      2,
      3
   }
}


Pretty print of the second decoded stream
=========================================

{
   ele2 {
      1,
      2,
      3
   }
}



Hope it helps ...


/md
Technical Details
Message-ID: <443*mdeslauriers@ccrit.doc.ca>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!ucbvax!ccrit.doc.ca!mdeslauriers

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!ucbvax!ccrit.doc.ca!mdeslauriers
From: mdeslauriers@ccrit.doc.ca (Michel Deslauriers)
Newsgroups: comp.protocols.iso.dev-environ
Subject: RE: OPTIONAL SEQUENCES and pepy
Message-ID: <443*mdeslauriers@ccrit.doc.ca>
Date: 20 Mar 91 04:34:00 GMT
Sender: daemon@ucbvax.BERKELEY.EDU
Distribution: inet
Organization: The Internet
Lines: 84