/*****************************************************************/
/**                                                             **/
/**             (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           **/
/**                                                             **/
/*****************************************************************/

static char sccsid_ASNgetRO_end[] = "@(#)ASNgetRO_end.c	1.10 10/19/92 13:19:55  LLNL ";

/*
	Embedded Language for Remote Operations Services
	ELROS

	AUTHOR:		James A. Guse
			Network Systems Division

	DATE WRITTEN:	6/27/90

	ROUTINE:	getRO_end
	Version:	__ROr_ASNgetRO_end

PURPOSE:
	This routine picks up EOC's after the argument in an operation.
	This version runs over ASN_1.

IN:
	instance - 

OUT:
	instance - 


CALLED ROUTINES:
	getP_header

	
MODIFICATION HISTORY:


*/

#include <elros/instance.h>
#include <elros/typetags.h>
#include <elros/typecodes.h>

int __ROr_ASNgetRO_end(instance,internal)

   __RO_Instance_Record *	instance;
   int * internal;

{
   __RO_int32 type;
   unsigned long length;
   __RO_Give_table_Entry *thisop = &(instance->give_table[*internal]);

/********* OLD CODE
   switch (thisop->operation_class)
   {
      case __RO_RESULT:
         if (!thisop->encoded_representation)	/* Default result * /
      case __RO_REJECT:
            return(SUCCESS);
         if ((instance->getP_header)(instance,&type,&length))
            return(EXCEPTION);
         if (type != TAG_EOC)
            __RO_RETURN_RUNTIME(instance,__ROx_ASN_EXPECTRESSEQEOC);
      case __RO_INVOKE:
      case __RO_ERROR:
         if ((instance->getP_header)(instance,&type,&length))
            return(EXCEPTION);
         if (type != TAG_EOC)
            __RO_RETURN_RUNTIME(instance,__ROx_ASN_EXPECTOPEOC);
         break;
      default:
         __RO_RETURN_RUNTIME(instance,__ROx_INTERNAL_BADGTCLASS);
   }
*********/


	/* If the operation is  RESULT, but not a Default Result;'
	   then get an EOC */

   if (thisop->operation_class == __RO_RESULT &&
	 thisop->encoded_representation)
   {
      if ((instance->getP_header)(instance,&type,&length))
         return(EXCEPTION);
      if (type != TAG_EOC)
         __RO_RETURN_RUNTIME(instance,__ROx_ASN_EXPECTRESSEQEOC);
   }


	/* Now, that we're finished getting the Remote Operation (APDU) */
	/* Finish getting the PPDU */

   if ((instance->getP_end)(instance))
      return(EXCEPTION);


   return(SUCCESS);

}



