/*****************************************************************/
/**                                                             **/
/**             (C) Copyright 1992 the Regents of the           **/
/**        University of California.  All Rights Reserved.      **/
/**                                                             **/
/**        This work was produced under the sponsorship of      **/
/**         the U.S. Department of Energy.  The Government      **/
/**                retains certain rights therein.              **/
/**                                                             **/
/**                         Written by                          **/
/**         Distributed Programming Environments Project        **/
/**           Computer Software and Networking Division,        **/
/**                   Livermore Computer Center,                **/
/**            Lawrence Livermore National Laboratory           **/
/**                                                             **/
/*****************************************************************/

Interface sample;

   Record {
      Integer(2) <Optional -12 Default -123> int2;
      Integer(4) <Optional -345 Default -3456> int4;
   } rectype;

   Invoke ike 52 Integer(2);

End;

main(argc,argv)

   int argc;
   char *argv[];
{
   rectype rec_s, rec_r;
   Data (sample) inst;

   if (argc != 2)
      exit(1);   

   rec_s.int2 = -12;
   rec_s.int4 = -345;

/***************** send it out ************************/

   Bind_STUB(inst,argv[1],"w",Asn_1_ber);
   Encode inst
   {
      rec_s => rectype;
   }
   Unbind(inst);

/***************** receive it back ********************/

   Bind_STUB(inst,argv[1],"r",Asn_1_ber);
   Decode inst
      {
	 On rectype => (rec_r);
      }
   Unbind(inst);

/***************** report results *********************/

   if (-123 != rec_r.int2) {
      printf("   rec_r.int2 value was bad\n");
      exit(1);
   }
   if (-3456 != rec_r.int4) {
      printf("   rec_r.int4 value was bad\n");
      exit(1);
   }

   printf("test completed\n");
   return(0);
}
