/*****************************************************************/
/**                                                             **/
/**             (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; 
 
   Error  op 2.1.6.3		Integer(4); 
   Invoke ip 1.2.8.655.17.8	Integer(4); 
 
End; 
  

main(argc,argv) 
   int argc; 
   char *argv[]; 
{ 
   Integer(4) x; 
 
   Control (sample) inst; 
  
   long *iv,*lv; 
   int i,j; 
 
   if (argc != 2) 
      exit(1);    
  
/***************** send it out ************************/

   Bind_STUB(inst,argv[1],"w",Asn_1_ber); 
   Give inst 
   { 
      for (x=0;x<10;x++)  
         op[x](x); 
      Set_invokeID(inst,100);  
      for (x=0;x<10;x++)  
         ip[,x](x); 
  
      if (Get_invokeID(inst) != 110) 
         printf("###Bad invokeID %d\n",get_invokeID(inst)); 
   } 
   Unbind(inst); 
  
/***************** receive it back ********************/

   Bind_STUB(inst,argv[1],"r",Asn_1_ber); 
 
   for (j=0; j<2; j++) for (i=0;i<10;i++) { 
  
   Accept [iv,lv] inst 
   { 
      On op(x) 
        if (x != i || *iv != i) 
	   printf("###wrong id %d %d %d\n",i,x,*iv); 
        
      On ip(x) 
        if (x != i || *iv != i+100 || *lv != i) 
	   printf("###wrong ids %d %d %d %d\n",i,x,*iv,*lv); 
        
   } 
  
   } 
 
   Unbind(inst); 
 
   printf("test completed\n");
   return(0); 
} 
