Nigel Rantor / azure_c_shared_utility

Fork of azure_c_shared_utility by Azure IoT

Committer:
AzureIoTClient
Date:
Fri Jul 29 16:01:07 2016 -0700
Revision:
7:1af47e3a19b6
Parent:
6:c55b013dfc2a
Child:
13:920e00014ee3
1.0.10

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Azure.IoT Build 0:fa2de1b79154 1 // Copyright (c) Microsoft. All rights reserved.
Azure.IoT Build 0:fa2de1b79154 2 // Licensed under the MIT license. See LICENSE file in the project root for full license information.
Azure.IoT Build 0:fa2de1b79154 3
Azure.IoT Build 0:fa2de1b79154 4 #ifndef XIO_H
Azure.IoT Build 0:fa2de1b79154 5 #define XIO_H
Azure.IoT Build 0:fa2de1b79154 6
AzureIoTClient 7:1af47e3a19b6 7 #include "azure_c_shared_utility/optionhandler.h"
AzureIoTClient 7:1af47e3a19b6 8
Azure.IoT Build 0:fa2de1b79154 9 #include "azure_c_shared_utility/xlogging.h"
AzureIoTClient 2:20b88da3e604 10 #include "azure_c_shared_utility/umock_c_prod.h"
Azure.IoT Build 0:fa2de1b79154 11
Azure.IoT Build 0:fa2de1b79154 12 #ifdef __cplusplus
Azure.IoT Build 0:fa2de1b79154 13 #include <cstddef>
Azure.IoT Build 0:fa2de1b79154 14 extern "C" {
Azure.IoT Build 0:fa2de1b79154 15 #else
Azure.IoT Build 0:fa2de1b79154 16 #include <stddef.h>
Azure.IoT Build 0:fa2de1b79154 17 #endif /* __cplusplus */
Azure.IoT Build 0:fa2de1b79154 18
Azure.IoT Build 0:fa2de1b79154 19 typedef struct XIO_INSTANCE_TAG* XIO_HANDLE;
Azure.IoT Build 0:fa2de1b79154 20 typedef void* CONCRETE_IO_HANDLE;
Azure.IoT Build 0:fa2de1b79154 21
Azure.IoT Build 0:fa2de1b79154 22 typedef enum IO_SEND_RESULT_TAG
Azure.IoT Build 0:fa2de1b79154 23 {
Azure.IoT Build 0:fa2de1b79154 24 IO_SEND_OK,
Azure.IoT Build 0:fa2de1b79154 25 IO_SEND_ERROR,
Azure.IoT Build 0:fa2de1b79154 26 IO_SEND_CANCELLED
Azure.IoT Build 0:fa2de1b79154 27 } IO_SEND_RESULT;
Azure.IoT Build 0:fa2de1b79154 28
Azure.IoT Build 0:fa2de1b79154 29 typedef enum IO_OPEN_RESULT_TAG
Azure.IoT Build 0:fa2de1b79154 30 {
Azure.IoT Build 0:fa2de1b79154 31 IO_OPEN_OK,
Azure.IoT Build 0:fa2de1b79154 32 IO_OPEN_ERROR,
Azure.IoT Build 0:fa2de1b79154 33 IO_OPEN_CANCELLED
Azure.IoT Build 0:fa2de1b79154 34 } IO_OPEN_RESULT;
Azure.IoT Build 0:fa2de1b79154 35
Azure.IoT Build 0:fa2de1b79154 36 typedef void(*ON_BYTES_RECEIVED)(void* context, const unsigned char* buffer, size_t size);
Azure.IoT Build 0:fa2de1b79154 37 typedef void(*ON_SEND_COMPLETE)(void* context, IO_SEND_RESULT send_result);
Azure.IoT Build 0:fa2de1b79154 38 typedef void(*ON_IO_OPEN_COMPLETE)(void* context, IO_OPEN_RESULT open_result);
Azure.IoT Build 0:fa2de1b79154 39 typedef void(*ON_IO_CLOSE_COMPLETE)(void* context);
Azure.IoT Build 0:fa2de1b79154 40 typedef void(*ON_IO_ERROR)(void* context);
Azure.IoT Build 0:fa2de1b79154 41
AzureIoTClient 7:1af47e3a19b6 42 typedef OPTIONHANDLER_HANDLE (*IO_RETRIEVEOPTIONS)(CONCRETE_IO_HANDLE concrete_io);
Azure.IoT Build 6:c55b013dfc2a 43 typedef CONCRETE_IO_HANDLE(*IO_CREATE)(void* io_create_parameters);
Azure.IoT Build 0:fa2de1b79154 44 typedef void(*IO_DESTROY)(CONCRETE_IO_HANDLE concrete_io);
Azure.IoT Build 0:fa2de1b79154 45 typedef int(*IO_OPEN)(CONCRETE_IO_HANDLE concrete_io, ON_IO_OPEN_COMPLETE on_io_open_complete, void* on_io_open_complete_context, ON_BYTES_RECEIVED on_bytes_received, void* on_bytes_received_context, ON_IO_ERROR on_io_error, void* on_io_error_context);
Azure.IoT Build 0:fa2de1b79154 46 typedef int(*IO_CLOSE)(CONCRETE_IO_HANDLE concrete_io, ON_IO_CLOSE_COMPLETE on_io_close_complete, void* callback_context);
Azure.IoT Build 0:fa2de1b79154 47 typedef int(*IO_SEND)(CONCRETE_IO_HANDLE concrete_io, const void* buffer, size_t size, ON_SEND_COMPLETE on_send_complete, void* callback_context);
Azure.IoT Build 0:fa2de1b79154 48 typedef void(*IO_DOWORK)(CONCRETE_IO_HANDLE concrete_io);
Azure.IoT Build 0:fa2de1b79154 49 typedef int(*IO_SETOPTION)(CONCRETE_IO_HANDLE concrete_io, const char* optionName, const void* value);
Azure.IoT Build 0:fa2de1b79154 50
AzureIoTClient 7:1af47e3a19b6 51
Azure.IoT Build 0:fa2de1b79154 52 typedef struct IO_INTERFACE_DESCRIPTION_TAG
Azure.IoT Build 0:fa2de1b79154 53 {
AzureIoTClient 7:1af47e3a19b6 54 IO_RETRIEVEOPTIONS concrete_io_retrieveoptions;
Azure.IoT Build 0:fa2de1b79154 55 IO_CREATE concrete_io_create;
Azure.IoT Build 0:fa2de1b79154 56 IO_DESTROY concrete_io_destroy;
Azure.IoT Build 0:fa2de1b79154 57 IO_OPEN concrete_io_open;
Azure.IoT Build 0:fa2de1b79154 58 IO_CLOSE concrete_io_close;
Azure.IoT Build 0:fa2de1b79154 59 IO_SEND concrete_io_send;
Azure.IoT Build 0:fa2de1b79154 60 IO_DOWORK concrete_io_dowork;
Azure.IoT Build 0:fa2de1b79154 61 IO_SETOPTION concrete_io_setoption;
Azure.IoT Build 0:fa2de1b79154 62 } IO_INTERFACE_DESCRIPTION;
Azure.IoT Build 0:fa2de1b79154 63
Azure.IoT Build 6:c55b013dfc2a 64 MOCKABLE_FUNCTION(, XIO_HANDLE, xio_create, const IO_INTERFACE_DESCRIPTION*, io_interface_description, const void*, io_create_parameters);
AzureIoTClient 2:20b88da3e604 65 MOCKABLE_FUNCTION(, void, xio_destroy, XIO_HANDLE, xio);
AzureIoTClient 2:20b88da3e604 66 MOCKABLE_FUNCTION(, int, xio_open, XIO_HANDLE, xio, ON_IO_OPEN_COMPLETE, on_io_open_complete, void*, on_io_open_complete_context, ON_BYTES_RECEIVED, on_bytes_received, void*, on_bytes_received_context, ON_IO_ERROR, on_io_error, void*, on_io_error_context);
AzureIoTClient 2:20b88da3e604 67 MOCKABLE_FUNCTION(, int, xio_close, XIO_HANDLE, xio, ON_IO_CLOSE_COMPLETE, on_io_close_complete, void*, callback_context);
AzureIoTClient 2:20b88da3e604 68 MOCKABLE_FUNCTION(, int, xio_send, XIO_HANDLE, xio, const void*, buffer, size_t, size, ON_SEND_COMPLETE, on_send_complete, void*, callback_context);
AzureIoTClient 2:20b88da3e604 69 MOCKABLE_FUNCTION(, void, xio_dowork, XIO_HANDLE, xio);
AzureIoTClient 2:20b88da3e604 70 MOCKABLE_FUNCTION(, int, xio_setoption, XIO_HANDLE, xio, const char*, optionName, const void*, value);
AzureIoTClient 7:1af47e3a19b6 71 MOCKABLE_FUNCTION(, OPTIONHANDLER_HANDLE, xio_retrieveoptions, XIO_HANDLE, xio);
Azure.IoT Build 0:fa2de1b79154 72
Azure.IoT Build 0:fa2de1b79154 73 #ifdef __cplusplus
Azure.IoT Build 0:fa2de1b79154 74 }
Azure.IoT Build 0:fa2de1b79154 75 #endif /* __cplusplus */
Azure.IoT Build 0:fa2de1b79154 76
Azure.IoT Build 0:fa2de1b79154 77 #endif /* XIO_H */