////////////////////////////////////////////////////////////
//
//     	Declaration of a base class
//	DceInterface
//
//      Copyright 2001 
//
////////////////////////////////////////////////////////////

#ifndef __DCEINTERFACE_H__
#define __DCEINTERFACE_H__

#include <dce/rpc.h>
#include "DceUuid.h"


	// DceInterface
	// rpc_if_handle_t from idl generated .h file 
	
		
class DceCall;
class DceServer;

class DceInterface
{
friend class DceCall;
friend class DceServer;
public:				 
	
	DceInterface():interface_handle(0){}
			
	int set_interface(rpc_if_handle_t z)
	{ if(!z) return 1; interface_handle=z; return 0;}
		
	// in case of a polymorphic interface
	int link_interface_id(const char * string_id) // its length is UUID_STRING_LEN
	{ return linked_id.set(string_id); }
		
	bool interface_is_set()const{return interface_handle != 0;}
	
protected:
	
	rpc_if_handle_t interface_handle;
	DceUuid linked_id;			// default is automatically nil
	
}; 

	// DceCalleeInterface
	// an entry point some_interface_epv_t (from idl generated .h file) 
	// should be defined and set in a wrapper file


class DceCalleeInterface: public DceInterface
{
friend class DceServer;
public:				 
	
	DceCalleeInterface():entry_point(0){}
		
	// optional, 
	// set a pointer to a structure some_interface_epv_t	
	int set_entry_point(void* z) 
	{ entry_point=(rpc_mgr_epv_t)z; return 0;}
			
	bool interface_is_set()const
	{return interface_handle != 0; }
	
protected:
	
	rpc_mgr_epv_t entry_point; // pointer	
}; 


#endif