[IOT-1209] Fix provisioningclient for Windows
authorDan Mihai <Daniel.Mihai@microsoft.com>
Mon, 8 Aug 2016 15:33:05 +0000 (08:33 -0700)
committerDave Thaler <dthaler@microsoft.com>
Sat, 27 Aug 2016 00:00:58 +0000 (00:00 +0000)
1. Include security provisioning code and data just in octbstack.dll,
   instead of duplicating it in provisioningclient.exe.

2. Use octbstack.def instead of dllexport/dllimport, because dllexport
   and dllimport are too fragile.

Change-Id: Ic96e249e71563824ae943883168cae2e56e10937
Signed-off-by: Dan Mihai <Daniel.Mihai@microsoft.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/9993
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Soemin Tjong <stjong@microsoft.com>
Reviewed-by: David Antler <david.a.antler@intel.com>
Reviewed-by: Dave Thaler <dthaler@microsoft.com>
15 files changed:
build_common/windows/SConscript
extlibs/cjson/cJSON.h
resource/c_common/platform_features.h
resource/csdk/SConscript
resource/csdk/octbstack_product.def [new file with mode: 0644]
resource/csdk/octbstack_test.def [new file with mode: 0644]
resource/csdk/security/provisioning/SConscript
resource/csdk/security/provisioning/sample/SConscript
resource/csdk/stack/include/internal/ocpayloadcbor.h
resource/csdk/stack/include/internal/ocstackinternal.h
resource/csdk/stack/include/ocpayload.h
resource/csdk/stack/include/ocstack.h
resource/csdk/stack/include/oicresourcedirectory.h
resource/csdk/stack/include/payload_logging.h
resource/oc_logger/SConscript

index 39e7fd2..48eee71 100644 (file)
@@ -23,9 +23,6 @@ if env['CC'] == 'cl':
 
     vs_version = env['MSVC_VERSION']
 
-    # Enable special exports for unit test purposes
-    if env.get('TEST') == '1':
-        env.AppendUnique(CPPDEFINES = ['ENABLE_TEST_EXPORTS'])
     # Set release/debug flags
     if env.get('RELEASE'):
         env.AppendUnique(CCFLAGS = ['/MD', '/O2', '/GF'])
index eef7b8b..ba92e29 100644 (file)
@@ -61,71 +61,71 @@ typedef struct cJSON_Hooks {
 } cJSON_Hooks;
 
 /* Supply malloc, realloc and free functions to cJSON */
-OC_EXPORT extern void cJSON_InitHooks(cJSON_Hooks* hooks);
+extern void cJSON_InitHooks(cJSON_Hooks* hooks);
 
 
 /* Supply a block of JSON, and this returns a cJSON object you can interrogate. Call cJSON_Delete when finished. */
-OC_EXPORT extern cJSON *cJSON_Parse(const char *value);
+extern cJSON *cJSON_Parse(const char *value);
 /* Render a cJSON entity to text for transfer/storage. Free the char* when finished. */
-OC_EXPORT extern char  *cJSON_Print(cJSON *item);
+extern char  *cJSON_Print(cJSON *item);
 /* Render a cJSON entity to text for transfer/storage without any formatting. Free the char* when finished. */
-OC_EXPORT extern char  *cJSON_PrintUnformatted(cJSON *item);
+extern char  *cJSON_PrintUnformatted(cJSON *item);
 /* Delete a cJSON entity and all subentities. */
-OC_EXPORT extern void   cJSON_Delete(cJSON *c);
+extern void   cJSON_Delete(cJSON *c);
 
 /* Returns the number of items in an array (or object). */
-OC_EXPORT extern int     cJSON_GetArraySize(cJSON *array);
+extern int       cJSON_GetArraySize(cJSON *array);
 /* Retrieve item number "item" from array "array". Returns NULL if unsuccessful. */
-OC_EXPORT extern cJSON *cJSON_GetArrayItem(cJSON *array,int item);
+extern cJSON *cJSON_GetArrayItem(cJSON *array,int item);
 /* Get item "string" from object. Case insensitive. */
-OC_EXPORT extern cJSON *cJSON_GetObjectItem(cJSON *object,const char *string);
+extern cJSON *cJSON_GetObjectItem(cJSON *object,const char *string);
 
 /* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */
-OC_EXPORT extern const char *cJSON_GetErrorPtr(void);
+extern const char *cJSON_GetErrorPtr(void);
 
 /* These calls create a cJSON item of the appropriate type. */
-OC_EXPORT extern cJSON *cJSON_CreateNull(void);
-OC_EXPORT extern cJSON *cJSON_CreateTrue(void);
-OC_EXPORT extern cJSON *cJSON_CreateFalse(void);
-OC_EXPORT extern cJSON *cJSON_CreateBool(int b);
-OC_EXPORT extern cJSON *cJSON_CreateNumber(double num);
-OC_EXPORT extern cJSON *cJSON_CreateString(const char *string);
-OC_EXPORT extern cJSON *cJSON_CreateArray(void);
-OC_EXPORT extern cJSON *cJSON_CreateObject(void);
+extern cJSON *cJSON_CreateNull(void);
+extern cJSON *cJSON_CreateTrue(void);
+extern cJSON *cJSON_CreateFalse(void);
+extern cJSON *cJSON_CreateBool(int b);
+extern cJSON *cJSON_CreateNumber(double num);
+extern cJSON *cJSON_CreateString(const char *string);
+extern cJSON *cJSON_CreateArray(void);
+extern cJSON *cJSON_CreateObject(void);
 
 /* These utilities create an Array of count items. */
-OC_EXPORT extern cJSON *cJSON_CreateIntArray(const int *numbers,int count);
-OC_EXPORT extern cJSON *cJSON_CreateFloatArray(const float *numbers,int count);
-OC_EXPORT extern cJSON *cJSON_CreateDoubleArray(const double *numbers,int count);
-OC_EXPORT extern cJSON *cJSON_CreateStringArray(const char **strings,int count);
+extern cJSON *cJSON_CreateIntArray(const int *numbers,int count);
+extern cJSON *cJSON_CreateFloatArray(const float *numbers,int count);
+extern cJSON *cJSON_CreateDoubleArray(const double *numbers,int count);
+extern cJSON *cJSON_CreateStringArray(const char **strings,int count);
 
 /* Append item to the specified array/object. */
-OC_EXPORT extern void cJSON_AddItemToArray(cJSON *array, cJSON *item);
-OC_EXPORT extern void  cJSON_AddItemToObject(cJSON *object,const char *string,cJSON *item);
+extern void cJSON_AddItemToArray(cJSON *array, cJSON *item);
+extern void    cJSON_AddItemToObject(cJSON *object,const char *string,cJSON *item);
 /* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */
-OC_EXPORT extern void cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item);
-OC_EXPORT extern void  cJSON_AddItemReferenceToObject(cJSON *object,const char *string,cJSON *item);
+extern void cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item);
+extern void    cJSON_AddItemReferenceToObject(cJSON *object,const char *string,cJSON *item);
 
 /* Remove/Detatch items from Arrays/Objects. */
-OC_EXPORT extern cJSON *cJSON_DetachItemFromArray(cJSON *array,int which);
-OC_EXPORT extern void   cJSON_DeleteItemFromArray(cJSON *array,int which);
-OC_EXPORT extern cJSON *cJSON_DetachItemFromObject(cJSON *object,const char *string);
-OC_EXPORT extern void   cJSON_DeleteItemFromObject(cJSON *object,const char *string);
+extern cJSON *cJSON_DetachItemFromArray(cJSON *array,int which);
+extern void   cJSON_DeleteItemFromArray(cJSON *array,int which);
+extern cJSON *cJSON_DetachItemFromObject(cJSON *object,const char *string);
+extern void   cJSON_DeleteItemFromObject(cJSON *object,const char *string);
 
 /* Update array items. */
-OC_EXPORT extern void cJSON_ReplaceItemInArray(cJSON *array,int which,cJSON *newitem);
-OC_EXPORT extern void cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem);
+extern void cJSON_ReplaceItemInArray(cJSON *array,int which,cJSON *newitem);
+extern void cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem);
 
 /* Duplicate a cJSON item */
