/*****************************************************************/
/**                                                             **/
/**             (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 
	BitString(9),BitString(96),BitString(1974),BitString(1976); 
 
End; 
  

main(argc,argv) 
   int argc; 
   char *argv[]; 
{ 
   BitString(9) a2,b2; 
   BitString(96) a12,b12; 
   BitString(1974) a500,b500; 
   BitString(1976) c500,d500;
 
   Control (sample) inst; 
  
   int i; 
 
   if (argc != 2) 
      exit(1);    
 
   a2.len = 9;
   a2.val[0] = 0xea; 
   a2.val[1] = 0x8f; 

   a12.len = 96;
   for (i=0;i<sizeof(a12.val);i++) 
      a12.val[i] = (i+1)|(i<<4); 

   a500.len = 1974;
   for (i=0;i<sizeof(a500.val);i++) 
      a500.val[i] = (i+1) & 0xFF; 

   c500.len = 1976;
   for (i=0;i<sizeof(c500.val);i++) 
      c500.val[i] = (i+1) & 0xFF; 

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

   Bind_STUB(inst,argv[1],"w",Asn_1_ber); 
   Give inst 
   { 
      iop(a2,a12,a500,c500); 
   } 
   Unbind(inst); 
  
/***************** receive it back ********************/

   Bind_STUB(inst,argv[1],"r",Asn_1_ber); 
   Accept inst 
   { 
      On iop(b2,b12,b500,d500) 
       { 
          int l,l2; 
 
         if (!__ROr_cmpP_BitString(&a2,&b2,(l2=9,&l2),0)) 
            printf("###Compare 2:9 failed\n"); 
         if (!__ROr_cmpP_BitString(&a12,&b12,(l2=96,&l2),0)) 
            printf("###Compare 12:96 failed\n"); 
         if (!__ROr_cmpP_BitString(&a500,&b500,(l2=1974,&l2),0)) 
            printf("###Compare 500:1974 failed\n"); 
         if (!__ROr_cmpP_BitString(&c500,&d500,(l2=1976,&l2),0)) 
            printf("###Compare 500:1976 failed\n"); 
      }  
   } 
   Unbind(inst); 
  
   printf("test completed\n");
   return(0); 
} 
