A datatype which defines an available service, its capabilities and its parameters. More...

#include <service.h>

Collaboration diagram for Service:
[legend]

Public Member Functions

bool InitialiseService (Service *const service_p, const char *(*get_service_name_fn)(Service *service_p), const char *(*get_service_description_fn)(Service *service_p), const char *(*get_service_info_uri_fn)(struct Service *service_p), struct ServiceJobSet *(*run_fn)(Service *service_p, ParameterSet *param_set_p, UserDetails *user_p, ProvidersStateTable *providers_p), ParameterSet *(*match_fn)(Service *service_p, Resource *resource_p, Handler *handler_p), ParameterSet *(*get_parameters_fn)(Service *service_p, Resource *resource_p, UserDetails *user_p), void(*release_parameters_fn)(Service *service_p, ParameterSet *params_p), bool(*close_fn)(struct Service *service_p), void(*customise_service_job_fn)(Service *service_p, struct ServiceJob *job_p), bool specific_flag, Synchronicity synchronous, ServiceData *data_p, ServiceMetadata *(*get_metadata_fn)(struct Service *service_p))
 Initialise the basic structure of a Service. More...
 
struct ServiceJobSetRunService (Service *service_p, ParameterSet *param_set_p, UserDetails *user_p, ProvidersStateTable *providers_p)
 Run a Service. More...
 
bool DoesServiceHaveCustomServiceJobSerialisation (struct Service *service_p)
 Does the Service use the default ServiceJob serialisation/deserialisation when storing ServiceJobs in the JobsManager or does it use its own specialised routines? More...
 
struct ServiceJobCreateSerialisedServiceJobFromService (struct Service *service_p, const json_t *service_job_json_p)
 Function to parse a JSON fragment from a previously serialised ServiceJob. More...
 
json_t * CreateSerialisedJSONForServiceJobFromService (struct Service *service_p, struct ServiceJob *service_job_p, bool omit_results_flag)
 Function to create a JSON fragment representing a serialised ServiceJob. More...
 
ServiceGetServiceByName (const char *const service_name_s)
 Get a Service by its name. More...
 
ParameterSetIsServiceMatch (Service *service_p, Resource *resource_p, Handler *handler_p)
 Is the Service able to work upon the given Resource. More...
 
const char * GetServiceName (Service *service_p)
 Get the user-friendly name of the service. More...
 
const char * GetServiceDescription (Service *service_p)
 Get the user-friendly description of the service. More...
 
const char * GetServiceInformationURI (Service *service_p)
 Get the address of a web page about the service. More...
 
ParameterSetGetServiceParameters (Service *service_p, Resource *resource_p, UserDetails *user_p)
 Get a newly-created ParameterSet describing the parameters for a given Service. More...
 
char * GetServiceUUIDAsString (Service *service_p)
 Get the unique id of a service object. More...
 
void FreeService (Service *service_p)
 Free a Service and its associated Parameters and ServiceData. More...
 
void ReleaseService (Service *service_p)
 For an asynchronous Service, tell it that it is no longer needed by the Grassroots system. More...
 
void SetServiceReleaseFunction (Service *service_p, void(*release_fn)(Service *service_p))
 For an asynchronous Service, set the function that will be called if ReleaseService() is called. More...
 
bool CloseService (Service *service_p)
 Close a Service. More...
 
bool IsServiceLive (Service *service_p)
 Has the Service got any jobs still running? More...
 
json_t * GetServiceAsJSON (Service *const service_p, Resource *resource_p, UserDetails *user_p, const bool add_id_flag)
 Generate a json-based description of a Service. More...
 
const char * GetServiceIcon (Service *service_p)
 Get the URL of an icon image to use for a given Service. More...
 
void ReleaseServiceParameters (Service *service_p, ParameterSet *params_p)
 Free a ParameterSet that was got from a call to GetServiceParameters. More...
 
bool AddServiceResponseHeader (Service *service_p, json_t *result_json_p)
 Add a JSON fragment to the response for a given Service that has been run. More...
 
OperationStatus GetCurrentServiceStatus (Service *service_p, const uuid_t service_id)
 Get the OperationStatus for an operation in a Service. More...
 
