GridLab
Grid Application Toolkit

A simple API for Grid Applications
GAT

Menu



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

pipe.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <GATCPI.h>
#include "pipe.h"
#include "Common.h"

Include dependency graph for pipe.c:

Include dependency graph

Go to the source code of this file.

Defines

#define __countof(x)   (sizeof(x)/sizeof(x[0]))
#define METRIC_PIPE_READ   0
#define METRIC_PIPE_WRITE   1
#define METRIC_PIPE_SEEK   2
#define METRIC_PIPE_CLOSE   3

Functions

void pipe_adaptor_PipeCPI_Destroy (void *data)
 pipe_adaptor_PipeCPI_Destroy Destroy the adaptor-provided data object on GATPipeCPI destruction.

GATResult pipe_adaptor_PipeCPI_CreateInstance (void *adaptor_data, GATPipeCPI_Instance *data, void *information)
 pipe_adaptor_PipeCPI_CreateInstance Create a new CPI object instance.

void pipe_adaptor_PipeCPI_DestroyInstance (void *adaptor_data, GATPipeCPI_Instance *data)
 pipe_adaptor_PipeCPI_DestroyInstance Destroy a CPI object instance.

GATResult pipe_adaptor_PipeCPI_CloneInstance (void *adaptor_data, GATPipeCPI_Instance const *data, GATPipeCPI_Instance *new_data)
 pipe_adaptor_PipeCPI_CloneInstance Clone a CPI object instance.

GATResult pipe_adaptor_PipeCPI_EqualsInstance (void *adaptor_data, GATPipeCPI_Instance const *lhs, GATPipeCPI_Instance const *rhs, GATBool *isequal)
 pipe_adaptor_PipeCPI_EqualsInstance Clone a CPI object instance.

GATResult pipe_adaptor_PipeCPI_Read (void *data, GATPipeCPI_Instance const *instance_data, void *buffer, GATuint32 size, GATuint32 *readBytes)
 pipe_adaptor_PipeCPI_Read Reads data from a Pipe.

GATResult pipe_adaptor_PipeCPI_Write (void *data, GATPipeCPI_Instance const *instance_data, void const *buffer, GATuint32 size, GATuint32 *writtenBytes)
 pipe_adaptor_PipeCPI_Write Writes data to a Pipe.

GATResult pipe_adaptor_PipeCPI_Seek (void *data, GATPipeCPI_Instance const *instance_data, GATOrigin origin, GATint32 offset, GATuint32 *new_position)
 pipe_adaptor_PipeCPI_Seek Seeks on a Pipe.

GATResult pipe_adaptor_PipeCPI_Close (void *data, GATPipeCPI_Instance const *instance_data)
 pipe_adaptor_PipeCPI_Close Closes a Pipe Adaptor implementation of Pipe close capability.

GATResult pipe_adaptor_PipeCPI_GetMetrics (void *data, GATPipeCPI_Instance const *instance_data, GATList_GATMetric *metrics)
 pipe_adaptor_PipeCPI_GetMetrics

GATResult pipe_adaptor_PipeCPI_GetMetricEvent (void *data, GATPipeCPI_Instance const *instance_data, GATMetric metric, GATMetricEvent *event)
 pipe_adaptor_PipeCPI_GetMetricEvent

GATResult pipe_adaptor_PipeCPI_CreateServerInstance (void *adaptor_data, GATPipeCPI_Instance *data, int clientSocket)
 pipe_adaptor_PipeCPI_CreateServerInstance Create a new CPI object instance.

GATResult pipe_adaptor_PipeCPI_CreateClientInstance (void *adaptor_data, GATPipeCPI_Instance *data, int clientSocket)
 pipe_adaptor_PipeCPI_CreateClientInstance Create a new CPI object instance.

GATResult pipe_adaptor_FireReadEvent (GATContext context, GATMonitorable_Impl monitorable, GATObject_const source, char const *name)
 pipe_adaptor_FireReadEvent

GATResult pipe_adaptor_FireWriteEvent (GATContext context, GATMonitorable_Impl monitorable, GATObject_const source, char const *name)
 pipe_adaptor_FireWriteEvent

