mcl_core_common.h
Go to the documentation of this file.
1 
11 #ifndef MCL_CORE_COMMON_H_
12 #define MCL_CORE_COMMON_H_
13 
15 
16 #include <stddef.h>
17 #include <stdint.h>
18 #include <time.h>
19 
20 #ifdef __cplusplus
21 extern "C"
22 {
23 #endif
24 
25 typedef size_t mcl_size_t;
26 typedef int8_t mcl_int8_t;
27 typedef int16_t mcl_int16_t;
28 typedef int32_t mcl_int32_t;
29 typedef int64_t mcl_int64_t;
30 typedef uint8_t mcl_uint8_t;
31 typedef uint16_t mcl_uint16_t;
32 typedef uint32_t mcl_uint32_t;
33 typedef uint64_t mcl_uint64_t;
34 typedef mcl_uint8_t mcl_bool_t;
35 typedef time_t mcl_time_t;
36 typedef mcl_int32_t mcl_error_t;
37 
41 #define MCL_FUNCTION_LEAVE_LABEL mcl_function_leave_label
42 
46 #define MCL_FALSE ((mcl_bool_t) 0)
47 
51 #define MCL_TRUE ((mcl_bool_t) 1)
52 
53 // Maximum value mcl_size_t can have.
54 // The expression below is portable and safe.
55 #define MCL_SIZE_MAX ((mcl_size_t) - 1)
56 
57 // MCL_NULL Definition. Refer to C-FAQ Q5.2 - Q5.17 (http://c-faq.com/null/safermacs.html).
58 #define MCL_NULL ((void *) 0)
59 
60 #define MCL_NULL_CHAR '\0'
61 #define MCL_NULL_CHAR_SIZE 1
62 
66 #define MCL_MAXIMUM_HTTP_PAYLOAD_SIZE (10485760)
67 
71 typedef enum E_MCL_PROXY
72 {
81 } E_MCL_PROXY;
82 
87 {
92 
97 {
98  // General return codes.
99  MCL_OK = 0,
110 
111  // HTTPS return codes.
133 
134  // Status return codes.
140 
141  // Operational return codes.
149 
150  // Internal return codes.
155 
156 // Deprecated error code. Kept for backward compatibility.
157 #define MCL_NON_EXISTING_JSON_CHILD MCL_JSON_NON_EXISTING_CHILD
158 
160 
161 // This function converts the given return code to its string value for core module.
162 #define MCL_CORE_CODE_TO_STRING(code) (code < MCL_CORE_RETURN_CODE_END ? mcl_core_return_code_strings[code] : NULL)
163 
178 typedef mcl_error_t (*mcl_credentials_load_shared_secret_callback_t)(char **client_id, char **client_secret, char **registration_access_token, char **registration_uri);
179 
194 typedef mcl_error_t (*mcl_credentials_save_shared_secret_callback_t)(const char *client_id, const char *client_secret, const char *registration_access_token,
195  const char *registration_uri);
196 
211 typedef mcl_error_t (*mcl_credentials_load_rsa_callback_t)(char **client_id, char **public_key, char **private_key, char **registration_access_token, char **registration_uri);
212 
227 typedef mcl_error_t (*mcl_credentials_save_rsa_callback_t)(const char *client_id, const char *public_key, const char *private_key, const char *registration_access_token,
228  const char *registration_uri);
229 
234 {
238 
243 {
247 
259 
266 
267 #ifdef __cplusplus
268 }
269 #endif
270 
271 #endif //MCL_CORE_COMMON_H_
End of proxy codes.
mcl_error_t(* mcl_critical_section_enter_callback_t)(void)
mcl_credentials_save_rsa_callback_t rsa
Callback type to save RSA key.
MCL failed to connect to the host or proxy.
E_MCL_PROXY
Unknown proxy.
uint16_t mcl_uint16_t
size_t mcl_size_t
int32_t mcl_int32_t
Credentials of the mcl_core are already up to date.
Credentials are not loaded.
If SHA256 calculation fails.
Agent is already onboarded to the server, hence the library did not try to onboard again...
Given log level is invalid.
The system does not support file handling.
Success.
uint64_t mcl_uint64_t
Received parameter is null.
There is no element in the list.
If the response of server is HTTP 409.
Credentials are not saved.
A problem occured during SSL/TLS handshake.
mcl_int32_t mcl_error_t
If the response of server is unexpected.
If the response of server is HTTP 412.
If the response of server is HTTP 429.
SOCKS5 proxy.
uint32_t mcl_uint32_t
End of security profile codes.
Requested operation is not supported.
If given content for Base64 encoding is bad.
If the response of server is HTTP 206.
mcl_credentials_load_rsa_callback_t rsa
Callback type to load RSA key.
If the response of server is HTTP 401.
Configuration setup module interface header file.
mcl_error_t(* mcl_credentials_save_shared_secret_callback_t)(const char *client_id, const char *client_secret, const char *registration_access_token, const char *registration_uri)
No access token exists in mcl_core_t handle.
Mindsphere certificate was not verified.
Neither initial access token nor loading/saving credentials callback functions are provided...
Host name given as a configuration parameter could not be resolved.
mcl_error_t(* mcl_credentials_load_shared_secret_callback_t)(char **client_id, char **client_secret, char **registration_access_token, char **registration_uri)
End of return codes.
void(* mcl_critical_section_leave_callback_t)(void)
If the response of server is HTTP 413.
If the response of server is HTTP 201.
SOCKS4 proxy.
int16_t mcl_int16_t
If the response of server is HTTP 400.
Agent is not onboarded to the server yet and does not possess an authentication key.
The streaming is active and shouldn&#39;t be interrupted.
uint8_t mcl_uint8_t
MCL_CORE_EXPORT const char * mcl_core_return_code_strings[MCL_CORE_RETURN_CODE_END]
Definition: core_common.c:11
SOCKS5 hostname proxy.
#define MCL_CORE_EXPORT
Internal server error.
A problem occured when sending data to the network.
SOCKS4a proxy.
time_t mcl_time_t
The server did not respond within a timeout period.
Server time is not received from the server.
The server certificate provided is in improper format and it can not be parsed.
If the response of server is HTTP 403.
mcl_credentials_save_shared_secret_callback_t shared_secret
Callback type to save shared secret.
Http 1.0 proxy.
int64_t mcl_int64_t
A problem occured when receiving data from the network.
Http proxy.
mcl_uint8_t mcl_bool_t
No more space is left to add an additional object.
int8_t mcl_int8_t
mcl_error_t(* mcl_credentials_save_rsa_callback_t)(const char *client_id, const char *public_key, const char *private_key, const char *registration_access_token, const char *registration_uri)
Memory allocation fail.
The same name can not be added in the same level of json object.
General invalid parameter fail.
mcl_credentials_load_shared_secret_callback_t shared_secret
Callback type to load shared secret.
Internal failure in MCL.
Proxy host name given as a configuration parameter could not be resolved.
Type of the value of the json object does not match the type requested.
Json child which we try to get doesn&#39;t exist in the parent Json object.
E_MCL_CORE_RETURN_CODE
If the response of server is HTTP 404.
If agent cannot enter critical section.
mcl_error_t(* mcl_credentials_load_rsa_callback_t)(char **client_id, char **public_key, char **private_key, char **registration_access_token, char **registration_uri)
E_MCL_SECURITY_PROFILE