bool CreateAndAddPairedService (Service *service_p, struct ExternalServer *external_server_p, const char *remote_service_name_s, const json_t *op_p, const json_t *provider_p)
 Create a new PairedService and add it to a Service. More...
 
bool AddPairedService (Service *service_p, PairedService *paired_service_p)
 Add a PairedService to a Service. More...
 
bool CreateAndAddLinkedService (Service *service_p, const json_t *service_config_p)
 Create and add a LinkedService to a Service. More...
 
bool AddLinkedService (Service *service_p, LinkedService *paired_service_p)
 Add a LinkedService to a Service. More...
 
bool IsServiceRunning (Service *service_p)
 Check if a Service is currently running any ServiceJobs. More...
 
void SetServiceRunning (Service *service_p, bool b)
 Set if a Service is currently running any ServiceJobs or not. More...
 
void SetMetadataForService (Service *service_p, SchemaTerm *category_p, SchemaTerm *subcategory_p)
 Set the values of a Service's ServiceMetadata object. More...
 
bool AddServiceJobToService (Service *service_p, ServiceJob *job_p, bool require_lock_flag)
 Add a ServiceJob to a Service. More...
 
bool RemoveServiceJobFromService (Service *service_p, ServiceJob *job_p)
 Remove a ServiceJob from a Service. More...
 
int32 GetNumberOfLiveJobs (Service *service_p)
 Check if any ServiceJobs within Service are still running. More...
 
bool IsServiceLockable (const Service *service_p)
 Is a given Service lockable with a mutex for use in a multi-threaded situation. More...
 
bool LockService (Service *service_p)
 Lock a given Service with a mutex for use in a multi-threaded situation. More...
 
bool UnlockService (Service *service_p)
 Release the lock for a given Service in a multi-threaded situation. More...
 

Data Fields

struct Pluginse_plugin_p
 The platform-specific plugin that the code for the Service is stored in. More...
 
bool se_is_specific_service_flag
 Is the service self-contained. More...
 
struct ServiceJobSet *(* se_run_fn )(struct Service *service_p, ParameterSet *param_set_p, UserDetails *user_p, ProvidersStateTable *providers_p)
 Run this Service. More...
 
ParameterSet *(* se_match_fn )(struct Service *service_p, Resource *resource_p, Handler *handler_p)
 Is the Service able to work upon the given Resource. More...
 
bool(* se_has_permissions_fn )(struct Service *service_p, ParameterSet *params_p, const UserDetails *const user_p)
 Check whether the user have permissions to run the Service. More...
 
const char *(* se_get_service_name_fn )(struct Service *service_p)
 Function to get the user-friendly name of the service. More...
 
const char *(* se_get_service_description_fn )(struct Service *service_p)
 Function to get the user-friendly description of the service. More...
 
const char *(* se_get_service_info_uri_fn )(struct Service *service_p)
 Function to get a web address for more information about the service. More...
 
ParameterSet *(* se_get_params_fn )(struct Service *service_p, Resource *resource_p, UserDetails *user_p)
 Function to get the ParameterSet for this Service. More...
 
void(* se_customise_service_job_fn )(struct Service *service_p, struct ServiceJob *job_p)
 This function is used to customise any ServiceJob objects that this Service creates. More...
 
void(* se_release_params_fn )(struct Service *service_p, ParameterSet *params_p)
 Function to release the ParameterSet for this Service. More...
 
bool(* se_close_fn )(struct Service *service_p)
 Function to close this Service. More...
 
struct ServiceJob *(* se_deserialise_job_json_fn )(struct Service *service_p, const json_t *service_job_json_p)
 Function to parse a JSON fragment from a previously serialised ServiceJob created by this Service. More...
 
json_t *(* se_serialise_job_json_fn )(struct Service *service_p, struct ServiceJob *service_job_p, bool omit_results_flag)
 Function to create a JSON fragment representing a serialised ServiceJob. More...
 
bool(* se_process_linked_services_fn )(struct Service *service_p, struct ServiceJob *job_p, LinkedService *linked_service_p)
 Callback function used when processing the results from running ServiceJobs for this Service as input for any LinkedServices for this Service. More...
 
Synchronicity se_synchronous
 The synchronicity for how this Service runs. More...
 
uuid_t se_id
 Unique Id for this service. More...
 
struct ServiceJobSetse_jobs_p
 The ServiceJobSet for this Service. More...
 
