🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.protocols.iso
Article #96

Re: C++ posy/pepy

#96
From: Ju Zhang
Date: Thu, 09 Apr 1992 21:41
106 lines
2891 bytes

isode@nic.ddn.mil (Nathan Banks) writes:
>or just pointers and ideas may help me in convincing the decision makers to
>use ASN.1.
>
>Has anyone heard of any work related to creating object oriented ASN.1
>parsers?  e.g. a set of tools (posy++, pepy++) which generate C++ classes
>which encapsulate contents of the ASN.1 message and provides encode, decode,
>and selector operations.

ASN.C from DSET (908-832-6533) will have two interfaces. One is the AC/AD 
preprocessor interface. Another is the C++ interface. It will simply be an 
option of our ASN.1 compiler.

When you compile your ASN.1 source code with -p option, it will generate
a C++ class for every ASN.1 type.

For example, suppose you have an ASN.1 type,

-----------------------------
T ::= SET OF SET OF SET {
                a [1] INTEGER,
                b CHOICE {
			c INTEGER,
			d SET OF INTEGER
		}
        }
-----------------------------

Compile it:

-----------------------------
asn -p test32.asn
-----------------------------

Type T is mapped to a class

----------------------------- 

class D_id0 : 	...

...

class T : public D_nd, public D_rt{
        int size;
        D_id0 *elements;
        public:
        int alloc(int);
        D_id0& operator[](int);
};

-----------------------------

You don't need to read or understand this mapping. The accessing to fields
will be as if T is mapped to (the AD output from ASN.1 compiler):

-----------------------------
AD_TYPE struct {
    int a;
    union {
        int     c;
        int     d[];
    } b;
} T[][];
-----------------------------

Your application code will look like

-----------------------------
T t_inst1;
char *bufferP;
int  size;

t_inst1.alloc(1);		/* SET has one element */
t_inst1[0].alloc(2);		/* This element has two element */
t_inst1[0][0].a = 13
t_inst1[0][0].b.pick_d();	/* d is selected in CHOICE */
t_inst1[0][0].b.d.alloc(3);
t_inst1[0][0].b.d[1] = 14;
t_inst1[0][1].a = 12

t_inst1.print();

t_inst1.encode(BER, &bufferP, &size);

...

-----------------------------

See if this sample code can convince your management. Second Generation
ASN.1 tools turn using ASN.1 definition almost as easy as using just 
another type definition in C or C++.

This C++ support will be sent to the ASN.C customers for beta testing
from this summer.

If you don't have to map ASN.1 type to C++ class, we have a more efficient
approach to achieve the same level of development convenience. 



						Ju Zhang

(908)832-7296
-- DSET Co., NJ
Technical Details
Message-ID: <132@dset.UUCP>
Path: arc1-ca.pugleaf.net!sparky!uunet!dset!zhang

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!dset!zhang
From: zhang@dset.UUCP (Ju Zhang)
Newsgroups: comp.protocols.iso
Subject: Re: C++ posy/pepy
Message-ID: <132@dset.UUCP>
Date: 9 Apr 92 21:41:36 GMT
Organization: DSET Corporation, Lebanon, NJ
Lines: 106
Keywords: C++, ASN.C, Second Generation Interface