json_tools.h File Reference
#include "network_library.h"
#include "jansson.h"
#include "typedefs.h"
#include "operation.h"
#include "request_tools.h"
#include "uuid/uuid.h"
#include "user_details.h"
#include "schema_version.h"
Include dependency graph for json_tools.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

json_t * GetAvailableServicesRequest (const UserDetails *user_p, const SchemaVersion *const sv_p)
 Generate the JSON fragment to send to the Server for getting all available Services. More...
 
bool GetUsernameAndPassword (const UserDetails *const user_p, const char *provider_s, const char **username_ss, const char **password_ss)
 Extract the user credentials from a JSON fragment. More...
 
json_t * GetInterestedServicesRequest (const UserDetails *user_p, const char *const protocol_s, const char *const filename_s, const SchemaVersion *const sv_p)
 Generate the JSON fragment to send to the Server for getting Services that are viable for a given Resource. More...
 
json_t * GetKeywordServicesRequest (const UserDetails *user_p, const char *const keyword_s, const SchemaVersion *const sv_p)
 Generate the JSON fragment to send to the Server for running all keyword-aware Services for a given keyword. More...
 
json_t * GetNamedServicesRequest (const UserDetails *user_p, const char *const service_name_s, const SchemaVersion *const sv_p)
 Generate the JSON fragment to send to the Server for getting the details of a particular Service. More...
 
json_t * GetNamedServicesIndexingDataRequest (const UserDetails *user_p, const char *const service_names_s, const SchemaVersion *const sv_p)
 Generate the JSON fragment to send to the Server for getting the indexing data of a particular Service. More...
 
bool AddClientConfigToJSON (json_t *root_p, const UserDetails *user_p)
 Add the given credentials in the correct position in a JSON fragment. More...
 
json_t * GetOperationAsJSON (Operation op, const SchemaVersion *const sv_p)
 Get the JSON fragment for a given Operation. More...
 
json_t * GetServicesRequest (const UserDetails *user_p, const Operation op, const char *const op_key_s, json_t *const op_data_p, const SchemaVersion *const sv_p)
 Generate the request to run an Operation. More...
 
json_t * MakeRemoteJsonCall (json_t *req_p, Connection *connection_p)
 Send a JSON-based request to the server and get the JSON-based response. More...
 
void WipeJSON (json_t *json_p)
 Delete a json object and all of its references to its children. More...
 
const char * GetUserUUIDStringFromJSON (const json_t *credentials_p)
 Get the User uuid from a JSON fragment. More...
 
json_t * GetServicesResultsRequest (const uuid_t **ids_pp, const uint32 num_ids, Connection *connection_p, const SchemaVersion *const sv_p)
 Generate the JSON fragment to send to the Server for getting the results of one or more Operations. More...
 
bool GetStatusFromJSON (const json_t *service_json_p, OperationStatus *status_p)
 Get the current OperationStatus for a Service from its JSON fragment. More...
 
json_t * GetInitialisedMessage (const SchemaVersion *const sv_p)
 Create a response object with a valid header. More...
 
const char * GetServiceDescriptionFromJSON (const json_t *const root_p)
 Get the description of a Service. More...
 
const char * GetServiceAliasFromJSON (const json_t *const root_p)
 Get the alias of a Service. More...
 
const char * GetServiceNameFromJSON (const json_t *const root_p)
 Get the name of a Service. More...
 
const char * GetOperationDescriptionFromJSON (const json_t *const root_p)
 Get the description of an Operation. More...
 
const char * GetOperationNameFromJSON (const json_t *const root_p)
 Get the name of an Operation. More...
 
const char * GetOperationInformationURIFromJSON (const json_t *const root_p)
 Get the URI of an Operation. More...
 
const char * GetOperationIconURIFromJSON (const json_t *const root_p)
 Get the URI for an associated image icon an Operation. More...
 
const json_t * GetProviderFromServiceJSON (const json_t *service_json_p)
 Get the JSON fragment specifying the Provider details from a JSON fragment representing a Service. More...
 
Operation GetOperationFromTopLevelJSON (const json_t *const json_p)
 Get requested Operation from a JSON fragment. More...
 

Function Documentation

◆ GetServiceDescriptionFromJSON()

const char* GetServiceDescriptionFromJSON ( const json_t *const  root_p)

Get the description of a Service.

Parameters
root_pThe json_t representation of a Service.
Returns
The description or NULL if it could not be found.

◆ GetServiceAliasFromJSON()

const char* GetServiceAliasFromJSON ( const json_t *const  root_p)

Get the alias of a Service.

Parameters
root_pThe json_t representation of a Service.
Returns
The description or NULL if it could not be found.

◆ GetServiceNameFromJSON()

const char* GetServiceNameFromJSON ( const json_t *const  root_p)

Get the name of a Service.

Parameters
root_pThe json_t representation of a Service.
Returns
The name or NULL if it could not be found.

◆ GetOperationDescriptionFromJSON()

const char* GetOperationDescriptionFromJSON ( const json_t *const  root_p)

Get the description of an Operation.

Parameters
root_pThe json_t representation of a Service.
Returns
The description or NULL if it could not be found.

◆ GetOperationNameFromJSON()

const char* GetOperationNameFromJSON ( const json_t *const  root_p)

Get the name of an Operation.

Parameters
root_pThe json_t representation of a Service.
Returns
The name or NULL if it could not be found.

◆ GetOperationInformationURIFromJSON()

const char* GetOperationInformationURIFromJSON ( const json_t *const  root_p)

Get the URI of an Operation.

Parameters
root_pThe json_t representation of a Service.
Returns
The URI or NULL if it could not be found.

◆ GetOperationIconURIFromJSON()

const char* GetOperationIconURIFromJSON ( const json_t *const  root_p)

Get the URI for an associated image icon an Operation.

Parameters
root_pThe json_t representation of a Service.
Returns
The URI or NULL if it could not be found.

◆ GetProviderFromServiceJSON()

const json_t* GetProviderFromServiceJSON ( const json_t *  service_json_p)

Get the JSON fragment specifying the Provider details from a JSON fragment representing a Service.

Parameters
service_json_pThe JSON fragment representing a Service.
Returns
The JSON fragment representing a Provider or NULL if it could not be found.

◆ GetOperationFromTopLevelJSON()

Operation GetOperationFromTopLevelJSON ( const json_t *const  json_p)

Get requested Operation from a JSON fragment.

The fragment is of the form

{ ... "operation": { "operation": <operation string> } }

Parameters
json_pThe JSON fragment to get the Operation from
Returns
The requested Operation or Operation :: OP_NONE if it could not be found.