LinkedList se_paired_services
 Any remote Services that are paired with this Service. More...
 
LinkedList se_linked_services
 Any LinkedServices that will use the output from running this Service as input for itself. More...
 
ServiceDatase_data_p
 Any custom data that the service needs to store. More...
 
bool se_running_flag
 A flag to specify whether this Service is currently running. More...
 
ServiceMetadatase_metadata_p
 The ServiceMetadata for this Service. More...
 
ServiceMetadata *(* se_get_metadata_fn )(struct Service *service_p)
 Callback function used to create a Service's ServiceMetadata. More...
 
SyncDatase_sync_data_p
 If the Service's synchronicity is set to SY_ASYNCHRONOUS_ATTACHED, this is used as mutex to control access to this Service when needed. More...
 
void(* se_release_service_fn )(struct Service *service_p)
 A custom callback function to use to close the service if needed. More...
 

Detailed Description

A datatype which defines an available service, its capabilities and its parameters.

Examples:
long_running_service.c.

Member Function Documentation

◆ InitialiseService()

bool InitialiseService ( Service *const  service_p,
const char *(*)(Service *service_p)  get_service_name_fn,
const char *(*)(Service *service_p)  get_service_description_fn,
const char *(*)(struct Service *service_p)  get_service_info_uri_fn,
struct ServiceJobSet *(*)(Service *service_p, ParameterSet *param_set_p, UserDetails *user_p, ProvidersStateTable *providers_p)  run_fn,
ParameterSet *(*)(Service *service_p, Resource *resource_p, Handler *handler_p)  match_fn,
ParameterSet *(*)(Service *service_p, Resource *resource_p, UserDetails *user_p)  get_parameters_fn,
void(*)(Service *service_p, ParameterSet *params_p)  release_parameters_fn,
bool(*)(struct Service *service_p)  close_fn,
void(*)(Service *service_p, struct ServiceJob *job_p)  customise_service_job_fn,
bool  specific_flag,
Synchronicity  synchronous,
ServiceData data_p,
ServiceMetadata *(*)(struct Service *service_p)  get_metadata_fn 
)

Initialise the basic structure of a Service.

Parameters
service_pThe Service to initialise.
get_service_name_fnThe callback function that the Service will call to get its name.
get_service_description_fnThe callback function that the Service will call to get its description.
get_service_info_uri_fnThe callback function that the Service will call to get a web address for more information about the Service. This can be NULL.
run_fnThe callback function that the Service will call to run itself.
match_fnThe callback function that the Service will call to check whether it is an appropriate Service for a given Resource.
get_parameters_fnThe callback function that the Service will call to get its ParameterSet.
release_parameters_fnThe callback function that the Service will call to free a ParameterSet returned from a previous call to get its ParameterSet.
close_fnThe callback function that the Service will call when the Service is closed.
customise_service_job_fnIf the ServiceJobs that this Service uses are extended from the Base ServiceJob datatype, this function is used to set them up. This can be NULL.
specific_flagtrue if this Service performs a specific analysis. For Services used by scripted reference Services detailed by JSON configuration files, then this should be false.
synchronousThe synchronicity for how this Service runs.
data_pThe ServiceData for this Service.
get_metadata_fnThe callback function that the Service will call to create its ServiceMetadata.
Returns
true if the Service was set up successfully, false otherwise.
Examples:
long_running_service.c.

◆ RunService()

struct ServiceJobSet * RunService ( Service service_p,
ParameterSet param_set_p,
UserDetails user_p,
ProvidersStateTable providers_p 
)

Run a Service.

This is a convenience wrapper around se_run_fn.

Parameters
service_pThe Service to run.
param_set_pThe ParameterSet to run the Service with.
user_pAn optional set of UserDetails as json.
providers_pThe ProvidersStateTable to be used by any RemoteServices.
Returns
A newly-allocated ServiceJobSet containing the details for the new jobs or NULL upon error.
See also
se_run_fn

◆ DoesServiceHaveCustomServiceJobSerialisation()

bool DoesServiceHaveCustomServiceJobSerialisation ( struct Service service_p)

Does the Service use the default ServiceJob serialisation/deserialisation when storing ServiceJobs in the JobsManager or does it use its own specialised routines?