GATResult pipe_adaptor_FireSeekEvent (GATMonitorable_Impl monitorable, GATObject_const source, char const *name)
 pipe_adaptor_FireSeekEvent

GATResult pipe_adaptor_FireCloseEvent (GATContext context, GATMonitorable_Impl monitorable, GATObject_const source, char const *name)
 pipe_adaptor_FireCloseEvent

GATResult pipe_adaptor_register_pipe (GATContext error_context, GATRegistry registry, GATTable_const system_config, GATTable_const instance_config, void *token)
 pipe_adaptor_register Registers all CPIs this adaptor provides.


Variables

const char * rcsid = "$Header: /export/cvs-gridlab/GridLabWeb/WorkPackages/wp-1/Doc/C-Reference/pipe_8c.html,v 1.6 2004/05/13 09:52:23 merzky Exp $"
GATStaticMetric metric_data []


Define Documentation

#define __countof      (sizeof(x)/sizeof(x[0]))
 

Definition at line 54 of file pipe.c.

#define METRIC_PIPE_READ   0
 

Definition at line 173 of file pipe.c.

Referenced by pipe_adaptor_FireReadEvent().

#define METRIC_PIPE_WRITE   1
 

Definition at line 174 of file pipe.c.

Referenced by pipe_adaptor_FireWriteEvent().

#define METRIC_PIPE_SEEK   2
 

Definition at line 175 of file pipe.c.

Referenced by pipe_adaptor_FireSeekEvent().

#define METRIC_PIPE_CLOSE   3
 

Definition at line 176 of file pipe.c.

Referenced by pipe_adaptor_FireCloseEvent().


Function Documentation

void pipe_adaptor_PipeCPI_Destroy void *    data [static]
 

pipe_adaptor_PipeCPI_Destroy Destroy the adaptor-provided data object on GATPipeCPI destruction.

When the GATPipeCPI object created in this adaptor's _register function is destroyed, this function is invoked to allow the adaptor to cleanup.

Parameters:
data  Adaptor-provided data object.

Definition at line 290 of file pipe.c.

References data, and GAT_UNUSED_PARAMETER.

Referenced by pipe_adaptor_register_pipe().

GATResult pipe_adaptor_PipeCPI_CreateInstance void *    adaptor_data,
GATPipeCPI_Instance   data,
void *    information
 

pipe_adaptor_PipeCPI_CreateInstance Create a new CPI object instance.

Adaptor implementation of create instance capability.

Parameters:
adaptor_data  Adaptor-provided data object.
data  The pointer to the data structure containing at least the constructor provided data items and a member instance_data, which may be used by the adaptor to store CPI instance specific data.
information  Additional infor required
Returns:
An error code.

Definition at line 307 of file pipe.c.

References GATPipeAdaptorInfo_S::clientSocket, GATPipeCPI_Instance::context, data, GAT_CREATE_STATUS, GAT_INVALID_HANDLE, GAT_INVALID_PARAMETER, GAT_RETURN_STATUS, GAT_USES_STATUS, GATTrue, GATPipeAdaptorInfo_S::isClientInfo, pipe_adaptor_PipeCPI_CreateClientInstance(), and pipe_adaptor_PipeCPI_CreateServerInstance().

Referenced by pipe_adaptor_register_pipe().

void pipe_adaptor_PipeCPI_DestroyInstance void *    adaptor_data,
GATPipeCPI_Instance   data
 

pipe_adaptor_PipeCPI_DestroyInstance Destroy a CPI object instance.

Adaptor implementation of destroy instance capability.

Parameters:
data  Adaptor-provided data object.
instance_data  The instance data of the CPI object to destroy.

Definition at line 491 of file pipe.c.

References data, GAT_UNUSED_PARAMETER, and GATPipeCPI_Instance::instance_data.

Referenced by pipe_adaptor_register_pipe().

GATResult pipe_adaptor_PipeCPI_CloneInstance void *    adaptor_data,
GATPipeCPI_Instance const *    instance_data,
GATPipeCPI_Instance   new_instance_data
 

