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.
raw_connection.h
Go to the documentation of this file.
1 /*
2 ** Copyright 2014-2016 The Earlham Institute
3 **
4 ** Licensed under the Apache License, Version 2.0 (the "License");
5 ** you may not use this file except in compliance with the License.
6 ** You may obtain a copy of the License at
7 **
8 ** http://www.apache.org/licenses/LICENSE-2.0
9 **
10 ** Unless required by applicable law or agreed to in writing, software
11 ** distributed under the License is distributed on an "AS IS" BASIS,
12 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 ** See the License for the specific language governing permissions and
14 ** limitations under the License.
15 */
16 
21 /*
22  * raw_connection.h
23  *
24  * Created on: 16 Mar 2015
25  * Author: billy
26  *
27  * @brief A datatype to encapsulate Server-Client connections.
28  * @addto@group network_group
29  * @{
30  */
31 
32 #ifndef RAW_CONNECTION_H_
33 #define RAW_CONNECTION_H_
34 
35 #include "jansson.h"
36 
37 #include "network_library.h"
38 #include "typedefs.h"
39 
40 /* forward declarations */
41 struct RawConnection;
42 struct Connection;
43 
44 
45 #ifdef __cplusplus
46 extern "C"
47 {
48 #endif
49 
50 
59 GRASSROOTS_NETWORK_API struct Connection *AllocateRawServerConnection (const char * const hostname_s, const char * const port_s);
60 
61 
62 
63 
74 GRASSROOTS_NETWORK_API int AtomicReceiveViaRawConnection (struct RawConnection *connection_p);
75 
76 
77 
89 GRASSROOTS_NETWORK_API int AtomicSendStringViaRawConnection (const char *data_s, struct RawConnection *connection_p);
90 
91 
104 GRASSROOTS_NETWORK_API int AtomicSendViaRawConnection (const char *buffer_p, uint32 num_to_send, struct RawConnection *connection_p);
105 
106 
107 GRASSROOTS_NETWORK_LOCAL int SendJsonRequestViaRawConnection (struct RawConnection *connection_p, const json_t *json_p);
108 
109 
110 GRASSROOTS_NETWORK_LOCAL const char *GetRawConnectionData (struct Connection *connection_p);
111 
112 
113 GRASSROOTS_NETWORK_LOCAL bool MakeRemoteJsonCallViaRawConnection (struct Connection *connection_p, const json_t *req_p);
114 
115 GRASSROOTS_NETWORK_LOCAL void FreeRawConnection (struct RawConnection *conn_p);
116 
117 #ifdef __cplusplus
118 }
119 #endif
120 
121 
122 
123 #endif /* #ifndef RAW_CONNECTION_H_ */
124 
GRASSROOTS_NETWORK_API
#define GRASSROOTS_NETWORK_API
Definition: network_library.h:46
network_library.h
typedefs.h
Connection
The base class for building a Server-Client connection.
Definition: connection.h:65
Connection::AllocateRawServerConnection
struct Connection * AllocateRawServerConnection(const char *const hostname_s, const char *const port_s)
Allocate a RawConnection to a Server.
GRASSROOTS_NETWORK_LOCAL
#define GRASSROOTS_NETWORK_LOCAL
Definition: network_library.h:47