Parameters
service_pThe Service to check.
Returns
true if the Service use custom routines, false if it uses the standard ones.

◆ CreateSerialisedServiceJobFromService()

struct ServiceJob * CreateSerialisedServiceJobFromService ( struct Service service_p,
const json_t *  service_job_json_p 
)

Function to parse a JSON fragment from a previously serialised ServiceJob.

Parameters
service_pA Service of the same type that the serialised ServiceJob was run by.
service_job_json_pThe JSON fragment representing the serialised ServiceJob.
Returns
The newly-constructed ServiceJob or NULL upon error.
See also
se_deserialise_job_fn

◆ CreateSerialisedJSONForServiceJobFromService()

json_t * CreateSerialisedJSONForServiceJobFromService ( struct Service service_p,
struct ServiceJob service_job_p,
bool  omit_results_flag 
)

Function to create a JSON fragment representing a serialised ServiceJob.

Parameters
service_pA Service of the same type that the serialised ServiceJob was run by.
service_job_pThe ServiceJob to serialise.
omit_results_flagIf this is true then just the minimal status information for the ServiceJob will be returned. If it is false then the job results will be included too if possible.
Returns
The JSON fragment representing the serialised ServiceJob or NULL upon error.
See also
se_serialise_job_fn

◆ GetServiceByName()

Service * GetServiceByName ( const char *const  service_name_s)

Get a Service by its name.

This will match a Service with its response from getting GetServiceName.

Parameters
service_name_sThe name of the Service to find.
Returns
The matching Service or NULL if it could not be found.

◆ IsServiceMatch()

ParameterSet * IsServiceMatch ( Service service_p,
Resource resource_p,
Handler handler_p 
)

Is the Service able to work upon the given Resource.

Parameters
service_pThe Service to check.
resource_pThe Resource to check.
handler_pA custom Handler for accessing the Resource. This can be NULL.
Returns
If the Service can run on the given Resource, it returns a ParameterSet that is partially filled in using the value of the Resource. If the Service cannot run on the given Resource, this will return NULL.
See also
se_match_fn

◆ GetServiceName()

const char * GetServiceName ( Service service_p)

Get the user-friendly name of the service.

Parameters
service_pThe Service to get the name for.
Returns
The name of Service.

◆ GetServiceDescription()

const char * GetServiceDescription ( Service service_p)

Get the user-friendly description of the service.

Parameters
service_pThe Service to get the description for.
Returns
The description of Service.

◆ GetServiceInformationURI()

const char * GetServiceInformationURI ( Service service_p)

Get the address of a web page about the service.

Parameters
service_pThe Service to get the description for.
Returns
The address of the page or NULL if there isn't one.

◆ GetServiceParameters()

ParameterSet * GetServiceParameters ( Service service_p,
Resource resource_p,
UserDetails user_p 
)

Get a newly-created ParameterSet describing the parameters for a given Service.

Parameters
service_pThe Service to get the ParameterSet for.
resource_pThis is the input to the Service and can be NULL.
user_pAny user authorisation details that the Service might need. This can be NULL.
Returns
The newly-created ParameterSet or NULL upon error. This ParameterSet will need to be freed once it is no longer needed by calling FreeParameterSet.
See also
FreeParameterSet.

◆ GetServiceUUIDAsString()

char * GetServiceUUIDAsString ( Service service_p)

Get the unique id of a service object.

Parameters
service_pThe Service to get the id for.
Returns
The string of the id.

◆ FreeService()

void FreeService ( Service service_p)

Free a Service and its associated Parameters and ServiceData.

Parameters
service_pThe Service to free.
Examples:
long_running_service.c.

◆ ReleaseService()

void ReleaseService ( Service service_p)

For an asynchronous Service, tell it that it is no longer needed by the Grassroots system.

Parameters
service_pThe Service to release.

◆ SetServiceReleaseFunction()

void SetServiceReleaseFunction ( Service service_p,
void(*)(Service *service_p)  release_fn 
)

For an asynchronous Service, set the function that will be called if ReleaseService() is called.

Parameters
service_pThe Service to set the release function for.
release_fnThe release function to set for the given Service.

◆ CloseService()

bool CloseService ( Service service_p)

Close a Service.

Parameters
service_pThe Service to close.
Returns
true if the Service was closed successfully, false otherwise.