pipe_adaptor_PipeCPI_CloneInstance Clone a CPI object instance.

Adaptor implementation of the clone instance capability.

Parameters:
data  Adaptor-provided data object.
instance_data  The instance data of this CPI object
new_instance_data  The pointer to the variable, where the instance data of the cloned CPI object is to be returned to.
Returns:
An error code.

Definition at line 520 of file pipe.c.

References GATPipeCPI_Instance::context, GAT_CREATE_STATUS, GAT_INVALID_HANDLE, GAT_INVALID_PARAMETER, GAT_MEMORYFAILURE, GAT_RETURN_STATUS, GAT_UNUSED_PARAMETER, GAT_USES_STATUS, and GATPipeCPI_Instance::instance_data.

Referenced by pipe_adaptor_register_pipe().

GATResult pipe_adaptor_PipeCPI_EqualsInstance void *    data,
GATPipeCPI_Instance const *    lhs,
GATPipeCPI_Instance const *    rhs,
GATBool   isequal
 

pipe_adaptor_PipeCPI_EqualsInstance Clone a CPI object instance.

Adaptor implementation of the clone instance capability.

Parameters:
data  Adaptor-provided data object.
lhs  The instance data of the left CPI object.
lhs  The instance data of the right CPI object.
isequal  The pointer to the variable, where the result is to be returned to.
Returns:
An error code.

Definition at line 567 of file pipe.c.

References data, GAT_INVALID_HANDLE, GAT_SUCCESS, GAT_UNUSED_PARAMETER, GATBool, GATFalse, GATResult, and GATTrue.

Referenced by pipe_adaptor_register_pipe().

GATResult pipe_adaptor_PipeCPI_Read void *    data,
GATPipeCPI_Instance const *    instance_data,
void *    buffer,
GATuint32    size,
GATuint32   readBytes
[static]
 

pipe_adaptor_PipeCPI_Read Reads data from a Pipe.

Adaptor implementation of Pipe read capability.

Parameters:
data  Adaptor-provided data object.
instance_data  The instance data of this CPI object
buffer  The buffer into which data is read
size  The size of the buffer
readBytes  the number of bytes read
Returns:
An error code.

Definition at line 603 of file pipe.c.

References GATPipeCPI_Instance::context, data, GAT_CREATE_STATUS, GAT_INVALID_HANDLE, GAT_INVALID_PARAMETER, GAT_RETURN_STATUS, GAT_UNUSED_PARAMETER, GAT_USES_STATUS, GATuint32, GATPipeCPI_Instance::instance_data, GATPipeCPI_Instance::monitorable, pipe_adaptor_FireReadEvent(), size, and GATPipeCPI_Instance::source.

Referenced by pipe_adaptor_register_pipe().

GATResult pipe_adaptor_PipeCPI_Write void *    data,
GATPipeCPI_Instance const *    instance_data,
void const *    buffer,
GATuint32    size,
GATuint32   writtenBytes
[static]
 

pipe_adaptor_PipeCPI_Write Writes data to a Pipe.

Adaptor implementation of Pipe write capability.

Parameters:
data  Adaptor-provided data object.
instance_data  The instance data of this CPI object
buffer  The buffer from which data is written
size  The size of the buffer
writtenBytes  the number of bytes written
Returns:
An error code.

Definition at line 646 of file pipe.c.

References GATPipeCPI_Instance::context, data, GAT_CREATE_STATUS, GAT_INVALID_HANDLE, GAT_INVALID_PARAMETER, GAT_RETURN_STATUS, GAT_UNUSED_PARAMETER, GAT_USES_STATUS, GATuint32, GATPipeCPI_Instance::instance_data, GATPipeCPI_Instance::monitorable, pipe_adaptor_FireWriteEvent(), size, and GATPipeCPI_Instance::source.

Referenced by pipe_adaptor_register_pipe().

GATResult pipe_adaptor_PipeCPI_Seek void *    data,
GATPipeCPI_Instance const *    instance_data,
GATOrigin    origin,
GATint32    offset,
GATuint32   new_position
[static]
 

