Grassroots Infrastructure
The Grassroots Infrastructure is a suite of computing tools to help users and developers use scientific data infrastructure that can easily be interconnected.
Connection Struct Reference

The base class for building a Server-Client connection. More...

#include <connection.h>

Inheritance diagram for Connection:
[legend]

Public Member Functions

ConnectionAllocateWebServerConnection (const char *const full_uri_s, CurlMode curl_mode)
 Allocate a WebConnection to a Server. More...
 
ConnectionAllocaterRawClientConnection (int server_socket_fd)
 Allocate a RawConnection to a Client. More...
 
const char * GetConnectionData (Connection *connection_p)
 Get the data stored in a Connection's buffer. More...
 
void FreeConnection (Connection *connection_p)
 Free a Connection. More...
 
const char * MakeRemoteJsonCallViaConnection (Connection *connection_p, const json_t *req_p)
 Send JSON-based data over a Connection. More...
 
bool SetConnectionCredentials (Connection *connection_p, const char *username_s, const char *password_s)
 
json_t * CallServices (json_t *client_results_p, const User *user_p, Connection *connection_p)
 Make a call from a Client to a Server. More...
 
struct ConnectionAllocateRawServerConnection (const char *const hostname_s, const char *const port_s)
 Allocate a RawConnection to a Server. More...
 

Data Fields

uint32 co_id
 The internal id for this Connection. More...
 
ConnectionType co_type
 The ConnectionType for this Connection. More...
 

Detailed Description

The base class for building a Server-Client connection.

Member Function Documentation

◆ AllocateWebServerConnection()

Connection * AllocateWebServerConnection ( const char *const  full_uri_s,
CurlMode  curl_mode 
)

Allocate a WebConnection to a Server.

Parameters
full_uri_sThe URI to connect to.
Returns
A Connection to the given Server or NULL upon error.

◆ AllocaterRawClientConnection()

Connection * AllocaterRawClientConnection ( int  server_socket_fd)

Allocate a RawConnection to a Client.

Parameters
server_socket_fdThe Client's socket_fd on the Server.
Returns
A Connection to the given Client or NULL upon error.

◆ GetConnectionData()

const char * GetConnectionData ( Connection connection_p)

Get the data stored in a Connection's buffer.

Parameters
connection_pThe Connection to get the data from.
Returns
The data stored in a Connection's buffer.

◆ FreeConnection()

void FreeConnection ( Connection connection_p)

Free a Connection.

Parameters
connection_pThe Connection to free.

◆ MakeRemoteJsonCallViaConnection()

const char * MakeRemoteJsonCallViaConnection ( Connection connection_p,
const json_t *  req_p 
)

Send JSON-based data over a Connection.

Parameters
connection_pThe Connection to use.
req_pThe data to send.
Returns
The response or NULL upon error.

◆ SetConnectionCredentials()

bool SetConnectionCredentials ( Connection connection_p,
const char *  username_s,
const char *  password_s 
)

◆ CallServices()

json_t * CallServices ( json_t *  client_results_p,
const User user_p,
Connection connection_p 
)

Make a call from a Client to a Server.

Parameters
client_results_pThe request data to send from the Client to the Server.
user_pAn optional set of User to send for authentication if needed.
connection_pThe connection to the Server.
Returns
The response of the Server to the Client or NULL upon error.

◆ AllocateRawServerConnection()

struct Connection * AllocateRawServerConnection ( const char *const  hostname_s,
const char *const  port_s 
)

Allocate a RawConnection to a Server.

Parameters
hostname_sThe hostname of the Server to connect to.
port_sThe Server's port to connect to.
Returns
A Connection to the given Server or NULL upon error.

Field Documentation

◆ co_id

uint32 co_id

The internal id for this Connection.

◆ co_type

ConnectionType co_type

The ConnectionType for this Connection.


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