◆ IsServiceLive()

bool IsServiceLive ( Service service_p)

Has the Service got any jobs still running?

Parameters
service_pThe Service to check.
Returns
true if the Service still has active jobs, false otherwise.

◆ GetServiceAsJSON()

json_t * GetServiceAsJSON ( Service *const  service_p,
Resource resource_p,
UserDetails user_p,
const bool  add_id_flag 
)

Generate a json-based description of a Service.

Parameters
service_pThe Service to generate the description for.
resource_pAn optional Resource for the Service to run on. This can be NULL.
user_pOptional user configuration details. This can be NULL.
add_id_flagIf this is true then the UUID of the Service will be added to the returned JSON. If this is false then it will not.
Returns
The json-based representation of the Service or NULL if there was an error.

◆ GetServiceIcon()

const char * GetServiceIcon ( Service service_p)

Get the URL of an icon image to use for a given Service.

Parameters
service_pThe Service to get the icon for.
Returns
The URL of the image to use for the Service.

◆ ReleaseServiceParameters()

void ReleaseServiceParameters ( Service service_p,
ParameterSet params_p 
)

Free a ParameterSet that was got from a call to GetServiceParameters.

Parameters
service_pThe Service used for the previous call to GetServiceParameters
params_pThe ParameterSet to free.s
See also
GetServiceParameters

◆ AddServiceResponseHeader()

bool AddServiceResponseHeader ( Service service_p,
json_t *  result_json_p 
)

Add a JSON fragment to the response for a given Service that has been run.

Parameters
service_pThe Service which will have its response amended.
result_json_pThe JSON fragment to add.
Returns
true if the sService response was successfully updated, false otherwise.

◆ GetCurrentServiceStatus()

OperationStatus GetCurrentServiceStatus ( Service service_p,
const uuid_t  service_id 
)

Get the OperationStatus for an operation in a Service.

Parameters
service_pThe Service to query.
service_idThe uuid_t for the Operation whose OperationStatus is wanted.
Returns
The OperationStatus for the given Operation

◆ CreateAndAddPairedService()

bool CreateAndAddPairedService ( Service service_p,
struct ExternalServer external_server_p,
const char *  remote_service_name_s,
const json_t *  op_p,
const json_t *  provider_p 
)

Create a new PairedService and add it to a Service.

Parameters
service_pThe Service to add the PairedService to.
external_server_pThe ExternalServer that the PairedService runs on.
remote_service_name_sThe name of the PairedService on the ExternalServer.
op_pThe JSON fragment to create the PairedService's ParameterSet from.
provider_pThe JSON fragment representing the Provider.
Returns
true if the PairedService was created and added successfully, false otherwise.
See also
AddPairedService.
AllocatePairedService.
CreateParameterSetFromJSON

◆ AddPairedService()

bool AddPairedService ( Service service_p,
PairedService paired_service_p 
)

Add a PairedService to a Service.

Parameters
service_pThe Service to add the PairedService to.
paired_service_pThe PairedService to add.
Returns
true if the PairedService was added successfully, false otherwise.

◆ CreateAndAddLinkedService()

bool CreateAndAddLinkedService ( Service service_p,
const json_t *  service_config_p 
)

Create and add a LinkedService to a Service.

Parameters
service_pThe Service to add the LinkedService to.
service_config_pThe json fragement defining the LinkedService to add.
Returns
true if the LinkedService was added successfully, false otherwise.

◆ AddLinkedService()

bool AddLinkedService ( Service service_p,
LinkedService paired_service_p 
)

Add a LinkedService to a Service.

Parameters
service_pThe Service to add the LinkedService to.
paired_service_pThe LinkedService to add.
Returns
true if the LinkedService was added successfully, false otherwise.

◆ IsServiceRunning()

bool IsServiceRunning ( Service service_p)

Check if a Service is currently running any ServiceJobs.

Parameters
service_pThe Service to check.
Returns
true if the Service is running, false if it is not.

◆ SetServiceRunning()

void SetServiceRunning ( Service service_p,
bool  b 
)

Set if a Service is currently running any ServiceJobs or not.

Parameters
service_pThe Service to set.
btrue if the Service is running, false if it is not.

◆ SetMetadataForService()

void SetMetadataForService ( Service service_p,
SchemaTerm category_p,
SchemaTerm subcategory_p 
)

