C Porting Layer API Reference for Oracle Internet of Things Cloud Service Client Software Library. Release 21.1.1.0.0-3. E80003-19
|
00001 /* 00002 * Copyright (c) 2015, 2016, 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_PORT_QUEUE_H 00015 #define IOTCS_PORT_QUEUE_H 00016 00017 #ifdef __cplusplus 00018 extern "C" { 00019 #endif 00020 00021 #include <stdint.h> 00022 #include "iotcs.h" 00023 #include "advanced/iotcs_message.h" 00024 00030 typedef void* iotcs_port_message_queue; 00031 00032 #ifndef IOTCS_PORT_MESSAGE_QUEUE_SIZE 00033 #define IOTCS_PORT_MESSAGE_QUEUE_SIZE 25 00034 #endif 00035 00036 #ifndef IOTCS_PORT_REQUEST_QUEUE_SIZE 00037 #define IOTCS_PORT_REQUEST_QUEUE_SIZE 8 00038 #endif 00039 00040 #ifdef IOTCS_STORAGE_SUPPORT 00041 00044 typedef struct iotcs_storage_request_t { 00045 struct iotcs_uri_object_t* storage; 00046 } iotcs_storage_request; 00047 #ifndef IOTCS_PORT_MEDIA_STORAGE_REQUEST_QUEUE_SIZE 00048 #define IOTCS_PORT_MEDIA_STORAGE_REQUEST_QUEUE_SIZE 8 00049 #endif 00050 #endif 00051 00064 iotcs_port_message_queue iotcs_port_message_queue_create(); 00065 00072 void iotcs_port_message_queue_destroy(iotcs_port_message_queue queue); 00073 00096 iotcs_result iotcs_port_message_queue_put(iotcs_port_message_queue queue, iotcs_message *message, int32_t timeout_ms); 00097 00120 iotcs_result iotcs_port_message_queue_get(iotcs_port_message_queue queue, iotcs_message *message /* OUT */, int32_t timeout_ms); 00121 00132 int iotcs_port_message_queue_count(iotcs_port_message_queue queue); 00133 00139 typedef void* iotcs_port_request_queue; 00140 00146 typedef void* iotcs_port_request_handler_queue; 00147 00160 iotcs_port_request_queue iotcs_port_request_queue_create(); 00161 00168 void iotcs_port_request_queue_destroy(iotcs_port_request_queue queue); 00169 00189 iotcs_result iotcs_port_request_queue_put(iotcs_port_request_queue queue, iotcs_request_message *request, int32_t timeout_ms); 00190 00213 iotcs_result iotcs_port_request_queue_get(iotcs_port_request_queue queue, iotcs_request_message **request /* OUT */, int32_t timeout_ms); 00214 00215 00223 int iotcs_port_request_queue_count(iotcs_port_request_queue queue); 00224 00225 #if defined IOTCS_STORAGE_SUPPORT || defined IOTCS_DOXYGEN 00226 00232 typedef void* iotcs_port_storage_request_queue; 00233 00246 iotcs_port_request_queue iotcs_port_storage_request_queue_create(); 00247 00254 void iotcs_port_storage_request_queue_destroy(iotcs_port_storage_request_queue queue); 00255 00275 iotcs_result iotcs_port_storage_request_queue_put(iotcs_port_storage_request_queue queue, iotcs_storage_request *request, int32_t timeout_ms); 00276 00299 iotcs_result iotcs_port_storage_request_queue_get(iotcs_port_storage_request_queue queue, iotcs_storage_request *request /* OUT */, int32_t timeout_ms); 00300 #endif 00301 00302 #if defined(IOTCS_MESSAGE_DISPATCHER) && (IOTCS_REQUEST_HANDLER_THREAD_POOL_SIZE > 1) 00303 00304 typedef void (*iotcs_request_handler) (iotcs_request_message* message, iotcs_message* response_message); 00305 00306 typedef struct iotcs_request_handler_message_t { 00307 iotcs_request_handler handler; 00308 iotcs_request_message* request_message; 00309 } iotcs_request_handler_message; 00310 00311 iotcs_port_request_handler_queue iotcs_port_request_handler_queue_create(); 00312 00313 void iotcs_port_request_handler_queue_destroy(iotcs_port_request_handler_queue queue); 00314 00315 iotcs_result iotcs_port_request_handler_queue_put(iotcs_port_request_handler_queue queue, iotcs_request_handler_message *request, int32_t timeout_ms); 00316 00317 iotcs_result iotcs_port_request_handler_queue_get(iotcs_port_request_handler_queue queue, iotcs_request_handler_message *request /* OUT */, int32_t timeout_ms); 00318 00319 int iotcs_port_request_handler_queue_count(iotcs_port_request_handler_queue queue); 00320 00321 #endif 00322 00323 #ifdef __cplusplus 00324 } 00325 #endif 00326 00327 #endif /* IOTCS_PORT_QUEUE_H */ 00328