ThingWorx C SDK
twApiStubs.h
1 #ifndef TW_API_STUBS_H
2 #define TW_API_STUBS_H
3 #include <cfuhash.h>
4 
5 #ifdef TW_STUBS
6 #include "twApiStubsOn.h"
7 #else
8 
9 #include "twApiStubsOff.h"
10 #endif
11 #include "twProperties.h"
12 #include "twServices.h"
13 #include "twTls.h"
14 #include "twApi.h"
15 #include "twFileManager.h"
16 #include "twSubscribedProps.h"
17 
18 /*********************************************************/
19 /* Internal Functions */
20 typedef int (*cfuhash_destroyStub)(cfuhash_table_t *);
21 typedef void (*PropertyChangeListenerFunctionStub)(const char *, const char *,twPrimitive*);
22 typedef void (*deleteCallbackInfoStub)(void * info);
23 typedef bindListEntry * (*bindListEntry_CreateStub)(char * entityName);
24 typedef void (*bindListEntry_DeleteStub)(void * entry);
25 typedef enum msgCodeEnum (*notifyPropertyUpdateHandlerStub)(const char * entityName, const char * serviceName, twInfoTable * params, twInfoTable ** content, void * userdata);
26 typedef void (*subscribedPropertyUpdateTaskStub)(DATETIME now, void * params);
27 typedef char (*isFileTransferServiceStub)(char * service);
28 typedef char (*isTunnelServiceStub)(char * service);
29 typedef int (*convertMsgCodeToErrorCodeStub)(enum msgCodeEnum code);
30 typedef ListEntry * (*findRegisteredItemStub)(twList * list, enum entityTypeEnum entityType, char * entityName, enum characteristicEnum characteristicType, char * characteristicName);
31 typedef void * (*getCallbackFromListStub)(twList * list, enum entityTypeEnum entityType, char * entityName, enum characteristicEnum characteristicType, char * characteristicName, void ** userdata);
32 typedef enum msgCodeEnum (*sendMessageBlockingStub)(twMessage ** msg, int32_t timeout, twInfoTable ** result);
33 typedef enum msgCodeEnum (*makeRequestStub)(enum msgCodeEnum method, enum entityTypeEnum entityType, char * entityName, enum characteristicEnum characteristicType, char * characteristicName, twInfoTable * params, twInfoTable ** result, int32_t timeout, char forceConnect);
34 typedef enum msgCodeEnum (*makePropertyRequestStub)(enum msgCodeEnum method, enum entityTypeEnum entityType, char * entityName, char * propertyName, twPrimitive * value, twPrimitive ** result, int32_t timeout, char forceConnect);
35 typedef int (*twApi_SendResponseStub)(twMessage * msg);
36 typedef int (*api_requesthandlerStub)(struct twWs * ws, struct twMessage * msg);
37 typedef enum msgCodeEnum (*getMetadataServiceStub)(const char * entityName, const char * serviceName, twInfoTable * params, twInfoTable ** content, void * userdata);
38 typedef int (*pong_handlerStub)(struct twWs * ws, const char * data, size_t length);
39 typedef int (*makeAuthOrBindCallbacksStub)(char * entityName, enum entityTypeEnum entityType, char type, char * value);
40 typedef int (*makeSynchronizedStateCallbacksStub)(char * entityName, enum entityTypeEnum entityType, twInfoTable* subscriptionData);
41 typedef int (*registerServiceOrEventStub)(enum entityTypeEnum entityType, char * entityName, char * serviceName, char * serviceDescription, twDataShape * inputs, enum BaseType outputType, twDataShape * outputDataShape, service_cb cb, void * userdata, char isService);
42 typedef int (*AddAspectToEntityStub)(char * entityName, enum characteristicEnum type, char * characteristicName, char * aspectName, twPrimitive * aspectValue);
43 
44 /*********************************************************/
45 /* API Functions */
46 typedef int (*twApi_InitializeStub)(char * host, uint16_t port, char * resource, char * app_key, char * gatewayName, uint32_t messageChunkSize, uint16_t frameSize, char autoreconnect);
47 typedef int (*twApi_DeleteStub)(void);
48 typedef int (*twApi_SetProxyInfoStub)(char * proxyHost, uint16_t proxyPort, char * proxyUser, char * proxyPass);
49 typedef char * (*twApi_GetVersionStub)(void);
50 typedef int (*twApi_BindAllStub)(char unbind);
51 typedef int (*twApi_AuthenticateStub)();
52 typedef int (*twApi_ConnectStub)(uint32_t timeout, int32_t retries);
53 typedef int (*twApi_DisconnectStub)(char * reason);
54 typedef char (*twApi_isConnectedStub)();
55 typedef char (*twApi_ConnectionInProgressStub)();
56 typedef int (*twApi_StopConnectionAttemptStub)();
57 typedef int (*twApi_SetDutyCycleStub)(uint8_t duty_cycle, uint32_t period);
58 typedef int (*twApi_SetPingRateStub)(uint32_t rate);
59 typedef int (*twApi_SetConnectTimeoutStub)(uint32_t timeout);
60 typedef int (*twApi_SetConnectRetriesStub)(signed char retries);
61 typedef int (*twApi_SetGatewayNameStub)(const char* input_name);
62 typedef int (*twApi_SetGatewayTypeStub)(const char* input_type);
63 typedef int (*twApi_BindThingStub)(char * entityName);
64 typedef int (*twApi_BindThings_Metadata_OptionStub)(char * entityName);
65 typedef int (*twApi_UnbindThingStub)(char * entityName);
66 typedef char (*twApi_IsEntityBoundStub)(char * entityName);
67 typedef void (*twApi_TaskerFunctionStub)(DATETIME now, void * params);
68 typedef int (*twApi_RegisterPropertyStub)(enum entityTypeEnum entityType, char * entityName, char * propertyName, enum BaseType propertyType, char * propertyDescription, char * propertyPushType, double propertyPushThreshold, property_cb cb, void * userdata);
69 typedef int (*twApi_UpdatePropertyMetaDataStub)(enum entityTypeEnum entityType, char * entityName, char * propertyName, enum BaseType propertyType, char * propertyDescription, char * propertyPushType, double propertyPushThreshold);
70 typedef int (*twApi_AddAspectToPropertyStub)(char * entityName, char * propertyName, char * aspectName, twPrimitive * aspectValue);
71 typedef int (*twApi_RegisterServiceStub)(enum entityTypeEnum entityType, const char * entityName, char * serviceName, char * serviceDescription, twDataShape * inputs, enum BaseType outputType, twDataShape * outputDataShape, service_cb cb, void * userdata);
72 typedef int (*twApi_AddAspectToServiceStub)(char * entityName, char * serviceName, char * aspectName, twPrimitive * aspectValue);
73 typedef int (*twApi_RegisterEventStub)(enum entityTypeEnum entityType, char * entityName, char * eventName, char * eventDescription, twDataShape * parameters);
74 typedef int (*twApi_AddAspectToEventStub)(char * entityName, char * eventName, char * aspectName, twPrimitive * aspectValue);
75 typedef int (*twApi_RegisterPropertyCallbackStub)(enum entityTypeEnum entityType, char * entityName, char * propertyName, property_cb cb, void * userdata) ;
76 typedef int (*twApi_RegisterServiceCallbackStub)(enum entityTypeEnum entityType, char * entityName, char * serviceName, service_cb cb, void * userdata);
77 typedef int (*twApi_UnregisterThingStub)(char * entityName);
78 typedef int (*twApi_UnregisterCallbackStub)(char * entityName, enum characteristicEnum type, char * characteristicName, void * userdata);
79 typedef int (*twApi_UnregisterPropertyCallbackStub)(char * entityName, char * propertyName, void * cb);
80 typedef int (*twApi_UnregisterServiceCallbackStub)(char * entityName, char * serviceName, void * cb);
81 typedef int (*twApi_RegisterDefaultRequestHandlerStub)(genericRequest_cb cb);
82 typedef propertyList * (*twApi_CreatePropertyListStub)(char * name, twPrimitive * value, DATETIME timestamp);
83 typedef int (*twApi_DeletePropertyListStub)(propertyList * list);
84 typedef int (*twApi_AddPropertyToListStub)(propertyList * proplist, char * name, twPrimitive * value, DATETIME timestamp);
85 typedef int (*twApi_ReadPropertyStub)(enum entityTypeEnum entityType, char * entityName, char * propertyName, twPrimitive ** result, int32_t timeout, char forceConnect);
86 typedef int (*twApi_WritePropertyStub)(enum entityTypeEnum entityType, char * entityName, char * propertyName, twPrimitive * value, int32_t timeout, char forceConnect);
87 typedef int (*twApi_SetSubscribedPropertyVTQStub)(char * entityName, char * propertyName, twPrimitive * value, DATETIME timestamp, char * quality, char fold, char pushUpdate);
88 typedef int (*twApi_SetSubscribedPropertyStub)(char * entityName, char * propertyName, twPrimitive * value, char fold, char pushUpdate);
89 typedef int (*twApi_PushSubscribedPropertiesStub)(char * entityName, char forceConnect);
90 typedef int (*twApi_PushPropertiesStub)(enum entityTypeEnum entityType, char * entityName, propertyList * properties, int32_t timeout, char forceConnect);
91 typedef int (*twApi_InvokeServiceStub)(enum entityTypeEnum entityType, char * entityName, char * serviceName, twInfoTable * params, twInfoTable ** result, int32_t timeout, char forceConnect);
92 typedef int (*twApi_FireEventStub)(enum entityTypeEnum entityType, char * entityName, char * eventName, twInfoTable * params, int32_t timeout, char forceConnect);
93 typedef int (*twApi_RegisterConnectCallbackStub)(eventcb cb) ;
94 typedef int (*twApi_RegisterCloseCallbackStub)(eventcb cb);
95 typedef int (*twApi_RegisterPingCallbackStub)(eventcb cb);
96 typedef int (*twApi_RegisterPongCallbackStub)(eventcb cb);
97 typedef int (*twApi_RegisterBindEventCallbackStub)(char * entityName, bindEvent_cb cb, void * userdata);
98 typedef int (*twApi_UnregisterBindEventCallbackStub)(char * entityName, bindEvent_cb cb, void * userdata);
99 typedef int (*twApi_RegisterOnAuthenticatedCallbackStub)(authEvent_cb cb, void * userdata);
100 typedef int (*twApi_UnregisterOnAuthenticatedCallbackStub)(authEvent_cb cb, void * userdata);
101 typedef int (*twApi_CleanupOldMessagesStub)(void);
102 typedef int (*twApi_SendPingStub)(char * content);
103 typedef int (*twApi_CreateTaskStub)(uint32_t runTintervalMsec, twTaskFunction func);
104 typedef void (*twApi_SetSelfSignedOkStub)();
105 typedef void (*twApi_DisableCertValidationStub)();
106 typedef int (*twApi_LoadCACertStub)(const char *file, int type);
107 typedef int (*twApi_LoadClientCertStub)(char *file);
108 typedef int (*twApi_SetClientKeyStub)(const char *file, char * passphrase, int type);
109 typedef int (*twApi_IsFIPSCompatibleStub)();
110 typedef int (*twApi_EnableFipsModeStub)();
111 typedef int (*twApi_IsFipsModeEnabledStub)();
112 typedef void (*twApi_DisableEncryptionStub)();
113 typedef int (*twApi_SetX509FieldsStub)(char * subject_cn, char * subject_o, char * subject_ou, char * issuer_cn, char * issuer_o, char * issuer_ou);
114 typedef int (*twApi_SetOfflineMsgStoreDirStub)(const char *dir);
115 typedef twConnectionInfo * (*twApi_GetConnectionInfoStub)(void);
116 
117 /* Properties */
118 typedef twPropertyDef * (*twPropertyDef_CreateStub)(char * name, enum BaseType type, char * description, char * pushType, double pushThreshold);
119 typedef void (*twPropertyDef_DeleteStub)(void * input);
120 typedef twProperty * (*twProperty_CreateStub)(char * name, twPrimitive * value, DATETIME timestamp);
121 typedef twProperty * (*twPropertyVTQ_CreateStub)(char * name, twPrimitive * value, DATETIME timestamp, char * quality);
122 typedef twProperty * (*twProperty_CreateFromStreamStub)(twStream * s);
123 typedef void (*twProperty_DeleteStub)(void * input);
124 
125 /* Services */
126 typedef twServiceDef * (*twServiceDef_CreateStub)(char * name, char * description, twDataShape * inputs, enum BaseType outputType, twDataShape * outputDataShape);
127 typedef void (*twServiceDef_DeleteStub)(void * input);
128 
129 /* Base Types */
130 typedef twStream * (*twStream_CreateStub)();
131 typedef twStream * (*twStream_CreateFromCharArrayStub)(const char * data, uint32_t length);
132 typedef twStream * (*twStream_CreateFromCharArrayZeroCopyStub)(const char * data, uint32_t length);
133 typedef void (*twStream_DeleteStub)(void* s);
134 typedef char * (*twStream_GetDataStub)(struct twStream * s);
135 typedef int32_t (*twStream_GetIndexStub)(struct twStream * s);
136 typedef int32_t (*twStream_GetLengthStub)(struct twStream * s);
137 typedef int (*twStream_AddBytesStub)(struct twStream * s, void * b, uint32_t count);
138 typedef int (*twStream_GetBytesStub)(struct twStream * s, void * b, uint32_t count);
139 typedef int (*twStream_ResetStub)(struct twStream * s);
140 typedef twStream * (*twStream_CreateFromFileStub)(const char * fname);
141 typedef void (*swap4bytesStub)(char * bytes);
142 typedef void (*swap8bytesStub)(char * bytes);
143 typedef int (*stringToStreamStub)(char * string, twStream * s);
144 typedef char * (*streamToStringStub)(twStream * s);
145 typedef enum BaseType (*baseTypeFromStringStub)(const char * s);
146 typedef const char * (*baseTypeToStringStub)(enum BaseType b);
147 typedef twPrimitive * (*twPrimitive_CreateStub)();
148 typedef twPrimitive * (*twPrimitive_CreateFromStreamStub)( twStream * s);
149 typedef twPrimitive * (*twPrimitive_CreateFromStreamTypedStub)(twStream * s, enum BaseType type);
150 typedef twPrimitive * (*twPrimitive_ZeroCopyStub)(twPrimitive * p);
151 typedef twPrimitive * (*twPrimitive_FullCopyStub)(twPrimitive * p);
152 typedef void (*twPrimitive_DeleteStub)(void * p);
153 typedef int (*twPrimitive_ToStreamStub)(twPrimitive * p, twStream * s);
154 typedef char * (*twPrimitive_DecoupleStringAndDeleteStub)(twPrimitive * p);
155 typedef int (*twPrimitive_CompareStub)(twPrimitive * p1, twPrimitive * p2);
156 typedef char (*twPrimitive_IsTrueStub)(twPrimitive * p1) ;
157 typedef twPrimitive * (*twPrimitive_CreateFromLocationStub)(const twLocation * value);
158 typedef twPrimitive * (*twPrimitive_CreateFromNumberStub)(const double value);
159 typedef twPrimitive * (*twPrimitive_CreateFromIntegerStub)(const int32_t value);
160 typedef twPrimitive * (*twPrimitive_CreateFromDatetimeStub)(const DATETIME value);
161 typedef twPrimitive * (*twPrimitive_CreateFromCurrentTimeStub)();
162 typedef twPrimitive * (*twPrimitive_CreateFromBooleanStub)(const char value);
163 typedef twPrimitive * (*twPrimitive_CreateFromInfoTableStub)(struct twInfoTable * it);
164 typedef twPrimitive * (*twPrimitive_CreateVariantStub)(twPrimitive * input);
165 typedef twPrimitive * (*twPrimitive_CreateFromStringStub)(const char * value, char duplicate);
166 typedef twPrimitive * (*twPrimitive_CreateFromBlobStub)(const char * value, int32_t length, char isImage, char duplicate);
167 typedef twPrimitive * (*twPrimitive_CreateFromVariableStub)(const void * value, enum BaseType type, char duplicateCharArray, uint32_t blobLength);
168 typedef struct cJSON * (*twPrimitive_ToJsonStub)(char * name, twPrimitive * p, struct cJSON * parent);
169 typedef twPrimitive * (*twPrimitive_CreateFromJsonStub)(struct cJSON * j, char * name, enum BaseType type);
170 
171 /* InfoTables */
172 typedef twDataShapeAspect * (*twDataShapeAspect_CreateStub)(const char * name, twPrimitive * value);
173 typedef twDataShapeAspect * (*twDataShapeAspect_CreateFromStreamStub)(twStream * s);
174 typedef void (*twDataShapeAspect_DeleteStub)(void * aspect);
175 typedef twDataShapeEntry * (*twDataShapeEntry_CreateStub)(const char * name, const char * description, enum BaseType type);
176 typedef twDataShapeEntry * (*twDataShapeEntry_CreateFromStreamStub)(struct twStream * s);
177 typedef void (*twDataShapeEntry_DeleteStub)(void * entry);
178 typedef int (*twDataShapeEntry_AddAspectStub)(struct twDataShapeEntry * entry, const char * name, twPrimitive * value);
179 typedef uint32_t (*twDataShapeEntry_GetLengthStub)(struct twDataShapeEntry * entry);
180 typedef int (*twDataShapeEntry_ToStreamStub)(struct twDataShapeEntry * entry, twStream * s);
181 typedef twDataShape * (*twDataShape_CreateStub)(twDataShapeEntry * firstEntry);
182 typedef twDataShape * (*twDataShape_CreateFromStreamStub)(struct twStream * s);
183 typedef void (*twDataShape_DeleteStub)(void * ds);
184 typedef uint32_t (*twDataShape_GetLengthStub)(struct twDataShape * ds);
185 typedef int (*twDataShape_ToStreamStub)(struct twDataShape * ds, twStream * s);
186 typedef int (*twDataShape_SetNameStub)(struct twDataShape * ds, char * name);
187 typedef int (*twDataShape_AddEntryStub)(struct twDataShape * ds, struct twDataShapeEntry * entry);
188 typedef int (*twDataShape_GetEntryIndexStub)(struct twDataShape * ds, const char * name, int * index);
189 typedef twInfoTableRow * (*twInfoTableRow_CreateStub)(twPrimitive * firstEntry);
190 typedef twInfoTableRow * (*twInfoTableRow_CreateFromStreamStub)(twStream * s);
191 typedef void (*twInfoTableRow_DeleteStub)(void * row);
192 typedef int (*twInfoTableRow_GetCountStub)(twInfoTableRow * row);
193 typedef uint32_t (*twInfoTableRow_GetLengthStub)(twInfoTableRow * row);
194 typedef int (*twInfoTableRow_AddEntryStub)(twInfoTableRow * row, twPrimitive * entry);
195 typedef twPrimitive * (*twInfoTableRow_GetEntryStub)(twInfoTableRow * row, int index);
196 typedef int (*twInfoTableRow_ToStreamStub)(twInfoTableRow * row, twStream * s);
197 typedef twInfoTable * (*twInfoTable_CreateStub)(twDataShape * shape);
198 typedef twInfoTable * (*twInfoTable_CreateFromStreamStub)(twStream * s);
199 typedef void (*twInfoTable_DeleteStub)(void * it);
200 typedef twInfoTable * (*twInfoTable_FullCopyStub)(twInfoTable * it);
201 typedef twInfoTable * (*twInfoTable_ZeroCopyStub)(twInfoTable * it);
202 typedef int (*twInfoTable_CompareStub)(twInfoTable * p1, twInfoTable * p2);
203 typedef int (*twInfoTable_AddRowStub)(twInfoTable * it, twInfoTableRow * row);
204 typedef twInfoTableRow * (*twInfoTable_GetEntryStub)(twInfoTable * it, int index);
205 typedef int (*twInfoTable_ToStreamStub)(twInfoTable * it, twStream * s);
206 typedef twInfoTable * (*twInfoTable_CreateFromPrimitiveStub)(const char * name, twPrimitive * value);
207 typedef twInfoTable * (*twInfoTable_CreateFromStringStub)(const char * name, char * value, char duplicate);
208 typedef twInfoTable * (*twInfoTable_CreateFromNumberStub)(const char * name, double value);
209 typedef twInfoTable * (*twInfoTable_CreateFromIntegerStub)(const char * name, int32_t value);
210 typedef twInfoTable * (*twInfoTable_CreateFromLocationStub)(const char * name, twLocation * value);
211 typedef twInfoTable * (*twInfoTable_CreateFromBlobStub)(const char * name, char * value, int32_t length, char isImage, char duplicate);
212 typedef twInfoTable * (*twInfoTable_CreateFromDatetimeStub)(const char * name, DATETIME value);
213 typedef twInfoTable * (*twInfoTable_CreateFromBooleanStub)(const char * name, char value);
214 typedef int (*twInfoTable_GetStringStub)(twInfoTable * it, const char * name, int32_t row, char ** value);
215 typedef int (*twInfoTable_GetNumberStub)(twInfoTable * it, const char * name, int32_t row, double * value);
216 typedef int (*twInfoTable_GetIntegerStub)(twInfoTable * it, const char * name, int32_t row, int32_t * value);
217 typedef int (*twInfoTable_GetLocationStub)(twInfoTable * it, const char * name, int32_t row, twLocation * value);
218 typedef int (*twInfoTable_GetBlobStub)(twInfoTable * it, const char * name, int32_t row, char ** value, int32_t * length);
219 typedef int (*twInfoTable_GetDatetimeStub)(twInfoTable * it, const char * name, int32_t row, DATETIME * value);
220 typedef int (*twInfoTable_GetBooleanStub)(twInfoTable * it, const char * name, int32_t row, char * value);
221 typedef int (*twInfoTable_GetPrimitiveStub)(twInfoTable * it, const char * name, int32_t row, twPrimitive ** value);
222 typedef twInfoTable * (*twInfoTable_CreateFromJsonStub)(struct cJSON * json, char * singleEntryName);
223 typedef struct cJSON * (*twDataShape_ToJsonStub)(twDataShape * ds, struct cJSON * parent);
224 typedef struct cJSON * (*twInfoTable_ToJsonStub)(twInfoTable * it);
225 
226 /* Messages */
227 typedef twMessage * (*twMessage_CreateStub)(enum msgCodeEnum code, uint32_t reqId); /* Set Reqid to zero to autogenerate ID */
228 typedef twMessage * (*twMessage_CreateRequestMsgStub)(enum msgCodeEnum code);
229 typedef twMessage * (*twMessage_CreateResponseMsgStub)(enum msgCodeEnum code, uint32_t id, uint32_t sessionId, uint32_t endpointId);
230 typedef twMessage * (*twMessage_CreateBindMsgStub)(char * name, char isUnbind);
231 typedef twMessage * (*twMessage_CreateAuthMsgStub)(char * claimName, char * claimValue);
232 typedef twMessage * (*twMessage_CreateFromStreamStub)(twStream * s);
233 typedef void (*twMessage_DeleteStub)(void * input);
234 typedef int (*twMessage_SendStub)(struct twMessage ** msg, struct twWs * ws);
235 typedef int (*twMessage_SetBodyStub)(struct twMessage * msg, void * body);
236 typedef twRequestBody * (*twRequestBody_CreateStub)();
237 typedef twRequestBody * (*twRequestBody_CreateFromStreamStub)(twStream * s);
238 typedef int (*twRequestBody_DeleteStub)(struct twRequestBody * body);
239 typedef int (*twRequestBody_SetParamsStub)(struct twRequestBody * body, twInfoTable * params);
240 typedef int (*twRequestBody_SetEntityStub)(struct twRequestBody * body, enum entityTypeEnum entityType, char * entityName);
241 typedef int (*twRequestBody_SetCharacteristicStub)(struct twRequestBody * body, enum characteristicEnum characteristicType, char * characteristicName);
242 typedef int (*twRequestBody_AddHeaderStub)(struct twRequestBody * body, char * name, char * value);
243 typedef int (*twRequestBody_ToStreamStub)(struct twRequestBody * body, twStream * s);
244 typedef twResponseBody * (*twResponseBody_CreateStub)();
245 typedef twResponseBody * (*twResponseBody_CreateFromStreamStub)(twStream * s);
246 typedef int (*twResponseBody_DeleteStub)(struct twResponseBody * body);
247 typedef int (*twResponseBody_SetContentStub)(struct twResponseBody * body, twInfoTable * t);
248 typedef int (*twResponseBody_SetReasonStub)(struct twResponseBody * body, char * reason);
249 typedef int (*twResponseBody_ToStreamStub)(struct twResponseBody * body, twStream * s);
250 typedef twAuthBody * (*twAuthBody_CreateStub)();
251 typedef twAuthBody * (*twAuthBody_CreateFromStreamStub)(twStream * s);
252 typedef int (*twAuthBody_DeleteStub)(struct twAuthBody * body);
253 typedef int (*twAuthBody_SetClaimStub)(struct twAuthBody * body, char * name, char * value);
254 typedef int (*twAuthBody_ToStreamStub)(struct twAuthBody * body, twStream * s);
255 typedef twBindBody * (*twBindBody_CreateStub)(char * name);
256 typedef twBindBody * (*twBindBody_CreateFromStreamStub)(twStream * s);
257 typedef int (*twBindBody_DeleteStub)(struct twBindBody * body);
258 typedef int (*twBindBody_AddNameStub)(struct twBindBody * body, char * name);
259 typedef int (*twBindBody_ToStreamStub)(struct twBindBody * body, twStream * s, char * gatewayName, char * gatewayType);
260 typedef twMultipartBody * (*twMultipartBody_CreateFromStreamStub)(twStream * s, char isRequest);
261 typedef void (*twMultipartBody_DeleteStub)(void * body);
262 typedef mulitpartMessageStoreEntry * (*mulitpartMessageStoreEntry_CreateStub)(twMessage * msg);
263 typedef void (*mulitpartMessageStoreEntry_DeleteStub)(void * entry);
264 typedef twMultipartMessageStore * (*twMultipartMessageStore_InstanceStub)();
265 typedef void (*twMultipartMessageStore_DeleteStub)(void * store);
266 typedef twMessage * (*twMultipartMessageStore_AddMessageStub)(twMessage * msg);
267 typedef void (*twMultipartMessageStore_RemoveStaleMessagesStub)();
268 typedef int (*twCompressBytesStub)(char * buf, uint32_t length, twStream* s, struct twWs * ws);
269 
270 /* Messaging */
271 typedef twMessageHandler * (*twMessageHandler_InstanceStub)(twWs * ws);
272 typedef int (*twMessageHandler_DeleteStub)(twMessageHandler * handler);
273 typedef int (*twMessageHandler_CleanupOldMessagesStub)(twMessageHandler * handler);
274 typedef void (*twMessageHandler_msgHandlerTaskStub)(DATETIME now, void * params);
275 typedef int (*twMessageHandler_RegisterConnectCallbackStub)(twMessageHandler * handler, eventcb cb);
276 typedef int (*twMessageHandler_RegisterCloseCallbackStub)(twMessageHandler * handler, eventcb cb);
277 typedef int (*twMessageHandler_RegisterPingCallbackStub)(twMessageHandler * handler, eventcb cb);
278 typedef int (*twMessageHandler_RegisterPongCallbackStub)(twMessageHandler * handler, eventcb cb);
279 typedef int (*twMessageHandler_RegisterDefaultRequestCallbackStub)(twMessageHandler * handler, message_cb cb);
280 typedef int (*twMessageHandler_RegisterDumpIncomingMsgListCallbackStub)(twMessageHandler * handler, dumpLog_cb cb);
281 typedef int (*twMessageHandler_RegisterRequestCallbackStub)(twMessageHandler * handler, message_cb cb, enum entityTypeEnum entityType, char * entityName, enum characteristicEnum characteristicType, char * characteristicName);
282 typedef int (*twMessageHandler_RegisterResponseCallbackStub)(twMessageHandler * handler, response_cb cb, uint32_t requestId, DATETIME expirationTime);
283 typedef twResponseCallbackStruct * (*twMessageHandler_GetCompletedResponseStructStub)(twMessageHandler * handler, uint32_t id);
284 typedef int (*twMessageHandler_UnegisterRequestCallbackStub)(twMessageHandler * handler, enum entityTypeEnum entityType, char * entityName, enum characteristicEnum characteristicType, char * characteristicName);
285 typedef int (*twMessageHandler_UnegisterResponseCallbackStub)(twMessageHandler * handler, uint32_t requestId);
286 
287 /* Subscribed Properties */
288 typedef int (*twSubscribedPropsMgr_InitializeStub)();
289 typedef void (*twSubscribedPropsMgr_DeleteStub)();
290 typedef void (*twSubscribedPropsMgr_SetFoldingStub)(char fold);
291 typedef int (*twSubscribedPropsMgr_PushSubscribedPropertiesStub)(char * entityName, char forceConnect);
292 typedef int (*twSubscribedPropsMgr_SetPropertyVTQStub)(char * entityName, char * propertyName, twPrimitive * value, DATETIME timestamp, char * quality, char fold, char pushUpdate);
293 typedef int (*twSubscribedPropsMgr_QueueValueForSendingStub) (twSubscribedProperty * pProp, twDict * pList, char* src);
294 typedef void (*twSubscribedProperty_DeleteStub)(void * prop);
295 typedef int (*twSubscribedProperty_ToStreamStub) (twSubscribedProperty * p, struct twStream * s);
296 
297 /* Offline Message Store */
298 typedef int (*twOfflineMsgStore_InitializeStub)(char enabled, const char * filePath, uint64_t size, char onDisk);
299 typedef int (*twOfflineMsgStore_SetDirStub)(const char * dir);
300 typedef int (*twOfflineMsgStore_DeleteStub)();
301 typedef int (*twOfflineMsgStore_HandleRequestStub)(struct twMessage ** msg, struct twWs * ws, enum OfflineRequest request_type);
302 
303 /* Crypto */
304 typedef int (*EncryptDESStub)(const unsigned char * key, unsigned char * ct, const unsigned char * pt);
305 typedef int (*DecryptDESStub)(const unsigned char * key, const unsigned char * ct, unsigned char * pt);
306 typedef void (*createDESKeyStub)(const uint8_t * bytes, uint8_t * key);
307 typedef int (*MD4HashStub)(const unsigned char * buf, int length, unsigned char * hash);
308 
309 
310 /* twList */
311 typedef twList * (*twList_CreateSearchableStub)(del_func delete_function,parse_func parse_function);
312 typedef twList * (*twList_CreateStub)(del_func delete_function);
313 typedef int (*twList_DeleteStub)(struct twList *list);
314 typedef int (*twList_ClearStub)(struct twList *list);
315 typedef int (*twList_AddStub)(twList *list, void *value);
316 typedef int (*twList_RemoveStub)(struct twList *list, struct ListEntry * entry, char deleteValue);
317 typedef ListEntry * (*twList_NextStub)(struct twList *list, struct ListEntry * entry);
318 typedef ListEntry * (*twList_GetByIndexStub)(struct twList *list, int index);
319 typedef int (*twList_GetCountStub)(struct twList *list);
320 typedef int (*twList_ReplaceValueStub)(struct twList *list, struct ListEntry * entry, void * new_value, char dispose);
321 
322 /* twMap */
323 typedef int (*twMap_AddStub)(twMap* in, void *value);
324 typedef int (*twMap_RemoveStub)(twMap* in, void *value, char deleteValue);
325 
326 /* twDict */
327 typedef int (*twDict_AddStub)(twDict* in, void *value);
328 
329 /* String Utils */
330 typedef char * (*lowercaseStub)(char *input);
331 typedef char * (*uppercaseStub)(char *input);
332 typedef char * (*duplicateStringStub)(const char * input);
333 
334 /* twProxy */
335 typedef int (*connectToProxyStub)(twSocket * s, char * authCredentials);
336 typedef int (*twSocket_WriteStub)(twSocket * s, char * buf, int len, int timeout);
337 typedef int (*twSocket_WaitForStub)(twSocket * s, int timeout);
338 typedef int (*twSocket_ReadStub)(twSocket * s, char * buf, int len, int timeout);
339 
340 /* Logger */
341 typedef twLogger * (*twLogger_InstanceStub)();
342 typedef int (*twLogger_DeleteStub)();
343 typedef int (*twLogger_SetLevelStub)(enum LogLevel level);
344 typedef int (*twLogger_SetFunctionStub)(log_function f);
345 typedef int (*twLogger_SetIsVerboseStub)(char val);
346 typedef void (*twLogStub)(enum LogLevel level, const char * format, ... );
347 typedef void (*twLogHexStringStub)(const char * msg, char * preamble, int32_t length);
348 typedef void (*twLogMessageStub)(void * m, char * preamble);
349 typedef char * (*twCodeToStringStub)(enum msgCodeEnum m);
350 typedef char * (*twEntityToStringStub)(enum entityTypeEnum m);
351 typedef char * (*twCharacteristicToStringStub)(enum characteristicEnum m);
352 
353 /* NTLM */
354 typedef int (*NTLM_connectToProxyStub)(twSocket * sock, const char * req, const char * resp, char * user, char * password);
355 
356 /* twNTLM */
357 typedef int (*NTLM_parseType2MsgStub)(twSocket * sock, const char * req, char * resp, char * domain, char * username, char * password);
358 typedef int (*GenerateType3MsgStub)(const char * domain, const char * username, const char * password, const void *challenge, uint32_t challengeLength, char **outputBuf, uint32_t *outputLength);
359 typedef int (*GenerateType1MsgStub)(char **buffer, uint32_t *length);
360 typedef int (*NTLM_sendType1MsgStub)(twSocket * sock, const char * req, char * domain, char * user, char * password);
361 
362 /* Tasker */
363 typedef void (*twTasker_InitializeStub)();
364 typedef int (*twTasker_CreateTaskStub)(uint32_t runTimeIntervalMsec, twTaskFunction func);
365 typedef int (*twTasker_RemoveTaskStub)(int id);
366 
367 /* Websocket */
368 typedef int (*twWs_CreateStub)(char * host, uint16_t port, char * resource, char * api_key, char * gatewayName,uint32_t messageChunkSize, uint16_t frameSize, twWs ** entity);
369 typedef int (*twWs_DeleteStub)(twWs * ws);
370 typedef int (*twWs_ConnectStub)(twWs * ws, uint32_t timeout);
371 typedef int (*twWs_DisconnectStub)(twWs * ws, enum close_status code, char * reason);
372 typedef char (*twWs_IsConnectedStub)(twWs * ws);
373 typedef int (*twWs_RegisterConnectCallbackStub)(twWs * ws, ws_cb cb);
374 typedef int (*twWs_RegisterCloseCallbackStub)(twWs * ws, ws_data_cb cb);
375 typedef int (*twWs_RegisterBinaryMessageCallbackStub)(twWs * ws, ws_data_cb cb);
376 typedef int (*twWs_RegisterTextMessageCallbackStub)(twWs * ws, ws_data_cb cb);
377 typedef int (*twWs_RegisterPingCallbackStub)(twWs * ws, ws_data_cb cb);
378 typedef int (*twWs_RegisterPongCallbackStub)(twWs * ws, ws_data_cb cb);
379 typedef int (*twWs_ReceiveStub)(twWs * ws, uint32_t timeout);
380 typedef int (*twWs_SendMessageStub)(twWs * ws, char * buf, uint32_t length, char isText);
381 typedef int (*twWs_SendPingStub)(twWs * ws, char * msg);
382 typedef int (*twWs_SendPongStub)(twWs * ws, char * msg);
383 typedef int (*twWs_SendDataFrameStub)(twWs * ws, char * msg, uint16_t length, char isContinuation, char isFinal, char isText);
384 
385 /* TLS Client */
386 typedef int (*twTlsClient_UseCertificateChainFileStub)(twTlsClient * t, const char *file, int type);
387 typedef int (*twTlsClient_SetClientCaListStub)(twTlsClient * t, char * caFile, char * caPath);
388 typedef int (*twTlsClient_UsePrivateKeyFileStub)(twTlsClient * t, const char *file, int type);
389 typedef int (*twTlsClient_ReadStub)(twTlsClient * t, char * buf, int len, int timeout);
390 typedef int (*twTlsClient_WriteStub)(twTlsClient * t, char * buf, int len, int timeout);
391 typedef int (*twTlsClient_ReconnectStub)(twTlsClient * t, const char * host, int16_t port);
392 
393 /* cJSON */
394 typedef void (*cJSON_DeleteStub)(cJSON *c);
395 
396 /* Mutexes */
397 typedef void (*twMutex_LockStub)(TW_MUTEX m);
398 typedef void (*twMutex_UnlockStub)(TW_MUTEX m);
399 typedef TW_MUTEX (*twMutex_CreateStub)();
400 
401 /* file transfer */
402 typedef char(*twDirectory_FileExistsStub)(char * name);
403 typedef int(*twDirectory_GetFileInfoStub)(char * filename, uint64_t * size, DATETIME * lastModified, char * isDirectory, char * isReadOnly);
404 typedef int(*twDirectory_GetLastErrorStub)();
405 typedef twFile * (*twFile_CreateStub)();
406 typedef void(*twFileManager_CloseFileStub)(void * file);
407 typedef twFile * (*twFileManager_GetOpenFileStub)(const char * thingName, const char * path, const char * filename, const char * tid, char * isTimedOut);
408 typedef char * (*twFileManager_GetRealPathStub)(const char * thingName, const char * path, const char * filename);
409 typedef void(* twFileManager_MakeFileCallbackStub)(char rcvd, twFileTransferInfo * fti);
410 typedef void(*twFile_DeleteStub)(void * f);
411 typedef TW_FILE_HANDLE(*twFile_FOpenStub)(const char * name, const char * mode);
412 typedef int(*twDirectory_CreateDirectoryStub)(char * name);
413 typedef int(*twDirectory_CreateFileStub)(char * name);
414 typedef int(*twDirectory_DeleteFileStub)(char * name);
415 typedef int(*listDirsInInfoTableStub)(char * entityName, char * virtualPath, twInfoTable * it);
416 
417 /* base64_encode */
418 typedef int(*base64_encodeStub)(const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen);
419 
420 typedef struct twApi_Stubs {
421  /* internal functions */
422  cfuhash_destroyStub cfuhash_destroy;
423  deleteCallbackInfoStub deleteCallbackInfo;
424  bindListEntry_CreateStub bindListEntry_Create;
425  bindListEntry_DeleteStub bindListEntry_Delete;
426  notifyPropertyUpdateHandlerStub notifyPropertyUpdateHandler;
427  subscribedPropertyUpdateTaskStub subscribedPropertyUpdateTask;
428  isFileTransferServiceStub isFileTransferService;
429  isTunnelServiceStub isTunnelService;
430  convertMsgCodeToErrorCodeStub convertMsgCodeToErrorCode;
431  findRegisteredItemStub findRegisteredItem;
432  getCallbackFromListStub getCallbackFromList;
433  sendMessageBlockingStub sendMessageBlocking;
434  makeRequestStub makeRequest;
435  makePropertyRequestStub makePropertyRequest;
436  twApi_SendResponseStub twApi_SendResponse;
437  api_requesthandlerStub api_requesthandler;
438  getMetadataServiceStub getMetadataService;
439  pong_handlerStub pong_handler;
440  makeAuthOrBindCallbacksStub makeAuthOrBindCallbacks;
441  makeSynchronizedStateCallbacksStub makeSynchronizedStateCallbacks;
442  registerServiceOrEventStub registerServiceOrEvent;
443  AddAspectToEntityStub AddAspectToEntity;
444 
445  /* external functions */
446  twApi_InitializeStub twApi_Initialize;
447  twApi_DeleteStub twApi_Delete;
448  twApi_SetProxyInfoStub twApi_SetProxyInfo;
449  twApi_GetVersionStub twApi_GetVersion;
450  twApi_BindAllStub twApi_BindAll;
451  twApi_AuthenticateStub twApi_Authenticate;
452  twApi_ConnectStub twApi_Connect;
453  twApi_DisconnectStub twApi_Disconnect;
454  twApi_isConnectedStub twApi_isConnected;
455  twApi_ConnectionInProgressStub twApi_ConnectionInProgress;
456  twApi_StopConnectionAttemptStub twApi_StopConnectionAttempt;
457  twApi_SetDutyCycleStub twApi_SetDutyCycle;
458  twApi_SetPingRateStub twApi_SetPingRate;
459  twApi_SetConnectTimeoutStub twApi_SetConnectTimeout;
460  twApi_SetConnectRetriesStub twApi_SetConnectRetries;
461  twApi_SetGatewayNameStub twApi_SetGatewayName;
462  twApi_SetGatewayTypeStub twApi_SetGatewayType;
463  twApi_BindThingStub twApi_BindThing;
464  twApi_BindThings_Metadata_OptionStub twApi_BindThings_Metadata_Option;
465  twApi_UnbindThingStub twApi_UnbindThing;
466  twApi_IsEntityBoundStub twApi_IsEntityBound;
467  twApi_TaskerFunctionStub twApi_TaskerFunction;
468  twApi_RegisterPropertyStub twApi_RegisterProperty;
469  twApi_UpdatePropertyMetaDataStub twApi_UpdatePropertyMetaData;
470  twApi_AddAspectToPropertyStub twApi_AddAspectToProperty;
471  twApi_RegisterServiceStub twApi_RegisterService;
472  twApi_AddAspectToServiceStub twApi_AddAspectToService;
473  twApi_RegisterEventStub twApi_RegisterEvent;
474  twApi_AddAspectToEventStub twApi_AddAspectToEvent;
475  twApi_RegisterPropertyCallbackStub twApi_RegisterPropertyCallback;
476  twApi_RegisterServiceCallbackStub twApi_RegisterServiceCallback;
477  twApi_UnregisterThingStub twApi_UnregisterThing;
478  twApi_UnregisterCallbackStub twApi_UnregisterCallback;
479  twApi_UnregisterPropertyCallbackStub twApi_UnregisterPropertyCallback;
480  twApi_UnregisterServiceCallbackStub twApi_UnregisterServiceCallback;
481  twApi_RegisterDefaultRequestHandlerStub twApi_RegisterDefaultRequestHandler;
482  twApi_CreatePropertyListStub twApi_CreatePropertyList;
483  twApi_DeletePropertyListStub twApi_DeletePropertyList;
484  twApi_AddPropertyToListStub twApi_AddPropertyToList;
485  twApi_ReadPropertyStub twApi_ReadProperty;
486  twApi_WritePropertyStub twApi_WriteProperty;
487  twApi_SetSubscribedPropertyVTQStub twApi_SetSubscribedPropertyVTQ;
488  twApi_SetSubscribedPropertyStub twApi_SetSubscribedProperty;
489  twApi_PushSubscribedPropertiesStub twApi_PushSubscribedProperties;
490  twApi_PushPropertiesStub twApi_PushProperties;
491  twApi_InvokeServiceStub twApi_InvokeService;
492  twApi_FireEventStub twApi_FireEvent;
493  twApi_RegisterConnectCallbackStub twApi_RegisterConnectCallback;
494  twApi_RegisterCloseCallbackStub twApi_RegisterCloseCallback;
495  twApi_RegisterPingCallbackStub twApi_RegisterPingCallback;
496  twApi_RegisterPongCallbackStub twApi_RegisterPongCallback;
497  twApi_RegisterBindEventCallbackStub twApi_RegisterBindEventCallback;
498  twApi_UnregisterBindEventCallbackStub twApi_UnregisterBindEventCallback;
499  twApi_RegisterOnAuthenticatedCallbackStub twApi_RegisterOnAuthenticatedCallback;
500  twApi_UnregisterOnAuthenticatedCallbackStub twApi_UnregisterOnAuthenticatedCallback;
501  twApi_CleanupOldMessagesStub twApi_CleanupOldMessages;
502  twApi_SendPingStub twApi_SendPing;
503  twApi_CreateTaskStub twApi_CreateTask;
504  twApi_SetSelfSignedOkStub twApi_SetSelfSignedOk;
505  twApi_DisableCertValidationStub twApi_DisableCertValidation;
506  twApi_LoadCACertStub twApi_LoadCACert;
507  twApi_LoadClientCertStub twApi_LoadClientCert;
508  twApi_SetClientKeyStub twApi_SetClientKey;
509  twApi_EnableFipsModeStub twApi_EnableFipsMode;
510  twApi_IsFIPSCompatibleStub twApi_IsFIPSCompatible;
511  twApi_IsFipsModeEnabledStub twApi_IsFipsModeEnabled;
512 
513  twApi_DisableEncryptionStub twApi_DisableEncryption;
514  twApi_SetX509FieldsStub twApi_SetX509Fields;
515  twApi_SetOfflineMsgStoreDirStub twApi_SetOfflineMsgStoreDir;
516  twApi_GetConnectionInfoStub twApi_GetConnectionInfo;
517 
518  /* Properties */
519  twPropertyDef_CreateStub twPropertyDef_Create;
520  twPropertyDef_DeleteStub twPropertyDef_Delete;
521  twProperty_CreateStub twProperty_Create;
522  twPropertyVTQ_CreateStub twPropertyVTQ_Create;
523  twProperty_CreateFromStreamStub twProperty_CreateFromStream;
524  twProperty_DeleteStub twProperty_Delete;
525 
526  /* Services */
527  twServiceDef_CreateStub twServiceDef_Create;
528  twServiceDef_DeleteStub twServiceDef_Delete;
529 
530  /* Base Types */
531  twStream_CreateStub twStream_Create;
532  twStream_CreateFromCharArrayStub twStream_CreateFromCharArray;
533  twStream_CreateFromCharArrayZeroCopyStub twStream_CreateFromCharArrayZeroCopy;
534  twStream_DeleteStub twStream_Delete;
535  twStream_GetDataStub twStream_GetData;
536  twStream_GetIndexStub twStream_GetIndex;
537  twStream_GetLengthStub twStream_GetLength;
538  twStream_AddBytesStub twStream_AddBytes;
539  twStream_GetBytesStub twStream_GetBytes;
540  twStream_ResetStub twStream_Reset;
541  twStream_CreateFromFileStub twStream_CreateFromFile;
542  swap4bytesStub swap4bytes;
543  swap8bytesStub swap8bytes;
544  stringToStreamStub stringToStream;
545  streamToStringStub streamToString;
546  baseTypeFromStringStub baseTypeFromString;
547  baseTypeToStringStub baseTypeToString;
548  twPrimitive_CreateStub twPrimitive_Create;
549  twPrimitive_CreateFromStreamStub twPrimitive_CreateFromStream;
550  twPrimitive_CreateFromStreamTypedStub twPrimitive_CreateFromStreamTyped;
551  twPrimitive_ZeroCopyStub twPrimitive_ZeroCopy;
552  twPrimitive_FullCopyStub twPrimitive_FullCopy;
553  twPrimitive_DeleteStub twPrimitive_Delete;
554  twPrimitive_ToStreamStub twPrimitive_ToStream;
555  twPrimitive_DecoupleStringAndDeleteStub twPrimitive_DecoupleStringAndDelete;
556  twPrimitive_CompareStub twPrimitive_Compare;
557  twPrimitive_IsTrueStub twPrimitive_IsTrue;
558  twPrimitive_CreateFromLocationStub twPrimitive_CreateFromLocation;
559  twPrimitive_CreateFromNumberStub twPrimitive_CreateFromNumber;
560  twPrimitive_CreateFromIntegerStub twPrimitive_CreateFromInteger;
561  twPrimitive_CreateFromDatetimeStub twPrimitive_CreateFromDatetime;
562  twPrimitive_CreateFromCurrentTimeStub twPrimitive_CreateFromCurrentTime;
563  twPrimitive_CreateFromBooleanStub twPrimitive_CreateFromBoolean;
564  twPrimitive_CreateFromInfoTableStub twPrimitive_CreateFromInfoTable;
565  twPrimitive_CreateVariantStub twPrimitive_CreateVariant;
566  twPrimitive_CreateFromStringStub twPrimitive_CreateFromString;
567  twPrimitive_CreateFromBlobStub twPrimitive_CreateFromBlob;
568  twPrimitive_CreateFromVariableStub twPrimitive_CreateFromVariable;
569  twPrimitive_ToJsonStub twPrimitive_ToJson;
570  twPrimitive_CreateFromJsonStub twPrimitive_CreateFromJson;
571 
572  /* InfoTables */
573  twDataShapeAspect_CreateStub twDataShapeAspect_Create;
574  twDataShapeAspect_CreateFromStreamStub twDataShapeAspect_CreateFromStream;
575  twDataShapeAspect_DeleteStub twDataShapeAspect_Delete;
576  twDataShapeEntry_CreateStub twDataShapeEntry_Create;
577  twDataShapeEntry_CreateFromStreamStub twDataShapeEntry_CreateFromStream;
578  twDataShapeEntry_DeleteStub twDataShapeEntry_Delete;
579  twDataShapeEntry_AddAspectStub twDataShapeEntry_AddAspect;
580  twDataShapeEntry_GetLengthStub twDataShapeEntry_GetLength;
581  twDataShapeEntry_ToStreamStub twDataShapeEntry_ToStream;
582  twDataShape_CreateStub twDataShape_Create;
583  twDataShape_CreateFromStreamStub twDataShape_CreateFromStream;
584  twDataShape_DeleteStub twDataShape_Delete;
585  twDataShape_GetLengthStub twDataShape_GetLength;
586  twDataShape_ToStreamStub twDataShape_ToStream;
587  twDataShape_SetNameStub twDataShape_SetName;
588  twDataShape_AddEntryStub twDataShape_AddEntry;
589  twDataShape_GetEntryIndexStub twDataShape_GetEntryIndex;
590  twInfoTableRow_CreateStub twInfoTableRow_Create;
591  twInfoTableRow_CreateFromStreamStub twInfoTableRow_CreateFromStream;
592  twInfoTableRow_DeleteStub twInfoTableRow_Delete;
593  twInfoTableRow_GetCountStub twInfoTableRow_GetCount;
594  twInfoTableRow_GetLengthStub twInfoTableRow_GetLength;
595  twInfoTableRow_AddEntryStub twInfoTableRow_AddEntry;
596  twInfoTableRow_GetEntryStub twInfoTableRow_GetEntry;
597  twInfoTableRow_ToStreamStub twInfoTableRow_ToStream;
598  twInfoTable_CreateStub twInfoTable_Create;
599  twInfoTable_CreateFromStreamStub twInfoTable_CreateFromStream;
600  twInfoTable_DeleteStub twInfoTable_Delete;
601  twInfoTable_FullCopyStub twInfoTable_FullCopy;
602  twInfoTable_ZeroCopyStub twInfoTable_ZeroCopy;
603  twInfoTable_CompareStub twInfoTable_Compare;
604  twInfoTable_AddRowStub twInfoTable_AddRow;
605  twInfoTable_GetEntryStub twInfoTable_GetEntry;
606  twInfoTable_ToStreamStub twInfoTable_ToStream;
607  twInfoTable_CreateFromPrimitiveStub twInfoTable_CreateFromPrimitive;
608  twInfoTable_CreateFromStringStub twInfoTable_CreateFromString;
609  twInfoTable_CreateFromNumberStub twInfoTable_CreateFromNumber;
610  twInfoTable_CreateFromIntegerStub twInfoTable_CreateFromInteger;
611  twInfoTable_CreateFromLocationStub twInfoTable_CreateFromLocation;
612  twInfoTable_CreateFromBlobStub twInfoTable_CreateFromBlob;
613  twInfoTable_CreateFromDatetimeStub twInfoTable_CreateFromDatetime;
614  twInfoTable_CreateFromBooleanStub twInfoTable_CreateFromBoolean;
615  twInfoTable_GetStringStub twInfoTable_GetString;
616  twInfoTable_GetNumberStub twInfoTable_GetNumber;
617  twInfoTable_GetIntegerStub twInfoTable_GetInteger;
618  twInfoTable_GetLocationStub twInfoTable_GetLocation;
619  twInfoTable_GetBlobStub twInfoTable_GetBlob;
620  twInfoTable_GetDatetimeStub twInfoTable_GetDatetime;
621  twInfoTable_GetBooleanStub twInfoTable_GetBoolean;
622  twInfoTable_GetPrimitiveStub twInfoTable_GetPrimitive;
623  twInfoTable_CreateFromJsonStub twInfoTable_CreateFromJson;
624  twDataShape_ToJsonStub twDataShape_ToJson;
625  twInfoTable_ToJsonStub twInfoTable_ToJson;
626 
627  /* Messages */
628  twMessage_CreateStub twMessage_Create;
629  twMessage_CreateRequestMsgStub twMessage_CreateRequestMsg;
630  twMessage_CreateResponseMsgStub twMessage_CreateResponseMsg;
631  twMessage_CreateBindMsgStub twMessage_CreateBindMsg;
632  twMessage_CreateAuthMsgStub twMessage_CreateAuthMsg;
633  twMessage_CreateFromStreamStub twMessage_CreateFromStream;
634  twMessage_DeleteStub twMessage_Delete;
635  twMessage_SendStub twMessage_Send;
636  twMessage_SetBodyStub twMessage_SetBody;
637  twRequestBody_CreateStub twRequestBody_Create;
638  twRequestBody_CreateFromStreamStub twRequestBody_CreateFromStream;
639  twRequestBody_DeleteStub twRequestBody_Delete;
640  twRequestBody_SetParamsStub twRequestBody_SetParams;
641  twRequestBody_SetEntityStub twRequestBody_SetEntity;
642  twRequestBody_SetCharacteristicStub twRequestBody_SetCharacteristic;
643  twRequestBody_AddHeaderStub twRequestBody_AddHeader;
644  twRequestBody_ToStreamStub twRequestBody_ToStream;
645  twResponseBody_CreateStub twResponseBody_Create;
646  twResponseBody_CreateFromStreamStub twResponseBody_CreateFromStream;
647  twResponseBody_DeleteStub twResponseBody_Delete;
648  twResponseBody_SetContentStub twResponseBody_SetContent;
649  twResponseBody_SetReasonStub twResponseBody_SetReason;
650  twResponseBody_ToStreamStub twResponseBody_ToStream;
651  twAuthBody_CreateStub twAuthBody_Create;
652  twAuthBody_CreateFromStreamStub twAuthBody_CreateFromStream;
653  twAuthBody_DeleteStub twAuthBody_Delete;
654  twAuthBody_SetClaimStub twAuthBody_SetClaim;
655  twAuthBody_ToStreamStub twAuthBody_ToStream;
656  twBindBody_CreateStub twBindBody_Create;
657  twBindBody_CreateFromStreamStub twBindBody_CreateFromStream;
658  twBindBody_DeleteStub twBindBody_Delete;
659  twBindBody_AddNameStub twBindBody_AddName;
660  twBindBody_ToStreamStub twBindBody_ToStream;
661  twMultipartBody_CreateFromStreamStub twMultipartBody_CreateFromStream;
662  twMultipartBody_DeleteStub twMultipartBody_Delete;
663  mulitpartMessageStoreEntry_CreateStub mulitpartMessageStoreEntry_Create;
664  mulitpartMessageStoreEntry_DeleteStub mulitpartMessageStoreEntry_Delete;
665  twMultipartMessageStore_InstanceStub twMultipartMessageStore_Instance;
666  twMultipartMessageStore_DeleteStub twMultipartMessageStore_Delete;
667  twMultipartMessageStore_AddMessageStub twMultipartMessageStore_AddMessage;
668  twMultipartMessageStore_RemoveStaleMessagesStub twMultipartMessageStore_RemoveStaleMessages;
669  twCompressBytesStub twCompressBytes;
670 
671  /* Messaging */
672  twMessageHandler_InstanceStub twMessageHandler_Instance;
673  twMessageHandler_DeleteStub twMessageHandler_Delete;
674  twMessageHandler_CleanupOldMessagesStub twMessageHandler_CleanupOldMessages;
675  twMessageHandler_msgHandlerTaskStub twMessageHandler_msgHandlerTask;
676  twMessageHandler_RegisterConnectCallbackStub twMessageHandler_RegisterConnectCallback;
677  twMessageHandler_RegisterCloseCallbackStub twMessageHandler_RegisterCloseCallback;
678  twMessageHandler_RegisterPingCallbackStub twMessageHandler_RegisterPingCallback;
679  twMessageHandler_RegisterPongCallbackStub twMessageHandler_RegisterPongCallback;
680  twMessageHandler_RegisterDefaultRequestCallbackStub twMessageHandler_RegisterDefaultRequestCallback;
681  twMessageHandler_RegisterDumpIncomingMsgListCallbackStub twMessageHandler_RegisterDumpIncomingMsgListCallback;
682  twMessageHandler_RegisterRequestCallbackStub twMessageHandler_RegisterRequestCallback;
683  twMessageHandler_RegisterResponseCallbackStub twMessageHandler_RegisterResponseCallback;
684  twMessageHandler_GetCompletedResponseStructStub twMessageHandler_GetCompletedResponseStruct;
685  twMessageHandler_UnegisterRequestCallbackStub twMessageHandler_UnegisterRequestCallback;
686  twMessageHandler_UnegisterResponseCallbackStub twMessageHandler_UnegisterResponseCallback;
687 
688  /* Subscribed Properties */
689  twSubscribedPropsMgr_InitializeStub twSubscribedPropsMgr_Initialize;
690  twSubscribedPropsMgr_DeleteStub twSubscribedPropsMgr_Delete;
691  twSubscribedPropsMgr_SetFoldingStub twSubscribedPropsMgr_SetFolding;
692  twSubscribedPropsMgr_PushSubscribedPropertiesStub twSubscribedPropsMgr_PushSubscribedProperties;
693  twSubscribedPropsMgr_SetPropertyVTQStub twSubscribedPropsMgr_SetPropertyVTQ;
694  twSubscribedPropsMgr_QueueValueForSendingStub twSubscribedPropsMgr_QueueValueForSending;
695  twSubscribedProperty_DeleteStub twSubscribedProperty_Delete;
696  twSubscribedProperty_ToStreamStub twSubscribedProperty_ToStream;
697 
698  /* Offline Message Store */
699  twOfflineMsgStore_HandleRequestStub twOfflineMsgStore_HandleRequest;
700  twOfflineMsgStore_InitializeStub twOfflineMsgStore_Initialize;
701  twOfflineMsgStore_SetDirStub twOfflineMsgStore_SetDir;
702  twOfflineMsgStore_DeleteStub twOfflineMsgStore_Delete;
703 
704  /* Crypto */
705  EncryptDESStub EncryptDES;
706  DecryptDESStub DecryptDES;
707  createDESKeyStub createDESKey;
708  MD4HashStub MD4Hash;
709 
710  /* twList */
711  twList_CreateStub twList_Create;
712  twList_CreateSearchableStub twList_CreateSearchable;
713  twList_DeleteStub twList_Delete;
714  twList_ClearStub twList_Clear;
715  twList_AddStub twList_Add;
716  twList_RemoveStub twList_Remove;
717  twList_NextStub twList_Next;
718  twList_GetByIndexStub twList_GetByIndex;
719  twList_GetCountStub twList_GetCount;
720  twList_ReplaceValueStub twList_ReplaceValue;
721 
722  /* twMap */
723  twMap_AddStub twMap_Add;
724  twMap_RemoveStub twMap_Remove;
725 
726  /* twMap */
727  twDict_AddStub twDict_Add;
728 
729  /* String Utils */
730  lowercaseStub lowercase;
731  uppercaseStub uppercase;
732  duplicateStringStub duplicateString;
733 
734  /* twProxy */
735  connectToProxyStub connectToProxy;
736  twSocket_WriteStub twSocket_Write;
737  twSocket_WaitForStub twSocket_WaitFor;
738  twSocket_ReadStub twSocket_Read;
739 
740  /* Logger */
741  twLogger_InstanceStub twLogger_Instance;
742  twLogger_DeleteStub twLogger_Delete;
743  twLogger_SetLevelStub twLogger_SetLevel;
744  twLogger_SetFunctionStub twLogger_SetFunction;
745  twLogger_SetIsVerboseStub twLogger_SetIsVerbose;
746  twLogStub twLog;
747  twLogHexStringStub twLogHexString;
748  twLogMessageStub twLogMessage;
749  twCodeToStringStub twCodeToString;
750  twEntityToStringStub twEntityToString;
751  twCharacteristicToStringStub twCharacteristicToString;
752 
753  /* NTLM */
754  NTLM_connectToProxyStub NTLM_connectToProxy;
755 
756  /* twNTLM */
757  NTLM_parseType2MsgStub NTLM_parseType2Msg;
758  GenerateType3MsgStub GenerateType3Msg;
759  GenerateType1MsgStub GenerateType1Msg;
760  NTLM_sendType1MsgStub NTLM_sendType1Msg;
761 
762  /* Tasker */
763  twTasker_InitializeStub twTasker_Initialize;
764  twTasker_CreateTaskStub twTasker_CreateTask;
765  twTasker_RemoveTaskStub twTasker_RemoveTask;
766 
767  /* Websocket */
768  twWs_CreateStub twWs_Create;
769  twWs_DeleteStub twWs_Delete;
770  twWs_ConnectStub twWs_Connect;
771  twWs_DisconnectStub twWs_Disconnect;
772  twWs_IsConnectedStub twWs_IsConnected;
773  twWs_RegisterConnectCallbackStub twWs_RegisterConnectCallback;
774  twWs_RegisterCloseCallbackStub twWs_RegisterCloseCallback;
775  twWs_RegisterBinaryMessageCallbackStub twWs_RegisterBinaryMessageCallback;
776  twWs_RegisterTextMessageCallbackStub twWs_RegisterTextMessageCallback;
777  twWs_RegisterPingCallbackStub twWs_RegisterPingCallback;
778  twWs_RegisterPongCallbackStub twWs_RegisterPongCallback;
779  twWs_ReceiveStub twWs_Receive;
780  twWs_SendMessageStub twWs_SendMessage;
781  twWs_SendPingStub twWs_SendPing;
782  twWs_SendPongStub twWs_SendPong;
783  twWs_SendDataFrameStub twWs_SendDataFrame;
784 
785  /* TLS Client */
786  twTlsClient_UseCertificateChainFileStub twTlsClient_UseCertificateChainFile;
787  twTlsClient_SetClientCaListStub twTlsClient_SetClientCaList;
788  twTlsClient_UsePrivateKeyFileStub twTlsClient_UsePrivateKeyFile;
789  twTlsClient_ReadStub twTlsClient_Read;
790  twTlsClient_WriteStub twTlsClient_Write;
791  twTlsClient_ReconnectStub twTlsClient_Reconnect;
792 
793  /* cJSON */
794  cJSON_DeleteStub cJSON_Delete;
795 
796  /* Mutexes */
797  twMutex_LockStub twMutex_Lock;
798  twMutex_UnlockStub twMutex_Unlock;
799  twMutex_CreateStub twMutex_Create;
800 
801  /* file transfer */
802  twDirectory_FileExistsStub twDirectory_FileExists;
803  twDirectory_GetFileInfoStub twDirectory_GetFileInfo;
804  twDirectory_GetLastErrorStub twDirectory_GetLastError;
805  twFile_CreateStub twFile_Create;
806  twFileManager_CloseFileStub twFileManager_CloseFile;
807  twFileManager_GetOpenFileStub twFileManager_GetOpenFile;
808  twFileManager_GetRealPathStub twFileManager_GetRealPath;
809  twFileManager_MakeFileCallbackStub twFileManager_MakeFileCallback;
810  twFile_DeleteStub twFile_Delete;
811  twFile_FOpenStub twFile_FOpen;
812  twDirectory_CreateDirectoryStub twDirectory_CreateDirectory;
813  twDirectory_CreateFileStub twDirectory_CreateFile;
814  twDirectory_DeleteFileStub twDirectory_DeleteFile;
815  listDirsInInfoTableStub listDirsInInfoTable;
816 
817  /* base64_encode */
818  base64_encodeStub base64_encode;
819 } twApi_Stubs;
820 
821 #ifdef WIN32
822 extern __declspec(dllimport) twApi_Stubs * twApi_stub;
823 extern __declspec(dllimport) twApi * tw_api;
824 #else
825 extern twApi * tw_api;
826 extern twApi_Stubs * twApi_stub;
827 #endif
828 
829 int twStubs_Use();
830 int twStubs_Reset();
831 
832 int twApi_CreateStubs();
833 int twApi_DeleteStubs();
834 
835 #endif
void(* authEvent_cb)(char *credentialType, char *credentialValue, void *userdata)
Signature of a callback function that is registered to be called when authentication to the ThingWorx...
Definition: twApi.h:184
Definition: twMessages.h:104
enum msgCodeEnum(* service_cb)(const char *entityName, const char *serviceName, twInfoTable *params, twInfoTable **content, void *userdata)
Signature of a callback function that is registered to be called when a specific service request is r...
Definition: twApi.h:114
Property definitions & metadata functions.
void(* log_function)(enum LogLevel level, const char *timestamp, const char *message)
For log message level enumeration see twDefinitions.h.
Definition: twLogger.h:36
Definition: twMessages.h:156
ThingWorx API structure definition.
Definition: twApi.h:204
void * value
Definition: twList.h:51
char * name
Definition: twInfoTable.h:187
#define TW_MUTEX
For Linux builds a TW_MUTEX is a pthread_mutex_t.
Definition: twLinux-openssl.h:81
File Transfer Information structure definition.
Definition: twFileManager.h:48
uint16_t frameSize
Definition: twWebsocket.h:93
Dynamically allocated byte array. Automatically expands its length as needed.
Definition: twBaseTypes.h:35
twSocket base type definition.
Definition: twOSPort.h:174
Linked list structure definition.
Definition: twList.h:59
Definition: twSubscribedProps.h:20
ThingWorx Logger singleton structure definition.
Definition: twLogger.h:41
Definition: twMessaging.h:52
Definition: twMessages.h:139
Definition: twMessages.h:80
LogLevel
Definition: twDefinitions.h:209
entityTypeEnum
Definition: twDefinitions.h:114
Definition: twMessaging.h:41
Service definitions & metadata functions.
msgCodeEnum
Enumeration of HTTP message codes.
Definition: twDefinitions.h:74
characteristicEnum
Definition: twDefinitions.h:147
ThingWorx TLS client abstraction layer.
void(* bindEvent_cb)(char *entityName, char isBound, void *userdata)
Signature of a callback function that is registered to be called when a bind or unbind completes...
Definition: twApi.h:145
uint32_t messageChunkSize
Definition: twWebsocket.h:89
Portable ThingWorx C SDK API layer.
uint16_t port
Definition: twWebsocket.h:100
DataShape entry structure definition.
Definition: twInfoTable.h:84
Data shape base structure definition.
Definition: twInfoTable.h:184
Definition: inftree9.h:24
void(* twTaskFunction)(uint64_t sys_msecs, void *params)
Function signature of a task called in round robin fashion.
Definition: twTasker.h:32
uint32_t length
Definition: twInfoTable.h:421
Property base structure.
Definition: twProperties.h:68
close_status
Websocket close reasoning enumeration.
Definition: twWebsocket.h:68
Linked list entry structure definition.
Definition: twList.h:48
char * resource
Definition: twWebsocket.h:120
Definition: twMessages.h:37
Tunnel Connection Details Structure Definition.
Definition: twConnectionInfo.h:23
Info table base structure.
Definition: twInfoTable.h:418
Definition: twMessages.h:122
Info table row structure.
Definition: twInfoTable.h:302
File/directory data structure.
Definition: twFileManager.h:117
char * name
Definition: twInfoTable.h:85
TLS client structure definition.
Definition: twTls.h:34
enum msgCodeEnum(* property_cb)(const char *entityName, const char *propertyName, twInfoTable **value, char isWrite, void *userdata)
Signature of a callback function that is registered to be called when a specific property request is ...
Definition: twApi.h:89
ThingWorx file transfer structure definitions and functions.
Definition: twMessages.h:183
Websocket entity structure definition.
Definition: twWebsocket.h:87
Service definition structure.
Definition: twServices.h:27
char * gatewayName
Definition: twWebsocket.h:114
Property definition structure.
Definition: twProperties.h:27
Location primitive structure.
Definition: twBaseTypes.h:177
Definition: twMessages.h:169
Definition: cJSON.h:43
char * host
Definition: twWebsocket.h:99
BaseType
Definition: twDefinitions.h:156
BaseType primitive structure.
Definition: twBaseTypes.h:204
Definition: twApi.h:59
Data shape aspect structure definition.
Definition: twInfoTable.h:31
twMessage *(* genericRequest_cb)(twMessage *msg)
Signature of a callback function that is registered to be called for unhandled requests.
Definition: twApi.h:127
Definition: twApiStubs.h:420
Definition: gzappend.c:170