GridLab
Grid Application Toolkit

A simple API for Grid Applications
GAT

Menu



Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members  

GATEndpointCPI.h

Go to the documentation of this file.
00001 /** @file GATEndpointCPI.h
00002  * Header for the GATEndpointCPI class.
00003  * 
00004  * A GATEndpointCPI encapsulates all the methods that a GATEndpoint capability
00005  * provider provides.
00006  * 
00007  * @date $Date: 2004/03/24 19:30:58 $
00008  * 
00009  * @version $Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATEndpointCPI.h,v 1.8 2004/03/24 19:30:58 hartmutkaiser Exp $
00010  *
00011  *  Copyright (C) Kelly Davis
00012  *  This is part of the GAT Engine.
00013  *  Contributed by Kelly Davis <kdavis@aei.mpg.de>.
00014  *
00015  *  Use, modification and distribution is subject to the Gridlab Software
00016  *  License. (See accompanying file GLlicense.txt or copy at
00017  *  http://www.gridlab.org/GLlicense.txt)
00018  */
00019 
00020 #ifndef _GATENDPOINTCPI_H_
00021 #define _GATENDPOINTCPI_H_ 1
00022 
00023 typedef struct GATEndpointCPI_S *GATEndpointCPI;
00024 
00025 #include "GATContext.h"
00026 #include "GATPreferences.h"
00027 #include "GATMetricEvent.h"
00028 #include "GATMetric.h"
00029 #include "GATTime.h"
00030 #include "GATEndpoint.h"
00031 #include "GATMonitorable.h"
00032 
00033 /* Versioning constants for the GATEndpointCPI_Data struct */
00034 #define GATENDPOINTCPI_VERSION1 1 
00035 
00036 /* the newest version we know of */
00037 #define GATENDPOINTCPI_VERSION  GATENDPOINTCPI_VERSION1
00038 
00039 /**
00040  *  The @c #GATEndpointCPI_Instance structure holds all data items supplied by the 
00041  *  client during the construction of the GATEndpoint object.
00042  */
00043 typedef struct 
00044 {
00045   GATContext context;   /* the GAT context to use for all GATEndpoint operations */
00046   GATBool isdirty;      /* dirty status for the whole object */
00047   char *nodename;       /* node name of this computer */
00048   GATMonitorable_Impl monitorable;  /* monitoring support */
00049   GATObject_const source;   /* the object this CPI is associated with */
00050   void *instance_data;  /* eventually supplied CPI provider instance data */
00051 } GATEndpointCPI_Instance;
00052 
00053 /* prototypes for the adapter callback functions */
00054 typedef void (*GATEndpointCPI_Adaptor_Destroy)(void *);
00055 
00056 typedef GATResult (*GATEndPointCPI_Adaptor_ServiceActions)(void *, 
00057   GATEndpointCPI_Instance *, GATTimePeriod_const);
00058 
00059 /* instance specific functions */
00060 typedef void (*GATEndpointCPI_Adaptor_DestroyInstance)(void *, 
00061   GATEndpointCPI_Instance *);
00062 
00063 typedef GATResult (*GATEndpointCPI_Adaptor_CreateInstance)(void *, 
00064   GATEndpointCPI_Instance *);
00065 
00066 typedef GATResult (*GATEndpointCPI_Adaptor_CloneInstance)(void *, 
00067   GATEndpointCPI_Instance const *, GATEndpointCPI_Instance *);
00068 
00069 typedef GATResult (*GATEndpointCPI_Adaptor_EqualsInstance)(void *, 
00070   GATEndpointCPI_Instance const *, GATEndpointCPI_Instance const *, GATBool *);
00071 
00072 
00073 /* Serialisation API */
00074 typedef GATResult (*GATEndpointCPI_Adaptor_Serialise)(void *, 
00075   GATEndpointCPI_Instance const *, GATObject, GATBool);
00076 
00077 typedef GATResult (*GATEndpointCPI_Adaptor_DeSerialise)(void *, GATObject,
00078   GATEndpointCPI_Instance *);
00079 
00080 
00081 /* CPI specific API */
00082 typedef GATResult (*GATEndpointCPI_Adaptor_Connect)(void *, GATEndpointCPI_Instance const *, 
00083   GATPipe *);
00084   
00085 typedef GATResult (*GATEndpointCPI_Adaptor_Listen)(void *, GATEndpointCPI_Instance const *, 
00086   GATPipe *);
00087   
00088 typedef GATResult (*GATEndpointCPI_Adaptor_AddGATPipeListener)(void *, GATEndpointCPI_Instance const *, 
00089   GATPipeListener, void *);
00090   
00091 
00092 /* callback function prototypes for the GATMonitorable interface support */
00093 typedef GATResult (* GATEndpointCPI_Adaptor_GetMetrics)(void *, 
00094   GATEndpointCPI_Instance const *, GATList_GATMetric *);
00095 
00096 typedef GATResult (* GATEndpointCPI_Adaptor_GetMetricEvent)(void *, 
00097   GATEndpointCPI_Instance const *, GATMetric, GATMetricEvent *); 
00098   
00099 typedef struct
00100 {
00101   /* CPI data (type local data) */
00102   void *data;
00103   GATEndpointCPI_Adaptor_Destroy destroy;
00104   GATEndPointCPI_Adaptor_ServiceActions service_actions;
00105   
00106   /* CPI instance data */
00107   GATEndpointCPI_Adaptor_CreateInstance create_instance;
00108   GATEndpointCPI_Adaptor_DestroyInstance destroy_instance;
00109   GATEndpointCPI_Adaptor_CloneInstance clone_instance;
00110   GATEndpointCPI_Adaptor_EqualsInstance equals_instance;
00111   
00112   /* CPI serialisation */
00113   GATEndpointCPI_Adaptor_Serialise serialise;
00114   GATEndpointCPI_Adaptor_DeSerialise deserialise;
00115   
00116   /* CPI functionality */
00117   GATEndpointCPI_Adaptor_Connect connect;
00118   GATEndpointCPI_Adaptor_Listen listen;
00119   GATEndpointCPI_Adaptor_AddGATPipeListener addPipeListener;
00120   
00121   /* CPI monitoring support */
00122   GATEndpointCPI_Adaptor_GetMetrics get_metrics;
00123   GATEndpointCPI_Adaptor_GetMetricEvent get_metric_event;
00124 } GATEndpointCPI_Data;
00125 
00126 #ifdef __cplusplus
00127 extern "C" {
00128 #endif
00129 
00130 /* Adaptor API */
00131 GATEndpointCPI GATEndpointCPI_Create(unsigned long int version,
00132   GATEndpointCPI_Data *data);
00133 
00134 /* API internal to the GAT engine */
00135 void GATEndpointCPI_Destroy(GATEndpointCPI *cpi);
00136 
00137 /* CPI instance specific functions */
00138 int GATEndpointCPI_CreateInstance(GATEndpointCPI cpi, 
00139   GATEndpointCPI_Instance *instance_data);
00140   
00141 void GATEndpointCPI_DestroyInstance(GATEndpointCPI cpi, 
00142   GATEndpointCPI_Instance *instance_data);
00143 
00144 GATResult GATEndpointCPI_CloneInstance(GATEndpointCPI cpi, 
00145   GATEndpointCPI_Instance const *instance_data, 
00146   GATEndpointCPI_Instance *new_instance_data);
00147 
00148 GATResult GATEndpointCPI_EqualsInstance(GATEndpointCPI cpi, GATEndpointCPI_Instance const *lhs, 
00149   GATEndpointCPI_Instance const *rhs, GATBool *isequal);
00150 
00151 /* Serialisation API */
00152 GATResult GATEndpointCPI_Serialise(GATEndpointCPI cpi, GATEndpointCPI_Instance const *data, 
00153   GATObject stream, GATBool clear_dirty);
00154   
00155 GATResult GATEndpointCPI_DeSerialise(GATEndpointCPI cpi, GATObject stream, 
00156   GATEndpointCPI_Instance *data);
00157   
00158 /* CPI specific API functions */
00159 GATResult GATEndpointCPI_Connect(GATEndpointCPI cpi, GATEndpointCPI_Instance const *data,
00160   GATPipe *peep);
00161   
00162 GATResult GATEndpointCPI_Listen(GATEndpointCPI cpi, GATEndpointCPI_Instance const *data,
00163   GATPipe *peep);
00164   
00165 GATResult GATEndpointCPI_AddGATPipeListener(GATEndpointCPI cpi, GATEndpointCPI_Instance const *data,
00166   GATPipeListener pipeListener, void *listenerData);
00167 
00168 /* GATMonitorable */
00169 GATResult GATEndpointCPI_GetMetrics(GATEndpointCPI cpi, GATEndpointCPI_Instance const *data, 
00170   GATList_GATMetric *metrics);
00171   
00172 GATResult GATEndpointCPI_GetMetricEvent(GATEndpointCPI cpi, GATEndpointCPI_Instance const *data, 
00173   GATMetric metric, GATMetricEvent *event);
00174 
00175 #ifdef __cplusplus
00176 }
00177 #endif
00178 
00179 #endif /* _GATENDPOINTCPI_H_ */