pipe_adaptor_PipeCPI_Seek Seeks on a Pipe.

Adaptor implementation of Pipe seek capability.

Parameters:
data  Adaptor-provided data object.
instance_data  The instance data of this CPI object
origin  The GATOrigin from whence to seek
offset  The offset from the origin which to seek to
new_position  The new position of the Pipe
Returns:
An error code.

Definition at line 688 of file pipe.c.

References data, GAT_NOTIMPL, GAT_UNUSED_PARAMETER, GATint32, GATOrigin, GATResult, GATuint32, GATPipeCPI_Instance::monitorable, pipe_adaptor_FireSeekEvent(), and GATPipeCPI_Instance::source.

Referenced by pipe_adaptor_register_pipe().

GATResult pipe_adaptor_PipeCPI_Close void *    data,
GATPipeCPI_Instance const *    instance_data
[static]
 

pipe_adaptor_PipeCPI_Close Closes a Pipe Adaptor implementation of Pipe close capability.

Parameters:
data  Adaptor-provided data object.
instance_data  The instance data of this CPI object
Returns:
An error code.

Definition at line 710 of file pipe.c.

References GATPipeCPI_Instance::context, data, GAT_CREATE_STATUS, GAT_INVALID_HANDLE, GAT_INVALID_PARAMETER, GAT_RETURN_STATUS, GAT_UNUSED_PARAMETER, GAT_USES_STATUS, GATPipeCPI_Instance::instance_data, GATPipeCPI_Instance::monitorable, pipe_adaptor_FireCloseEvent(), and GATPipeCPI_Instance::source.

Referenced by pipe_adaptor_register_pipe().

GATResult pipe_adaptor_PipeCPI_GetMetrics void *    data,
GATPipeCPI_Instance const *    instance_data,
GATList_GATMetric *    metrics
[static]
 

pipe_adaptor_PipeCPI_GetMetrics

The function pipe_adaptor_PipeCPI_GetMetrics should return a list of GATMetric objects supported by this adaptor. I.e. the adaptor is capable to fire GATMetricEvents for the returned metrics. This list should include all the supported metrics, event like and continuous ones.

Parameters:
data  Adaptor-provided data object.
instance_data  Instance data for the CPI provider object.
metrics  The pointer to the variable, which receives the returned list of metrics.
Returns:
An error code.

Definition at line 756 of file pipe.c.

References __countof, data, GAT_UNUSED_PARAMETER, and GATMetric_CreateListOfMetrics().

Referenced by pipe_adaptor_register_pipe().

GATResult pipe_adaptor_PipeCPI_GetMetricEvent void *    data,
GATPipeCPI_Instance const *    instance_data,
GATMetric    metric,
GATMetricEvent   event
[static]
 

pipe_adaptor_PipeCPI_GetMetricEvent

The function pipe_adaptor_PipeCPI_GetMetricEvent should return the GATMetricEvent associated with the given continuous metric. This function gets called for continuous metrics only, since returning the metric event object to the caller is th only way for the client to get access to it.

Parameters:
data  Adaptor-provided data object.
instance_data  Instance data for the CPI provider object.
metric  The metric instance describing the metric event to return. This metric should be equivalent to one of the metrics returned by our own GetMetrics CPI function (see above). If this is another (not known to us metric), an error should be returned.
event  The pointer to the variable, which receives the metric event to return.
Returns:
An error code.

Definition at line 785 of file pipe.c.

References data, GAT_SUCCESS, GAT_UNUSED_PARAMETER, and GATMetric.

Referenced by pipe_adaptor_register_pipe().

GATResult pipe_adaptor_PipeCPI_CreateServerInstance void *    adaptor_data,
GATPipeCPI_Instance   data,
int    clientSocket
[static]
 

pipe_adaptor_PipeCPI_CreateServerInstance Create a new CPI object instance.

Adaptor implementation of create instance capability.

Parameters:
adaptor_data  Adaptor-provided data object.
data  The pointer to the data structure containing at least the constructor provided data items and a member instance_data, which may be used by the adaptor to store CPI instance specific data.
clientSocket  The client socket
Returns:
An error code.

