worsley@ditmela.oz (Andrew Worsley) (02/19/90)
in article <9002141412.AA15822@mgmt4.ncsl.nist.gov>, brady@MGMT4.NCSL.NIST.GOV (Kevin Brady) says: > > > > I am involved in a project that will build a network > >management system using the encoder/decoder of ISODE. The > >use of the CMIP/CMIS protocol is required, using PEPY to > >create the structures and encode/decode routines. > > > The problem: PEPY creates structures with pointers to > >other structures containing pointers and so on. We need to > >pass a "message" between processes composed of these struc- > >tures. To accomplish this over a socket leaves a "piece- > >meal" approach as the only alternative for a bcopy. This is > >totally unacceptable, does anyone know of a way to have PEPY > >generate "instances" rather than pointers?? > > Let me try to be a little more specific: > We will run the ASN.1 code for CMIP/CMIS thru PEPY to create > the encoder/decoder code and data structures to be used. These data > structures must then be filled in before handing them to the encoder/decoder > for processing. The problem is that a "USER" process fills in these > data structures and must pass this message to the process that contains > the encoder/decoder (SMAE). The "passing" I am talking about is between > two processes, not the encoded PDU that goes out on the network. > > Kevin Brady There are lots of approaches you can take. Prehaps the best might be to look at the whole design, assuming you haven't suck too much effort into it already and come up with a way which avoids the problem. Another people may have already suggested to you encoding in the user part and then decoding in the receiving process? If you don't like that then prehaps you could try modifying posy and pepy. (I believe posy generates the data structures and pepy (written earlier generates the C code). I don't belive there is an option to generate the code/data structures that doesn't use pointers, but say arrays instead. There is an option -h2 which does this for SEQUENCE/SET OF types only. How would you handle octet strings, bit strings and so forth anyway? I don't understand why you want to pass the data structures around. Does each process fill a little bit in? Or are you trying to save memory space by concentrating the C code in one place. Prehaps shared libraries are better for that. Really depends what you are after. Here we have modified posy successfully to generate data structures that summaries the ASN.1 instead of generating input for pepy. These tables are processed by a small amount of fixed code that encodes/decodes or prints ( like -DDEBUG in ISODE) the stuff from/to the ISODE generated data structures. This avoids the need for large and different C code for encoding/decoding stuff. This reduces the C code associated with encoding/decoding by a large factor for FTAM (about 2-300 k). Again if you are after reducing the size of the programs this is another approach. Or you could take the driver routines and modify them to dump the data structures out in a standard form. e.g. Do a preorder traversal of the data structure, changing pointers into simple names and dumping the "name" before each data structure. This might be simpler in the long run than modifying posy or writing routines for each data structure to be sent. Once you have done it once you don't have to do it for anything else. It wouldn't be that hard to do once you understood how the drivers worked, which isn't trivial but I don't believe is extremely hard. Again depends on what you are trying to do. This stuff I have described is now freely distributable and a very alpha-ish version is available via ftp from ditmela.cng.dit.CSIRO.AU [128.250.1.81] via ftp in pub/pepsy.system-6.0.Z Andrew Worsley -- Division of Information Technology (Melbourne), Phone +61 3 347 8644 C.S.I.R.O. Fax +61 3 347 8987 55 Barry St. Telex AA 152914 Carlton, Vic, 3053, Australia E-mail: worsley@ditmela.oz.au