C Messaging API Reference for Oracle Internet of Things Cloud Service Client Software Library. Release 21.1.1.0.0-3. E70344-26
iotcs_messaging.h
Go to the documentation of this file.
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 
00014 #ifndef IOTCS_MESSAGE_DISPATCHER_H_
00015 #define IOTCS_MESSAGE_DISPATCHER_H_
00016 
00017 #include "iotcs_message.h"
00018 
00019 #ifdef  __cplusplus
00020 extern "C" {
00021 #endif
00022 
00023     /*
00024      * IOT CS Message Dispatcher part
00025      */
00026 #if defined IOTCS_MESSAGE_DISPATCHER || defined IOTCS_DOXYGEN
00027 
00036     typedef void(*iotcs_message_dispatcher_delivery_callback)(iotcs_message *message);
00037 
00048     typedef void(*iotcs_message_dispatcher_error_callback)(iotcs_message *message, iotcs_result result,
00049             const char *fail_reason);
00050 
00055     void iotcs_message_dispatcher_set_delivery_callback(iotcs_message_dispatcher_delivery_callback delivery_cb);
00056 
00061     void iotcs_message_dispatcher_set_error_callback(iotcs_message_dispatcher_error_callback error_cb);
00062 
00073     iotcs_result iotcs_message_dispatcher_queue(iotcs_message* message);
00074 
00075 #if defined IOTCS_IMPLICIT_EDGE_COMPUTING || defined IOTCS_DOXYGEN
00076 
00083     iotcs_result iotcs_offer(iotcs_message *message);
00084 #endif
00085 #endif
00086 
00087 #if !defined IOTCS_MESSAGE_DISPATCHER || defined IOTCS_DOXYGEN
00088 
00098     iotcs_result iotcs_send(iotcs_message messages[], size_t len);
00099 
00109     iotcs_request_message* iotcs_receive(int32_t timeout);
00110 
00115     void iotcs_request_message_free(iotcs_request_message* message);
00116 
00117 #endif /* #else #ifdef IOTCS_MESSAGE_DISPATCHER */
00118 
00119     /*
00120      * IOT CS Request Dispatcher part
00121      */
00122 
00131     typedef void (*iotcs_resource_handler)(iotcs_request_message *request, void *arg, iotcs_message *response);
00132 
00133 #if !defined IOTCS_MESSAGE_DISPATCHER || defined IOTCS_DOXYGEN
00134 
00140     iotcs_result iotcs_request_dispatcher_init(void);
00141 
00145     void iotcs_request_dispatcher_finalize(void);
00146 
00173     void iotcs_request_dispatcher_dispatch(iotcs_request_message* request_message, iotcs_message* response_message);
00174 
00175 #endif /* #ifndef IOTCS_MESSAGE_DISPATCHER */
00176 
00192     iotcs_result iotcs_register_request_handler(const char* endpoint_id, const char* path, iotcs_resource_handler handler, void* arg);
00193 
00202     iotcs_result iotcs_unregister_request_handler_all(iotcs_resource_handler handler);
00203 
00214     iotcs_result iotcs_unregister_request_handler(const char* endpoint_id, const char* path);
00215 
00230     iotcs_resource_handler iotcs_get_request_handler(const char* endpoint_id, const char* path);
00231 
00232 #if defined IOTCS_STORAGE_SUPPORT || !defined IOTCS_DOXYGEN
00233     struct iotcs_uri_object_t;
00238     typedef struct iotcs_uri_object_t iotcs_storage_object;
00239 #if !defined IOTCS_DOXYGEN
00240 
00244     typedef struct iotcs_uri_object_t iotcs_external_object;
00245 #endif
00246 #endif
00247 
00248 #ifdef  __cplusplus
00249 }
00250 #endif
00251 
00252 #endif  /* IOTCS_MESSAGE_DISPATCHER_H_ */