Definition at line 354 of file pipe.c.

References GATPipeCPI_Instance::context, data, GAT_CREATE_STATUS, GAT_INVALID_HANDLE, GAT_MEMORYFAILURE, GAT_RETURN_STATUS, GAT_UNUSED_PARAMETER, GAT_USES_STATUS, and GATPipeCPI_Instance::instance_data.

Referenced by pipe_adaptor_PipeCPI_CreateInstance().

GATResult pipe_adaptor_PipeCPI_CreateClientInstance void *    adaptor_data,
GATPipeCPI_Instance   data,
int    clientSocket
[static]
 

pipe_adaptor_PipeCPI_CreateClientInstance Create a new CPI object instance.

Adaptor implementation of create instance capability.

Parameters:
adaptor_data  Adaptor-provided data object.
data  The pointer to the data structure containing at least the constructor provided data items and a member instance_data, which may be used by the adaptor to store CPI instance specific data.
serverNodename  The server nodename
serverPort  The server port
Returns:
An error code.

Definition at line 391 of file pipe.c.

References GATPipeCPI_Instance::context, data, GAT_CREATE_STATUS, GAT_INVALID_HANDLE, GAT_MEMORYFAILURE, GAT_RETURN_STATUS, GAT_UNUSED_PARAMETER, GAT_USES_STATUS, and GATPipeCPI_Instance::instance_data.

Referenced by pipe_adaptor_PipeCPI_CreateInstance().

GATResult pipe_adaptor_FireReadEvent GATContext    context,
GATMonitorable_Impl    monitorable,
GATObject_const    source,
char const *    name
[static]
 

pipe_adaptor_FireReadEvent

The function pipe_adaptor_FireReadEvent fires a 'pipe read' event to all registered metric listeners.

Definition at line 806 of file pipe.c.

References GAT_CREATE_STATUS, GAT_CURRENT_STATUS, GAT_INVALID_PARAMETER, GAT_MEMORYFAILURE, GAT_RETURN_STATUS, GAT_SUCCEEDED, GAT_USES_STATUS, GATMetric, GATMetric_CreateMetric(), GATMetric_Destroy(), GATMetricEvent_Create_EventLike(), GATMetricEvent_Destroy(), GATMonitorable_Impl_FireEvent(), GATObject_const, GATuint32, METRIC_PIPE_READ, and name.

Referenced by pipe_adaptor_PipeCPI_Read().

GATResult pipe_adaptor_FireWriteEvent GATContext    context,
GATMonitorable_Impl    monitorable,
GATObject_const    source,
char const *    name
[static]
 

pipe_adaptor_FireWriteEvent

The function pipe_adaptor_FireWriteEvent fires a 'pipe write' event to all registered metric listeners.

Definition at line 850 of file pipe.c.

References GAT_CREATE_STATUS, GAT_CURRENT_STATUS, GAT_INVALID_PARAMETER, GAT_MEMORYFAILURE, GAT_RETURN_STATUS, GAT_SUCCEEDED, GAT_USES_STATUS, GATMetric, GATMetric_CreateMetric(), GATMetric_Destroy(), GATMetricEvent_Create_EventLike(), GATMetricEvent_Destroy(), GATMonitorable_Impl_FireEvent(), GATObject_const, GATuint32, METRIC_PIPE_WRITE, and name.

Referenced by pipe_adaptor_PipeCPI_Write().

GATResult pipe_adaptor_FireSeekEvent GATMonitorable_Impl    monitorable,
GATObject_const    source,
char const *    name
[static]
 

pipe_adaptor_FireSeekEvent

The function pipe_adaptor_FireSeekEvent fires a 'pipe seek' event to all registered metric listeners.

Definition at line 894 of file pipe.c.

References GAT_INVALID_PARAMETER, GAT_MEMORYFAILURE, GAT_SUCCESS, GATMetric, GATMetric_CreateMetric(), GATMetric_Destroy(), GATMetricEvent_Create_EventLike(), GATMetricEvent_Destroy(), GATMonitorable_Impl_FireEvent(), GATObject_const, GATResult, GATuint32, METRIC_PIPE_SEEK, and name.

