/*****************************************************************/
/**                                                             **/
/**             (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 <Noautotag Set> {
      Integer(2) <Application 1 Application 2 Private 3 Context 4> f1;
      Integer(4) <Application 5 Application 6 Application 8> f2;
      Integer(4) <Application 9 Application 10 Context 11> f3;
      Integer(4) <Private 12 Private 13 Application 14> f4;
      Integer(4) <Context 15 Context 16 Private 17> f5;
   } 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.f1 = 123;
   rec_s.f2 = 3456;
   rec_s.f3 = 789;
   rec_s.f4 = 234;
   rec_s.f5 = 567;

/***************** 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 (rec_s.f1 != rec_r.f1) {
      printf("   rec_r.f1 value was bad\n");
      exit(1);
   }
   if (rec_s.f2 != rec_r.f2) {
      printf("   rec_r.f2 value was bad\n");
      exit(1);
   }
   if (rec_s.f3 != rec_r.f3) {
      printf("   rec_r.f3 value was bad\n");
      exit(1);
   }
   if (rec_s.f4 != rec_r.f4) {
      printf("   rec_r.f4 value was bad\n");
      exit(1);
   }
   if (rec_s.f5 != rec_r.f5) {
      printf("   rec_r.f5 value was bad\n");
      exit(1);
   }

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