/*****************************************************************/
/**                                                             **/
/**             (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; 
 
   Invoke iop 5 
	OctetString(700),PrintableString(80), 
        Boolean(1),Boolean(1),Boolean(1); 
 
End; 

  
main(argc,argv) 
   int argc; 
   char *argv[]; 
{ 
   OctetString(700) o1,o2; 
   PrintableString(80) s1,s2; 
   Boolean(1) bt1,bt2; 
   Boolean(1) btt1,btt2; 
   Boolean(1) bf1,bf2; 
 
   Control (sample) inst; 
  
   int i; 
   long l1;
 
   if (argc != 2) 
      exit(1);    
 
   o1.len=700;
   for (i=0;i<700;i++) 
      o1.val[i] = i*16%256; 

   strcpy(s1,"This is typical text."); 

   bt1 = 1; 
   btt1 = -1; 
   bf1 = 0; 
 
/***************** send it out ************************/

   Bind_STUB(inst,argv[1],"w",Asn_1_ber); 
   Give inst 
   { 
      iop(o1,s1,bt1,bf1,btt1); 
   } 
   Unbind(inst); 
  
/***************** receive it back ********************/

   Bind_STUB(inst,argv[1],"r",Asn_1_ber); 
   Accept inst 
   { 
      On iop(o2,s2,bt2,bf2,btt2) 
       { 
          int l,l2; 
 
         if (!__ROr_CMPP_OctetString(o1,o2,(l1=700,&l1),0))
            printf("###Compare OctetString failed\n"); 
         if (strcmp(s1,s2)) 
            printf("###Compare PrintableString failed\n"); 
         if (bt1 != bt2 || bf1 != bf2 || !!btt1 != !!btt2) 
            printf("###Compare Boolean failed\n"); 
      }  
   } 
   Unbind(inst); 
 
   printf("test completed\n");
   return(0); 
} 