Referenced by pipe_adaptor_PipeCPI_Seek().

GATResult pipe_adaptor_FireCloseEvent GATContext    context,
GATMonitorable_Impl    monitorable,
GATObject_const    source,
char const *    name
[static]
 

pipe_adaptor_FireCloseEvent

The function pipe_adaptor_FireCloseEvent fires a 'pipe close' event to all registered metric listeners.

Definition at line 930 of file pipe.c.

References GAT_CREATE_STATUS, GAT_CURRENT_STATUS, GAT_INVALID_PARAMETER, GAT_MEMORYFAILURE, GAT_RETURN_STATUS, GAT_SUCCEEDED, GAT_USES_STATUS, GATMetric, GATMetric_CreateMetric(), GATMetric_Destroy(), GATMetricEvent_Create_EventLike(), GATMetricEvent_Destroy(), GATMonitorable_Impl_FireEvent(), GATObject_const, GATuint32, METRIC_PIPE_CLOSE, and name.

Referenced by pipe_adaptor_PipeCPI_Close().

GATResult pipe_adaptor_register_pipe GATContext    error_context,
GATRegistry    registry,
GATTable_const    system_config,
GATTable_const    instance_config,
void *    token
 

pipe_adaptor_register Registers all CPIs this adaptor provides.

This function is invoked by the loader in the GATEngine when an instance of this adaptor is loaded. Each instance has its own private configuration table.

For every CPI provided the adapter has to hand all the corresponding function pointers to the engine to allow to be called back under certain circumstances. Additionally the adaptor may allocate some private data for every loaded instance. This data is handed back to the adaptor as the first parameter to each of the subsequently called functions.

Parameters:
registry  The registry the adaptor should register its CPIs with.
system_config  The system configuration table.
instance_config  The configuration table for this instance.
token  An arbitrary token used by the loader to identify this adaptor instance
Returns:
An error code.

Definition at line 202 of file pipe.c.

References GATPipeCPI_Data::clone_instance, GATPipeCPI_Data::close, cpi, GATPipeCPI_Data::create_instance, GATPipeCPI_Data::data, GATPipeCPI_Data::destroy, GATPipeCPI_Data::destroy_instance, GATPipeCPI_Data::equals_instance, GAT_CREATE_STATUS, GAT_CURRENT_STATUS, GAT_FAILED, GAT_MEMORYFAILURE, GAT_RETURN_STATUS, GAT_UNUSED_PARAMETER, GAT_USES_STATUS, GATPipeCPI_Create(), GATPipeCPI_Destroy(), GATPIPECPI_VERSION, GATPreferences_Add(), GATPreferences_Create(), GATPreferences_Destroy(), GATTable_const, GATPipeCPI_Data::get_metric_event, GATPipeCPI_Data::get_metrics, pipe_adaptor_PipeCPI_CloneInstance(), pipe_adaptor_PipeCPI_Close(), pipe_adaptor_PipeCPI_CreateInstance(), pipe_adaptor_PipeCPI_Destroy(), pipe_adaptor_PipeCPI_DestroyInstance(), pipe_adaptor_PipeCPI_EqualsInstance(), pipe_adaptor_PipeCPI_GetMetricEvent(), pipe_adaptor_PipeCPI_GetMetrics(), pipe_adaptor_PipeCPI_Read(), pipe_adaptor_PipeCPI_Seek(), pipe_adaptor_PipeCPI_Write(), GATPipeCPI_Data::read, GATPipeCPI_Data::seek, token, and GATPipeCPI_Data::write.

Referenced by endpoint_adaptor_register().


Variable Documentation

const char* rcsid = "$Header: /export/cvs-gridlab/GridLabWeb/WorkPackages/wp-1/Doc/C-Reference/pipe_8c.html,v 1.6 2004/05/13 09:52:23 merzky Exp $" [static]
 

Definition at line 31 of file pipe.c.

GATStaticMetric metric_data[] [static]
 

Definition at line 133 of file pipe.c.