Set the values of a Service's ServiceMetadata object.

Parameters
service_pThe Service to set.
category_pThe top-level application category to use.
subcategory_pThe application subcategory to use.
Returns
true if the ServiceMetadata was set successfully, false if it was not.

◆ AddServiceJobToService()

bool AddServiceJobToService ( Service service_p,
ServiceJob job_p,
bool  require_lock_flag 
)

Add a ServiceJob to a Service.

Parameters
service_pThe Service to add the ServiceJob to.
job_pThe ServiceJob to add.
require_lock_flagSet this to true if the Service needs to be thread-safe, false otherwise.
Returns
true if the ServiceJob was added to the Service successfully, false otherwise.
Examples:
long_running_service.c.

◆ RemoveServiceJobFromService()

bool RemoveServiceJobFromService ( Service service_p,
ServiceJob job_p 
)

Remove a ServiceJob from a Service.

Parameters
service_pThe Service to remove the ServiceJob from.
job_pThe ServiceJob to remove.
Returns
true if the ServiceJob was removed to the ServiceJob successfully, false if could not as the ServiceJob is not a member of the Service

◆ GetNumberOfLiveJobs()

int32 GetNumberOfLiveJobs ( Service service_p)

Check if any ServiceJobs within Service are still running.

Parameters
service_pThe Service to check.
Returns
true if there are still some ServiceJobs in the given service that are still running, false otherwise.

◆ IsServiceLockable()

bool IsServiceLockable ( const Service service_p)

Is a given Service lockable with a mutex for use in a multi-threaded situation.

Parameters
service_pThe Service to check.
Returns
true if the Service is lockable, false otherwise.

◆ LockService()

bool LockService ( Service service_p)

Lock a given Service with a mutex for use in a multi-threaded situation.

Parameters
service_pThe Service to check.
Returns
true if the Service was locked successfully, false otherwise.

◆ UnlockService()

bool UnlockService ( Service service_p)

Release the lock for a given Service in a multi-threaded situation.

Parameters
service_pThe Service to check.
Returns
true if the Service was unlocked successfully, false otherwise.

Field Documentation

◆ se_plugin_p

struct Plugin* se_plugin_p

The platform-specific plugin that the code for the Service is stored in.

◆ se_is_specific_service_flag

bool se_is_specific_service_flag

Is the service self-contained.

If a Service has a specific task that it can perform then this is true. If it is a utility that is reused for different Services, such as a generic web search service, then this is false

◆ se_run_fn

struct ServiceJobSet*(* se_run_fn) (struct Service *service_p, ParameterSet *param_set_p, UserDetails *user_p, ProvidersStateTable *providers_p)

Run this Service.

Parameters
service_pThe Service to run.
param_set_pThe ParameterSet to run the Service with.
credentials_pAn optional set of credentials if the Service requires it.
Returns
A newly-allocated ServiceJobSet with the status of the ServiceJobs started by this call or NULL if there was an error.
See also
RunService

◆ se_match_fn

ParameterSet*(* se_match_fn) (struct Service *service_p, Resource *resource_p, Handler *handler_p)

Is the Service able to work upon the given Resource.

Parameters
service_pThe Service to check.
resource_pThe Resource to check.
handler_pA custom Handler for accessing the Resource. This can be NULL.
Returns
If the Service can run on the given Resource, it returns a ParameterSet that is partially filled in using the value of the Resource. If the Service cannot run on the given Resource, this will return NULL.

◆ se_has_permissions_fn

bool(* se_has_permissions_fn) (struct Service *service_p, ParameterSet *params_p, const UserDetails *const user_p)

Check whether the user have permissions to run the Service.

Parameters
service_pThis Service.
params_pThe ParameterSet that the user wishes to use. If this is NULL which will check whether the user can run the Service with any ParameterSet. If this is set, it will also check whether the user can run the Service with the specific parameters e.g. access to a given input file.
user_pThe UserDetails for the user.
Returns
true if the user has permissions, false otherwise.

◆ se_get_service_name_fn

const char*(* se_get_service_name_fn) (struct Service *service_p)

Function to get the user-friendly name of the service.

◆ se_get_service_description_fn

const char*(* se_get_service_description_fn) (struct Service *service_p)