-OC_EXPORT extern cJSON *cJSON_Duplicate(cJSON *item,int recurse);
+extern cJSON *cJSON_Duplicate(cJSON *item,int recurse);
 /* Duplicate will create a new, identical cJSON item to the one you pass, in new memory that will
 need to be released. With recurse!=0, it will duplicate any children connected to the item.
 The item->next and ->prev pointers are always zero on return from Duplicate. */
 
 /* ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. */
-OC_EXPORT extern cJSON *cJSON_ParseWithOpts(const char *value,const char **return_parse_end,int require_null_terminated);
+extern cJSON *cJSON_ParseWithOpts(const char *value,const char **return_parse_end,int require_null_terminated);
 
-OC_EXPORT extern void cJSON_Minify(char *json);
+extern void cJSON_Minify(char *json);
 
 /* Macros for creating things quickly. */
 #define cJSON_AddNullToObject(object,name)             cJSON_AddItemToObject(object, name, cJSON_CreateNull())
index 4335e49..3af42cd 100644 (file)
 #endif
 
 #ifdef _MSC_VER
-#  ifdef OC_EXPORT_DLL
-#    define OC_EXPORT __declspec(dllexport)
-#  else
-#    define OC_EXPORT __declspec(dllimport)
-#  endif
-#  ifdef ENABLE_TEST_EXPORTS
-#    define OC_EXPORT_TEST OC_EXPORT
-#  else
-#    define OC_EXPORT_TEST
-#  endif
 #  define OC_ANNOTATE_UNUSED
 #else
 #  define OC_ANNOTATE_UNUSED  __attribute__((unused))
-#  define OC_EXPORT
-#  define OC_EXPORT_TEST
 #endif
 
 #ifdef _WIN32
index 194d03d..7c5224e 100644 (file)
@@ -99,7 +99,16 @@ if target_os in ['android', 'linux', 'tizen', 'msys_nt', 'windows']:
                        liboctbstack_env.AppendUnique(LIBS = ['ra_xmpp'])
 
 if target_os in ['windows', 'msys_nt']:
-       liboctbstack_env.AppendUnique(CPPDEFINES  = ['OC_EXPORT_DLL'])
+       # octbstack.dll is exporting ocpmapi APIs on Windows - there is no ocpmapi.dll.
+       liboctbstack_env.PrependUnique(LIBS = ['ocpmapi'])
+
+       # octbstack.def specifies the list of functions exported by octbstack.dll.
+       liboctbstack_env.Replace(WINDOWS_INSERT_DEF = ['1'])
+       if env.get('TEST') == '1':
+               liboctbstack_env.Textfile(target = 'octbstack.def', source = [File('octbstack_product.def'), File('octbstack_test.def')])
+       else:
+               liboctbstack_env.Textfile(target = 'octbstack.def', source = [File('octbstack_product.def')])
+
        liboctbstack_env.AppendUnique(LIBS = ['ws2_32', 'advapi32', 'iphlpapi'])
 else:
        liboctbstack_env.AppendUnique(LIBS = ['m'])
@@ -163,12 +172,12 @@ if with_tcp == True:
 
 liboctbstack_src.extend(env['cbor_files'])
 
-if target_os == 'windows':
-       liboctbstack_env.AppendUnique(CPPDEFINES = ['CBOR_API=__declspec(dllexport)',
-                                                   'CBOR_PRIVATE_API=__declspec(dllexport)'
-    ])
+if target_os in ['windows', 'msys_nt']:
+       # Avoid a name conflict with the octbstack.lib target of the SharedLibrary.
+       static_liboctbstack = liboctbstack_env.StaticLibrary('octbstack_static', liboctbstack_src)
+else:
+       static_liboctbstack = liboctbstack_env.StaticLibrary('octbstack', liboctbstack_src)
 
-static_liboctbstack = liboctbstack_env.StaticLibrary('octbstack', liboctbstack_src)
 octbstack_libs = Flatten(static_liboctbstack)
 
 if target_os not in ['arduino','darwin','ios'] :
