Main Page Alphabetical List Compound List File List Compound Members File Members
endpoint.c File Reference#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <GATCPI.h>
#include "Common.h"
#include "endpoint.h"
Include dependency graph for endpoint.c:
Go to the source code of this file.
|
Compounds |
| struct | GATEndpointInstance_Data |
Defines |
| #define | ENDPOINT_ADAPTOR_PORT 1227 |
| #define | __countof(x) (sizeof(x)/sizeof(x[0])) |
| #define | METRIC_FILESTREAM_CONNECT 0 |
| #define | METRIC_FILESTREAM_LISTEN 1 |
| #define | METRIC_FILESTREAM_ADDGATPIPELISTENER 2 |
Typedefs |
| typedef GATEndpointInstance_Data | GATEndpointInstance_Data |
Functions |
| void | endpoint_adaptor_EndpointCPI_Destroy (void *data) |
| | endpoint_adaptor_EndpointCPI_Destroy Destroy the adaptor-provided data object on GATEndpointCPI destruction.
|
| GATResult | endpoint_adaptor_EndpointCPI_CreateInstance (void *adaptor_data, GATEndpointCPI_Instance *data) |
| | endpoint_adaptor_EndpointCPI_CreateInstance Create a new CPI object instance.
|
| void | endpoint_adaptor_EndpointCPI_DestroyInstance (void *adaptor_data, GATEndpointCPI_Instance *data) |
| | endpoint_adaptor_EndpointCPI_DestroyInstance Destroy a CPI object instance.
|
| GATResult | endpoint_adaptor_EndpointCPI_CloneInstance (void *adaptor_data, GATEndpointCPI_Instance const *data, GATEndpointCPI_Instance *new_data) |
| | endpoint_adaptor_EndpointCPI_CloneInstance Clone a CPI object instance.
|
| GATResult | endpoint_adaptor_EndpointCPI_EqualsInstance (void *adaptor_data, GATEndpointCPI_Instance const *lhs, GATEndpointCPI_Instance const *rhs, GATBool *isequal) |
| | endpoint_adaptor_EndpointCPI_EqualsInstance Clone a CPI object instance.
|
| GATResult | endpoint_adaptor_EndpointCPI_Serialise (void *data, GATEndpointCPI_Instance const *instance_data, GATObject stream, GATBool clear_dirty) |
| | endpoint_adaptor_EndpointCPI_Serialise
|
| GATResult | endpoint_adaptor_EndpointCPI_DeSerialise (void *data, GATObject stream, GATEndpointCPI_Instance *instance_data) |
| | endpoint_adaptor_EndpointCPI_DeSerialise
|
| GATResult | endpoint_adaptor_EndpointCPI_Connect (void *, GATEndpointCPI_Instance const *, GATPipe *) |
| | endpoint_adaptor_EndpointCPI_Connect This function connects to this endpoint's server instance.
|
| GATResult | endpoint_adaptor_EndpointCPI_Listen (void *, GATEndpointCPI_Instance const *, GATPipe *) |
| | endpoint_adaptor_EndpointCPI_Listen This function listens for connections to this endpoint's server.
|
| GATResult | endpoint_adaptor_EndpointCPI_AddGATPipeListener (void *, GATEndpointCPI_Instance const *, GATPipeListener, void *) |
| | endpoint_adaptor_EndpointCPI_AddGATPipeListener This function registers the passed listener to listen for the connection of clients to this endpoint server.
|
| GATResult | endpoint_adaptor_EndpointCPI_GetMetrics (void *data, GATEndpointCPI_Instance const *instance_data, GATList_GATMetric *metrics) |
| | endpoint_adaptor_EndpointCPI_GetMetrics
|
| GATResult | endpoint_adaptor_EndpointCPI_GetMetricEvent (void *data, GATEndpointCPI_Instance const *instance_data, GATMetric metric, GATMetricEvent *event) |
| | endpoint_adaptor_EndpointCPI_GetMetricEvent
|
| GATResult | endpoint_adaptor_FireConnect (GATContext context, GATMonitorable_Impl monitorable, GATObject_const source, char const *name) |
| | endpoint_adaptor_FireConnect
|
| GATResult | endpoint_adaptor_FireListen (GATContext context, GATMonitorable_Impl monitorable, GATObject_const source, char const *name) |
| | endpoint_adaptor_FireListen
|
| GATResult | endpoint_adaptor_FireAddGATPipeListener (GATMonitorable_Impl monitorable, GATObject_const source, char const *name) |
| | endpoint_adaptor_FireAddGATPipeListener
|
| GATResult | endpoint_adaptor_register_endpoint (GATContext error_context, GATRegistry registry, GATTable_const system_config, GATTable_const instance_config, void *token) |
| | endpoint_adaptor_register Registers all CPIs this adaptor provides.
|
Variables |
| const char * | rcsid = "$Header: /export/cvs-gridlab/GridLabWeb/WorkPackages/wp-1/Doc/C-Reference/endpoint_8c.html,v 1.6 2004/05/13 09:52:23 merzky Exp $" |
| GATStaticMetric | metric_data [] |
Define Documentation
| #define ENDPOINT_ADAPTOR_PORT 1227
|
|
| #define __countof |
( |
x |
|
) |
(sizeof(x)/sizeof(x[0]))
|
|
| #define METRIC_FILESTREAM_CONNECT 0
|
|
| #define METRIC_FILESTREAM_LISTEN 1
|
|
| #define METRIC_FILESTREAM_ADDGATPIPELISTENER 2
|
|
Typedef Documentation
| typedef struct GATEndpointInstance_Data GATEndpointInstance_Data
|
|
Function Documentation
| void endpoint_adaptor_EndpointCPI_Destroy |
( |
void * |
data |
) |
[static] |
|
|
|
endpoint_adaptor_EndpointCPI_Destroy Destroy the adaptor-provided data object on GATEndpointCPI destruction.
When the GATEndpointCPI 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 313 of file endpoint.c.
References data.
Referenced by endpoint_adaptor_register_endpoint(). |
|
|
endpoint_adaptor_EndpointCPI_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. |
- Returns:
-
An error code.
Definition at line 332 of file endpoint.c.
References GATEndpointInstance_Data::callBackData, GATEndpointCPI_Instance::context, data, ENDPOINT_ADAPTOR_PORT, GAT_CREATE_STATUS, GAT_FAIL, GAT_INVALID_HANDLE, GAT_MEMORYFAILURE, GAT_RETURN_STATUS, GAT_UNUSED_PARAMETER, GAT_USES_STATUS, GATEndpointCPI_Instance::instance_data, GATEndpointInstance_Data::listener, GATEndpointInstance_Data::local_socket, GATEndpointInstance_Data::server_port, and GATEndpointInstance_Data::socketAddress.
Referenced by endpoint_adaptor_register_endpoint(). |
|
|
endpoint_adaptor_EndpointCPI_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 430 of file endpoint.c.
References GATEndpointInstance_Data::callBackData, GATEndpointCPI_Instance::context, GAT_CREATE_STATUS, GAT_INVALID_HANDLE, GAT_INVALID_PARAMETER, GAT_MEMORYFAILURE, GAT_RETURN_STATUS, GAT_UNUSED_PARAMETER, GAT_USES_STATUS, GATEndpointCPI_Instance::instance_data, GATEndpointInstance_Data::listener, GATEndpointInstance_Data::local_socket, and GATEndpointInstance_Data::socketAddress.
Referenced by endpoint_adaptor_register_endpoint(). |
|
|
endpoint_adaptor_EndpointCPI_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 497 of file endpoint.c.
References GATEndpointInstance_Data::callBackData, data, GAT_INVALID_HANDLE, GAT_SUCCESS, GAT_UNUSED_PARAMETER, GATBool, GATFalse, GATResult, GATTrue, GATEndpointCPI_Instance::instance_data, GATEndpointInstance_Data::listener, GATEndpointInstance_Data::local_socket, and GATEndpointInstance_Data::socketAddress.
Referenced by endpoint_adaptor_register_endpoint(). |
|
|
endpoint_adaptor_EndpointCPI_Serialise
The function endpoint_adaptor_EndpointCPI_Serialise is called by the GAT engine, whenever the client requested a Serialise operation on the corresponding GATendpoint object. The function should serialise into the given stream all the instance specific data of the object. - Parameters:
-
| cpi |
The GATEndpoint CPI |
| data |
Adaptor-provided data object. |
| instance_data |
The instance data of this CPI object. |
| stream |
The GATSTream object to use for serialisation of the instance data. |
| clear_dirty |
This flag defines, whether the dirty flag of saved dependent objects is to be cleared. |
- Returns:
-
An error code
Definition at line 582 of file endpoint.c.
References GATEndpointCPI_Instance::context, data, GAT_CREATE_STATUS, GAT_INVALID_HANDLE, GAT_RETURN_STATUS, GAT_UNUSED_PARAMETER, GAT_USES_STATUS, GATBool, GATuint32_Serialise(), GATEndpointCPI_Instance::instance_data, and GATEndpointInstance_Data::server_port.
Referenced by endpoint_adaptor_register_endpoint(). |
|
|
endpoint_adaptor_EndpointCPI_DeSerialise
The function endpoint_adaptor_EndpointCPI_DeSerialise is called by the GATEngine, whenever the client requested a DeSerialise operation for a GATEndpoint object. The function should deserialise all the instance specific data of the object from the given stream. - Parameters:
-
| cpi |
The GATEndpoint CPI |
| data |
Adaptor-provided data object. |
| stream |
The GATSTream object to use for de-serialisation of the instance data. |
| instance_data |
The instance data of this CPI object. |
- Returns:
-
An error code
Definition at line 622 of file endpoint.c.
References GATEndpointInstance_Data::client_port, GATEndpointCPI_Instance::context, data, GAT_CREATE_STATUS, GAT_CURRENT_STATUS, GAT_FAIL, GAT_INVALID_HANDLE, GAT_MEMORYFAILURE, GAT_RETURN_STATUS, GAT_SUCCEEDED, GAT_UNUSED_PARAMETER, GAT_USES_STATUS, GATuint32, GATuint32_DeSerialise(), GATEndpointCPI_Instance::instance_data, GATEndpointInstance_Data::local_socket, GATEndpointInstance_Data::server_port, and GATEndpointInstance_Data::socketAddress.
Referenced by endpoint_adaptor_register_endpoint(). |
|
|
endpoint_adaptor_EndpointCPI_Connect This function connects to this endpoint's server instance.
This is the adaptor implementation of the connect capability. - Parameters:
-
| data |
Adaptor-provided data object. |
| instance_data |
Instance data of the CPI object |
| peep |
The created GATPipe |
- Returns:
-
An error code.
Definition at line 710 of file endpoint.c.
References GATPipeAdaptorInfo_S::clientSocket, GATEndpointCPI_Instance::context, data, endpoint_adaptor_FireConnect(), GAT_CREATE_STATUS, GAT_CURRENT_STATUS, GAT_FAIL, GAT_INVALID_HANDLE, GAT_MEMORYFAILURE, GAT_RETURN_STATUS, GAT_SUCCEEDED, GAT_UNUSED_PARAMETER, GAT_USES_STATUS, GATPipe_Create(), GATPreferences_Add(), GATPreferences_Create(), GATPreferences_Destroy(), GATTrue, GATEndpointCPI_Instance::instance_data, GATPipeAdaptorInfo_S::isClientInfo, GATEndpointInstance_Data::local_socket, GATEndpointCPI_Instance::monitorable, GATEndpointCPI_Instance::nodename, GATEndpointInstance_Data::server_port, and GATEndpointCPI_Instance::source.
Referenced by endpoint_adaptor_register_endpoint(). |
|
|
endpoint_adaptor_EndpointCPI_Listen This function listens for connections to this endpoint's server.
This is the adaptor implementation of the listen capability. - Parameters:
-
| data |
Adaptor-provided data object. |
| instance_data |
Instance data of the CPI object |
| peep |
The created GATPipe |
- Returns:
-
An error code.
Definition at line 809 of file endpoint.c.
References GATEndpointInstance_Data::callBackData, GATPipeAdaptorInfo_S::clientSocket, GATEndpointCPI_Instance::context, data, endpoint_adaptor_FireListen(), GAT_CREATE_STATUS, GAT_CURRENT_STATUS, GAT_FAIL, GAT_INVALID_PARAMETER, GAT_INVALID_STATE, GAT_MEMORYFAILURE, GAT_RETURN_STATUS, GAT_SUCCEEDED, GAT_UNUSED_PARAMETER, GAT_USES_STATUS, GATFalse, GATPipe_Create(), GATPreferences_Add(), GATPreferences_Create(), GATPreferences_Destroy(), GATResult, GATEndpointCPI_Instance::instance_data, GATPipeAdaptorInfo_S::isClientInfo, GATEndpointInstance_Data::listener, GATEndpointInstance_Data::local_socket, GATEndpointCPI_Instance::monitorable, GATEndpointInstance_Data::socketAddress, and GATEndpointCPI_Instance::source.
Referenced by endpoint_adaptor_register_endpoint(). |
|
|
endpoint_adaptor_EndpointCPI_AddGATPipeListener This function registers the passed listener to listen for the connection of clients to this endpoint server.
This is the adaptor implementation of the AddGATPipeListener functionality. - Parameters:
-
| data |
Adaptor-provided data object. |
| instance_data |
Instance data of the CPI object |
| peepListener |
GATPipeListener object which handles incoming connections |
| listenerData |
Call back data |
- Returns:
-
An error code.
Definition at line 911 of file endpoint.c.
References GATEndpointInstance_Data::callBackData, data, endpoint_adaptor_FireAddGATPipeListener(), GAT_INVALID_PARAMETER, GAT_INVALID_STATE, GAT_SUCCESS, GAT_UNUSED_PARAMETER, GATPipeListener, GATResult, GATEndpointCPI_Instance::instance_data, GATEndpointInstance_Data::listener, GATEndpointCPI_Instance::monitorable, and GATEndpointCPI_Instance::source.
Referenced by endpoint_adaptor_register_endpoint(). |
|
|
endpoint_adaptor_EndpointCPI_GetMetrics
The function endpoint_adaptor_EndpointCPI_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 961 of file endpoint.c.
References __countof, data, GAT_UNUSED_PARAMETER, and GATMetric_CreateListOfMetrics().
Referenced by endpoint_adaptor_register_endpoint(). |
|
|
endpoint_adaptor_EndpointCPI_GetMetricEvent
The function endpoint_adaptor_EndpointCPI_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 990 of file endpoint.c.
References data, GAT_SUCCESS, GAT_UNUSED_PARAMETER, and GATMetric.
Referenced by endpoint_adaptor_register_endpoint(). |
|
|
endpoint_adaptor_FireConnect
The function endpoint_adaptor_FireConnect fires a 'endpoint connect' event to all registered metric listeners.
Definition at line 1010 of file endpoint.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_FILESTREAM_CONNECT, and name.
Referenced by endpoint_adaptor_EndpointCPI_Connect(). |
|
|
endpoint_adaptor_FireListen
The function endpoint_adaptor_FireWriteEvent fires a 'endpoint listen' event to all registered metric listeners.
Definition at line 1053 of file endpoint.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_FILESTREAM_LISTEN, and name.
Referenced by endpoint_adaptor_EndpointCPI_Listen(). |
|
|
endpoint_adaptor_FireAddGATPipeListener
The function endpoint_adaptor_FireSeekEvent fires a 'endpoint add gat pipe listener' event to all registered metric listeners.
Definition at line 1089 of file endpoint.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_FILESTREAM_ADDGATPIPELISTENER, and name.
Referenced by endpoint_adaptor_EndpointCPI_AddGATPipeListener(). |
|
|
endpoint_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 203 of file endpoint.c.
References GATEndpointCPI_Data::addPipeListener, GATEndpointCPI_Data::clone_instance, GATEndpointCPI_Data::connect, cpi, GATEndpointCPI_Data::create_instance, GATEndpointCPI_Data::data, GATEndpointCPI_Data::deserialise, GATEndpointCPI_Data::destroy, GATEndpointCPI_Data::destroy_instance, endpoint_adaptor_EndpointCPI_AddGATPipeListener(), endpoint_adaptor_EndpointCPI_CloneInstance(), endpoint_adaptor_EndpointCPI_Connect(), endpoint_adaptor_EndpointCPI_CreateInstance(), endpoint_adaptor_EndpointCPI_DeSerialise(), endpoint_adaptor_EndpointCPI_Destroy(), endpoint_adaptor_EndpointCPI_DestroyInstance(), endpoint_adaptor_EndpointCPI_EqualsInstance(), endpoint_adaptor_EndpointCPI_GetMetricEvent(), endpoint_adaptor_EndpointCPI_GetMetrics(), endpoint_adaptor_EndpointCPI_Listen(), endpoint_adaptor_EndpointCPI_Serialise(), GATEndpointCPI_Data::equals_instance, GAT_CREATE_STATUS, GAT_CURRENT_STATUS, GAT_FAILED, GAT_MEMORYFAILURE, GAT_RETURN_STATUS, GAT_UNUSED_PARAMETER, GAT_USES_STATUS, GATEndpointCPI_Create(), GATEndpointCPI_Destroy(), GATFILESTREAMCPI_VERSION, GATPreferences_Add(), GATPreferences_Create(), GATPreferences_Destroy(), GATTable_const, GATEndpointCPI_Data::get_metric_event, GATEndpointCPI_Data::get_metrics, GATEndpointCPI_Data::listen, GATEndpointCPI_Data::serialise, and token.
Referenced by endpoint_adaptor_register(). |
Variable Documentation
const char* rcsid = "$Header: /export/cvs-gridlab/GridLabWeb/WorkPackages/wp-1/Doc/C-Reference/endpoint_8c.html,v 1.6 2004/05/13 09:52:23 merzky Exp $" [static]
|
|
|
|
Initial value: {
{
"endpoint.connect",
GATMeasurementType_EventLike,
GATType_String,
"",
0,
0
},
{
"endpoint.listen",
GATMeasurementType_EventLike,
GATType_String,
"",
0,
0
},
{
"endpoint.addgatpipelistener",
GATMeasurementType_EventLike,
GATType_String,
"",
0,
0
}
}
Definition at line 144 of file endpoint.c. |
|