Main Page Alphabetical List Compound List File List Compound Members File Members
GATEndpoint.c File ReferenceMain .c for the GATEndpoint class.
More...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <sys/utsname.h>
#include "GAT.h"
#include "GATRegistry.h"
#include "GATInternal.h"
#include "GATXdsWrapper.h"
#include "GATEndpointCPI.h"
#include "GATMetricEvent.h"
Include dependency graph for GATEndpoint.c:
Go to the source code of this file.
|
Compounds |
| struct | GATEndpoint_S |
Functions |
| | GATOBJECT_DEFINE_VTABLE (GATEndpoint) |
| | GATSERIALISABLE_DEFINE_VTABLE (GATEndpoint) |
| | GATMONITORABLE_DEFINE_VTABLE (GATEndpoint) |
| | GATOBJECT_DEFINE_CONVERTERS (GATEndpoint) |
| GATResult | GATEndpoint_GetCPIInstanceData (GATEndpoint endpoint, void **data) |
| int | GATEndpoint_DeSerialise_Create (GATContext context, GATObject stream, char const *name, GATEndpoint *new_endpoint) |
| | GATEndpoint_DeSerialise_Create.
|
| GATResult | GATEndpoint_GetNodename (struct utsname systemInfo, char **nodename) |
| | GATEndpoint_GetNodename.
|
| GATResult | GATEndpoint_CloneString (char **destination, const char *source) |
| | GATEndpoint_CloneString Creates a clone of a string.
|
| GATResult | GATEndpoint_Register_GATSerialisable (void) |
| | GATEndpoint_Register_GATSerialisable The GATEndpoint_Register_GATSerialisable function registers the serialization vtable with the GAT engine to allow generic object creation.
|
| GATEndpoint | GATEndpoint_Create (GATContext context, GATPreferences_const preferences) |
| | Constructs a unconnected instance of this class.
|
| void | GATEndpoint_Destroy (GATEndpoint *endpoint) |
| | GATEndpoint_Destroy The GATEndpoint destructor.
|
| GATType | GATEndpoint_GetType (GATEndpoint_const endpoint) |
| | int GATEndpoint_GetType(GATEndpoint_const endpoint) Return the type of the GATEndpoint
|
| GATResult | GATEndpoint_Clone (GATEndpoint_const endpoint, GATEndpoint *new_object) |
| | int GATEndpoint_Clone(GATEndpoint_const endpoint, GATEndpoint *new_endpoint) Clone the given GATEndpoint
|
| GATResult | GATEndpoint_Equals (GATEndpoint_const lhs, GATEndpoint_const rhs, GATBool *isequal) |
| | int GATEndpoint_Equals(GATEndpoint_const lhs, GATEndpoint_const rhs, GATBool *isequal) Compares two GATEndpoint objects
|
| GATResult | GATEndpoint_GetInterface (GATEndpoint_const endpoint, GATInterface iftype, void const **ifp) |
| | int GATEndpoint_GetInterface(GATEndpoint_const endpoint, GATInterface iftype, void const **ifp) Get an interface supported by a GATEndpoint
|
| GATResult | GATEndpoint_Connect (GATEndpoint_const endpoint, GATPipe *peep) |
| | When a GATEndpoint is obtained from an Advert Directory, it can be used to create a GATPipe connected to the advertising application, by calling connect on the GATEndpoint instance.
|
| GATResult | GATEndpoint_Listen (GATEndpoint_const endpoint, GATPipe *peep) |
| | The creator of an GATEndpoint can use the GATEndpoint to create GATPipes, which represent incoming connections.
|
| GATResult | GATEndpoint_AddGATPipeListener (GATEndpoint_const endpoint, GATPipeListener peepListener, void *listenerData) |
| | The creator of an GATEndpoint can use the GATEndpoint to create GATPipes, which represent incoming connections.
|
| GATResult | GATEndpoint_AddMetricListener (GATEndpoint endpoint, GATMetricListener listener, void *listener_data, GATMetric metric, GATuint32 *cookie) |
| | GATEndpoint_AddMetricListener.
|
| GATResult | GATEndpoint_RegisterPolling (GATEndpoint endpoint, GATMetric metric, GATMetricEvent *event, GATuint32 *cookie) |
| | GATEndpoint_RegisterPolling.
|
| GATResult | GATEndpoint_RemoveRegisteredMetric (GATEndpoint endpoint, GATMetric metric, GATuint32 cookie) |
| | GATEndpoint_RemoveRegisteredMetric.
|
| GATResult | GATEndpoint_GetMetrics (GATEndpoint_const endpoint, GATList_GATMetric *metrics) |
| | GATEndpoint_GetMetrics.
|
| GATResult | GATEndpointCPI_SerialiseCallback (GATObject object, GATObject stream, GATBool clear_dirty) |
| | GATEndpointCPI_SerialiseCallback.
|
| GATResult | GATEndpoint_Serialise (GATEndpoint endpoint, GATObject stream, GATBool clear_dirty) |
| | int GATEndpoint_Serialise(GATEndpoint endpoint, GATObject stream, GATBool clear_dirty) Serialise a GATEndpoint object
|
| GATBool | GATEndpointCPI_VersionCallback (GATuint32 version) |
| | GATEndpointCPI_VersionCallback.
|
| GATResult | GATEndpointCPI_DeSerialiseCallback (GATContext context, GATObject stream, GATObject *object, GATuint32 version, va_list args) |
| | GATEndpointCPI_DeSerialiseCallback.
|
| GATEndpoint | GATEndpoint_DeSerialise (GATContext context, GATObject stream, GATResult *result) |
| | GATEndpoint GATEndpoint_DeSerialise(GATContext context, GATObject stream, GATBool clear_dirty) De-serialise a GATEndpoint object.
|
| GATResult | GATEndpoint_GetIsDirty (GATEndpoint_const endpoint, GATBool *isdirty) |
| | GATEndpoint_GetIsDirty.
|
Variables |
| const char * | rcsid = "$Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATEndpoint.c,v 1.22 2004/05/10 15:17:32 hartmutkaiser Exp $" |
| GATEndpoint_vtable | GATEndpoint__vtable |
| GATEndpoint_ISerialisable_vtable | GATEndpoint_ISerialisable__vtable |
| GATEndpoint_IMonitorable_vtable | GATEndpoint_IMonitorable__vtable |
Detailed Description
Main .c for the GATEndpoint class.
An GATEndpoint represents an end of a byte stream.
- Date:
-
- Date:
-
2004/05/10 15:17:32
- Version:
-
- Header:
-
/export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATEndpoint.c,v 1.22 2004/05/10 15:17:32 hartmutkaiser Exp
Copyright (C) Kelly Davis This is part of the GAT Engine. Contributed by Kelly Davis <kdavis@aei.mpg.de>
Use, modification and distribution is subject to the Gridlab Software License. (See accompanying file GLlicense.txt or copy at http://www.gridlab.org/GLlicense.txt)
Definition in file GATEndpoint.c.
Function Documentation
|
|
GATEndpoint_DeSerialise_Create.
The function GATEndpoint_DeSerialise_Create creates a new GATEndpoint object and tries to find a CPI provider to associate with this endpoint object. The CPI provider is selected by testing, which adapter is able to handle the streamed instance data of the original CPI provider. - Parameters:
-
| context |
The GAT context to use for creation of the GATEndpoint object. |
| stream |
The object from which the adaptor should read the streamed instance data. |
| new_object |
The pointer to the variable, which should receive the newly constructed GATEndpoint object. |
- Returns:
-
An error code.
Definition at line 956 of file GATEndpoint.c.
References GATEndpointCPI_Instance::context, GATEndpoint_S::cpi, GATEndpoint_S::cpilist, GATEndpoint_S::data, GAT_CREATE_STATUS, GAT_CURRENT_STATUS, GAT_INVALID_PARAMETER, GAT_MEMORYFAILURE, GAT_NO_MATCHING_CPI, GAT_NO_REGISTERED_CPI, GAT_NOTIMPL, GAT_RETURN_STATUS, GAT_SUCCEEDED, GAT_SUCCESS, GAT_USES_STATUS, GATBool, GATContext_GetPreferences(), GATContext_internal_GetRegistry(), GATEndpoint__vtable, GATEndpoint_CloneString(), GATEndpoint_Destroy(), GATEndpoint_IMonitorable__vtable, GATEndpoint_ISerialisable__vtable, GATEndpointCPI_DeSerialise(), GATEndpointCPI_GetMetrics(), GATFalse, GATEndpoint_S::GATMonitorable__vtable, GATMonitorable_Impl_Create(), GATEndpoint_S::GATObject__vtable, GATOrigin_Current, GATOrigin_Set, GATPreferences_const, GATRegistry_const, GATResult, GATEndpoint_S::GATSerialisable__vtable, GATStreamable_Seek(), GATTrue, GATuint32, GATEndpointCPI_Instance::isdirty, GATEndpointCPI_Instance::monitorable, name, GATEndpointCPI_Instance::nodename, and GATEndpointCPI_Instance::source.
Referenced by GATEndpointCPI_DeSerialiseCallback(). |
| GATResult GATEndpoint_GetNodename |
( |
struct utsname |
systemInfo, |
|
|
char ** |
nodename |
|
) |
[static] |
|
| GATResult GATEndpoint_CloneString |
( |
char ** |
destination, |
|
|
const char * |
source |
|
) |
[static] |
|
| GATResult GATEndpoint_Register_GATSerialisable |
( |
void |
|
) |
|
|
|
|
Constructs a unconnected instance of this class.
- Parameters:
-
| context |
Used to broker resources. |
| preferences |
User preferences for this instance. |
Definition at line 122 of file GATEndpoint.c.
References GATEndpointCPI_Instance::context, GATEndpoint_S::cpi, GATEndpoint_S::cpilist, GATEndpoint_S::data, GAT_CREATE_STATUS, GAT_CURRENT_STATUS, GAT_FAIL, GAT_FAILED, GAT_MEMORYFAILURE, GAT_NO_REGISTERED_CPI, GAT_NOTIMPL, GAT_STATUS_APIENTRY, GAT_STORE_STATUS, GAT_SUCCEEDED, GAT_SUCCESS, GATBool, GATContext_GetPreferences(), GATContext_internal_GetRegistry(), GATEndpoint__vtable, GATEndpoint_Destroy(), GATEndpoint_GetNodename(), GATEndpoint_IMonitorable__vtable, GATEndpoint_ISerialisable__vtable, GATEndpointCPI_CreateInstance(), GATEndpointCPI_GetMetrics(), GATFalse, GATEndpoint_S::GATMonitorable__vtable, GATMonitorable_Impl_Create(), GATEndpoint_S::GATObject__vtable, GATPreferences_const, GATRegistry_const, GATResult, GATEndpoint_S::GATSerialisable__vtable, GATTrue, GATEndpointCPI_Instance::isdirty, GATEndpointCPI_Instance::monitorable, GATEndpointCPI_Instance::nodename, and GATEndpointCPI_Instance::source.
Referenced by main(). |
|
|
int GATEndpoint_Clone(GATEndpoint_const endpoint, GATEndpoint *new_endpoint) Clone the given GATEndpoint
The function GATEndpoint_Clone generates a (deep) copy of the given GATEndpoint. - Parameters:
-
| endpoint |
The object to clone |
| new_endpoint |
The pointer, through which the result is to be returned. |
- Returns:
-
An error type.
Definition at line 286 of file GATEndpoint.c.
References assert, GATEndpointCPI_Instance::context, GATEndpoint_S::cpi, GATEndpoint_S::cpilist, GATEndpoint_S::data, GAT_CREATE_STATUS, GAT_CURRENT_STATUS, GAT_FAILED, GAT_INVALID_HANDLE, GAT_INVALID_PARAMETER, GAT_MEMORYFAILURE, GAT_RETURN_STATUS, GAT_STATUS_APIENTRY, GATEndpoint__vtable, GATEndpoint_CloneString(), GATEndpoint_const, GATEndpoint_Destroy(), GATEndpoint_IMonitorable__vtable, GATEndpoint_ISerialisable__vtable, GATEndpointCPI_CloneInstance(), GATFalse, GATEndpoint_S::GATMonitorable__vtable, GATMonitorable_Impl_Clone(), GATEndpoint_S::GATObject__vtable, GATResult, GATEndpoint_S::GATSerialisable__vtable, GATEndpointCPI_Instance::isdirty, GATEndpointCPI_Instance::monitorable, GATEndpointCPI_Instance::nodename, and GATEndpointCPI_Instance::source. |
|
|
int GATEndpoint_Equals(GATEndpoint_const lhs, GATEndpoint_const rhs, GATBool *isequal) Compares two GATEndpoint objects
The function GATEndpoint_Equals compares two endpoint objects of type #GATEndpoint. - Parameters:
-
| lhs |
The first endpoint object to compare |
| rhs |
The second endpoint object to compare |
| isequal |
The pointer to the GATBool variable, which should receive the result if the comparision |
- Returns:
-
An error code.
Definition at line 392 of file GATEndpoint.c.
References GAT_CREATE_STATUS, GAT_INVALID_HANDLE, GAT_RETURN_STATUS, GAT_STATUS_APIENTRY, GATBool, GATEndpoint_const, GATEndpointCPI_EqualsInstance(), and GATFalse. |
|
|
int GATEndpoint_GetInterface(GATEndpoint_const endpoint, GATInterface iftype, void const **ifp) Get an interface supported by a GATEndpoint
The function GATEndpoint_GetInterface allows to get a pointer to an additional interface supported by this GATEndpoint. - Parameters:
-
| object |
The object to be asked for the new interface. |
| iftype |
The interface the object is to be asked for. |
| ifp |
The pointer, through which the result is to be returned. |
- Returns:
-
An error type.
Definition at line 424 of file GATEndpoint.c.
References GAT_CREATE_STATUS, GAT_INVALID_HANDLE, GAT_INVALID_PARAMETER, GAT_NO_INTERFACE, GAT_RETURN_STATUS, GAT_STATUS_APIENTRY, GATEndpoint_const, GATInterface, GATInterface_IAdvertisable, GATInterface_IMonitorable, and GATInterface_ISerialisable. |
|
|
GATEndpoint_AddMetricListener.
The function GATEndpoint_AddMetricListener adds the passed instance of a GATMetricListener to the list of GATMetricListeners which are notified of fired GATMetricEvents of the type described by the provided GATMetric instance. - Parameters:
-
| endpoint |
The GATEndpoint instance to add the GATMetricListener to. |
| listener |
The GTAMetricListener to call, when the corresponding GATMetricEvent is fired. |
| listener_data |
The client supplied data, which will be passed through to the GATMetricListener. |
| metric |
The GATMetric instance describing the GATMetricEvent to pass to the GATMetricListener. |
| cookie |
The returned value should be used to remove the GATMetricListener from this GATMonitorable. |
- Returns:
-
An error code.
Definition at line 550 of file GATEndpoint.c.
References GATEndpointCPI_Instance::context, GATEndpoint_S::data, GAT_CREATE_STATUS, GAT_INVALID_HANDLE, GAT_NO_INTERFACE, GAT_RETURN_STATUS, GAT_STATUS_APIENTRY, GATMetric, GATMetricListener, GATMonitorable_Impl_AddMetricListener(), GATuint32, and GATEndpointCPI_Instance::monitorable. |
|
|
GATEndpoint_RegisterPolling.
The function GATEndpoint_RegisterPolling registers a continuous metric with the given GATEndpoint instance. - Parameters:
-
| endpoint |
The GATEndpoint instance to register the metric with. |
| metric |
The GATMetric instance describing the GATMetricEvent to pass to the GATMetricListener. This metric instance must be of type GATMeasurementType_Continuous, otherwise an error is returned. |
| event |
The pointer to a variable, which should receive the resulting GATMetricEvent. The GATMetricEvent instance should be freed by the caller when it isn't used anymore. |
| cookie |
The returned value should be used to remove the GATMetricListener from this GATEndpoint. |
- Returns:
-
An error code.
Definition at line 591 of file GATEndpoint.c.
References GATEndpointCPI_Instance::context, GATEndpoint_S::cpi, GATEndpoint_S::data, GAT_CREATE_STATUS, GAT_CURRENT_STATUS, GAT_FAILED, GAT_INVALID_HANDLE, GAT_NO_INTERFACE, GAT_RETURN_STATUS, GAT_STATUS_APIENTRY, GATEndpointCPI_GetMetricEvent(), GATMetric, GATMonitorable_Impl_RegisterPolling(), GATMonitorable_Impl_RemoveRegisteredMetric(), GATuint32, and GATEndpointCPI_Instance::monitorable. |
|
|
GATEndpoint_RemoveRegisteredMetric.
The function GATEndpoint_RemoveRegisteredMetric removes a GATMetricListener, which was previously registered with GATEndpoint_AddMetricListener. - Parameters:
-
| endpoint |
The GATEndpoint instance to remove the GATMetricListener from. |
| metric |
The GATMetric instance describing the GATMetricEvent to pass to the GATMetricListener. |
| cookie |
This value identifies the GATMetricListener to remove, it was returned from the corresponding GATMonitorable_AddMetricListener or GATMonitorable_MetricRegisterPolling functions. |
- Returns:
-
An error code.
Definition at line 639 of file GATEndpoint.c.
References GATEndpointCPI_Instance::context, GATEndpoint_S::data, GAT_CREATE_STATUS, GAT_INVALID_HANDLE, GAT_NO_INTERFACE, GAT_RETURN_STATUS, GAT_STATUS_APIENTRY, GATMetric, GATMonitorable_Impl_RemoveRegisteredMetric(), GATResult, GATuint32, and GATEndpointCPI_Instance::monitorable. |
|
|
GATEndpointCPI_SerialiseCallback.
The function GATEndpointCPI_SerialiseCallback is used as a callback function for the serialisation of a GATEndpoint object. It should be provided to serialise the associated CPI provider data for the given object. - Parameters:
-
| object |
The object to serialise. This is the same as the object passed as the first parameter to the function GATXds_SerialiseObject. |
| stream |
The stream interface to use for the serialisation. |
| clear_dirty |
If the clear_dirty parameter is set to GATTrue, the internal dirty flag of this object is to be reset (no used here) |
- Returns:
-
An error code.
- Remarks:
-
This function is called from the GAT engine, there is no need to call it directly.
Definition at line 718 of file GATEndpoint.c.
References GATEndpointCPI_Instance::context, GATEndpoint_S::cpi, GATEndpoint_S::data, GAT_CREATE_STATUS, GAT_CURRENT_STATUS, GAT_INVALID_HANDLE, GAT_RETURN_STATUS, GAT_SUCCEEDED, GAT_USES_STATUS, GATBool, GATEndpointCPI_Serialise(), GATFalse, GATTrue, and GATEndpointCPI_Instance::isdirty.
Referenced by GATEndpoint_Serialise(). |
|
|
int GATEndpoint_Serialise(GATEndpoint endpoint, GATObject stream, GATBool clear_dirty) Serialise a GATEndpoint object
The function GATEndpoint_Serialise serialises the given GATFIle object into the given stream. - Parameters:
-
| endpoint |
The GATEndpoint object to serialise. |
| stream |
The stream interface to use for the serialisation. |
| clear_dirty |
If the clear_dirty parameter is set to GATTrue, the internal dirty flag of this object is to be reset (no used here) |
- Returns:
-
An error code.
Definition at line 753 of file GATEndpoint.c.
References GATEndpointCPI_Instance::context, GATEndpoint_S::data, GAT_CREATE_STATUS, GAT_INVALID_HANDLE, GAT_RETURN_STATUS, GAT_USES_STATUS, GATBool, GATENDPOINT_VERSION1, GATEndpointCPI_SerialiseCallback(), GATXds_SerialiseObject(), and GATEndpointCPI_Instance::nodename. |
|
|
GATEndpointCPI_VersionCallback.
The function GATEndpointCPI_VersionCallback is used as a callback function during the de-serialisation of a GATEndpoint. It should be provided to test, whether the de-serialised version matches the expected version. - Parameters:
-
| version |
The version number, which was de-serialised from the stream. |
- Returns:
-
This function should return GATTrue, if the version matches the expected value (version is valid), GATFalse otherwise.
- Remarks:
-
This function is called from the GAT engine, there is no need to call it directly.
Definition at line 784 of file GATEndpoint.c.
References GATBool, GATENDPOINT_LASTVERSION, GATENDPOINT_MINOR_MASK, GATFalse, GATTrue, and GATuint32.
Referenced by GATEndpoint_DeSerialise(). |
|
|
GATEndpointCPI_DeSerialiseCallback.
The function GATEndpointCPI_DeSerialiseCallback is used as a callback function during the de-serialisation of a GATEndpoint. It should be provided for the instantiation of the new GATEndpoint object based on the already de-serialised data items and the de-serialisation of the associated CPI provider data for the given object. - Parameters:
-
| context |
The GAT context to be used for object construction. |
| stream |
The stream interface to use for the serialisation. |
| object |
The pointer to the variable, which should receive the newly constructed object. |
| version |
The version of the saved data read from the input stream. |
| args |
This parameter is the pointer to the va_list containing pointers to the already de-serialised data items accordingly to the format string, provided during the call to the GATEndpoint_DeSerialise function. |
- Returns:
-
An error code.
- Remarks:
-
This function is called from the GAT engine, there is no need to call it directly.
Definition at line 818 of file GATEndpoint.c.
References GAT_CREATE_STATUS, GAT_CREATE_STATUS_IF, GAT_CURRENT_STATUS, GAT_INVALID_PARAMETER, GAT_RETURN_STATUS, GAT_SUCCEEDED, GAT_UNUSED_PARAMETER, GAT_USES_STATUS, GATEndpoint_DeSerialise_Create(), GATEndpoint_Destroy(), GATuint32, and POSIX_TO_GAT.
Referenced by GATEndpoint_DeSerialise(). |
|
|
GATEndpoint GATEndpoint_DeSerialise(GATContext context, GATObject stream, GATBool clear_dirty) De-serialise a GATEndpoint object.
The function GATEndpoint_DeSerialise de-serialises a streamed GATEndpoint object from the given stream It constructs a new instance of the de-serialised object. - Parameters:
-
| context |
The GAT context to be used for object construction. |
| stream |
The stream interface to use for the serialisation. |
| result |
The pointer to a variable, which receives the status code of the operation. |
- Returns:
-
The newly constructed GATEndpoint object.
Definition at line 868 of file GATEndpoint.c.
References GAT_BAD_OBJECT_CONVERSION, GAT_CREATE_STATUS, GAT_CURRENT_STATUS, GAT_FAILED, GAT_STORE_STATUS, GAT_USES_STATUS, GATEndpointCPI_DeSerialiseCallback(), GATEndpointCPI_VersionCallback(), GATObject_Destroy(), GATResult, GATuint32, and GATXds_DeSerialiseObject(). |
Variable Documentation
const char* rcsid = "$Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/src/GATEndpoint.c,v 1.22 2004/05/10 15:17:32 hartmutkaiser Exp $" [static]
|
|
GATEndpoint_vtable GATEndpoint__vtable [static]
|
|
GATEndpoint_ISerialisable_vtable GATEndpoint_ISerialisable__vtable [static]
|
|
GATEndpoint_IMonitorable_vtable GATEndpoint_IMonitorable__vtable [static]
|
|
|