diff --git a/resource/csdk/octbstack_product.def b/resource/csdk/octbstack_product.def
new file mode 100644 (file)
index 0000000..47b95d9
--- /dev/null
@@ -0,0 +1,134 @@
+LIBRARY octbstack
+
+EXPORTS
+
+; Windows octbstack.dll exports that are required for both products and tests.
+
+_cbor_value_decode_int64_internal
+_cbor_value_dup_string
+cbor_encode_byte_string
+cbor_encode_int
+cbor_encode_simple_value
+cbor_encode_text_string
+cbor_encoder_close_container
+cbor_encoder_create_array
+cbor_encoder_create_map
+cbor_encoder_init
+cbor_error_string
+cbor_parser_init
+cbor_value_advance
+cbor_value_enter_container
+cbor_value_map_find_value
+
+cJSON_Parse
+cJSON_GetObjectItem
+cJSON_GetArraySize
+cJSON_GetArrayItem
+
+calcDimTotal
+ConvertStrToUuid
+convertTriggerEnumToString
+CreateJustWorksOwnerTransferPayload
+CreateJustWorksSelectOxmPayload
+CreatePinBasedSelectOxmPayload
+CreatePinBasedOwnerTransferPayload
+CreateSecureSessionJustWorksCallback
+CreateSecureSessionRandomPinCallback
+InputPinCodeCallback
+LoadSecretJustWorksCallback
+
+OCBindResource
+OCBindResourceHandler
+OCBindResourceInsToResource
+OCBindResourceInterfaceToResource
+OCBindResourceTypeToResource
+OCCancel
+OCCreateOCStringLL
+OCCreateResource
+OCDeleteACLList
+OCDeleteDiscoveredDevices
+OCDeletePdAclList
+OCDeleteResource
+OCDeleteUuidList
+OCDiscoverDirectPairingDevices
+OCDiscoverUnownedDevices
+OCDiscoverOwnedDevices
+OCDoDirectPairing
+OCDoOwnershipTransfer
+OCDoResource
+OCDoResponse
+OCFreeOCStringLL
+OCGetACLResource
+OCGetCredResource
+OCGetDevInfoFromNetwork
+OCGetDirectPairedDevices
+OCGetLinkedStatus
+OCGetNumberOfResources
+OCGetNumberOfResourceInterfaces
+OCGetNumberOfResourceTypes
+OCGetResourceHandle
+OCGetResourceHandleAtUri
+OCGetResourceHandleFromCollection
+OCGetResourceHandler
+OCGetResourceInterfaceName
+OCGetResourceProperties
+OCGetResourceTypeName
+OCGetResourceUri
+OCGetServerInstanceIDString
+OCInit
+OCInit1
+OCInitPM
+OCNotifyAllObservers
+OCNotifyListOfObservers
+OCPayloadDestroy
+OCProcess
+OCProvisionACL
+OCProvisionCredentials
+OCProvisionDirectPairing
+OCProvisionPairwiseDevices
+OCRDDelete
+OCRDDeleteWithDeviceId
+OCRDPublish
+OCRDPublishWithDeviceId
+OCRegisterPersistentStorageHandler
+OCRemoveDevice
+OCRemoveDeviceWithUuid
+OCRepPayloadAddInterface
+OCRepPayloadAddResourceType
+OCRepPayloadAppend
+OCRepPayloadClone
+OCRepPayloadCreate
+OCRepPayloadDestroy
+OCRepPayloadGetByteStringArray
+OCRepPayloadGetPropBool
+OCRepPayloadGetPropByteString
+OCRepPayloadGetPropInt
+OCRepPayloadSetByteStringArray
+OCRepPayloadSetDoubleArrayAsOwner
+OCRepPayloadSetIntArrayAsOwner
+OCRepPayloadSetBoolArrayAsOwner
+OCRepPayloadSetNull
+OCRepPayloadSetPropBool
+OCRepPayloadSetPropDouble
+OCRepPayloadSetPropByteString
+OCRepPayloadSetPropInt
+OCRepPayloadSetPropObjectArrayAsOwner
+OCRepPayloadSetPropObjectAsOwner
+OCRepPayloadSetPropString
+OCRepPayloadSetStringArrayAsOwner
+OCRepPayloadSetUri
+OCResetDevice
+OCResourcePayloadAddStringLL
+OCSecurityPayloadCreate
+OCSetDefaultDeviceEntityHandler
+OCSetDeviceInfo
+OCSetOwnerTransferCallbackData
+OCSetPlatformInfo
+OCStartPresence
+OCStop
+OCStopPresence
+OCUnBindResource
+OCUnlinkDevices
+
+SetGeneratePinCB
+SetInputPinCB
diff --git a/resource/csdk/octbstack_test.def b/resource/csdk/octbstack_test.def
new file mode 100644 (file)
index 0000000..b698b9f
--- /dev/null
@@ -0,0 +1,6 @@
+; Windows octbstack.dll exports that are required just for tests.
+
+encodeAddressForRFC6874
+
+OCConvertPayload
+OCParsePayload
index d5ab9e1..96d59f3 100644 (file)
@@ -107,9 +107,8 @@ provisioning_src = [
 if target_os != 'tizen':
        provisioning_src = provisioning_src + [root_dir+'/extlibs/sqlite3/sqlite3.c' ]
 
-if target_os == 'windows':
-       # TODO: Add OC_EXPORT annotations and enable generation of Windows DLL
-       # https://jira.iotivity.org/browse/IOT-1188
+if target_os in ['windows', 'msys_nt']:
+       # octbstack.dll is exporting ocpmapi APIs on Windows - there is no ocpmapi.dll.
        provisioningserver = provisioning_env.StaticLibrary('ocpmapi', provisioning_src)
 else:
        provisioningserver = provisioning_env.SharedLibrary('ocpmapi', provisioning_src)
index cfbba58..23818ff 100644 (file)
@@ -66,7 +66,11 @@ else:
        provisioning_env.AppendUnique(LIBPATH = [os.path.join(env.get('BUILD_DIR'), 'resource', 'csdk')])
        provisioning_env.AppendUnique(LIBS = ['ws2_32', 'iphlpapi', 'advapi32', 'timer'])
 
-provisioning_env.PrependUnique(LIBS = ['ocpmapi','oc', 'oc_logger', 'ocsrm', 'octbstack', 'connectivity_abstraction', 'coap'])
+provisioning_env.PrependUnique(LIBS = ['oc', 'oc_logger', 'octbstack', 'connectivity_abstraction', 'coap'])
+
+if target_os not in ['msys_nt', 'windows']:
+       # octbstack.dll is exporting ocpmapi and ocsrm APIs on Windows.
+       provisioning_env.PrependUnique(LIBS = ['ocpmapi', 'ocsrm'])
 
 if env.get('SECURED') == '1':
     provisioning_env.AppendUnique(LIBS = ['tinydtls'])
index 8444694..052afad 100644 (file)
 extern "C"
 {
 #endif
-OC_EXPORT_TEST OCStackResult OCParsePayload(OCPayload** outPayload, OCPayloadType type,
+OCStackResult OCParsePayload(OCPayload** outPayload, OCPayloadType type,
         const uint8_t* payload, size_t payloadSize);
 
-OC_EXPORT_TEST OCStackResult OCConvertPayload(OCPayload* payload, uint8_t** outPayload, size_t* size);
+OCStackResult OCConvertPayload(OCPayload* payload, uint8_t** outPayload, size_t* size);
 
 #ifdef __cplusplus
 }
index e067d28..a8de15f 100644 (file)
@@ -298,13 +298,13 @@ OCStackResult OCChangeResourceProperty(OCResourceProperty * inputProperty,
         OCResourceProperty resourceProperties, uint8_t enable);
 #endif
 
-OC_EXPORT const char *convertTriggerEnumToString(OCPresenceTrigger trigger);
+const char *convertTriggerEnumToString(OCPresenceTrigger trigger);
 
-OC_EXPORT OCPresenceTrigger convertTriggerStringToEnum(const char * triggerStr);
+OCPresenceTrigger convertTriggerStringToEnum(const char * triggerStr);
 
-OC_EXPORT_TEST OCStackResult encodeAddressForRFC6874(char * outputAddress,
-                                                     size_t outputSize,
-                                                     const char * inputAddress);
+OCStackResult encodeAddressForRFC6874(char * outputAddress,
+                                      size_t outputSize,
+                                      const char * inputAddress);
 
 void CopyEndpointToDevAddr(const CAEndpoint_t *in, OCDevAddr *out);
 
index d5c727e..a301830 100644 (file)
@@ -60,34 +60,34 @@ extern "C"
 
 typedef struct OCResource OCResource;
 
-OC_EXPORT void OCPayloadDestroy(OCPayload* payload);
+void OCPayloadDestroy(OCPayload* payload);
 
 // Representation Payload
-OC_EXPORT OCRepPayload* OCRepPayloadCreate();
+OCRepPayload* OCRepPayloadCreate();
 
-OC_EXPORT size_t calcDimTotal(const size_t dimensions[MAX_REP_ARRAY_DEPTH]);
+size_t calcDimTotal(const size_t dimensions[MAX_REP_ARRAY_DEPTH]);
 
-OC_EXPORT OCRepPayload* OCRepPayloadClone(const OCRepPayload* payload);
+OCRepPayload* OCRepPayloadClone(const OCRepPayload* payload);
 
-OC_EXPORT void OCRepPayloadAppend(OCRepPayload* parent, OCRepPayload* child);
+void OCRepPayloadAppend(OCRepPayload* parent, OCRepPayload* child);
 
-OC_EXPORT bool OCRepPayloadSetUri(OCRepPayload* payload, const char* uri);
+bool OCRepPayloadSetUri(OCRepPayload* payload, const char* uri);
 
-OC_EXPORT bool OCRepPayloadAddResourceType(OCRepPayload* payload, const char* resourceType);
-OC_EXPORT bool OCRepPayloadAddInterface(OCRepPayload* payload, const char* iface);
-OC_EXPORT bool OCRepPayloadAddModelVersion(OCRepPayload* payload, const char* dmv);
+bool OCRepPayloadAddResourceType(OCRepPayload* payload, const char* resourceType);
+bool OCRepPayloadAddInterface(OCRepPayload* payload, const char* iface);
+bool OCRepPayloadAddModelVersion(OCRepPayload* payload, const char* dmv);
 
-OC_EXPORT bool OCRepPayloadAddResourceTypeAsOwner(OCRepPayload* payload, char* resourceType);
-OC_EXPORT bool OCRepPayloadAddInterfaceAsOwner(OCRepPayload* payload, char* iface);
+bool OCRepPayloadAddResourceTypeAsOwner(OCRepPayload* payload, char* resourceType);
+bool OCRepPayloadAddInterfaceAsOwner(OCRepPayload* payload, char* iface);
 
-OC_EXPORT bool OCRepPayloadIsNull(const OCRepPayload* payload, const char* name);
-OC_EXPORT bool OCRepPayloadSetNull(OCRepPayload* payload, const char* name);
+bool OCRepPayloadIsNull(const OCRepPayload* payload, const char* name);
+bool OCRepPayloadSetNull(OCRepPayload* payload, const char* name);
 
-OC_EXPORT bool OCRepPayloadSetPropInt(OCRepPayload* payload, const char* name, int64_t value);
-OC_EXPORT bool OCRepPayloadGetPropInt(const OCRepPayload* payload, const char* name, int64_t* value);
+bool OCRepPayloadSetPropInt(OCRepPayload* payload, const char* name, int64_t value);
+bool OCRepPayloadGetPropInt(const OCRepPayload* payload, const char* name, int64_t* value);
 
-OC_EXPORT bool OCRepPayloadSetPropDouble(OCRepPayload* payload, const char* name, double value);
-OC_EXPORT bool OCRepPayloadGetPropDouble(const OCRepPayload* payload, const char* name, double* value);
+bool OCRepPayloadSetPropDouble(OCRepPayload* payload, const char* name, double value);
+bool OCRepPayloadGetPropDouble(const OCRepPayload* payload, const char* name, double* value);
 
 /**
  * This function allocates memory for the byte string and sets it in the payload.
@@ -98,7 +98,7 @@ OC_EXPORT bool OCRepPayloadGetPropDouble(const OCRepPayload* payload, const char
  *
  * @return true on success, false upon failure.
  */
-OC_EXPORT bool OCRepPayloadSetPropByteString(OCRepPayload* payload, const char* name, OCByteString value);
+bool OCRepPayloadSetPropByteString(OCRepPayload* payload, const char* name, OCByteString value);
 
 /**
  * This function sets the byte string in the payload.
@@ -109,7 +109,7 @@ OC_EXPORT bool OCRepPayloadSetPropByteString(OCRepPayload* payload, const char*
  *
  * @return true on success, false upon failure.
  */
-OC_EXPORT bool OCRepPayloadSetPropByteStringAsOwner(OCRepPayload* payload, const char* name,
+bool OCRepPayloadSetPropByteStringAsOwner(OCRepPayload* payload, const char* name,
         OCByteString* value);
 
 /**
@@ -123,19 +123,19 @@ OC_EXPORT bool OCRepPayloadSetPropByteStringAsOwner(OCRepPayload* payload, const
  *
  * @return true on success, false upon failure.
  */
-OC_EXPORT bool OCRepPayloadGetPropByteString(const OCRepPayload* payload, const char* name,
+bool OCRepPayloadGetPropByteString(const OCRepPayload* payload, const char* name,
         OCByteString* value);
 
-OC_EXPORT bool OCRepPayloadSetPropString(OCRepPayload* payload, const char* name, const char* value);
-OC_EXPORT bool OCRepPayloadSetPropStringAsOwner(OCRepPayload* payload, const char* name, char* value);
-OC_EXPORT bool OCRepPayloadGetPropString(const OCRepPayload* payload, const char* name, char** value);
+bool OCRepPayloadSetPropString(OCRepPayload* payload, const char* name, const char* value);
+bool OCRepPayloadSetPropStringAsOwner(OCRepPayload* payload, const char* name, char* value);
+bool OCRepPayloadGetPropString(const OCRepPayload* payload, const char* name, char** value);
 
-OC_EXPORT bool OCRepPayloadSetPropBool(OCRepPayload* payload, const char* name, bool value);
-OC_EXPORT bool OCRepPayloadGetPropBool(const OCRepPayload* payload, const char* name, bool* value);
+bool OCRepPayloadSetPropBool(OCRepPayload* payload, const char* name, bool value);
+bool OCRepPayloadGetPropBool(const OCRepPayload* payload, const char* name, bool* value);
 
-OC_EXPORT bool OCRepPayloadSetPropObject(OCRepPayload* payload, const char* name, const OCRepPayload* value);
-OC_EXPORT bool OCRepPayloadSetPropObjectAsOwner(OCRepPayload* payload, const char* name, OCRepPayload* value);
-OC_EXPORT bool OCRepPayloadGetPropObject(const OCRepPayload* payload, const char* name, OCRepPayload** value);
+bool OCRepPayloadSetPropObject(OCRepPayload* payload, const char* name, const OCRepPayload* value);
+bool OCRepPayloadSetPropObjectAsOwner(OCRepPayload* payload, const char* name, OCRepPayload* value);
+bool OCRepPayloadGetPropObject(const OCRepPayload* payload, const char* name, OCRepPayload** value);
 
 /**
  * This function allocates memory for the byte string array and sets it in the payload.
@@ -147,7 +147,7 @@ OC_EXPORT bool OCRepPayloadGetPropObject(const OCRepPayload* payload, const char
  *
  * @return true on success, false upon failure.
  */
-OC_EXPORT bool OCRepPayloadSetByteStringArrayAsOwner(OCRepPayload* payload, const char* name,
+bool OCRepPayloadSetByteStringArrayAsOwner(OCRepPayload* payload, const char* name,
         OCByteString* array, size_t dimensions[MAX_REP_ARRAY_DEPTH]);
 
 /**
@@ -160,7 +160,7 @@ OC_EXPORT bool OCRepPayloadSetByteStringArrayAsOwner(OCRepPayload* payload, cons
  *
  * @return true on success, false upon failure.
  */
-OC_EXPORT bool OCRepPayloadSetByteStringArray(OCRepPayload* payload, const char* name,
+bool OCRepPayloadSetByteStringArray(OCRepPayload* payload, const char* name,
         const OCByteString* array, size_t dimensions[MAX_REP_ARRAY_DEPTH]);
 
 /**
@@ -176,87 +176,87 @@ OC_EXPORT bool OCRepPayloadSetByteStringArray(OCRepPayload* payload, const char*
  *
  * @return true on success, false upon failure.
  */
-OC_EXPORT bool OCRepPayloadGetByteStringArray(const OCRepPayload* payload, const char* name,
+bool OCRepPayloadGetByteStringArray(const OCRepPayload* payload, const char* name,
         OCByteString** array, size_t dimensions[MAX_REP_ARRAY_DEPTH]);
 
-OC_EXPORT bool OCRepPayloadSetIntArrayAsOwner(OCRepPayload* payload, const char* name,
+bool OCRepPayloadSetIntArrayAsOwner(OCRepPayload* payload, const char* name,
         int64_t* array, size_t dimensions[MAX_REP_ARRAY_DEPTH]);
-OC_EXPORT bool OCRepPayloadSetIntArray(OCRepPayload* payload, const char* name,
+bool OCRepPayloadSetIntArray(OCRepPayload* payload, const char* name,
         const int64_t* array, size_t dimensions[MAX_REP_ARRAY_DEPTH]);
-OC_EXPORT bool OCRepPayloadGetIntArray(const OCRepPayload* payload, const char* name,
+bool OCRepPayloadGetIntArray(const OCRepPayload* payload, const char* name,
         int64_t** array, size_t dimensions[MAX_REP_ARRAY_DEPTH]);
 
-OC_EXPORT bool OCRepPayloadSetDoubleArrayAsOwner(OCRepPayload* payload, const char* name,
+bool OCRepPayloadSetDoubleArrayAsOwner(OCRepPayload* payload, const char* name,
         double* array, size_t dimensions[MAX_REP_ARRAY_DEPTH]);
-OC_EXPORT bool OCRepPayloadSetDoubleArray(OCRepPayload* payload, const char* name,
+bool OCRepPayloadSetDoubleArray(OCRepPayload* payload, const char* name,
         const double* array, size_t dimensions[MAX_REP_ARRAY_DEPTH]);
-OC_EXPORT bool OCRepPayloadGetDoubleArray(const OCRepPayload* payload, const char* name,
+bool OCRepPayloadGetDoubleArray(const OCRepPayload* payload, const char* name,
         double** array, size_t dimensions[MAX_REP_ARRAY_DEPTH]);
 
-OC_EXPORT bool OCRepPayloadSetStringArrayAsOwner(OCRepPayload* payload, const char* name,
+bool OCRepPayloadSetStringArrayAsOwner(OCRepPayload* payload, const char* name,
         char** array, size_t dimensions[MAX_REP_ARRAY_DEPTH]);
-OC_EXPORT bool OCRepPayloadSetStringArray(OCRepPayload* payload, const char* name,
+bool OCRepPayloadSetStringArray(OCRepPayload* payload, const char* name,
         const char** array, size_t dimensions[MAX_REP_ARRAY_DEPTH]);
-OC_EXPORT bool OCRepPayloadGetStringArray(const OCRepPayload* payload, const char* name,
+bool OCRepPayloadGetStringArray(const OCRepPayload* payload, const char* name,
         char*** array, size_t dimensions[MAX_REP_ARRAY_DEPTH]);
 
-OC_EXPORT bool OCRepPayloadSetBoolArrayAsOwner(OCRepPayload* payload, const char* name,
+bool OCRepPayloadSetBoolArrayAsOwner(OCRepPayload* payload, const char* name,
         bool* array, size_t dimensions[MAX_REP_ARRAY_DEPTH]);
-OC_EXPORT bool OCRepPayloadSetBoolArray(OCRepPayload* payload, const char* name,
+bool OCRepPayloadSetBoolArray(OCRepPayload* payload, const char* name,
         const bool* array, size_t dimensions[MAX_REP_ARRAY_DEPTH]);
-OC_EXPORT bool OCRepPayloadGetBoolArray(const OCRepPayload* payload, const char* name,
+bool OCRepPayloadGetBoolArray(const OCRepPayload* payload, const char* name,
         bool** array, size_t dimensions[MAX_REP_ARRAY_DEPTH]);
 
-OC_EXPORT bool OCRepPayloadSetPropObjectArrayAsOwner(OCRepPayload* payload, const char* name,
+bool OCRepPayloadSetPropObjectArrayAsOwner(OCRepPayload* payload, const char* name,
         OCRepPayload** array, size_t dimensions[MAX_REP_ARRAY_DEPTH]);
-OC_EXPORT bool OCRepPayloadSetPropObjectArray(OCRepPayload* payload, const char* name,
+bool OCRepPayloadSetPropObjectArray(OCRepPayload* payload, const char* name,
         const OCRepPayload** array, size_t dimensions[MAX_REP_ARRAY_DEPTH]);
-OC_EXPORT bool OCRepPayloadGetPropObjectArray(const OCRepPayload* payload, const char* name,
+bool OCRepPayloadGetPropObjectArray(const OCRepPayload* payload, const char* name,
         OCRepPayload*** array, size_t dimensions[MAX_REP_ARRAY_DEPTH]);
 
-OC_EXPORT void OCRepPayloadDestroy(OCRepPayload* payload);
+void OCRepPayloadDestroy(OCRepPayload* payload);
 
 // Discovery Payload
-OC_EXPORT OCDiscoveryPayload* OCDiscoveryPayloadCreate();
+OCDiscoveryPayload* OCDiscoveryPayloadCreate();
 
-OC_EXPORT OCSecurityPayload* OCSecurityPayloadCreate(const uint8_t* securityData, size_t size);
-OC_EXPORT void OCSecurityPayloadDestroy(OCSecurityPayload* payload);
+OCSecurityPayload* OCSecurityPayloadCreate(const uint8_t* securityData, size_t size);
+void OCSecurityPayloadDestroy(OCSecurityPayload* payload);
 
 #ifndef TCP_ADAPTER
-OC_EXPORT void OCDiscoveryPayloadAddResource(OCDiscoveryPayload* payload, const OCResource* res,
-                                             uint16_t securePort);
+void OCDiscoveryPayloadAddResource(OCDiscoveryPayload* payload, const OCResource* res,
+                                   uint16_t securePort);
 #else
-OC_EXPORT void OCDiscoveryPayloadAddResource(OCDiscoveryPayload* payload, const OCResource* res,
-                                             uint16_t securePort, uint16_t tcpPort);
+void OCDiscoveryPayloadAddResource(OCDiscoveryPayload* payload, const OCResource* res,
+                                   uint16_t securePort, uint16_t tcpPort);
 #endif
-OC_EXPORT void OCDiscoveryPayloadAddNewResource(OCDiscoveryPayload* payload, OCResourcePayload* res);
-OC_EXPORT bool OCResourcePayloadAddStringLL(OCStringLL **payload, const char* type);
+void OCDiscoveryPayloadAddNewResource(OCDiscoveryPayload* payload, OCResourcePayload* res);
+bool OCResourcePayloadAddStringLL(OCStringLL **payload, const char* type);
 
-OC_EXPORT size_t OCDiscoveryPayloadGetResourceCount(OCDiscoveryPayload* payload);
-OC_EXPORT OCResourcePayload* OCDiscoveryPayloadGetResource(OCDiscoveryPayload* payload, size_t index);
+size_t OCDiscoveryPayloadGetResourceCount(OCDiscoveryPayload* payload);
+OCResourcePayload* OCDiscoveryPayloadGetResource(OCDiscoveryPayload* payload, size_t index);
 
-OC_EXPORT void OCDiscoveryResourceDestroy(OCResourcePayload* payload);
-OC_EXPORT void OCDiscoveryPayloadDestroy(OCDiscoveryPayload* payload);
+void OCDiscoveryResourceDestroy(OCResourcePayload* payload);
+void OCDiscoveryPayloadDestroy(OCDiscoveryPayload* payload);
 
 // Device Payload
-OC_EXPORT OCDevicePayload* OCDevicePayloadCreate(const char* sid, const char* dname,
+OCDevicePayload* OCDevicePayloadCreate(const char* sid, const char* dname,
         const OCStringLL *types, const char* specVer, const char* dmVer);
-OC_EXPORT void OCDevicePayloadDestroy(OCDevicePayload* payload);
+void OCDevicePayloadDestroy(OCDevicePayload* payload);
 
 // Platform Payload
-OC_EXPORT OCPlatformPayload* OCPlatformPayloadCreate(const OCPlatformInfo* platformInfo);
-OC_EXPORT OCPlatformPayload* OCPlatformPayloadCreateAsOwner(OCPlatformInfo* platformInfo);
-OC_EXPORT void OCPlatformInfoDestroy(OCPlatformInfo *info);
-OC_EXPORT void OCPlatformPayloadDestroy(OCPlatformPayload* payload);
+OCPlatformPayload* OCPlatformPayloadCreate(const OCPlatformInfo* platformInfo);
+OCPlatformPayload* OCPlatformPayloadCreateAsOwner(OCPlatformInfo* platformInfo);
+void OCPlatformInfoDestroy(OCPlatformInfo *info);
+void OCPlatformPayloadDestroy(OCPlatformPayload* payload);
 
 // Presence Payload
-OC_EXPORT OCPresencePayload* OCPresencePayloadCreate(uint32_t seqNum, uint32_t maxAge,
+OCPresencePayload* OCPresencePayloadCreate(uint32_t seqNum, uint32_t maxAge,
         OCPresenceTrigger trigger, const char* resourceType);
-OC_EXPORT void OCPresencePayloadDestroy(OCPresencePayload* payload);
+void OCPresencePayloadDestroy(OCPresencePayload* payload);
 
 // Helper API
-OC_EXPORT OCStringLL* CloneOCStringLL (OCStringLL* ll);
-OC_EXPORT void OCFreeOCStringLL(OCStringLL* ll);
+OCStringLL* CloneOCStringLL (OCStringLL* ll);
+void OCFreeOCStringLL(OCStringLL* ll);
 
 /**
  * This function creates a list from a string (with separated contents if several)
@@ -264,7 +264,7 @@ OC_EXPORT void OCFreeOCStringLL(OCStringLL* ll);
  * @return newly allocated linked list
  * @note separator is ',' (according to rfc4180, ';' is not valid)
  **/
-OC_EXPORT OCStringLL* OCCreateOCStringLL(const char* text);
+OCStringLL* OCCreateOCStringLL(const char* text);
 
 /**
  * This function creates a string from a list (with separated contents if several)
@@ -272,7 +272,7 @@ OC_EXPORT OCStringLL* OCCreateOCStringLL(const char* text);
  * @return newly allocated string
  * @note separator is ',' (according to rfc4180)
  **/
-OC_EXPORT char* OCCreateString(const OCStringLL* ll);
+char* OCCreateString(const OCStringLL* ll);
 
 #ifdef __cplusplus
 }
index ea7daf8..f168df2 100644 (file)
@@ -52,7 +52,7 @@ extern "C" {
  *
  * @return ::OC_STACK_OK on success, some other value upon failure.
  */
-OC_EXPORT OCStackResult OCInit1(OCMode mode, OCTransportFlags serverFlags, OCTransportFlags clientFlags);
+OCStackResult OCInit1(OCMode mode, OCTransportFlags serverFlags, OCTransportFlags clientFlags);
 
 /**
  * This function Initializes the OC Stack.  Must be called prior to starting the stack.
@@ -63,7 +63,7 @@ OC_EXPORT OCStackResult OCInit1(OCMode mode, OCTransportFlags serverFlags, OCTra
  *
  * @return ::OC_STACK_OK on success, some other value upon failure.
  */
-OC_EXPORT OCStackResult OCInit(const char *ipAddr, uint16_t port, OCMode mode);
+OCStackResult OCInit(const char *ipAddr, uint16_t port, OCMode mode);
 
 #ifdef RA_ADAPTER
 /**
@@ -85,7 +85,7 @@ OCStackResult OCSetRAInfo(const OCRAInfo_t *raInfo);
  *
  * @return ::OC_STACK_OK on success, some other value upon failure.
  */
-OC_EXPORT OCStackResult OCStop();
+OCStackResult OCStop();
 
 /**
  * This function starts receiving the multicast traffic. This can be only called
@@ -112,7 +112,7 @@ OCStackResult OCStopMulticastServer();
  *
  * @return ::OC_STACK_OK on success, some other value upon failure.
  */
-OC_EXPORT OCStackResult OCProcess();
+OCStackResult OCProcess();
 
 /**
  * This function discovers or Perform requests on a specified resource
@@ -147,16 +147,16 @@ OC_EXPORT OCStackResult OCProcess();
  *
  * @return ::OC_STACK_OK on success, some other value upon failure.
  */
-OC_EXPORT OCStackResult OCDoResource(OCDoHandle *handle,
-                                     OCMethod method,
-                                     const char *requestUri,
-                                     const OCDevAddr *destination,
-                                     OCPayload* payload,
-                                     OCConnectivityType connectivityType,
-                                     OCQualityOfService qos,
-                                     OCCallbackData *cbData,
-                                     OCHeaderOption *options,
-                                     uint8_t numOptions);
+OCStackResult OCDoResource(OCDoHandle *handle,
+                           OCMethod method,
+                           const char *requestUri,
+                           const OCDevAddr *destination,
+                           OCPayload* payload,
+                           OCConnectivityType connectivityType,
+                           OCQualityOfService qos,
+                           OCCallbackData *cbData,
+                           OCHeaderOption *options,
+                           uint8_t numOptions);
 /**
  * This function cancels a request associated with a specific @ref OCDoResource invocation.
  *
@@ -168,10 +168,10 @@ OC_EXPORT OCStackResult OCDoResource(OCDoHandle *handle,
  *
  * @return ::OC_STACK_OK on success, some other value upon failure.
  */
-OC_EXPORT OCStackResult OCCancel(OCDoHandle handle,
-                                 OCQualityOfService qos,
-                                 OCHeaderOption * options,
-                                 uint8_t numOptions);
+OCStackResult OCCancel(OCDoHandle handle,
+                       OCQualityOfService qos,
+                       OCHeaderOption * options,
+                       uint8_t numOptions);
 
 /**
  * Register Persistent storage callback.
@@ -181,7 +181,7 @@ OC_EXPORT OCStackResult OCCancel(OCDoHandle handle,
  *     OC_STACK_OK                    No errors; Success.
  *     OC_STACK_INVALID_PARAM         Invalid parameter.
  */
-OC_EXPORT OCStackResult OCRegisterPersistentStorageHandler(OCPersistentStorage* persistentStorageHandler);
+OCStackResult OCRegisterPersistentStorageHandler(OCPersistentStorage* persistentStorageHandler);
 
 #ifdef WITH_PRESENCE
 /**
@@ -200,7 +200,7 @@ OC_EXPORT OCStackResult OCRegisterPersistentStorageHandler(OCPersistentStorage*
  *
  * @return ::OC_STACK_OK on success, some other value upon failure.
  */
-OC_EXPORT OCStackResult OCStartPresence(const uint32_t ttl);
+OCStackResult OCStartPresence(const uint32_t ttl);
 
 /**
  * When operating in OCServer or OCClientServer mode, this API will stop sending
@@ -214,7 +214,7 @@ OC_EXPORT OCStackResult OCStartPresence(const uint32_t ttl);
  * @return ::OC_STACK_OK on success, some other value upon failure.
  */
 
-OC_EXPORT OCStackResult OCStopPresence();
+OCStackResult OCStopPresence();
 #endif
 
 
@@ -228,7 +228,7 @@ OC_EXPORT OCStackResult OCStopPresence();
  *
  * @return ::OC_STACK_OK on success, some other value upon failure.
  */
-OC_EXPORT OCStackResult OCSetDefaultDeviceEntityHandler(OCDeviceEntityHandler entityHandler, void* callbackParameter);
+OCStackResult OCSetDefaultDeviceEntityHandler(OCDeviceEntityHandler entityHandler, void* callbackParameter);
 
 /**
  * This function sets device information.
@@ -246,7 +246,7 @@ OC_EXPORT OCStackResult OCSetDefaultDeviceEntityHandler(OCDeviceEntityHandler en
  *     ::OC_STACK_INVALID_PARAM    invalid parameter.
  *     ::OC_STACK_ERROR            stack process error.
  */
-OC_EXPORT OCStackResult OCSetDeviceInfo(OCDeviceInfo deviceInfo);
+OCStackResult OCSetDeviceInfo(OCDeviceInfo deviceInfo);
 
 /**
  * This function sets platform information.
@@ -260,7 +260,7 @@ OC_EXPORT OCStackResult OCSetDeviceInfo(OCDeviceInfo deviceInfo);
  *     ::OC_STACK_INVALID_PARAM    invalid parameter.
  *     ::OC_STACK_ERROR            stack process error.
  */
-OC_EXPORT OCStackResult OCSetPlatformInfo(OCPlatformInfo platformInfo);
+OCStackResult OCSetPlatformInfo(OCPlatformInfo platformInfo);
 
 /**
  * This function creates a resource.
@@ -279,14 +279,13 @@ OC_EXPORT OCStackResult OCSetPlatformInfo(OCPlatformInfo platformInfo);
  *
  * @return ::OC_STACK_OK on success, some other value upon failure.
  */
-OC_EXPORT OCStackResult OCCreateResource(OCResourceHandle *handle,
-                                         const char *resourceTypeName,
-                                         const char *resourceInterfaceName,
-                                         const char *uri,
-                                         OCEntityHandler entityHandler,
-                                         void* callbackParam,
-                                         uint8_t resourceProperties);
-
+OCStackResult OCCreateResource(OCResourceHandle *handle,
+                               const char *resourceTypeName,
+                               const char *resourceInterfaceName,
+                               const char *uri,
+                               OCEntityHandler entityHandler,
+                               void* callbackParam,
+                               uint8_t resourceProperties);
 
 /**
  * This function adds a resource to a collection resource.
@@ -296,7 +295,7 @@ OC_EXPORT OCStackResult OCCreateResource(OCResourceHandle *handle,
  *
  * @return ::OC_STACK_OK on success, some other value upon failure.
  */
-OC_EXPORT OCStackResult OCBindResource(OCResourceHandle collectionHandle, OCResourceHandle resourceHandle);
+OCStackResult OCBindResource(OCResourceHandle collectionHandle, OCResourceHandle resourceHandle);
 
 /**
  * This function removes a resource from a collection resource.
@@ -306,7 +305,7 @@ OC_EXPORT OCStackResult OCBindResource(OCResourceHandle collectionHandle, OCReso
  *
  * @return ::OC_STACK_OK on success, some other value upon failure.
  */
-OC_EXPORT OCStackResult OCUnBindResource(OCResourceHandle collectionHandle, OCResourceHandle resourceHandle);
+OCStackResult OCUnBindResource(OCResourceHandle collectionHandle, OCResourceHandle resourceHandle);
 
 /**
  * This function binds a resource type to a resource.
@@ -316,8 +315,8 @@ OC_EXPORT OCStackResult OCUnBindResource(OCResourceHandle collectionHandle, OCRe
  *
  * @return ::OC_STACK_OK on success, some other value upon failure.
  */
-OC_EXPORT OCStackResult OCBindResourceTypeToResource(OCResourceHandle handle,
-                                                     const char *resourceTypeName);
+OCStackResult OCBindResourceTypeToResource(OCResourceHandle handle,
+                                           const char *resourceTypeName);
 /**
  * This function binds a resource interface to a resource.
  *
@@ -326,8 +325,8 @@ OC_EXPORT OCStackResult OCBindResourceTypeToResource(OCResourceHandle handle,
  *
  * @return ::OC_STACK_OK on success, some other value upon failure.
  */
-OC_EXPORT OCStackResult OCBindResourceInterfaceToResource(OCResourceHandle handle,
-                                                          const char *resourceInterfaceName);
+OCStackResult OCBindResourceInterfaceToResource(OCResourceHandle handle,
+                                                const char *resourceInterfaceName);
 
 /**
  * This function binds an entity handler to the resource.
@@ -338,9 +337,9 @@ OC_EXPORT OCStackResult OCBindResourceInterfaceToResource(OCResourceHandle handl
  *
  * @return ::OC_STACK_OK on success, some other value upon failure.
  */
-OC_EXPORT OCStackResult OCBindResourceHandler(OCResourceHandle handle,
-                                              OCEntityHandler entityHandler,
-                                              void *callbackParameter);
+OCStackResult OCBindResourceHandler(OCResourceHandle handle,
+                                    OCEntityHandler entityHandler,
+                                    void *callbackParameter);
 
 /**
  * This function gets the number of resources that have been created in the stack.
@@ -349,7 +348,7 @@ OC_EXPORT OCStackResult OCBindResourceHandler(OCResourceHandle handle,
  *
  * @return ::OC_STACK_OK on success, some other value upon failure.
  */
-OC_EXPORT OCStackResult OCGetNumberOfResources(uint8_t *numResources);
+OCStackResult OCGetNumberOfResources(uint8_t *numResources);
 
 /**
  * This function gets a resource handle by index.
@@ -358,7 +357,7 @@ OC_EXPORT OCStackResult OCGetNumberOfResources(uint8_t *numResources);
  *
  * @return Found  resource handle or NULL if not found.
  */
-OC_EXPORT OCResourceHandle OCGetResourceHandle(uint8_t index);
+OCResourceHandle OCGetResourceHandle(uint8_t index);
 
 /**
  * This function deletes resource specified by handle.  Deletes resource and all
@@ -371,7 +370,7 @@ OC_EXPORT OCResourceHandle OCGetResourceHandle(uint8_t index);
  *
  * @return ::OC_STACK_OK on success, some other value upon failure.
  */
-OC_EXPORT OCStackResult OCDeleteResource(OCResourceHandle handle);
+OCStackResult OCDeleteResource(OCResourceHandle handle);
 
 /**
  * Get a string representation the server instance ID.
@@ -383,7 +382,7 @@ OC_EXPORT OCStackResult OCDeleteResource(OCResourceHandle handle);
  *
  * @return A string representation  the server instance ID.
  */
-OC_EXPORT const char* OCGetServerInstanceIDString(void);
+const char* OCGetServerInstanceIDString(void);
 
 /**
  * This function gets the URI of the resource specified by handle.
@@ -392,7 +391,7 @@ OC_EXPORT const char* OCGetServerInstanceIDString(void);
  *
  * @return URI string if resource found or NULL if not found.
  */
-OC_EXPORT const char *OCGetResourceUri(OCResourceHandle handle);
+const char *OCGetResourceUri(OCResourceHandle handle);
 
 /**
  * This function gets the properties of the resource specified by handle.
@@ -404,7 +403,7 @@ OC_EXPORT const char *OCGetResourceUri(OCResourceHandle handle);
  * @note that after a resource is created, the OC_ACTIVE property is set for the resource by the
  * stack.
  */
-OC_EXPORT OCResourceProperty OCGetResourceProperties(OCResourceHandle handle);
+OCResourceProperty OCGetResourceProperties(OCResourceHandle handle);
 
 /**
  * This function gets the number of resource types of the resource.
@@ -414,7 +413,7 @@ OC_EXPORT OCResourceProperty OCGetResourceProperties(OCResourceHandle handle);
  *
  * @return ::OC_STACK_OK on success, some other value upon failure.
  */
-OC_EXPORT OCStackResult OCGetNumberOfResourceTypes(OCResourceHandle handle, uint8_t *numResourceTypes);
+OCStackResult OCGetNumberOfResourceTypes(OCResourceHandle handle, uint8_t *numResourceTypes);
 
 /**
  * This function gets name of resource type of the resource.
@@ -424,7 +423,7 @@ OC_EXPORT OCStackResult OCGetNumberOfResourceTypes(OCResourceHandle handle, uint
  *
  * @return Resource type name if resource found or NULL if resource not found.
  */
-OC_EXPORT const char *OCGetResourceTypeName(OCResourceHandle handle, uint8_t index);
+const char *OCGetResourceTypeName(OCResourceHandle handle, uint8_t index);
 
 /**
  * This function gets the number of resource interfaces of the resource.
@@ -434,7 +433,7 @@ OC_EXPORT const char *OCGetResourceTypeName(OCResourceHandle handle, uint8_t ind
  *
  * @return ::OC_STACK_OK on success, some other value upon failure.
  */
-OC_EXPORT OCStackResult OCGetNumberOfResourceInterfaces(OCResourceHandle handle,
+OCStackResult OCGetNumberOfResourceInterfaces(OCResourceHandle handle,
         uint8_t *numResourceInterfaces);
 
 /**
@@ -445,7 +444,7 @@ OC_EXPORT OCStackResult OCGetNumberOfResourceInterfaces(OCResourceHandle handle,
  *
  * @return Resource interface name if resource found or NULL if resource not found.
  */
-OC_EXPORT const char *OCGetResourceInterfaceName(OCResourceHandle handle, uint8_t index);
+const char *OCGetResourceInterfaceName(OCResourceHandle handle, uint8_t index);
 
 /**
  * This function gets methods of resource interface of the resource.
@@ -455,7 +454,7 @@ OC_EXPORT const char *OCGetResourceInterfaceName(OCResourceHandle handle, uint8_
  *
  * @return Allowed methods if resource found or NULL if resource not found.
  */
-OC_EXPORT uint8_t OCGetResourceInterfaceAllowedMethods(OCResourceHandle handle, uint8_t index);
+uint8_t OCGetResourceInterfaceAllowedMethods(OCResourceHandle handle, uint8_t index);
 
 /**
  * This function gets resource handle from the collection resource by index.
@@ -465,7 +464,7 @@ OC_EXPORT uint8_t OCGetResourceInterfaceAllowedMethods(OCResourceHandle handle,
  *
  * @return Handle to contained resource if resource found or NULL if resource not found.
  */
-OC_EXPORT OCResourceHandle OCGetResourceHandleFromCollection(OCResourceHandle collectionHandle,
+OCResourceHandle OCGetResourceHandleFromCollection(OCResourceHandle collectionHandle,
         uint8_t index);
 
 /**
@@ -475,7 +474,7 @@ OC_EXPORT OCResourceHandle OCGetResourceHandleFromCollection(OCResourceHandle co
  *
  * @return Entity handler if resource found or NULL resource not found.
  */
-OC_EXPORT OCEntityHandler OCGetResourceHandler(OCResourceHandle handle);
+OCEntityHandler OCGetResourceHandler(OCResourceHandle handle);
 
 /**
  * This function notify all registered observers that the resource representation has
@@ -487,7 +486,7 @@ OC_EXPORT OCEntityHandler OCGetResourceHandler(OCResourceHandle handle);
  *
  * @return ::OC_STACK_OK on success, some other value upon failure.
  */
-OC_EXPORT OCStackResult OCNotifyAllObservers(OCResourceHandle handle, OCQualityOfService qos);
+OCStackResult OCNotifyAllObservers(OCResourceHandle handle, OCQualityOfService qos);
 
 /**
  * Notify specific observers with updated value of representation.
@@ -506,12 +505,12 @@ OC_EXPORT OCStackResult OCNotifyAllObservers(OCResourceHandle handle, OCQualityO
  *
  * @return ::OC_STACK_OK on success, some other value upon failure.
  */
-OC_EXPORT OCStackResult
+OCStackResult
 OCNotifyListOfObservers (OCResourceHandle handle,
-                            OCObservationId  *obsIdList,
-                            uint8_t          numberOfIds,
-                            const OCRepPayload *payload,
-                            OCQualityOfService qos);
+                         OCObservationId  *obsIdList,
+                         uint8_t          numberOfIds,
+                         const OCRepPayload *payload,
+                         OCQualityOfService qos);
 
 
 /**
@@ -523,7 +522,7 @@ OCNotifyListOfObservers (OCResourceHandle handle,
  *
  * @return ::OC_STACK_OK on success, some other value upon failure.
  */
-OC_EXPORT OCStackResult OCDoResponse(OCEntityHandlerResponse *response);
+OCStackResult OCDoResponse(OCEntityHandlerResponse *response);
 
 //#ifdef DIRECT_PAIRING
 /**
@@ -535,7 +534,7 @@ OC_EXPORT OCStackResult OCDoResponse(OCEntityHandlerResponse *response);
  *                    client before returning the list of devices.
  * @return OCDirectPairingDev_t pointer in case of success and NULL otherwise.
  */
-OC_EXPORT const OCDPDev_t* OCDiscoverDirectPairingDevices(unsigned short waittime);
+const OCDPDev_t* OCDiscoverDirectPairingDevices(unsigned short waittime);
 
 /**
  * The function is responsible for return of paired device list via direct-pairing. It will list
@@ -544,7 +543,7 @@ OC_EXPORT const OCDPDev_t* OCDiscoverDirectPairingDevices(unsigned short waittim
  *
  * @return OCDirectPairingDev_t pointer in case of success and NULL otherwise.
  */
-OC_EXPORT const OCDPDev_t* OCGetDirectPairedDevices();
+const OCDPDev_t* OCGetDirectPairedDevices();
 
 /**
  * The function is responsible for establishment of direct-pairing. It will proceed mode negotiation
@@ -556,8 +555,8 @@ OC_EXPORT const OCDPDev_t* OCGetDirectPairedDevices();
  * @param[in] resultCallback Callback fucntion to event status of process.
  * @return OTM_SUCCESS in case of success and other value otherwise.
  */
-OC_EXPORT OCStackResult OCDoDirectPairing(void *ctx, OCDPDev_t* peer, OCPrm_t pmSel, char *pinNumber,
-                                                     OCDirectPairingCB resultCallback);
+OCStackResult OCDoDirectPairing(void *ctx, OCDPDev_t* peer, OCPrm_t pmSel, char *pinNumber,
+                                OCDirectPairingCB resultCallback);
 
 #if defined(RD_CLIENT) || defined(RD_SERVER)
 /**
@@ -568,7 +567,7 @@ OC_EXPORT OCStackResult OCDoDirectPairing(void *ctx, OCDPDev_t* peer, OCPrm_t pm
  *
  * @return ::OC_STACK_OK on success, some other value upon failure.
  */
-OC_EXPORT OCStackResult OCBindResourceInsToResource(OCResourceHandle handle, uint8_t ins);
+OCStackResult OCBindResourceInsToResource(OCResourceHandle handle, uint8_t ins);
 
 /**
  * This function gets the resource unique id for a resource.
@@ -578,7 +577,7 @@ OC_EXPORT OCStackResult OCBindResourceInsToResource(OCResourceHandle handle, uin
  *
  * @return Ins if resource found or 0 resource not found.
  */
-OC_EXPORT OCStackResult OCGetResourceIns(OCResourceHandle handle, uint8_t *ins);
+OCStackResult OCGetResourceIns(OCResourceHandle handle, uint8_t *ins);
 
 /**
  * This function gets a resource handle by resource uri.
@@ -587,7 +586,7 @@ OC_EXPORT OCStackResult OCGetResourceIns(OCResourceHandle handle, uint8_t *ins);
  *
  * @return Found  resource handle or NULL if not found.
  */
-OC_EXPORT OCResourceHandle OCGetResourceHandleAtUri(const char *uri);
+OCResourceHandle OCGetResourceHandleAtUri(const char *uri);
 #endif
 //#endif // DIRECT_PAIRING
 
index 5eb55a6..f5df44e 100644 (file)
@@ -43,9 +43,9 @@ extern "C" {
  *
  * @return ::OC_STACK_OK on success, some other value upon failure.
  */
-OC_EXPORT OCStackResult OCRDPublish(const char *host, OCConnectivityType connectivityType,
-                                    OCResourceHandle *resourceHandles, uint8_t nHandles,
-                                    OCCallbackData *cbData, OCQualityOfService qos);
+OCStackResult OCRDPublish(const char *host, OCConnectivityType connectivityType,
+                          OCResourceHandle *resourceHandles, uint8_t nHandles,
+                          OCCallbackData *cbData, OCQualityOfService qos);
 
 /**
  * Publish RD resource to Resource Directory with a specific id.
@@ -62,10 +62,10 @@ OC_EXPORT OCStackResult OCRDPublish(const char *host, OCConnectivityType connect
  *
  * @return ::OC_STACK_OK on success, some other value upon failure.
  */
-OC_EXPORT OCStackResult OCRDPublishWithDeviceId(const char *host, const unsigned char *id,
-                                                OCConnectivityType connectivityType,
-                                                OCResourceHandle *resourceHandles, uint8_t nHandles,
-                                                OCCallbackData *cbData, OCQualityOfService qos);
+OCStackResult OCRDPublishWithDeviceId(const char *host, const unsigned char *id,
+                                      OCConnectivityType connectivityType,
+                                      OCResourceHandle *resourceHandles, uint8_t nHandles,
+                                      OCCallbackData *cbData, OCQualityOfService qos);
 
 /**
  * Delete RD resource from Resource Directory.
@@ -81,9 +81,9 @@ OC_EXPORT OCStackResult OCRDPublishWithDeviceId(const char *host, const unsigned
  *
  * @return ::OC_STACK_OK on success, some other value upon failure.
  */
-OC_EXPORT OCStackResult OCRDDelete(const char *host, OCConnectivityType connectivityType,
-                                   OCResourceHandle *resourceHandles, uint8_t nHandles,
-                                   OCCallbackData *cbData, OCQualityOfService qos);
+OCStackResult OCRDDelete(const char *host, OCConnectivityType connectivityType,
+                         OCResourceHandle *resourceHandles, uint8_t nHandles,
+                         OCCallbackData *cbData, OCQualityOfService qos);
 
 /**
  * Delete RD resource from Resource Directory.
@@ -100,10 +100,10 @@ OC_EXPORT OCStackResult OCRDDelete(const char *host, OCConnectivityType connecti
  *
  * @return ::OC_STACK_OK on success, some other value upon failure.
  */
-OC_EXPORT OCStackResult OCRDDeleteWithDeviceId(const char *host, const unsigned char *id,
-                                               OCConnectivityType connectivityType,
-                                               OCResourceHandle *resourceHandles, uint8_t nHandles,
-                                               OCCallbackData *cbData, OCQualityOfService qos);
+OCStackResult OCRDDeleteWithDeviceId(const char *host, const unsigned char *id,
+                                     OCConnectivityType connectivityType,
+                                     OCResourceHandle *resourceHandles, uint8_t nHandles,
+                                     OCCallbackData *cbData, OCQualityOfService qos);
 #endif
 #ifdef __cplusplus
 }
index bedd9b6..56afc67 100644 (file)
@@ -47,8 +47,8 @@ extern "C"
 #ifdef TB_LOG
     #define OIC_LOG_PAYLOAD(level, payload) OCPayloadLog((level),(payload))
     #define UUID_SIZE (16)
-OC_EXPORT const char *convertTriggerEnumToString(OCPresenceTrigger trigger);
-OC_EXPORT OCPresenceTrigger convertTriggerStringToEnum(const char * triggerStr);
+const char *convertTriggerEnumToString(OCPresenceTrigger trigger);
+OCPresenceTrigger convertTriggerStringToEnum(const char * triggerStr);
 
 #if defined(RD_CLIENT) || defined(RD_SERVER)
 INLINE_API void OCTagsLog(const LogLevel level, const OCTagsPayload *tags)
index 11b703e..bc27c9e 100644 (file)
@@ -53,7 +53,10 @@ if target_os not in ['darwin', 'ios', 'windows', 'msys_nt']:
 oc_logger_libs = []
 
 if target_os in ['windows', 'msys_nt']:
-       # TODO: Add OC_EXPORT API prefixes to enable oc_logger DLL generation.
+       # If oc_logger APIs have to be exported from a Windows DLL, these functions
+       # should be exported from octbstack.dll. Building a separate oc_logger.dll here
+       # would result in duplicated code and data across these two DLLs. Using just
+       # the static oc_logger.lib is good enough for Windows for now.
        oc_logger_libs += liboc_logger_env.StaticLibrary('oc_logger',
                ['c/oc_logger.c', 'c/oc_console_logger.c', 'cpp/oc_ostream_logger.cpp'])
 else: