C Messaging API Reference for Oracle Internet of Things Cloud Service Client Software Library. Release 21.1.1.0.0-3. E70344-26
|
00001 /* 00002 * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. 00003 * 00004 * This software is dual-licensed to you under the MIT License (MIT) and 00005 * the Universal Permissive License (UPL). See the LICENSE file in the root 00006 * directory for license terms. You may choose either license, or both. 00007 */ 00008 00009 00014 #ifndef IOTCS_MESSAGE_H_ 00015 #define IOTCS_MESSAGE_H_ 00016 00017 #include "iotcs.h" 00018 00023 typedef enum { 00024 IOTCS_MESSAGE_DATA = 0, 00025 IOTCS_MESSAGE_ALERT = 1, 00026 IOTCS_MESSAGE_REQUEST = 2, 00027 IOTCS_MESSAGE_RESPONSE = 3, 00028 IOTCS_MESSAGE_RESOURCE = 4, 00029 } iotcs_message_type; 00030 00035 typedef enum { 00036 IOTCS_MESSAGE_PRIORITY_LOWEST = 0, 00037 IOTCS_MESSAGE_PRIORITY_LOW = 1, 00038 IOTCS_MESSAGE_PRIORITY_MEDIUM = 2, 00039 IOTCS_MESSAGE_PRIORITY_HIGH = 3, 00040 IOTCS_MESSAGE_PRIORITY_HIGHEST = 4, 00041 IOTCS_MESSAGE_PRIORITY_DEFAULT = IOTCS_MESSAGE_PRIORITY_LOW 00042 } iotcs_message_priority; 00043 00048 typedef enum { 00049 IOTCS_MESSAGE_RELIABILITY_NO_GUARANTEE = 0, 00050 IOTCS_MESSAGE_RELIABILITY_BEST_EFFORT = 1, 00051 IOTCS_MESSAGE_RELIABILITY_GUARANTED_DELIVERY = 2, 00052 IOTCS_MESSAGE_RELIABILITY_DEFAULT = IOTCS_MESSAGE_RELIABILITY_BEST_EFFORT 00053 } iotcs_message_reliability; 00054 00059 typedef enum { 00060 IOTCS_MESSAGE_SEVERITY_CRITICAL = 0, 00061 IOTCS_MESSAGE_SEVERITY_SIGNIFICANT = 1, 00062 IOTCS_MESSAGE_SEVERITY_NORMAL = 2, 00063 IOTCS_MESSAGE_SEVERITY_LOW = 3, 00064 IOTCS_MESSAGE_SEVERITY_DEFAULT = IOTCS_MESSAGE_SEVERITY_SIGNIFICANT 00065 } iotcs_message_severity; 00066 00071 typedef enum { 00072 IOTCS_RESOURCE_MESSAGE_UPDATE = 0, 00073 IOTCS_RESOURCE_MESSAGE_DELETE = 1, 00074 IOTCS_RESOURCE_MESSAGE_RECONCILIATION = 2 00075 } iotcs_resource_message_type; 00076 00081 typedef struct { 00082 iotcs_value_type type; 00083 const char* key; 00084 } iotcs_data_item_desc; 00085 00090 typedef struct { 00091 iotcs_data_item_desc *base; 00092 iotcs_value value; 00093 } iotcs_data_item; 00094 00099 typedef struct { 00100 const char* key; 00101 iotcs_value value; 00102 iotcs_value_type type; 00103 } iotcs_message_diagnostic; 00104 00109 typedef struct { 00110 const char* key; 00111 const char* const* values; 00112 } iotcs_message_property; 00113 00118 typedef struct { 00119 iotcs_message_type type; 00120 const char* source; 00121 const char* sender; 00122 const char* destination; 00123 iotcs_message_priority priority; 00124 iotcs_message_reliability reliability; 00125 } iotcs_message_base; 00126 00131 typedef struct { 00132 const char *format; 00133 } iotcs_data_message_base; 00134 00139 typedef struct { 00140 const iotcs_data_message_base *base; 00141 const iotcs_data_item_desc *items_desc; 00142 iotcs_value *items_value; 00143 } iotcs_data_message; 00144 00149 typedef struct { 00150 const char *format; 00151 const char* description; 00152 iotcs_message_severity severity_level; 00153 } iotcs_alert_message_base; 00154 00159 typedef struct { 00160 const iotcs_alert_message_base *base; 00161 const iotcs_data_item_desc *items_desc; 00162 iotcs_value *items_value; 00163 } iotcs_alert_message; 00164 00169 typedef enum { 00170 IOTCS_REQUEST_METHOD_DELETE = 1, 00171 IOTCS_REQUEST_METHOD_GET = 2, 00172 IOTCS_REQUEST_METHOD_POST = 8, 00173 IOTCS_REQUEST_METHOD_PUT = 16 00174 } iotcs_request_method; 00175 00180 typedef struct { 00181 const char* name; 00182 const char* path; 00183 const char* description; 00184 iotcs_request_method methods; 00185 } iotcs_resource_message_base; 00186 00191 typedef struct { 00192 const iotcs_resource_message_base* base; 00193 int resource_len; 00194 iotcs_resource_message_type report_type; 00195 const char* endpointName; 00196 } iotcs_resource_message; 00197 00202 typedef struct { 00203 char* id; 00204 char* source; 00205 char* destination; 00206 iotcs_key_value *headers; 00207 int headers_len; 00208 iotcs_key_value *params; 00209 int params_len; 00210 iotcs_request_method method; 00211 char* url; 00212 char* body; 00213 } iotcs_request_message; 00214 00219 typedef struct { 00220 int status_code; 00221 const char* body; 00222 iotcs_request_message* request; 00223 iotcs_key_value *headers; 00224 int headers_len; 00225 } iotcs_response_message; 00226 00231 typedef struct { 00232 const iotcs_message_base *base; 00233 const char* id; 00234 int uid; 00235 uint64_t event_time; 00236 void *user_data; 00237 void *message_mark; 00238 const iotcs_message_diagnostic *diagnostics; 00240 const iotcs_message_property *properties; 00243 #ifdef IOTCS_VIRTUALIZATION_SUPPORT 00244 void* error_callback; 00245 void* error_callback_cpp; 00246 void* handler; 00247 #endif 00248 union { 00249 iotcs_data_message data; 00250 iotcs_alert_message alert; 00251 iotcs_response_message response; 00252 iotcs_resource_message resource; 00253 } u; 00254 } iotcs_message; 00255 00256 #endif /* IOTCS_MESSAGE_H_ */