Imported Upstream version 1.1.0
[platform/upstream/iotivity.git] / resource / csdk / stack / include / octypes.h
1 //******************************************************************
2 //
3 // Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
4 //
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 //
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 //      http://www.apache.org/licenses/LICENSE-2.0
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 //
19 //******************************************************************
20
21
22 /**
23  * @file
24  *
25  * This file contains the definition, types and APIs for resource(s) be implemented.
26  */
27
28 #ifndef OCTYPES_H_
29 #define OCTYPES_H_
30
31 #include "platform_features.h"
32 #include "ocstackconfig.h"
33 #include <stdbool.h>
34 #include <stdint.h>
35 #include <stdio.h>
36 #ifdef __cplusplus
37 #include <string.h>
38
39 extern "C" {
40 #endif // __cplusplus
41
42 /** For the feature presence.*/
43 #define WITH_PRESENCE
44
45 #include "ocpresence.h"
46 //-----------------------------------------------------------------------------
47 // Defines
48 //-----------------------------------------------------------------------------
49
50 /**
51  * OIC Virtual resources supported by every OIC device.
52  */
53 /**
54  *  Default discovery mechanism using '/oic/res' is supported by all OIC devices
55  *  That are Discoverable.
56  */
57 #define OC_RSRVD_WELL_KNOWN_URI               "/oic/res"
58
59 /** Device URI.*/
60 #define OC_RSRVD_DEVICE_URI                   "/oic/d"
61
62 /** Platform URI.*/
63 #define OC_RSRVD_PLATFORM_URI                 "/oic/p"
64
65 /** Resource Type.*/
66 #define OC_RSRVD_RESOURCE_TYPES_URI           "/oic/res/types/d"
67 #if defined (ROUTING_GATEWAY) || defined (ROUTING_EP)
68 /** Gateway URI.*/
69 #define OC_RSRVD_GATEWAY_URI                  "/oic/gateway"
70 #endif
71 #ifdef WITH_PRESENCE
72
73 /** Presence URI through which the OIC devices advertise their presence.*/
74 #define OC_RSRVD_PRESENCE_URI                 "/oic/ad"
75
76 /** Sets the default time to live (TTL) for presence.*/
77 #define OC_DEFAULT_PRESENCE_TTL_SECONDS (60)
78
79 /** For multicast Discovery mechanism.*/
80 #define OC_MULTICAST_DISCOVERY_URI           "/oic/res"
81
82 /** Separator for multiple query string.*/
83 #define OC_QUERY_SEPARATOR                "&;"
84
85 /**
86  *  OC_DEFAULT_PRESENCE_TTL_SECONDS sets the default time to live (TTL) for presence.
87  */
88 #define OC_DEFAULT_PRESENCE_TTL_SECONDS (60)
89
90 /**
91  *  OC_MAX_PRESENCE_TTL_SECONDS sets the maximum time to live (TTL) for presence.
92  *  NOTE: Changing the setting to a longer duration may lead to unsupported and untested
93  *  operation.
94  *  60 sec/min * 60 min/hr * 24 hr/day
95  */
96 #define OC_MAX_PRESENCE_TTL_SECONDS     (60 * 60 * 24)
97 #endif
98
99 /**
100  *  Presence "Announcement Triggers".
101  */
102
103 /** To create.*/
104 #define OC_RSRVD_TRIGGER_CREATE         "create"
105
106 /** To change.*/
107 #define OC_RSRVD_TRIGGER_CHANGE         "change"
108
109 /** To delete.*/
110 #define OC_RSRVD_TRIGGER_DELETE         "delete"
111
112 /**
113  *  Attributes used to form a proper OIC conforming JSON message.
114  */
115
116 #define OC_RSRVD_OC                     "oic"
117
118 /** For payload. */
119
120 #define OC_RSRVD_PAYLOAD                "payload"
121
122 /** To represent href */
123 #define OC_RSRVD_HREF                   "href"
124
125 /** To represent property*/
126 #define OC_RSRVD_PROPERTY               "prop"
127
128 /** For representation.*/
129 #define OC_RSRVD_REPRESENTATION         "rep"
130
131 /** To represent content type.*/
132 #define OC_RSRVD_CONTENT_TYPE           "ct"
133
134 /** To represent resource type.*/
135 #define OC_RSRVD_RESOURCE_TYPE          "rt"
136
137 /** To represent resource type with presence.*/
138 #define OC_RSRVD_RESOURCE_TYPE_PRESENCE "oic.wk.ad"
139
140 /** To represent resource type with device.*/
141 #define OC_RSRVD_RESOURCE_TYPE_DEVICE   "oic.wk.d"
142
143 /** To represent resource type with platform.*/
144 #define OC_RSRVD_RESOURCE_TYPE_PLATFORM "oic.wk.p"
145
146 /** To represent resource type with RES.*/
147 #define OC_RSRVD_RESOURCE_TYPE_RES    "oic.wk.res"
148
149 /** To represent interface.*/
150 #define OC_RSRVD_INTERFACE              "if"
151
152 /** To represent time to live.*/
153 #define OC_RSRVD_TTL                    "ttl"
154
155 /** To represent non*/
156 #define OC_RSRVD_NONCE                  "non"
157
158 /** To represent trigger type.*/
159 #define OC_RSRVD_TRIGGER                "trg"
160
161 /** To represent links.*/
162 #define OC_RSRVD_LINKS                  "links"
163
164 /** To represent default interface.*/
165 #define OC_RSRVD_INTERFACE_DEFAULT      "oic.if.baseline"
166
167 /** To represent read-only interface.*/
168 #define OC_RSRVD_INTERFACE_READ         "oic.if.r"
169
170 /** To represent ll interface.*/
171 #define OC_RSRVD_INTERFACE_LL           "oic.if.ll"
172
173 /** To represent batch interface.*/
174 #define OC_RSRVD_INTERFACE_BATCH        "oic.if.b"
175
176 /** To represent interface group.*/
177 #define OC_RSRVD_INTERFACE_GROUP        "oic.mi.grp"
178
179 /** To represent MFG date.*/
180 #define OC_RSRVD_MFG_DATE               "mndt"
181
182 /** To represent FW version.*/
183 #define OC_RSRVD_FW_VERSION             "mnfv"
184
185 /** To represent host name.*/
186 #define OC_RSRVD_HOST_NAME              "hn"
187
188 /** To represent policy.*/
189 #define OC_RSRVD_POLICY                 "p"
190
191 /** To represent bitmap.*/
192 #define OC_RSRVD_BITMAP                 "bm"
193
194 /** For security.*/
195 #define OC_RSRVD_SECURE                 "sec"
196
197 /** Port. */
198 #define OC_RSRVD_HOSTING_PORT           "port"
199
200 /** For Server instance ID.*/
201 #define OC_RSRVD_SERVER_INSTANCE_ID     "sid"
202
203 /**
204  *  Platform.
205  */
206
207 /** Platform ID. */
208 #define OC_RSRVD_PLATFORM_ID            "pi"
209
210 /** Platform MFG NAME. */
211 #define OC_RSRVD_MFG_NAME               "mnmn"
212
213 /** Platform URL. */
214 #define OC_RSRVD_MFG_URL                "mnml"
215
216 /** Model Number.*/
217 #define OC_RSRVD_MODEL_NUM              "mnmo"
218
219 /** Platform MFG Date.*/
220 #define OC_RSRVD_MFG_DATE               "mndt"
221
222 /** Platform versio.n */
223 #define OC_RSRVD_PLATFORM_VERSION       "mnpv"
224
225 /** Platform Operating system version. */
226 #define OC_RSRVD_OS_VERSION             "mnos"
227
228 /** Platform Hardware version. */
229 #define OC_RSRVD_HARDWARE_VERSION       "mnhw"
230
231 /**Platform Firmware version. */
232 #define OC_RSRVD_FIRMWARE_VERSION       "mnfv"
233
234 /** Support URL for the platform. */
235 #define OC_RSRVD_SUPPORT_URL            "mnsl"
236
237 /** System time for the platform. */
238 #define OC_RSRVD_SYSTEM_TIME             "st"
239
240 /**
241  *  Device.
242  */
243
244 /** Device ID.*/
245 #define OC_RSRVD_DEVICE_ID              "di"
246
247 /** Device Name.*/
248 #define OC_RSRVD_DEVICE_NAME            "n"
249
250 /** Device specification version.*/
251 #define OC_RSRVD_SPEC_VERSION           "icv"
252
253 /** Device data model.*/
254 #define OC_RSRVD_DATA_MODEL_VERSION     "dmv"
255
256 /** Device specification version.*/
257 #define OC_SPEC_VERSION                "core.1.0.0"
258
259 /** Device Data Model version.*/
260 #define OC_DATA_MODEL_VERSION          "res.1.0.0"
261
262 /**
263  *  These provide backward compatibility - their use is deprecated.
264  */
265 #ifndef GOING_AWAY
266
267 /** Multicast Prefix.*/
268 #define OC_MULTICAST_PREFIX                  "224.0.1.187:5683"
269
270 /** Multicast IP address.*/
271 #define OC_MULTICAST_IP                      "224.0.1.187"
272
273 /** Multicast Port.*/
274 #define OC_MULTICAST_PORT                    5683
275 #endif // GOING_AWAY
276
277 /** Max Device address size. */
278 #ifdef RA_ADAPTER
279 #define MAX_ADDR_STR_SIZE (256)
280 #else
281 /** Max Address could be "coap+tcp://[xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx]:xxxxx" */
282 #define MAX_ADDR_STR_SIZE (59)
283 #endif
284
285 /** Length of MAC address */
286 #define MAC_ADDR_STR_SIZE (17)
287
288 /** Blocks of MAC address */
289 #define MAC_ADDR_BLOCKS (6)
290
291 /** Max identity size. */
292 #define MAX_IDENTITY_SIZE (32)
293
294 /** Universal unique identity size. */
295 #define UUID_IDENTITY_SIZE (128/8)
296
297 /** Resource Directory */
298
299 /** Resource Directory URI used to Discover RD and Publish resources.*/
300 #define OC_RSRVD_RD_URI                  "/oic/rd"
301
302 /** To represent resource type with rd.*/
303 #define OC_RSRVD_RESOURCE_TYPE_RD        "oic.wk.rd"
304
305 /** RD Discovery bias factor type. */
306 #define OC_RSRVD_RD_DISCOVERY_SEL        "sel"
307
308 /** Base URI. */
309 #define OC_RSRVD_BASE_URI                "baseURI"
310
311 /** Unique value per collection/link. */
312 #define OC_RSRVD_INS                     "ins"
313
314 /** Allowable resource types in the links. */
315 #define OC_RSRVD_RTS                     "rts"
316
317 /** Default relationship. */
318 #define OC_RSRVD_DREL                    "drel"
319
320 /** Defines relationship between links. */
321 #define OC_RSRVD_REL                     "rel"
322
323 /** Defines title. */
324 #define OC_RSRVD_TITLE                   "title"
325
326 /** Defines URI. */
327 #define OC_RSRVD_URI                     "uri"
328
329 /** Defines media type. */
330 #define OC_RSRVD_MEDIA_TYPE              "mt"
331
332 /** To represent resource type with Publish RD.*/
333 #define OC_RSRVD_RESOURCE_TYPE_RDPUBLISH "oic.wk.rdpub"
334
335 /**
336  * These enums (OCTransportAdapter and OCTransportFlags) must
337  * be kept synchronized with OCConnectivityType (below) as well as
338  * CATransportAdapter and CATransportFlags (in CACommon.h).
339  */
340 typedef enum
341 {
342     /** value zero indicates discovery.*/
343     OC_DEFAULT_ADAPTER = 0,
344
345     /** IPv4 and IPv6, including 6LoWPAN.*/
346     OC_ADAPTER_IP           = (1 << 0),
347
348     /** GATT over Bluetooth LE.*/
349     OC_ADAPTER_GATT_BTLE    = (1 << 1),
350
351     /** RFCOMM over Bluetooth EDR.*/
352     OC_ADAPTER_RFCOMM_BTEDR = (1 << 2),
353 #ifdef RA_ADAPTER
354     /**Remote Access over XMPP.*/
355     OC_ADAPTER_REMOTE_ACCESS = (1 << 3),
356 #endif
357     /** CoAP over TCP.*/
358     OC_ADAPTER_TCP           = (1 << 4),
359
360     /** NFC Transport for Messaging.*/
361     OC_ADAPTER_NFC           = (1 << 5)
362 } OCTransportAdapter;
363
364 /**
365  *  Enum layout assumes some targets have 16-bit integer (e.g., Arduino).
366  */
367 typedef enum
368 {
369     /** default flag is 0*/
370     OC_DEFAULT_FLAGS = 0,
371
372     /** Insecure transport is the default (subject to change).*/
373     /** secure the transport path*/
374     OC_FLAG_SECURE     = (1 << 4),
375
376     /** IPv4 & IPv6 auto-selection is the default.*/
377     /** IP adapter only.*/
378     OC_IP_USE_V6       = (1 << 5),
379
380     /** IP adapter only.*/
381     OC_IP_USE_V4       = (1 << 6),
382
383     /** internal use only.*/
384     OC_RESERVED1       = (1 << 7),   // internal use only
385
386     /** Link-Local multicast is the default multicast scope for IPv6.
387      *  These are placed here to correspond to the IPv6 multicast address bits.*/
388
389     /** IPv6 Interface-Local scope (loopback).*/
390     OC_SCOPE_INTERFACE = 0x1,
391
392     /** IPv6 Link-Local scope (default).*/
393     OC_SCOPE_LINK      = 0x2,
394
395     /** IPv6 Realm-Local scope. */
396     OC_SCOPE_REALM     = 0x3,
397
398     /** IPv6 Admin-Local scope. */
399     OC_SCOPE_ADMIN     = 0x4,
400
401     /** IPv6 Site-Local scope. */
402     OC_SCOPE_SITE      = 0x5,
403
404     /** IPv6 Organization-Local scope. */
405     OC_SCOPE_ORG       = 0x8,
406
407     /**IPv6 Global scope. */
408     OC_SCOPE_GLOBAL    = 0xE,
409
410 } OCTransportFlags;
411
412 /** Bit mask for scope.*/
413 #define OC_MASK_SCOPE    (0x000F)
414
415 /** Bit mask for Mods.*/
416 #define OC_MASK_MODS     (0x0FF0)
417 #define OC_MASK_FAMS     (OC_IP_USE_V6|OC_IP_USE_V4)
418
419 typedef struct OCStringLL
420 {
421     struct OCStringLL *next;
422     char* value;
423 } OCStringLL;
424
425 /**
426  * End point identity.
427  */
428 typedef struct
429 {
430     /** Identity Length */
431     uint16_t id_length;
432
433     /** Array of end point identity.*/
434     unsigned char id[MAX_IDENTITY_SIZE];
435 } OCIdentity;
436
437 /**
438  * Universally unique identifier.
439  */
440 typedef struct
441 {
442     /** identitifier string.*/
443     unsigned char id[UUID_IDENTITY_SIZE];
444 } OCUUIdentity;
445
446 /**
447  * Data structure to encapsulate IPv4/IPv6/Contiki/lwIP device addresses.
448  * OCDevAddr must be the same as CAEndpoint (in CACommon.h).
449  */
450 typedef struct
451 {
452     /** adapter type.*/
453     OCTransportAdapter      adapter;
454
455     /** transport modifiers.*/
456     OCTransportFlags        flags;
457
458     /** for IP.*/
459     uint16_t                port;
460
461     /** address for all adapters.*/
462     char                    addr[MAX_ADDR_STR_SIZE];
463
464     /** usually zero for default interface.*/
465     uint32_t                interface;
466 #if defined (ROUTING_GATEWAY) || defined (ROUTING_EP)
467     char                    routeData[MAX_ADDR_STR_SIZE]; //destination GatewayID:ClientId
468 #endif
469 } OCDevAddr;
470
471 /**
472  * This enum type includes elements of both ::OCTransportAdapter and ::OCTransportFlags.
473  * It is defined conditionally because the smaller definition limits expandability on 32/64 bit
474  * integer machines, and the larger definition won't fit into an enum on 16-bit integer machines
475  * like Arduino.
476  *
477  * This structure must directly correspond to ::OCTransportAdapter and ::OCTransportFlags.
478  */
479 typedef enum
480 {
481     /** use when defaults are ok. */
482     CT_DEFAULT = 0,
483
484     /** IPv4 and IPv6, including 6LoWPAN.*/
485     CT_ADAPTER_IP           = (1 << 16),
486
487     /** GATT over Bluetooth LE.*/
488     CT_ADAPTER_GATT_BTLE    = (1 << 17),
489
490     /** RFCOMM over Bluetooth EDR.*/
491     CT_ADAPTER_RFCOMM_BTEDR = (1 << 18),
492
493 #ifdef RA_ADAPTER
494     /** Remote Access over XMPP.*/
495     CT_ADAPTER_REMOTE_ACCESS = (1 << 19),
496 #endif
497     /** CoAP over TCP.*/
498     CT_ADAPTER_TCP     = (1 << 20),
499
500     /** NFC Transport.*/
501     CT_ADAPTER_NFC     = (1 << 21),
502
503     /** Insecure transport is the default (subject to change).*/
504
505     /** secure the transport path.*/
506     CT_FLAG_SECURE     = (1 << 4),
507
508     /** IPv4 & IPv6 autoselection is the default.*/
509
510     /** IP adapter only.*/
511     CT_IP_USE_V6       = (1 << 5),
512
513     /** IP adapter only.*/
514     CT_IP_USE_V4       = (1 << 6),
515
516     /** Link-Local multicast is the default multicast scope for IPv6.
517      * These are placed here to correspond to the IPv6 address bits.*/
518
519     /** IPv6 Interface-Local scope(loopback).*/
520     CT_SCOPE_INTERFACE = 0x1,
521
522     /** IPv6 Link-Local scope (default).*/
523     CT_SCOPE_LINK      = 0x2,
524
525     /** IPv6 Realm-Local scope.*/
526     CT_SCOPE_REALM     = 0x3,
527
528     /** IPv6 Admin-Local scope.*/
529     CT_SCOPE_ADMIN     = 0x4,
530
531     /** IPv6 Site-Local scope.*/
532     CT_SCOPE_SITE      = 0x5,
533
534     /** IPv6 Organization-Local scope.*/
535     CT_SCOPE_ORG       = 0x8,
536
537     /** IPv6 Global scope.*/
538     CT_SCOPE_GLOBAL    = 0xE,
539 } OCConnectivityType;
540
541 /** bit shift required for connectivity adapter.*/
542 #define CT_ADAPTER_SHIFT 16
543
544 /** Mask Flag.*/
545 #define CT_MASK_FLAGS 0xFFFF
546
547 /** Mask Adapter.*/
548 #define CT_MASK_ADAPTER 0xFFFF0000
549
550 /**
551  *  OCDoResource methods to dispatch the request
552  */
553 typedef enum
554 {
555     OC_REST_NOMETHOD       = 0,
556
557     /** Read.*/
558     OC_REST_GET            = (1 << 0),
559
560     /** Write.*/
561     OC_REST_PUT            = (1 << 1),
562
563     /** Update.*/
564     OC_REST_POST           = (1 << 2),
565
566     /** Delete.*/
567     OC_REST_DELETE         = (1 << 3),
568
569     /** Register observe request for most up date notifications ONLY.*/
570     OC_REST_OBSERVE        = (1 << 4),
571
572     /** Register observe request for all notifications, including stale notifications.*/
573     OC_REST_OBSERVE_ALL    = (1 << 5),
574
575     /** De-register observation, intended for internal use.*/
576     OC_REST_CANCEL_OBSERVE = (1 << 6),
577
578     #ifdef WITH_PRESENCE
579     /** Subscribe for all presence notifications of a particular resource.*/
580     OC_REST_PRESENCE       = (1 << 7),
581
582     #endif
583     /** Allows OCDoResource caller to do discovery.*/
584     OC_REST_DISCOVER       = (1 << 8)
585 } OCMethod;
586
587 /**
588  *  Formats for payload encoding.
589  */
590 typedef enum
591 {
592     OC_FORMAT_CBOR,
593     OC_FORMAT_UNDEFINED,
594     OC_FORMAT_UNSUPPORTED,
595 } OCPayloadFormat;
596
597 /**
598  * Host Mode of Operation.
599  */
600 typedef enum
601 {
602     OC_CLIENT = 0,
603     OC_SERVER,
604     OC_CLIENT_SERVER,
605     OC_GATEWAY          /**< Client server mode along with routing capabilities.*/
606 } OCMode;
607
608 /**
609  * Quality of Service attempts to abstract the guarantees provided by the underlying transport
610  * protocol. The precise definitions of each quality of service level depend on the
611  * implementation. In descriptions below are for the current implementation and may changed
612  * over time.
613  */
614 typedef enum
615 {
616     /** Packet delivery is best effort.*/
617     OC_LOW_QOS = 0,
618
619     /** Packet delivery is best effort.*/
620     OC_MEDIUM_QOS,
621
622     /** Acknowledgments are used to confirm delivery.*/
623     OC_HIGH_QOS,
624
625     /** No Quality is defined, let the stack decide.*/
626     OC_NA_QOS
627 } OCQualityOfService;
628
629 /**
630  * Resource Properties.
631  * The value of a policy property is defined as bitmap.
632  * The LSB represents OC_DISCOVERABLE and Second LSB bit represents OC_OBSERVABLE and so on.
633  * Not including the policy property is equivalent to zero.
634  *
635  */
636 typedef enum
637 {
638     /** When none of the bits are set, the resource is non-discoverable &
639      *  non-observable by the client.*/
640     OC_RES_PROP_NONE = (0),
641
642     /** When this bit is set, the resource is allowed to be discovered by clients.*/
643     OC_DISCOVERABLE  = (1 << 0),
644
645     /** When this bit is set, the resource is allowed to be observed by clients.*/
646     OC_OBSERVABLE    = (1 << 1),
647
648     /** When this bit is set, the resource is initialized, otherwise the resource
649      *  is 'inactive'. 'inactive' signifies that the resource has been marked for
650      *  deletion or is already deleted.*/
651     OC_ACTIVE        = (1 << 2),
652
653     /** When this bit is set, the resource has been marked as 'slow'.
654      * 'slow' signifies that responses from this resource can expect delays in
655      *  processing its requests from clients.*/
656     OC_SLOW          = (1 << 3),
657
658     /** When this bit is set, the resource is a secure resource.*/
659     OC_SECURE        = (1 << 4),
660
661     /** When this bit is set, the resource is allowed to be discovered only
662      *  if discovery request contains an explicit querystring.
663      *  Ex: GET /oic/res?rt=oic.sec.acl */
664     OC_EXPLICIT_DISCOVERABLE   = (1 << 5)
665 } OCResourceProperty;
666
667 /**
668  * Transport Protocol IDs.
669  */
670 typedef enum
671 {
672     /** For invalid ID.*/
673     OC_INVALID_ID   = (1 << 0),
674
675     /* For coap ID.*/
676     OC_COAP_ID      = (1 << 1)
677 } OCTransportProtocolID;
678
679 /**
680  * Declares Stack Results & Errors.
681  */
682 typedef enum
683 {
684     /** Success status code - START HERE.*/
685     OC_STACK_OK = 0,
686     OC_STACK_RESOURCE_CREATED,
687     OC_STACK_RESOURCE_DELETED,
688     OC_STACK_CONTINUE,
689     /** Success status code - END HERE.*/
690
691     /** Error status code - START HERE.*/
692     OC_STACK_INVALID_URI = 20,
693     OC_STACK_INVALID_QUERY,
694     OC_STACK_INVALID_IP,
695     OC_STACK_INVALID_PORT,
696     OC_STACK_INVALID_CALLBACK,
697     OC_STACK_INVALID_METHOD,
698
699     /** Invalid parameter.*/
700     OC_STACK_INVALID_PARAM,
701     OC_STACK_INVALID_OBSERVE_PARAM,
702     OC_STACK_NO_MEMORY,
703     OC_STACK_COMM_ERROR,
704     OC_STACK_TIMEOUT,
705     OC_STACK_ADAPTER_NOT_ENABLED,
706     OC_STACK_NOTIMPL,
707
708     /** Resource not found.*/
709     OC_STACK_NO_RESOURCE,
710
711     /** e.g: not supported method or interface.*/
712     OC_STACK_RESOURCE_ERROR,
713     OC_STACK_SLOW_RESOURCE,
714     OC_STACK_DUPLICATE_REQUEST,
715
716     /** Resource has no registered observers.*/
717     OC_STACK_NO_OBSERVERS,
718     OC_STACK_OBSERVER_NOT_FOUND,
719     OC_STACK_VIRTUAL_DO_NOT_HANDLE,
720     OC_STACK_INVALID_OPTION,
721
722     /** The remote reply contained malformed data.*/
723     OC_STACK_MALFORMED_RESPONSE,
724     OC_STACK_PERSISTENT_BUFFER_REQUIRED,
725     OC_STACK_INVALID_REQUEST_HANDLE,
726     OC_STACK_INVALID_DEVICE_INFO,
727     OC_STACK_INVALID_JSON,
728
729     /** Request is not authorized by Resource Server. */
730     OC_STACK_UNAUTHORIZED_REQ,
731
732     /** Error code from PDM */
733     OC_STACK_PDM_IS_NOT_INITIALIZED,
734     OC_STACK_DUPLICATE_UUID,
735     OC_STACK_INCONSISTENT_DB,
736
737     /**
738      * Error code from OTM
739      * This error is pushed from DTLS interface when handshake failure happens
740      */
741     OC_STACK_AUTHENTICATION_FAILURE,
742
743     /** Insert all new error codes here!.*/
744     #ifdef WITH_PRESENCE
745     OC_STACK_PRESENCE_STOPPED = 128,
746     OC_STACK_PRESENCE_TIMEOUT,
747     OC_STACK_PRESENCE_DO_NOT_HANDLE,
748     #endif
749     /** ERROR in stack.*/
750     OC_STACK_ERROR = 255
751     /** Error status code - END HERE.*/
752 } OCStackResult;
753
754 /**
755  * Handle to an OCDoResource invocation.
756  */
757 typedef void * OCDoHandle;
758
759 /**
760  * Handle to an OCResource object owned by the OCStack.
761  */
762 typedef void * OCResourceHandle;
763
764 /**
765  * Handle to an OCRequest object owned by the OCStack.
766  */
767 typedef void * OCRequestHandle;
768
769 /**
770  * Unique identifier for each observation request. Used when observations are
771  * registered or de-registered. Used by entity handler to signal specific
772  * observers to be notified of resource changes.
773  * There can be maximum of 256 observations per server.
774  */
775 typedef uint8_t OCObservationId;
776
777 /**
778  * Action associated with observation.
779  */
780 typedef enum
781 {
782     /** To Register. */
783     OC_OBSERVE_REGISTER = 0,
784
785     /** To Deregister. */
786     OC_OBSERVE_DEREGISTER = 1,
787
788     /** Others. */
789     OC_OBSERVE_NO_OPTION = 2
790 } OCObserveAction;
791
792
793 /**
794  * Persistent storage handlers. An APP must provide OCPersistentStorage handler pointers
795  * when it calls OCRegisterPersistentStorageHandler.
796  * Persistent storage open handler points to default file path.
797  * It should check file path and whether the file is symbolic link or no.
798  * Application can point to appropriate SVR database path for it's IoTivity Server.
799  */
800 typedef struct {
801     /** Persistent storage file path.*/
802     FILE* (* open)(const char *path, const char *mode);
803
804     /** Persistent storage read handler.*/
805     size_t (* read)(void *ptr, size_t size, size_t nmemb, FILE *stream);
806
807     /** Persistent storage write handler.*/
808     size_t (* write)(const void *ptr, size_t size, size_t nmemb, FILE *stream);
809
810     /** Persistent storage close handler.*/
811     int (* close)(FILE *fp);
812
813     /** Persistent storage unlink handler.*/
814     int (* unlink)(const char *path);
815 } OCPersistentStorage;
816
817 /**
818  * Possible returned values from entity handler.
819  */
820 typedef struct
821 {
822     /** Action associated with observation request.*/
823     OCObserveAction action;
824
825     /** Identifier for observation being registered/deregistered.*/
826     OCObservationId obsId;
827 } OCObservationInfo;
828
829 /**
830  * Possible returned values from entity handler.
831  */
832 typedef enum
833 {
834     OC_EH_OK = 0,
835     OC_EH_ERROR,
836     OC_EH_RESOURCE_CREATED,
837     OC_EH_RESOURCE_DELETED,
838     OC_EH_SLOW,
839     OC_EH_FORBIDDEN,
840     OC_EH_RESOURCE_NOT_FOUND
841 } OCEntityHandlerResult;
842
843 /**
844  * This structure will be used to define the vendor specific header options to be included
845  * in communication packets.
846  */
847 typedef struct OCHeaderOption
848 {
849     /** The protocol ID this option applies to.*/
850     OCTransportProtocolID protocolID;
851
852     /** The header option ID which will be added to communication packets.*/
853     uint16_t optionID;
854
855     /** its length 191.*/
856     uint16_t optionLength;
857
858     /** pointer to its data.*/
859     uint8_t optionData[MAX_HEADER_OPTION_DATA_LENGTH];
860
861 #ifdef SUPPORTS_DEFAULT_CTOR
862     OCHeaderOption() = default;
863     OCHeaderOption(OCTransportProtocolID pid,
864                    uint16_t optId,
865                    uint16_t optlen,
866                    const uint8_t* optData)
867         : protocolID(pid),
868           optionID(optId),
869           optionLength(optlen)
870     {
871
872         // parameter includes the null terminator.
873         optionLength = optionLength < MAX_HEADER_OPTION_DATA_LENGTH ?
874                         optionLength : MAX_HEADER_OPTION_DATA_LENGTH;
875         memcpy(optionData, optData, optionLength);
876         optionData[optionLength - 1] = '\0';
877     }
878 #endif
879 } OCHeaderOption;
880
881
882 /**
883  * This structure describes the platform properties. All non-Null properties will be
884  * included in a platform discovery request.
885  */
886 typedef struct
887 {
888     /** Platform ID.*/
889     char *platformID;
890
891     /** Manufacturer name.*/
892     char *manufacturerName;
893
894     /** Manufacturer URL for platform property.*/
895     char *manufacturerUrl;
896
897     /** Model number.*/
898     char *modelNumber;
899
900     /** Manufacturer date.*/
901     char *dateOfManufacture;
902
903     /** Platform version.*/
904     char *platformVersion;
905
906     /** Operating system version.*/
907     char *operatingSystemVersion;
908
909     /** HW version.*/
910     char *hardwareVersion;
911
912     /** FW version.*/
913     char *firmwareVersion;
914
915     /** Platform support URL.*/
916     char *supportUrl;
917
918     /** System time.*/
919     char *systemTime;
920
921 } OCPlatformInfo;
922
923 /**
924  * This structure is expected as input for device properties.
925  * device name is mandatory and expected from the application.
926  * device id of type UUID will be generated by the stack.
927  */
928 typedef struct
929 {
930     /** Pointer to the device name.*/
931     char *deviceName;
932     /** Pointer to the types.*/
933     OCStringLL *types;
934 } OCDeviceInfo;
935
936 #ifdef RA_ADAPTER
937 /**
938  * callback for bound JID
939  */
940 typedef void (*jid_bound_cb)(char *jid);
941
942 /**
943  * CA Remote Access information for XMPP Client
944  *
945  */
946 typedef struct
947 {
948     char *hostname;     /**< XMPP server hostname */
949     uint16_t   port;    /**< XMPP server serivce port */
950     char *xmpp_domain;  /**< XMPP login domain */
951     char *username;     /**< login username */
952     char *password;     /**< login password */
953     char *resource;     /**< specific resource for login */
954     char *user_jid;     /**< specific JID for login */
955     jid_bound_cb jidbound;  /**< callback when JID bound */
956 } OCRAInfo_t;
957 #endif  /* RA_ADAPTER */
958
959
960 /** Enum to describe the type of object held by the OCPayload object.*/
961 typedef enum
962 {
963     /** Contents of the payload are invalid */
964     PAYLOAD_TYPE_INVALID,
965     /** The payload is an OCDiscoveryPayload */
966     PAYLOAD_TYPE_DISCOVERY,
967     /** The payload is an OCDevicePayload */
968     PAYLOAD_TYPE_DEVICE,
969     /** The payload is an OCPlatformPayload */
970     PAYLOAD_TYPE_PLATFORM,
971     /** The payload is an OCRepPayload */
972     PAYLOAD_TYPE_REPRESENTATION,
973     /** The payload is an OCSecurityPayload */
974     PAYLOAD_TYPE_SECURITY,
975     /** The payload is an OCPresencePayload */
976     PAYLOAD_TYPE_PRESENCE,
977     /** The payload is an OCRDPayload */
978     PAYLOAD_TYPE_RD
979 } OCPayloadType;
980
981 /**
982  * A generic struct representing a payload returned from a resource operation
983  *
984  * A pointer to OCPayLoad can be cast to a more specific struct to access members
985  * for the its type.
986  */
987 typedef struct
988 {
989     /** The type of message that was received */
990     OCPayloadType type;
991 } OCPayload;
992
993 typedef enum
994 {
995     OCREP_PROP_NULL,
996     OCREP_PROP_INT,
997     OCREP_PROP_DOUBLE,
998     OCREP_PROP_BOOL,
999     OCREP_PROP_STRING,
1000     OCREP_PROP_BYTE_STRING,
1001     OCREP_PROP_OBJECT,
1002     OCREP_PROP_ARRAY
1003 }OCRepPayloadPropType;
1004
1005 /** This structure will be used to represent a binary string for CBOR payloads.*/
1006 typedef struct
1007 {
1008     /** pointer to data bytes.*/
1009     uint8_t* bytes;
1010
1011     /** number of data bytes.*/
1012     size_t   len;
1013 } OCByteString;
1014
1015 #define MAX_REP_ARRAY_DEPTH 3
1016 typedef struct
1017 {
1018     OCRepPayloadPropType type;
1019     size_t dimensions[MAX_REP_ARRAY_DEPTH];
1020
1021     union
1022     {
1023         int64_t* iArray;
1024         double* dArray;
1025         bool* bArray;
1026         char** strArray;
1027
1028         /** pointer to ByteString array.*/
1029         OCByteString* ocByteStrArray;
1030
1031         struct OCRepPayload** objArray;
1032     };
1033 } OCRepPayloadValueArray;
1034
1035 typedef struct OCRepPayloadValue
1036 {
1037     char* name;
1038     OCRepPayloadPropType type;
1039     union
1040     {
1041         int64_t i;
1042         double d;
1043         bool b;
1044         char* str;
1045
1046         /** ByteString object.*/
1047         OCByteString ocByteStr;
1048
1049         struct OCRepPayload* obj;
1050         OCRepPayloadValueArray arr;
1051     };
1052     struct OCRepPayloadValue* next;
1053
1054 } OCRepPayloadValue;
1055
1056 // used for get/set/put/observe/etc representations
1057 typedef struct OCRepPayload
1058 {
1059     OCPayload base;
1060     char* uri;
1061     OCStringLL* types;
1062     OCStringLL* interfaces;
1063     OCRepPayloadValue* values;
1064     struct OCRepPayload* next;
1065 } OCRepPayload;
1066
1067 // used inside a discovery payload
1068 typedef struct OCResourcePayload
1069 {
1070     char* uri;
1071     OCStringLL* types;
1072     OCStringLL* interfaces;
1073     uint8_t bitmap;
1074     bool secure;
1075     uint16_t port;
1076     struct OCResourcePayload* next;
1077 } OCResourcePayload;
1078
1079 /**
1080  * Structure holding Links Payload. It is a sub-structure used in
1081  * OCResourceCollectionPayload.
1082  */
1083 typedef struct OCLinksPayload
1084 {
1085     /** This is the target relative URI. */
1086     char *href;
1087     /** Resource Type - A standard OIC specified or vendor defined resource
1088      * type of the resource referenced by the target URI. */
1089     OCStringLL *rt;
1090     /** Interface - The interfaces supported by the resource referenced by the target URI. */
1091     OCStringLL *itf;
1092     /** The relation of the target URI referenced by the link to the context URI;
1093      * The default value is null. */
1094     char *rel;
1095     /** Specifies if the resource referenced by the target URIis observable or not. */
1096     bool obs;
1097     /** A title for the link relation. Can be used by the UI to provide a context. */
1098     char *title;
1099     /** This is used to override the context URI e.g. override the URI of the containing collection. */
1100     char *uri;
1101     /** The instance identifier for this web link in an array of web links - used in links. */
1102     union
1103     {
1104         /** An ordinal number that is not repeated - must be unique in the collection context. */
1105         uint8_t ins;
1106         /** Any unique string including a URI. */
1107         char *uniqueStr;
1108         /** Use UUID for universal uniqueness - used in /oic/res to identify the device. */
1109         OCIdentity uniqueUUID;
1110     };
1111     /** A hint of the media type of the representation of the resource referenced by the target URI. */
1112     OCStringLL *mt;
1113     /** Holding address of the next resource. */
1114     struct OCLinksPayload *next;
1115 } OCLinksPayload;
1116
1117 /** Structure holding tags value of the links payload. */
1118 typedef struct
1119 {
1120     /** Name of tags. */
1121     OCDeviceInfo n;
1122     /** Device identifier. */
1123     OCIdentity di;
1124     /** The base URI where the resources are hold. */
1125     char *baseURI;
1126     /** Bitmap holds observable, discoverable, secure option flag.*/
1127     uint8_t bitmap;
1128     /** Port set in case, the secure flag is set above. */
1129     uint16_t port;
1130     /** Id for each set of links i.e. tag. */
1131     union
1132     {
1133         /** An ordinal number that is not repeated - must be unique in the collection context. */
1134         uint8_t ins;
1135         /** Any unique string including a URI. */
1136         char *uniqueStr;
1137         /** Use UUID for universal uniqueness - used in /oic/res to identify the device. */
1138         OCIdentity uniqueUUID;
1139     };
1140     /** Defines the list of allowable resource types (for Target and anchors) in links included
1141      * in the collection; new links being created can only be from this list. */
1142     char *rts;
1143     /** When specified this is the default relationship to use when an OIC Link does not specify
1144      * an explicit relationship with *rel* parameter. */
1145     char *drel;
1146     /** Time to keep holding resource.*/
1147     uint32_t ttl;
1148 } OCTagsPayload;
1149
1150 /** Resource collection payload. */
1151 typedef struct OCResourceCollectionPayload
1152 {
1153     /** Collection tags payload.*/
1154     OCTagsPayload *tags;
1155     /** Array of links payload. */
1156     OCLinksPayload *setLinks;
1157     /** Holding address of the next resource. */
1158     struct OCResourceCollectionPayload *next;
1159 } OCResourceCollectionPayload;
1160
1161 typedef struct
1162 {
1163     OCPayload base;
1164
1165     /** Device Id */
1166     char *sid;
1167
1168     /** A special case for handling RD address. */
1169     char* baseURI;
1170
1171     /** Name */
1172     char *name;
1173
1174     /** HREF */
1175     char *uri;
1176
1177     /** Resource Type */
1178     char *type;
1179
1180     /** Interface */
1181     OCStringLL *interface;
1182
1183     /** This structure holds the old /oic/res response. */
1184     OCResourcePayload *resources;
1185
1186 } OCDiscoveryPayload;
1187
1188 /**
1189  * Structure holding discovery payload.
1190  */
1191 typedef struct
1192 {
1193     /** Device Name. */
1194     OCDeviceInfo n;
1195     /** Device Identity. */
1196     OCIdentity di;
1197     /** Value holding the bias factor of the RD. */
1198     uint8_t sel;
1199 } OCRDDiscoveryPayload;
1200
1201 /**
1202  * RD Payload that will be transmitted over the wire.
1203  */
1204 typedef struct
1205 {
1206     OCPayload base;
1207     /** Pointer to the discovery response payload.*/
1208     OCRDDiscoveryPayload *rdDiscovery;
1209     /** Pointer to the publish payload.*/
1210     OCResourceCollectionPayload *rdPublish;
1211 } OCRDPayload;
1212
1213 typedef struct
1214 {
1215     OCPayload base;
1216     char *sid;
1217     char* deviceName;
1218     char* specVersion;
1219     char* dataModelVersion;
1220     OCStringLL *interfaces;
1221     OCStringLL *types;
1222 } OCDevicePayload;
1223
1224 typedef struct
1225 {
1226     OCPayload base;
1227     char* uri;
1228     OCPlatformInfo info;
1229     char* rt;
1230     OCStringLL* interfaces;
1231 } OCPlatformPayload;
1232
1233 typedef struct
1234 {
1235     OCPayload base;
1236     uint8_t* securityData;
1237     size_t payloadSize;
1238 } OCSecurityPayload;
1239
1240 #ifdef WITH_PRESENCE
1241 typedef struct
1242 {
1243     OCPayload base;
1244     uint32_t sequenceNumber;
1245     uint32_t maxAge;
1246     OCPresenceTrigger trigger;
1247     char* resourceType;
1248 } OCPresencePayload;
1249 #endif
1250
1251 /**
1252  * Incoming requests handled by the server. Requests are passed in as a parameter to the
1253  * OCEntityHandler callback API.
1254  * The OCEntityHandler callback API must be implemented in the application in order
1255  * to receive these requests.
1256  */
1257 typedef struct
1258 {
1259     /** Associated resource.*/
1260     OCResourceHandle resource;
1261
1262     /** Associated request handle.*/
1263     OCRequestHandle requestHandle;
1264
1265     /** the REST method retrieved from received request PDU.*/
1266     OCMethod method;
1267
1268     /** description of endpoint that sent the request.*/
1269     OCDevAddr devAddr;
1270
1271     /** resource query send by client.*/
1272     char * query;
1273
1274     /** Information associated with observation - valid only when OCEntityHandler flag includes
1275      * ::OC_OBSERVE_FLAG.*/
1276     OCObservationInfo obsInfo;
1277
1278     /** Number of the received vendor specific header options.*/
1279     uint8_t numRcvdVendorSpecificHeaderOptions;
1280
1281     /** Pointer to the array of the received vendor specific header options.*/
1282     OCHeaderOption * rcvdVendorSpecificHeaderOptions;
1283
1284     /** the payload from the request PDU.*/
1285     OCPayload *payload;
1286
1287 } OCEntityHandlerRequest;
1288
1289
1290 /**
1291  * Response from queries to remote servers. Queries are made by calling the OCDoResource API.
1292  */
1293 typedef struct
1294 {
1295     /** Address of remote server.*/
1296     OCDevAddr devAddr;
1297
1298     /** backward compatibility (points to devAddr).*/
1299     OCDevAddr *addr;
1300
1301     /** backward compatibility.*/
1302     OCConnectivityType connType;
1303
1304     /** the security identity of the remote server.*/
1305     OCIdentity identity;
1306
1307     /** the is the result of our stack, OCStackResult should contain coap/other error codes.*/
1308     OCStackResult result;
1309
1310     /** If associated with observe, this will represent the sequence of notifications from server.*/
1311     uint32_t sequenceNumber;
1312
1313     /** resourceURI.*/
1314     const char * resourceUri;
1315
1316     /** the payload for the response PDU.*/
1317     OCPayload *payload;
1318
1319     /** Number of the received vendor specific header options.*/
1320     uint8_t numRcvdVendorSpecificHeaderOptions;
1321
1322     /** An array of the received vendor specific header options.*/
1323     OCHeaderOption rcvdVendorSpecificHeaderOptions[MAX_HEADER_OPTIONS];
1324 } OCClientResponse;
1325
1326 /**
1327  * Request handle is passed to server via the entity handler for each incoming request.
1328  * Stack assigns when request is received, server sets to indicate what request response is for.
1329  */
1330 typedef struct
1331 {
1332     /** Request handle.*/
1333     OCRequestHandle requestHandle;
1334
1335     /** Resource handle.*/
1336     OCResourceHandle resourceHandle;
1337
1338     /** Allow the entity handler to pass a result with the response.*/
1339     OCEntityHandlerResult  ehResult;
1340
1341     /** This is the pointer to server payload data to be transferred.*/
1342     OCPayload* payload;
1343
1344     /** number of the vendor specific header options .*/
1345     uint8_t numSendVendorSpecificHeaderOptions;
1346
1347     /** An array of the vendor specific header options the entity handler wishes to use in response.*/
1348     OCHeaderOption sendVendorSpecificHeaderOptions[MAX_HEADER_OPTIONS];
1349
1350     /** URI of new resource that entity handler might create.*/
1351     char resourceUri[MAX_URI_LENGTH];
1352
1353     /** Server sets to true for persistent response buffer,false for non-persistent response buffer*/
1354     uint8_t persistentBufferFlag;
1355 } OCEntityHandlerResponse;
1356
1357 /**
1358  * Entity's state
1359  */
1360 typedef enum
1361 {
1362     /** Request state.*/
1363     OC_REQUEST_FLAG = (1 << 1),
1364     /** Observe state.*/
1365     OC_OBSERVE_FLAG = (1 << 2)
1366 } OCEntityHandlerFlag;
1367
1368 /**
1369  * Possible return values from client application callback
1370  *
1371  * A client application callback returns an OCStackApplicationResult to indicate whether
1372  * the stack should continue to keep the callback registered.
1373  */
1374 typedef enum
1375 {
1376     /** Make no more calls to the callback and call the OCClientContextDeleter for this callback */
1377     OC_STACK_DELETE_TRANSACTION = 0,
1378     /** Keep this callback registered and call it if an apropriate event occurs */
1379     OC_STACK_KEEP_TRANSACTION
1380 } OCStackApplicationResult;
1381
1382
1383 //#ifdef DIRECT_PAIRING
1384 /**
1385  * @brief   direct pairing Method Type.
1386  *              0:  not allowed
1387  *              1:  pre-configured pin
1388  *              2:  random pin
1389  */
1390 typedef enum OCPrm
1391 {
1392     DP_NOT_ALLOWED             = 0x0,
1393     DP_PRE_CONFIGURED        = (0x1 << 0),
1394     DP_RANDOM_PIN               = (0x1 << 1),
1395 } OCPrm_t;
1396
1397 /**
1398  * Device Information of discoverd direct pairing device(s).
1399  */
1400 typedef struct OCDPDev
1401 {
1402     OCDevAddr               endpoint;
1403     OCConnectivityType   connType;
1404     uint16_t                     securePort;
1405     bool                  edp;
1406     OCPrm_t           *prm;
1407     size_t                prmLen;
1408     OCUUIdentity     deviceID;
1409     OCUUIdentity     rowner;
1410     struct OCDPDev *next;
1411 } OCDPDev_t;
1412 //#endif // DIRECT_PAIRING
1413
1414 /*
1415  * -------------------------------------------------------------------------------------------
1416  * Callback function definitions
1417  * -------------------------------------------------------------------------------------------
1418  */
1419
1420 /**
1421  * Client applications implement this callback to consume responses received from Servers.
1422  */
1423 typedef OCStackApplicationResult (* OCClientResponseHandler)(void *context, OCDoHandle handle,
1424     OCClientResponse * clientResponse);
1425
1426 /**
1427  * Client applications using a context pointer implement this callback to delete the
1428  * context upon removal of the callback/context pointer from the internal callback-list.
1429  */
1430 typedef void (* OCClientContextDeleter)(void *context);
1431
1432 /**
1433  * This info is passed from application to OC Stack when initiating a request to Server.
1434  */
1435 typedef struct OCCallbackData
1436 {
1437     /** Pointer to the context.*/
1438     void *context;
1439
1440     /** The pointer to a function the stack will call to handle the requests.*/
1441     OCClientResponseHandler cb;
1442
1443     /** A pointer to a function to delete the context when this callback is removed.*/
1444     OCClientContextDeleter cd;
1445
1446 #ifdef SUPPORTS_DEFAULT_CTOR
1447     OCCallbackData() = default;
1448     OCCallbackData(void* ctx, OCClientResponseHandler callback, OCClientContextDeleter deleter)
1449         :context(ctx), cb(callback), cd(deleter){}
1450 #endif
1451 } OCCallbackData;
1452
1453 /**
1454  * Application server implementations must implement this callback to consume requests OTA.
1455  * Entity handler callback needs to fill the resPayload of the entityHandlerRequest.
1456  */
1457 typedef OCEntityHandlerResult (*OCEntityHandler)
1458 (OCEntityHandlerFlag flag, OCEntityHandlerRequest * entityHandlerRequest, void* callbackParam);
1459
1460 /**
1461  * Device Entity handler need to use this call back instead of OCEntityHandler.
1462  */
1463 typedef OCEntityHandlerResult (*OCDeviceEntityHandler)
1464 (OCEntityHandlerFlag flag, OCEntityHandlerRequest * entityHandlerRequest, char* uri, void* callbackParam);
1465
1466 //#ifdef DIRECT_PAIRING
1467 /**
1468  * Callback function definition of direct-pairing
1469  *
1470  * @param[OUT] peer - pairing device info.
1471  * @param[OUT} result - It's returned with 'OC_STACK_XXX'. It will return 'OC_STACK_OK'
1472  *                                   if D2D pairing is success without error
1473  */
1474 typedef void (*OCDirectPairingCB)(OCDPDev_t *peer, OCStackResult result);
1475 //#endif // DIRECT_PAIRING
1476
1477 #ifdef __cplusplus
1478 }
1479 #endif // __cplusplus
1480
1481 #endif /* OCTYPES_H_ */