Function to get the user-friendly description of the service.

◆ se_get_service_info_uri_fn

const char*(* se_get_service_info_uri_fn) (struct Service *service_p)

Function to get a web address for more information about the service.

◆ se_get_params_fn

ParameterSet*(* se_get_params_fn) (struct Service *service_p, Resource *resource_p, UserDetails *user_p)

Function to get the ParameterSet for this Service.

◆ se_customise_service_job_fn

void(* se_customise_service_job_fn) (struct Service *service_p, struct ServiceJob *job_p)

This function is used to customise any ServiceJob objects that this Service creates.

It is often used to automatically set the sj_update_fn and sj_free_fn members of a ServiceJob.

Parameters
service_pThis Service.
job_pThe ServiceJob to customise.
See also
ServiceJob
SetServiceJobCustomFunctions

◆ se_release_params_fn

void(* se_release_params_fn) (struct Service *service_p, ParameterSet *params_p)

Function to release the ParameterSet for this Service.

◆ se_close_fn

bool(* se_close_fn) (struct Service *service_p)

Function to close this Service.

Parameters
service_pThis Service.
Returns
true if the Service was closed successfully, false otherwise.

◆ se_deserialise_job_json_fn

struct ServiceJob*(* se_deserialise_job_json_fn) (struct Service *service_p, const json_t *service_job_json_p)

Function to parse a JSON fragment from a previously serialised ServiceJob created by this Service.

Parameters
service_pA Service of the same type that the serialised ServiceJob was run by.
service_job_json_pThe JSON fragment representing the serialised ServiceJob.
Returns
The newly-constructed ServiceJob or NULL upon error.
See also
CreateSerialisedServiceJobFromService

◆ se_serialise_job_json_fn

json_t*(* se_serialise_job_json_fn) (struct Service *service_p, struct ServiceJob *service_job_p, bool omit_results_flag)

Function to create a JSON fragment representing a serialised ServiceJob.

Parameters
service_pThe Service that created the ServiceJob.
service_job_pThe ServiceJob to serialise.
Returns
TThe JSON fragment representing the serialised ServiceJob or NULL upon error.
See also
CreateSerialisedJSONFromServiceJob

◆ se_process_linked_services_fn

bool(* se_process_linked_services_fn) (struct Service *service_p, struct ServiceJob *job_p, LinkedService *linked_service_p)

Callback function used when processing the results from running ServiceJobs for this Service as input for any LinkedServices for this Service.

Parameters
service_pThis Service.
job_pThe ServiceJob whose results will be processed.
linked_service_pThe LinkedService defining how to generate the Parameters for the Service to run based upon the given ServiceJob's results
Returns
true if the LinkedService was processed successfully, false otherwise.

◆ se_synchronous

Synchronicity se_synchronous

The synchronicity for how this Service runs.

◆ se_id

uuid_t se_id

Unique Id for this service.

◆ se_jobs_p

struct ServiceJobSet* se_jobs_p

The ServiceJobSet for this Service.

◆ se_paired_services

LinkedList se_paired_services

Any remote Services that are paired with this Service.

◆ se_linked_services

LinkedList se_linked_services

Any LinkedServices that will use the output from running this Service as input for itself.

◆ se_data_p

ServiceData* se_data_p

Any custom data that the service needs to store.

◆ se_running_flag

bool se_running_flag

A flag to specify whether this Service is currently running.

Do not access this value directly, use the API methods IsServiceRunning() and SetServiceRunning() instead.

◆ se_metadata_p

ServiceMetadata* se_metadata_p

The ServiceMetadata for this Service.

◆ se_get_metadata_fn

ServiceMetadata*(* se_get_metadata_fn) (struct Service *service_p)

Callback function used to create a Service's ServiceMetadata.

Parameters
service_pThis Service.
Returns
true if the Service's ServiceMetadata was created successfully, false otherwise.

◆ se_sync_data_p

SyncData* se_sync_data_p

If the Service's synchronicity is set to SY_ASYNCHRONOUS_ATTACHED, this is used as mutex to control access to this Service when needed.

◆ se_release_service_fn

void(* se_release_service_fn) (struct Service *service_p)

A custom callback function to use to close the service if needed.

Parameters
service_pThis Service.

The documentation for this struct was generated from the following file: