From 9419769e2aae9e6064aa9d70e7e5ddbf6e44012c Mon Sep 17 00:00:00 2001 From: Omar Maabreh Date: Mon, 22 May 2017 17:33:43 -0700 Subject: [PATCH] [IOT-2276] Add Calling Convention to Public APIs on Windows Change-Id: Ia7b382c29c12d5997894234eee93c57edaec819c Signed-off-by: Omar Maabreh Reviewed-on: https://gerrit.iotivity.org/gerrit/20289 Tested-by: jenkins-iotivity Reviewed-by: Dan Mihai --- resource/c_common/octimer/include/octimer.h | 8 +- resource/c_common/octimer/src/octimer.c | 8 +- .../csdk/resource-directory/include/rd_client.h | 10 +- .../csdk/resource-directory/include/rd_database.h | 8 +- .../csdk/resource-directory/include/rd_server.h | 6 +- .../resource-directory/src/internal/rd_database.c | 8 +- resource/csdk/resource-directory/src/rd_client.c | 40 ++--- resource/csdk/resource-directory/src/rd_server.c | 8 +- resource/csdk/security/include/occertutility.h | 20 +-- resource/csdk/security/include/ocsecurity.h | 2 +- resource/csdk/security/include/oxmverifycommon.h | 16 +- resource/csdk/security/include/pinoxmcommon.h | 36 ++-- resource/csdk/security/include/srmutility.h | 4 +- .../provisioning/include/ocprovisioningmanager.h | 119 +++++++------ .../csdk/security/provisioning/include/pmutility.h | 8 +- .../provisioning/sample/provisioningclient.c | 6 +- .../sample/sampleserver_mvjustworks.cpp | 4 +- .../provisioning/sample/sampleserver_randompin.cpp | 4 +- .../security/provisioning/sample/subownerclient.c | 2 +- .../provisioning/src/ocprovisioningmanager.c | 196 ++++++++++----------- .../csdk/security/provisioning/src/pmutility.c | 8 +- resource/csdk/security/src/occertutility.c | 20 +-- resource/csdk/security/src/ocsecurity.c | 2 +- resource/csdk/security/src/oxmpincommon.c | 26 +-- resource/csdk/security/src/oxmverifycommon.c | 12 +- resource/csdk/security/src/srmutility.c | 4 +- resource/csdk/stack/include/internal/ocendpoint.h | 2 +- .../stack/include/internal/ocresourcehandler.h | 2 +- .../csdk/stack/include/internal/ocstackinternal.h | 4 +- resource/csdk/stack/include/ocpayload.h | 155 ++++++++-------- resource/csdk/stack/include/ocstack.h | 132 +++++++------- resource/csdk/stack/include/payload_logging.h | 4 +- resource/csdk/stack/src/ocendpoint.c | 2 +- resource/csdk/stack/src/ocpayload.c | 184 +++++++++---------- resource/csdk/stack/src/ocresource.c | 14 +- resource/csdk/stack/src/ocstack.c | 192 ++++++++++---------- resource/csdk/stack/src/oicresourcedirectory.c | 6 +- resource/include/OCProvisioningManager.hpp | 4 +- resource/oc_logger/c/oc_console_logger.c | 2 +- resource/oc_logger/c/oc_logger.c | 14 +- resource/oc_logger/cpp/oc_ostream_logger.cpp | 2 +- resource/oc_logger/include/oc_console_logger.h | 2 +- resource/oc_logger/include/oc_logger.h | 15 +- .../oc_logger/include/targets/oc_console_logger.h | 2 +- .../oc_logger/include/targets/oc_ostream_logger.h | 2 +- .../provisioning/src/OCProvisioningManager.cpp | 8 +- 46 files changed, 675 insertions(+), 658 deletions(-) diff --git a/resource/c_common/octimer/include/octimer.h b/resource/c_common/octimer/include/octimer.h index 446ea79..296ea0f 100644 --- a/resource/c_common/octimer/include/octimer.h +++ b/resource/c_common/octimer/include/octimer.h @@ -72,14 +72,14 @@ time_t getSecondsFromAbsTime(struct tm *tp); int initThread(); void *loop(void *threadid); -time_t registerTimer(const time_t seconds, int *id, TimerCallback cb); -void unregisterTimer(int id); +time_t OC_CALL registerTimer(const time_t seconds, int *id, TimerCallback cb); +void OC_CALL unregisterTimer(int id); #else time_t timeToSecondsFromNow(tmElements_t *t); -time_t registerTimer(const time_t seconds, int *id, TimerCallback cb); -void unregisterTimer(int id); +time_t OC_CALL registerTimer(const time_t seconds, int *id, TimerCallback cb); +void OC_CALL unregisterTimer(int id); #endif diff --git a/resource/c_common/octimer/src/octimer.c b/resource/c_common/octimer/src/octimer.c index c4a9285..9f1117f 100644 --- a/resource/c_common/octimer/src/octimer.c +++ b/resource/c_common/octimer/src/octimer.c @@ -154,7 +154,7 @@ time_t getSecondsFromAbsTime(struct tm *tp) return delayed_time; } -time_t registerTimer(const time_t seconds, int *id, TimerCallback cb) +time_t OC_CALL registerTimer(const time_t seconds, int *id, TimerCallback cb) { time_t now, then; time_t next; @@ -212,7 +212,7 @@ time_t registerTimer(const time_t seconds, int *id, TimerCallback cb) return timeout_list[idx].timeout_time; } -void unregisterTimer(int idx) +void OC_CALL unregisterTimer(int idx) { if (0 <= idx && idx < TIMEOUTS) timeout_list[idx].timeout_state = TIMEOUT_UNUSED; @@ -278,7 +278,7 @@ time_t timeToSecondsFromNow(tmElements_t *t_then) return (time_t) (then - t); } -time_t registerTimer(const time_t seconds, int *id, TimerCallback cb) +time_t OC_CALL registerTimer(const time_t seconds, int *id, TimerCallback cb) { time_t t, then; time_t next; @@ -333,7 +333,7 @@ time_t registerTimer(const time_t seconds, int *id, TimerCallback cb) return timeout_list[idx].timeout_time; } -void unregisterTimer(int idx) +void OC_CALL unregisterTimer(int idx) { if (0 <= idx && idx < TIMEOUTS) timeout_list[idx].timeout_state = TIMEOUT_UNUSED; diff --git a/resource/csdk/resource-directory/include/rd_client.h b/resource/csdk/resource-directory/include/rd_client.h index 998118c..dddcb37 100644 --- a/resource/csdk/resource-directory/include/rd_client.h +++ b/resource/csdk/resource-directory/include/rd_client.h @@ -57,7 +57,7 @@ extern "C" { * * @return ::OC_STACK_OK on success, some other value upon failure. */ -OCStackResult OCRDDiscover(OCDoHandle *handle, OCConnectivityType connectivityType, +OCStackResult OC_CALL OCRDDiscover(OCDoHandle *handle, OCConnectivityType connectivityType, OCCallbackData *cbBiasFactor, OCQualityOfService qos); /** @@ -80,7 +80,7 @@ OCStackResult OCRDDiscover(OCDoHandle *handle, OCConnectivityType connectivityTy * * @return ::OC_STACK_OK on success, some other value upon failure. */ -OCStackResult OCRDPublish(OCDoHandle *handle, const char *host, +OCStackResult OC_CALL OCRDPublish(OCDoHandle *handle, const char *host, OCConnectivityType connectivityType, OCResourceHandle *resourceHandles, uint8_t nHandles, OCCallbackData *cbData, OCQualityOfService qos); @@ -106,7 +106,7 @@ OCStackResult OCRDPublish(OCDoHandle *handle, const char *host, * * @return ::OC_STACK_OK on success, some other value upon failure. */ -OCStackResult OCRDPublishWithDeviceId(OCDoHandle *handle, const char *host, +OCStackResult OC_CALL OCRDPublishWithDeviceId(OCDoHandle *handle, const char *host, const unsigned char *id, OCConnectivityType connectivityType, OCResourceHandle *resourceHandles, uint8_t nHandles, @@ -132,7 +132,7 @@ OCStackResult OCRDPublishWithDeviceId(OCDoHandle *handle, const char *host, * * @return ::OC_STACK_OK on success, some other value upon failure. */ -OCStackResult OCRDDelete(OCDoHandle *handle, const char *host, +OCStackResult OC_CALL OCRDDelete(OCDoHandle *handle, const char *host, OCConnectivityType connectivityType, OCResourceHandle *resourceHandles, uint8_t nHandles, OCCallbackData *cbData, OCQualityOfService qos); @@ -162,7 +162,7 @@ OCStackResult OCRDDelete(OCDoHandle *handle, const char *host, * - ::OC_STACK_INVALID_URI generated URI exceeds MAX_URI_LENGTH try fewer resourceHandles * - some other value upon failure. */ -OCStackResult OCRDDeleteWithDeviceId(OCDoHandle *handle, const char *host, +OCStackResult OC_CALL OCRDDeleteWithDeviceId(OCDoHandle *handle, const char *host, const unsigned char *id, OCConnectivityType connectivityType, OCResourceHandle *resourceHandles, uint8_t nHandles, diff --git a/resource/csdk/resource-directory/include/rd_database.h b/resource/csdk/resource-directory/include/rd_database.h index 2534643..287750e 100644 --- a/resource/csdk/resource-directory/include/rd_database.h +++ b/resource/csdk/resource-directory/include/rd_database.h @@ -32,7 +32,7 @@ extern "C" { * * @return ::OC_STACK_OK in case of success or else other value. */ -OCStackResult OCRDDatabaseInit(); +OCStackResult OC_CALL OCRDDatabaseInit(); /** * Stores in database the published resource. @@ -41,7 +41,7 @@ OCStackResult OCRDDatabaseInit(); * * @return ::OC_STACK_OK in case of success or else other value. */ -OCStackResult OCRDDatabaseStoreResources(const OCRepPayload *payload); +OCStackResult OC_CALL OCRDDatabaseStoreResources(const OCRepPayload *payload); /** * Delete the RD resources @@ -53,7 +53,7 @@ OCStackResult OCRDDatabaseStoreResources(const OCRepPayload *payload); * * @return ::OC_STACK_OK in case of success or else other value. */ -OCStackResult OCRDDatabaseDeleteResources(const char *deviceId, const int64_t *instanceIds, +OCStackResult OC_CALL OCRDDatabaseDeleteResources(const char *deviceId, const int64_t *instanceIds, uint16_t nInstanceIds); /** @@ -61,7 +61,7 @@ OCStackResult OCRDDatabaseDeleteResources(const char *deviceId, const int64_t *i * * @return ::OC_STACK_OK in case of success or else other value. */ -OCStackResult OCRDDatabaseClose(); +OCStackResult OC_CALL OCRDDatabaseClose(); #endif diff --git a/resource/csdk/resource-directory/include/rd_server.h b/resource/csdk/resource-directory/include/rd_server.h index 8554904..01a25ad 100644 --- a/resource/csdk/resource-directory/include/rd_server.h +++ b/resource/csdk/resource-directory/include/rd_server.h @@ -35,7 +35,7 @@ extern "C" { * * @return ::OC_STACK_OK upon success, ::OC_STACK_ERROR in case of error. */ -OCStackResult OCRDStart(); +OCStackResult OC_CALL OCRDStart(); /** * Stops resource directory. @@ -45,7 +45,7 @@ OCStackResult OCRDStart(); * @return ::OC_STACK_OK upon success, ::OC_STACK_ERROR is returned except * the case that OC_STACK_SUCCESS is returned. */ -OCStackResult OCRDStop(); +OCStackResult OC_CALL OCRDStop(); /** * Checks based on the resource type if the entity exists in the resource directory. @@ -57,7 +57,7 @@ OCStackResult OCRDStop(); * @return ::OC_STACK_OK upon success, ::OC_STACK_ERROR is returned except * the case that OC_STACK_SUCCESS is returned. */ -OCStackResult OCRDCheckPublishedResource(const char *interfaceType, const char *resourceType, +OCStackResult OC_CALL OCRDCheckPublishedResource(const char *interfaceType, const char *resourceType, OCDiscoveryPayload **payload); #endif diff --git a/resource/csdk/resource-directory/src/internal/rd_database.c b/resource/csdk/resource-directory/src/internal/rd_database.c index e2d059c..f9270da 100644 --- a/resource/csdk/resource-directory/src/internal/rd_database.c +++ b/resource/csdk/resource-directory/src/internal/rd_database.c @@ -646,7 +646,7 @@ exit: return res; } -OCStackResult OCRDDatabaseInit() +OCStackResult OC_CALL OCRDDatabaseInit() { if (SQLITE_OK == sqlite3_config(SQLITE_CONFIG_LOG, errorCallback)) { @@ -707,7 +707,7 @@ exit: } } -OCStackResult OCRDDatabaseClose() +OCStackResult OC_CALL OCRDDatabaseClose() { CHECK_DATABASE_INIT; int res; @@ -717,7 +717,7 @@ exit: return (SQLITE_OK == res) ? OC_STACK_OK : OC_STACK_ERROR; } -OCStackResult OCRDDatabaseStoreResources(OCRepPayload *payload) +OCStackResult OC_CALL OCRDDatabaseStoreResources(OCRepPayload *payload) { CHECK_DATABASE_INIT; int res; @@ -726,7 +726,7 @@ exit: return (SQLITE_OK == res) ? OC_STACK_OK : OC_STACK_ERROR; } -OCStackResult OCRDDatabaseDeleteResources(const char *deviceId, const uint8_t *instanceIds, +OCStackResult OC_CALL OCRDDatabaseDeleteResources(const char *deviceId, const uint8_t *instanceIds, uint8_t nInstanceIds) { CHECK_DATABASE_INIT; diff --git a/resource/csdk/resource-directory/src/rd_client.c b/resource/csdk/resource-directory/src/rd_client.c index 66f8127..77dc945 100644 --- a/resource/csdk/resource-directory/src/rd_client.c +++ b/resource/csdk/resource-directory/src/rd_client.c @@ -37,8 +37,8 @@ #ifdef RD_CLIENT -OCStackResult OCRDDiscover(OCDoHandle *handle, OCConnectivityType connectivityType, - OCCallbackData *cbBiasFactor, OCQualityOfService qos) +OCStackResult OC_CALL OCRDDiscover(OCDoHandle *handle, OCConnectivityType connectivityType, + OCCallbackData *cbBiasFactor, OCQualityOfService qos) { if (!cbBiasFactor || !cbBiasFactor->cb) { @@ -117,10 +117,10 @@ exit: return cbData->cb(cbData->context, handle, clientResponse); } -OCStackResult OCRDPublish(OCDoHandle *handle, const char *host, - OCConnectivityType connectivityType, - OCResourceHandle *resourceHandles, uint8_t nHandles, - OCCallbackData *cbData, OCQualityOfService qos) +OCStackResult OC_CALL OCRDPublish(OCDoHandle *handle, const char *host, + OCConnectivityType connectivityType, + OCResourceHandle *resourceHandles, uint8_t nHandles, + OCCallbackData *cbData, OCQualityOfService qos) { // Validate input parameters. if (!host) @@ -319,11 +319,11 @@ exit: return rdPayload; } -OCStackResult OCRDPublishWithDeviceId(OCDoHandle *handle, const char *host, - const unsigned char *id, - OCConnectivityType connectivityType, - OCResourceHandle *resourceHandles, uint8_t nHandles, - OCCallbackData *cbData, OCQualityOfService qos) +OCStackResult OC_CALL OCRDPublishWithDeviceId(OCDoHandle *handle, const char *host, + const unsigned char *id, + OCConnectivityType connectivityType, + OCResourceHandle *resourceHandles, uint8_t nHandles, + OCCallbackData *cbData, OCQualityOfService qos) { // Validate input parameters. if (!host || !cbData || !cbData->cb || !id) @@ -400,10 +400,10 @@ OCStackResult OCRDPublishWithDeviceId(OCDoHandle *handle, const char *host, connectivityType, qos, &rdPublishCbData, options, (uint8_t)numOptions); } -OCStackResult OCRDDelete(OCDoHandle *handle, const char *host, - OCConnectivityType connectivityType, - OCResourceHandle *resourceHandles, uint8_t nHandles, - OCCallbackData *cbData, OCQualityOfService qos) +OCStackResult OC_CALL OCRDDelete(OCDoHandle *handle, const char *host, + OCConnectivityType connectivityType, + OCResourceHandle *resourceHandles, uint8_t nHandles, + OCCallbackData *cbData, OCQualityOfService qos) { // Validate input parameters if (!host) @@ -422,11 +422,11 @@ OCStackResult OCRDDelete(OCDoHandle *handle, const char *host, cbData, qos); } -OCStackResult OCRDDeleteWithDeviceId(OCDoHandle *handle, const char *host, - const unsigned char *id, - OCConnectivityType connectivityType, - OCResourceHandle *resourceHandles, uint8_t nHandles, - OCCallbackData *cbData, OCQualityOfService qos) +OCStackResult OC_CALL OCRDDeleteWithDeviceId(OCDoHandle *handle, const char *host, + const unsigned char *id, + OCConnectivityType connectivityType, + OCResourceHandle *resourceHandles, uint8_t nHandles, + OCCallbackData *cbData, OCQualityOfService qos) { // Validate input parameters if (!host || !cbData || !cbData->cb || !id) diff --git a/resource/csdk/resource-directory/src/rd_server.c b/resource/csdk/resource-directory/src/rd_server.c index d1f0c25..24c7312 100644 --- a/resource/csdk/resource-directory/src/rd_server.c +++ b/resource/csdk/resource-directory/src/rd_server.c @@ -115,7 +115,7 @@ static OCEntityHandlerResult handlePublishRequest(const OCEntityHandlerRequest * if (payload) { OIC_LOG_PAYLOAD(DEBUG, (OCPayload *) payload); - if (OC_STACK_OK == OCRDDatabaseInit(NULL)) + if (OC_STACK_OK == OCRDDatabaseInit()) { if (OC_STACK_OK == OCRDDatabaseStoreResources(payload)) { @@ -171,7 +171,7 @@ static OCEntityHandlerResult handleDeleteRequest(const OCEntityHandlerRequest *e OIC_LOG_V(DEBUG, TAG, "Received OC_REST_DELETE from client with query: %s.", ehRequest->query); - if (OC_STACK_OK != OCRDDatabaseInit(NULL)) + if (OC_STACK_OK != OCRDDatabaseInit()) { goto exit; } @@ -306,7 +306,7 @@ static OCEntityHandlerResult rdEntityHandler(OCEntityHandlerFlag flag, /** * Registers RD resource */ -OCStackResult OCRDStart() +OCStackResult OC_CALL OCRDStart() { OCStackResult result = OCCreateResource(&rdHandle, OC_RSRVD_RESOURCE_TYPE_RD, @@ -342,7 +342,7 @@ OCStackResult OCRDStart() /** * Stops resource directory server */ -OCStackResult OCRDStop() +OCStackResult OC_CALL OCRDStop() { if (!rdHandle) { diff --git a/resource/csdk/security/include/occertutility.h b/resource/csdk/security/include/occertutility.h index 12f936d..b0cdf18 100644 --- a/resource/csdk/security/include/occertutility.h +++ b/resource/csdk/security/include/occertutility.h @@ -41,7 +41,7 @@ extern "C" { * * @return OC_STACK_OK if generated successfully; error otherwise. */ -OCStackResult OCGenerateRandomSerialNumber(char **serial, size_t *serialLen); +OCStackResult OC_CALL OCGenerateRandomSerialNumber(char **serial, size_t *serialLen); /** * Generate a new NIST P-256 elliptic curve key pair and return the public and private @@ -56,8 +56,8 @@ OCStackResult OCGenerateRandomSerialNumber(char **serial, size_t *serialLen); * this key remains protected and secret! * @param[OUT] privateKeyLen Variable to receive length of privateKey, which will include terminating NULL. */ -OCStackResult OCGenerateKeyPair(char **publicKey, size_t *publicKeyLen, - char **privateKey, size_t *privateKeyLen); +OCStackResult OC_CALL OCGenerateKeyPair(char **publicKey, size_t *publicKeyLen, + char **privateKey, size_t *privateKeyLen); /** * Generate a certificate to act as a Certificate Authority (CA). @@ -86,7 +86,7 @@ OCStackResult OCGenerateKeyPair(char **publicKey, size_t *publicKeyLen, * * @return OC_STACK_OK if successful, error code otherwise */ -OCStackResult OCGenerateCACertificate( +OCStackResult OC_CALL OCGenerateCACertificate( const char *subject, const char *subjectPublicKey, const char *issuerCert, @@ -120,7 +120,7 @@ OCStackResult OCGenerateCACertificate( * * @return OC_STACK_OK if successful, error code otherwise */ -OCStackResult OCGenerateIdentityCertificate( +OCStackResult OC_CALL OCGenerateIdentityCertificate( const OicUuid_t *subjectUuid, const char *subjectPublicKey, const char *issuerCert, @@ -157,7 +157,7 @@ OCStackResult OCGenerateIdentityCertificate( * * @return OC_STACK_OK if successful, error code otherwise */ -OCStackResult OCGenerateRoleCertificate( +OCStackResult OC_CALL OCGenerateRoleCertificate( const OicUuid_t *subjectUuid, const char *subjectPublicKey, const char *issuerCert, @@ -178,7 +178,7 @@ OCStackResult OCGenerateRoleCertificate( * * @return OC_STACK_OK if successful, error code otherwise */ -OCStackResult OCGetUuidFromCSR(const char* csr, OicUuid_t* uuid); +OCStackResult OC_CALL OCGetUuidFromCSR(const char* csr, OicUuid_t* uuid); /** * Extract a public key from a CSR. @@ -189,7 +189,7 @@ OCStackResult OCGetUuidFromCSR(const char* csr, OicUuid_t* uuid); * * @return OC_STACK_OK if successful, error code otherwise */ -OCStackResult OCGetPublicKeyFromCSR(const char* csr, char** publicKey); +OCStackResult OC_CALL OCGetPublicKeyFromCSR(const char* csr, char** publicKey); /** * Verify the signature in a CSR is valid. @@ -200,7 +200,7 @@ OCStackResult OCGetPublicKeyFromCSR(const char* csr, char** publicKey); * * @remark Requires that ECDSA with SHA-256 be used for the signature. */ -OCStackResult OCVerifyCSRSignature(const char* csr); +OCStackResult OC_CALL OCVerifyCSRSignature(const char* csr); /** * Convert a CSR from DER encoding to PEM encoding. @@ -212,7 +212,7 @@ OCStackResult OCVerifyCSRSignature(const char* csr); * * @return OC_STACK_OK if successful, error code otherwise */ -OCStackResult OCConvertDerCSRToPem(const char* derCSR, size_t derCSRLen, char** pemCSR); +OCStackResult OC_CALL OCConvertDerCSRToPem(const char* derCSR, size_t derCSRLen, char** pemCSR); #ifdef __cplusplus } diff --git a/resource/csdk/security/include/ocsecurity.h b/resource/csdk/security/include/ocsecurity.h index 786f3e8..5621267 100644 --- a/resource/csdk/security/include/ocsecurity.h +++ b/resource/csdk/security/include/ocsecurity.h @@ -51,7 +51,7 @@ typedef void(*OCAssertRolesCB)(void* ctx, bool hasError); * @note The port field of the devAddr parameter MUST contain the secure port of the peer. * */ -OCStackResult OCAssertRoles(void *ctx, const OCDevAddr *devAddr, OCAssertRolesCB resultCallback); +OCStackResult OC_CALL OCAssertRoles(void *ctx, const OCDevAddr *devAddr, OCAssertRolesCB resultCallback); #ifdef __cplusplus } diff --git a/resource/csdk/security/include/oxmverifycommon.h b/resource/csdk/security/include/oxmverifycommon.h index e3ef033..bd189be 100644 --- a/resource/csdk/security/include/oxmverifycommon.h +++ b/resource/csdk/security/include/oxmverifycommon.h @@ -47,12 +47,12 @@ /** * Function pointer to display verification PIN */ -typedef OCStackResult (*DisplayNumCallback)(void * ctx, uint8_t verifNum[MUTUAL_VERIF_NUM_LEN]); +typedef OCStackResult (OC_CALL *DisplayNumCallback)(void * ctx, uint8_t verifNum[MUTUAL_VERIF_NUM_LEN]); /** * Function pointer to get user confirmation */ -typedef OCStackResult (*UserConfirmCallback)(void * ctx); +typedef OCStackResult (OC_CALL *UserConfirmCallback)(void * ctx); /** * Context for displaying verification PIN @@ -75,33 +75,33 @@ typedef struct UserConfirmContext /** * Set Callback for displaying verification PIN */ -void SetDisplayNumCB(void * ptr, DisplayNumCallback displayNumCB); +void OC_CALL SetDisplayNumCB(void * ptr, DisplayNumCallback displayNumCB); /** * Unset Callback for displaying verification PIN */ -void* UnsetDisplayNumCB(); +void* OC_CALL UnsetDisplayNumCB(); /** * Set Callback for getting user confirmation */ -void SetUserConfirmCB(void * ptr, UserConfirmCallback userConfirmCB); +void OC_CALL SetUserConfirmCB(void * ptr, UserConfirmCallback userConfirmCB); /** * Unset Callback for getting user confirmation */ -void* UnsetUserConfirmCB(); +void* OC_CALL UnsetUserConfirmCB(); /** * Set verification method option. * The default is both display PIN and get user confirmation. */ -void SetVerifyOption(VerifyOptionBitmask_t verifyOption); +void OC_CALL SetVerifyOption(VerifyOptionBitmask_t verifyOption); /** * Call the Callback for Verifying Ownership Transfer process. */ -OCStackResult VerifyOwnershipTransfer(uint8_t mutualVerifNum[MUTUAL_VERIF_NUM_LEN], +OCStackResult OC_CALL VerifyOwnershipTransfer(uint8_t mutualVerifNum[MUTUAL_VERIF_NUM_LEN], VerifyOptionBitmask_t verifyOption); #ifdef __cplusplus diff --git a/resource/csdk/security/include/pinoxmcommon.h b/resource/csdk/security/include/pinoxmcommon.h index 23e22e6..5a80a63 100644 --- a/resource/csdk/security/include/pinoxmcommon.h +++ b/resource/csdk/security/include/pinoxmcommon.h @@ -51,27 +51,27 @@ typedef enum OicSecPinType{ /** * Function pointer to display pin code. */ -typedef void (*GeneratePinCallback)(char* pinData, size_t pinSize); +typedef void (OC_CALL *GeneratePinCallback)(char* pinData, size_t pinSize); /** * Function pointer to display pin code, with context. */ -typedef void(*DisplayPinCallbackWithContext)(char* pinData, size_t pinSize, void* context); +typedef void(OC_CALL *DisplayPinCallbackWithContext)(char* pinData, size_t pinSize, void* context); /** * Function pointer to close the displied PIN. */ -typedef void (*ClosePinDisplayCallback)(void); +typedef void (OC_CALL *ClosePinDisplayCallback)(void); /** * Function pointer to input pin code. */ -typedef void (*InputPinCallback)(char* pinBuf, size_t bufSize); +typedef void (OC_CALL *InputPinCallback)(char* pinBuf, size_t bufSize); /** * Function pointer to input pin code, with context and device information. */ -typedef void(*InputPinCallbackWithContext)(OicUuid_t deviceId, char* pinBuffer, size_t pinBufferSize, void* context); +typedef void(OC_CALL *InputPinCallbackWithContext)(OicUuid_t deviceId, char* pinBuffer, size_t pinBufferSize, void* context); /** * Function to set the display PIN callback from the user. @@ -80,7 +80,7 @@ typedef void(*InputPinCallbackWithContext)(OicUuid_t deviceId, char* pinBuffer, * * @param pinCB implementation of generate PIN callback. */ -void SetGeneratePinCB(GeneratePinCallback pinCB); +void OC_CALL SetGeneratePinCB(GeneratePinCallback pinCB); /** * Function to set the display PIN callback from the user with context. @@ -92,7 +92,7 @@ void SetGeneratePinCB(GeneratePinCallback pinCB); * OC_STACK_INVALID_PARAM if pinCB is invalid. * OC_STACK_DUPLICATE_REQUEST if a display pin callback has already been set. */ -OCStackResult SetDisplayPinWithContextCB(DisplayPinCallbackWithContext displayPinCB, void* context); +OCStackResult OC_CALL SetDisplayPinWithContextCB(DisplayPinCallbackWithContext displayPinCB, void* context); /** * Function to set the input PIN callback from the user. @@ -101,7 +101,7 @@ OCStackResult SetDisplayPinWithContextCB(DisplayPinCallbackWithContext displayPi * * @param pinCB implementation of input PIN callback. */ -void SetInputPinCB(InputPinCallback pinCB); +void OC_CALL SetInputPinCB(InputPinCallback pinCB); /** * Function to set the input PIN callback from the user with context. @@ -113,7 +113,7 @@ void SetInputPinCB(InputPinCallback pinCB); * OC_STACK_INVALID_PARAM if pinCB is invalid. * OC_STACK_DUPLICATE_REQUEST if an input pin callback has already been set. */ -OCStackResult SetInputPinWithContextCB(InputPinCallbackWithContext inputPinCB, void* context); +OCStackResult OC_CALL SetInputPinWithContextCB(InputPinCallbackWithContext inputPinCB, void* context); /** * Function to set the close PIN callback @@ -121,7 +121,7 @@ OCStackResult SetInputPinWithContextCB(InputPinCallbackWithContext inputPinCB, v * * @param closeCB implementation of close PIN callback. */ -void SetClosePinDisplayCB(ClosePinDisplayCallback closeCB); +void OC_CALL SetClosePinDisplayCB(ClosePinDisplayCallback closeCB); /** * Function to unset the input PIN callback. @@ -130,13 +130,13 @@ void SetClosePinDisplayCB(ClosePinDisplayCallback closeCB); * @deprecated Use UnsetInputPinWithContextCB instead. * */ -void UnsetInputPinCB(); +void OC_CALL UnsetInputPinCB(); /** * Function to unset the input PIN callback. * NOTE : Do not call this function while PIN based ownership transfer is in progress. */ -void UnsetInputPinWithContextCB(); +void OC_CALL UnsetInputPinWithContextCB(); /** * Function to unset the PIN generation callback. @@ -145,19 +145,19 @@ void UnsetInputPinWithContextCB(); * @deprecated Use UnsetDisplayPinWithContextCB instead. * */ -void UnsetGeneratePinCB(); +void OC_CALL UnsetGeneratePinCB(); /** * Function to unset the PIN display callback. * NOTE : Do not call this function while PIN based ownership transfer is in progress. */ -void UnsetDisplayPinWithContextCB(); +void OC_CALL UnsetDisplayPinWithContextCB(); /** * Function to unset the PIN close callback. * NOTE : Do not call this function while PIN based ownership transfer is in progress. */ -void UnsetClosePinCB(); +void OC_CALL UnsetClosePinCB(); /** * Function to generate a random PIN. @@ -169,7 +169,7 @@ void UnsetClosePinCB(); * * @return ::OC_STACK_OK in case of success or other value in case of error. */ -OCStackResult GeneratePin(char* pinBuffer, size_t bufferSize); +OCStackResult OC_CALL GeneratePin(char* pinBuffer, size_t bufferSize); /** * Function to get a pin for a device. @@ -199,7 +199,7 @@ void ClosePinDisplay(); * * @return ::OC_STACK_SUCCESS in case of success or other value in ccase of error. */ -OCStackResult SetPreconfigPin(const char *pinBuffer, size_t pinLength); +OCStackResult OC_CALL SetPreconfigPin(const char *pinBuffer, size_t pinLength); #endif /** @@ -210,7 +210,7 @@ OCStackResult SetPreconfigPin(const char *pinBuffer, size_t pinLength); * * @return ::OC_STACK_OK in case of success or other value in case of error. */ -OCStackResult SetRandomPinPolicy(size_t pinSize, OicSecPinType_t pinType); +OCStackResult OC_CALL SetRandomPinPolicy(size_t pinSize, OicSecPinType_t pinType); #ifdef __WITH_DTLS__ diff --git a/resource/csdk/security/include/srmutility.h b/resource/csdk/security/include/srmutility.h index 34e9ffe..79a8693 100644 --- a/resource/csdk/security/include/srmutility.h +++ b/resource/csdk/security/include/srmutility.h @@ -142,7 +142,7 @@ OCStackResult ConvertUuidToStr(const OicUuid_t* uuid, char** strUuid); * @return OC_STACK_OK for success. * */ -OCStackResult ConvertStrToUuid(const char* strUuid, OicUuid_t* uuid); +OCStackResult OC_CALL ConvertStrToUuid(const char* strUuid, OicUuid_t* uuid); /** * Compares two OicUuid_t structs. @@ -170,7 +170,7 @@ bool IsNilUuid(const OicUuid_t *uuid); * * @return ::OC_STACK_OK for Success, otherwise some error value. */ -OCStackResult SetDeviceIdSeed(const uint8_t* seed, size_t seedSize); +OCStackResult OC_CALL SetDeviceIdSeed(const uint8_t* seed, size_t seedSize); #endif #ifdef __cplusplus diff --git a/resource/csdk/security/provisioning/include/ocprovisioningmanager.h b/resource/csdk/security/provisioning/include/ocprovisioningmanager.h index 4cbf5a3..7abd523 100644 --- a/resource/csdk/security/provisioning/include/ocprovisioningmanager.h +++ b/resource/csdk/security/provisioning/include/ocprovisioningmanager.h @@ -42,7 +42,7 @@ extern "C" { * * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCInitPM(const char* dbPath); +OCStackResult OC_CALL OCInitPM(const char* dbPath); /** * API to cleanup PDM in case of timeout. @@ -50,7 +50,7 @@ OCStackResult OCInitPM(const char* dbPath); * * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCPDMCleanupForTimeout(); +OCStackResult OC_CALL OCPDMCleanupForTimeout(); /** * The function is responsible for discovery of owned/unowned device is specified endpoint/deviceID. @@ -62,7 +62,7 @@ OCStackResult OCPDMCleanupForTimeout(); * @param[out] ppFoundDevice OCProvisionDev_t of found device * @return OTM_SUCCESS in case of success and other value otherwise. */ -OCStackResult OCDiscoverSingleDevice(unsigned short timeout, const OicUuid_t* deviceID, +OCStackResult OC_CALL OCDiscoverSingleDevice(unsigned short timeout, const OicUuid_t* deviceID, OCProvisionDev_t **ppFoundDevice); /** @@ -78,7 +78,7 @@ OCStackResult OCDiscoverSingleDevice(unsigned short timeout, const OicUuid_t* de * @param[out] ppFoundDevice OCProvisionDev_t of found device. * @return OTM_SUCCESS in case of success and other value otherwise. */ -OCStackResult OCDiscoverSingleDeviceInUnicast(unsigned short timeout, const OicUuid_t* deviceID, +OCStackResult OC_CALL OCDiscoverSingleDeviceInUnicast(unsigned short timeout, const OicUuid_t* deviceID, const char* hostAddress, OCConnectivityType connType, OCProvisionDev_t **ppFoundDevice); @@ -92,7 +92,7 @@ OCStackResult OCDiscoverSingleDeviceInUnicast(unsigned short timeout, const OicU * @param[out] ppList List of candidate devices to be provisioned * @return OTM_SUCCESS in case of success and other value otherwise. */ -OCStackResult OCDiscoverUnownedDevices(unsigned short waittime, OCProvisionDev_t **ppList); +OCStackResult OC_CALL OCDiscoverUnownedDevices(unsigned short waittime, OCProvisionDev_t **ppList); /** * Do ownership transfer for un-owned device. @@ -102,7 +102,7 @@ OCStackResult OCDiscoverUnownedDevices(unsigned short waittime, OCProvisionDev_t * @param[in] resultCallback Result callback function to be invoked when ownership transfer finished. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCDoOwnershipTransfer(void* ctx, +OCStackResult OC_CALL OCDoOwnershipTransfer(void* ctx, OCProvisionDev_t *targetDevices, OCProvisionResultCB resultCallback); @@ -114,7 +114,7 @@ OCStackResult OCDoOwnershipTransfer(void* ctx, * * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCSetOxmAllowStatus(const OicSecOxm_t oxm, const bool allowStatus); +OCStackResult OC_CALL OCSetOxmAllowStatus(const OicSecOxm_t oxm, const bool allowStatus); #ifdef MULTIPLE_OWNER /** @@ -125,7 +125,7 @@ OCStackResult OCSetOxmAllowStatus(const OicSecOxm_t oxm, const bool allowStatus) * @param[in] resultCallback Result callback function to be invoked when ownership transfer finished. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCDoMultipleOwnershipTransfer(void* ctx, +OCStackResult OC_CALL OCDoMultipleOwnershipTransfer(void* ctx, OCProvisionDev_t *targetDevices, OCProvisionResultCB resultCallback); #endif //MULTIPLE_OWNER @@ -137,7 +137,7 @@ OCStackResult OCDoMultipleOwnershipTransfer(void* ctx, * @param[in] callbackData of callback functions for owership transfer. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCSetOwnerTransferCallbackData(OicSecOxm_t oxm, OTMCallbackData_t* callbackData); +OCStackResult OC_CALL OCSetOwnerTransferCallbackData(OicSecOxm_t oxm, OTMCallbackData_t* callbackData); /** * The function is responsible for discovery of owned device is current subnet. It will list @@ -148,7 +148,7 @@ OCStackResult OCSetOwnerTransferCallbackData(OicSecOxm_t oxm, OTMCallbackData_t* * @param[out] ppList List of device owned by provisioning tool. * @return OTM_SUCCESS in case of success and other value otherwise. */ -OCStackResult OCDiscoverOwnedDevices(unsigned short timeout, OCProvisionDev_t **ppList); +OCStackResult OC_CALL OCDiscoverOwnedDevices(unsigned short timeout, OCProvisionDev_t **ppList); #ifdef MULTIPLE_OWNER /** @@ -163,7 +163,7 @@ OCStackResult OCDiscoverOwnedDevices(unsigned short timeout, OCProvisionDev_t ** * OCDeleteDiscoveredDevices to delete the device. * @return OC_STACK_OK in case of success and other values otherwise. */ -OCStackResult OCDiscoverMultipleOwnerEnabledSingleDevice(unsigned short timeoutSeconds, +OCStackResult OC_CALL OCDiscoverMultipleOwnerEnabledSingleDevice(unsigned short timeoutSeconds, const OicUuid_t *deviceID, OCProvisionDev_t **ppFoundDevice); @@ -175,7 +175,7 @@ OCStackResult OCDiscoverMultipleOwnerEnabledSingleDevice(unsigned short timeoutS * @param[out] ppList List of MOT enabled devices. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCDiscoverMultipleOwnerEnabledDevices(unsigned short timeout, OCProvisionDev_t **ppList); +OCStackResult OC_CALL OCDiscoverMultipleOwnerEnabledDevices(unsigned short timeout, OCProvisionDev_t **ppList); /** * The function is responsible for discovery of Multiple Owned device is current subnet. @@ -185,7 +185,7 @@ OCStackResult OCDiscoverMultipleOwnerEnabledDevices(unsigned short timeout, OCPr * @param[out] ppList List of Multiple Owned devices. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCDiscoverMultipleOwnedDevices(unsigned short timeout, OCProvisionDev_t **ppList); +OCStackResult OC_CALL OCDiscoverMultipleOwnedDevices(unsigned short timeout, OCProvisionDev_t **ppList); /** * The function is responsible for determining if the caller is a subowner of the specified device. @@ -194,7 +194,7 @@ OCStackResult OCDiscoverMultipleOwnedDevices(unsigned short timeout, OCProvision * @param[out] isSubowner Bool indicating whether the caller is a subowner of device. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCIsSubownerOfDevice(OCProvisionDev_t *device, bool *isSubowner); +OCStackResult OC_CALL OCIsSubownerOfDevice(OCProvisionDev_t *device, bool *isSubowner); #endif //MULTIPLE_OWNER /** @@ -211,7 +211,7 @@ OCStackResult OCIsSubownerOfDevice(OCProvisionDev_t *device, bool *isSubowner); * provisioning request recieves a response from first resource server. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCProvisionPairwiseDevices(void* ctx, OicSecCredType_t type, size_t keySize, +OCStackResult OC_CALL OCProvisionPairwiseDevices(void* ctx, OicSecCredType_t type, size_t keySize, const OCProvisionDev_t *pDev1, OicSecAcl_t *pDev1Acl, const OCProvisionDev_t *pDev2, OicSecAcl_t *pDev2Acl, OCProvisionResultCB resultCallback); @@ -226,7 +226,7 @@ OCStackResult OCProvisionPairwiseDevices(void* ctx, OicSecCredType_t type, size_ request recieves a response from resource server. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCProvisionACL(void *ctx, const OCProvisionDev_t *selectedDeviceInfo, OicSecAcl_t *acl, +OCStackResult OC_CALL OCProvisionACL(void *ctx, const OCProvisionDev_t *selectedDeviceInfo, OicSecAcl_t *acl, OCProvisionResultCB resultCallback); /** @@ -239,7 +239,7 @@ OCStackResult OCProvisionACL(void *ctx, const OCProvisionDev_t *selectedDeviceIn request recieves a response from resource server. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCProvisionACL2(void *ctx, const OCProvisionDev_t *selectedDeviceInfo, OicSecAcl_t *acl, +OCStackResult OC_CALL OCProvisionACL2(void *ctx, const OCProvisionDev_t *selectedDeviceInfo, OicSecAcl_t *acl, OCProvisionResultCB resultCallback); /** @@ -248,7 +248,7 @@ OCStackResult OCProvisionACL2(void *ctx, const OCProvisionDev_t *selectedDeviceI * @param acl ACL to be saved in Acl of SVR. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCSaveACL(const OicSecAcl_t* acl); +OCStackResult OC_CALL OCSaveACL(const OicSecAcl_t* acl); /** * this function requests CRED information to resource. @@ -259,7 +259,7 @@ OCStackResult OCSaveACL(const OicSecAcl_t* acl); request recieves a response from resource server. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCGetCredResource(void* ctx, const OCProvisionDev_t *selectedDeviceInfo, +OCStackResult OC_CALL OCGetCredResource(void* ctx, const OCProvisionDev_t *selectedDeviceInfo, OCProvisionResultCB resultCallback); /** @@ -271,7 +271,7 @@ OCStackResult OCGetCredResource(void* ctx, const OCProvisionDev_t *selectedDevic request recieves a response from resource server. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCGetACLResource(void* ctx, const OCProvisionDev_t *selectedDeviceInfo, +OCStackResult OC_CALL OCGetACLResource(void* ctx, const OCProvisionDev_t *selectedDeviceInfo, OCProvisionResultCB resultCallback); /** @@ -283,7 +283,7 @@ OCStackResult OCGetACLResource(void* ctx, const OCProvisionDev_t *selectedDevice request recieves a response from resource server. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCGetACL2Resource(void* ctx, const OCProvisionDev_t *selectedDeviceInfo, +OCStackResult OC_CALL OCGetACL2Resource(void* ctx, const OCProvisionDev_t *selectedDeviceInfo, OCProvisionResultCB resultCallback); /** @@ -295,7 +295,7 @@ OCStackResult OCGetACL2Resource(void* ctx, const OCProvisionDev_t *selectedDevic request recieves a response from resource server. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCGetCSRResource(void* ctx, const OCProvisionDev_t *selectedDeviceInfo, +OCStackResult OC_CALL OCGetCSRResource(void* ctx, const OCProvisionDev_t *selectedDeviceInfo, OCGetCSRResultCB resultCallback); /** @@ -308,7 +308,7 @@ OCStackResult OCGetCSRResource(void* ctx, const OCProvisionDev_t *selectedDevice * request receives a response from the resource server. * @return OC_STACK_OK in case of success, and error value otherwise. */ -OCStackResult OCGetRolesResource(void *ctx, const OCProvisionDev_t *selectedDeviceInfo, +OCStackResult OC_CALL OCGetRolesResource(void *ctx, const OCProvisionDev_t *selectedDeviceInfo, OCGetRolesResultCB resultCallback); /** @@ -322,7 +322,7 @@ OCStackResult OCGetRolesResource(void *ctx, const OCProvisionDev_t *selectedDevi * * @return OC_STACK_OK in case of success, and error value otherwise. */ -OCStackResult OCDeleteRoleCertificateByCredId(void *ctx, const OCProvisionDev_t *selectedDeviceInfo, +OCStackResult OC_CALL OCDeleteRoleCertificateByCredId(void *ctx, const OCProvisionDev_t *selectedDeviceInfo, OCProvisionResultCB resultCallback, uint32_t credId); /** @@ -335,7 +335,7 @@ OCStackResult OCDeleteRoleCertificateByCredId(void *ctx, const OCProvisionDev_t request recieves a response from resource server. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCProvisionDirectPairing(void* ctx, const OCProvisionDev_t *selectedDeviceInfo, OicSecPconf_t *pconf, +OCStackResult OC_CALL OCProvisionDirectPairing(void* ctx, const OCProvisionDev_t *selectedDeviceInfo, OicSecPconf_t *pconf, OCProvisionResultCB resultCallback); /** @@ -350,7 +350,7 @@ OCStackResult OCProvisionDirectPairing(void* ctx, const OCProvisionDev_t *select * provisioning request recieves a response from first resource server. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCProvisionCredentials(void *ctx, OicSecCredType_t type, size_t keySize, +OCStackResult OC_CALL OCProvisionCredentials(void *ctx, OicSecCredType_t type, size_t keySize, const OCProvisionDev_t *pDev1, const OCProvisionDev_t *pDev2, OCProvisionResultCB resultCallback); @@ -372,7 +372,7 @@ OCStackResult OCProvisionCredentials(void *ctx, OicSecCredType_t type, size_t ke * provisioning request receives a response from first resource server. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCProvisionSymmetricRoleCredentials(void *ctx, OicSecCredType_t type, size_t keySize, +OCStackResult OC_CALL OCProvisionSymmetricRoleCredentials(void *ctx, OicSecCredType_t type, size_t keySize, const OCProvisionDev_t *pDev1, const OCProvisionDev_t *pDev2, const OicSecRole_t *role1, @@ -389,7 +389,7 @@ OCStackResult OCProvisionSymmetricRoleCredentials(void *ctx, OicSecCredType_t ty * provisioning request receives a response from first resource server. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCProvisionCertificate(void *ctx, +OCStackResult OC_CALL OCProvisionCertificate(void *ctx, const OCProvisionDev_t *pDev, const char* pemCert, OCProvisionResultCB resultCallback); @@ -409,7 +409,7 @@ OCStackResult OCProvisionCertificate(void *ctx, * provisioning request recieves a response from first resource server. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCProvisionPreconfigPin(void *ctx, +OCStackResult OC_CALL OCProvisionPreconfigPin(void *ctx, OCProvisionDev_t *targetDeviceInfo, const char *preconfigPin, size_t preconfigPinLen, @@ -423,7 +423,7 @@ OCStackResult OCProvisionPreconfigPin(void *ctx, * @param[in] preconfigPinLen Byte length of preconfigPin * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCAddPreconfigPin(const OCProvisionDev_t *targetDeviceInfo, +OCStackResult OC_CALL OCAddPreconfigPin(const OCProvisionDev_t *targetDeviceInfo, const char *preconfigPin, size_t preconfigPinLen); @@ -436,7 +436,7 @@ OCStackResult OCAddPreconfigPin(const OCProvisionDev_t *targetDeviceInfo, * POST 'mom' request recieves a response from resource server. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCChangeMOTMode(void *ctx, const OCProvisionDev_t *targetDeviceInfo, +OCStackResult OC_CALL OCChangeMOTMode(void *ctx, const OCProvisionDev_t *targetDeviceInfo, const OicSecMomType_t momType, OCProvisionResultCB resultCallback); /** @@ -448,7 +448,7 @@ OCStackResult OCChangeMOTMode(void *ctx, const OCProvisionDev_t *targetDeviceInf * POST 'oxmsel' request recieves a response from resource server. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCSelectMOTMethod(void *ctx, const OCProvisionDev_t *targetDeviceInfo, +OCStackResult OC_CALL OCSelectMOTMethod(void *ctx, const OCProvisionDev_t *targetDeviceInfo, const OicSecOxm_t oxmSelValue, OCProvisionResultCB resultCallback); #endif //MULTIPLE_OWNER @@ -463,7 +463,7 @@ OCStackResult OCSelectMOTMethod(void *ctx, const OCProvisionDev_t *targetDeviceI * device unlink is finished. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCUnlinkDevices(void* ctx, +OCStackResult OC_CALL OCUnlinkDevices(void* ctx, const OCProvisionDev_t* pTargetDev1, const OCProvisionDev_t* pTargetDev2, OCProvisionResultCB resultCallback); @@ -481,7 +481,7 @@ OCStackResult OCUnlinkDevices(void* ctx, * if OC_STACK_OK is returned, the caller of this API should wait for callback. * OC_STACK_CONTINUE means operation is success but no need to wait for callback. */ -OCStackResult OCRemoveDevice(void* ctx, +OCStackResult OC_CALL OCRemoveDevice(void* ctx, unsigned short waitTimeForOwnedDeviceDiscovery, const OCProvisionDev_t* pTargetDev, OCProvisionResultCB resultCallback); @@ -497,7 +497,7 @@ OCStackResult OCRemoveDevice(void* ctx, * credential revocation is finished. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCRemoveDeviceWithUuid(void* ctx, +OCStackResult OC_CALL OCRemoveDeviceWithUuid(void* ctx, unsigned short waitTimeForOwnedDeviceDiscovery, const OicUuid_t* pTargetUuid, OCProvisionResultCB resultCallback); @@ -513,7 +513,7 @@ OCStackResult OCRemoveDeviceWithUuid(void* ctx, * credential revocation is finished. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCResetDevice(void* ctx, unsigned short waitTimeForOwnedDeviceDiscovery, +OCStackResult OC_CALL OCResetDevice(void* ctx, unsigned short waitTimeForOwnedDeviceDiscovery, const OCProvisionDev_t* pTargetDev, OCProvisionResultCB resultCallback); @@ -522,14 +522,14 @@ OCStackResult OCResetDevice(void* ctx, unsigned short waitTimeForOwnedDeviceDisc * *@return OC_STACK_OK in case of successful reset and other value otherwise. */ -OCStackResult OCResetSVRDB(void); +OCStackResult OC_CALL OCResetSVRDB(void); /** * This function configures SVR DB as self-ownership. * *@return OC_STACK_OK in case of successful configue and other value otherwise. */ -OCStackResult OCConfigSelfOwnership(void); +OCStackResult OC_CALL OCConfigSelfOwnership(void); /** * API to get status of all the devices in current subnet. The status include endpoint information @@ -548,7 +548,7 @@ OCStackResult OCConfigSelfOwnership(void); * @param[out] pUnownedDevList list of unowned devices. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCGetDevInfoFromNetwork(unsigned short waittime, +OCStackResult OC_CALL OCGetDevInfoFromNetwork(unsigned short waittime, OCProvisionDev_t** pOwnedDevList, OCProvisionDev_t** pUnownedDevList); /** @@ -559,7 +559,7 @@ OCStackResult OCGetDevInfoFromNetwork(unsigned short waittime, * @param[out] numOfDevices total number of linked devices. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCGetLinkedStatus(const OicUuid_t* uuidOfDevice, +OCStackResult OC_CALL OCGetLinkedStatus(const OicUuid_t* uuidOfDevice, OCUuidList_t** uuidList, size_t* numOfDevices); @@ -571,38 +571,51 @@ OCStackResult OCGetLinkedStatus(const OicUuid_t* uuidOfDevice, * @return OC_STACK_RESOURCE_DELETED if credentials were removed, or * OC_STACK_ERROR if no credentials were removed. */ -OCStackResult OCRemoveCredential(const OicUuid_t* subjectUuid); +OCStackResult OC_CALL OCRemoveCredential(const OicUuid_t* subjectUuid); /** * API to delete memory allocated to linked list created by OCDiscover_XXX_Devices API. * * @param[in] pList Pointer to OCProvisionDev_t which should be deleted. */ -void OCDeleteDiscoveredDevices(OCProvisionDev_t *pList); +void OC_CALL OCDeleteDiscoveredDevices(OCProvisionDev_t *pList); /** * API to delete memory allocated to OicUuid_t list. * * @param[in] pList Pointer to OicUuid_t list which should be deleted. */ -void OCDeleteUuidList(OCUuidList_t* pList); +void OC_CALL OCDeleteUuidList(OCUuidList_t* pList); /** * This function deletes ACL data. * * @param pAcl Pointer to OicSecAcl_t structure. */ -void OCDeleteACLList(OicSecAcl_t* pAcl); +void OC_CALL OCDeleteACLList(OicSecAcl_t* pAcl); /** * This function deletes PDACL data. * * @param pPdAcl Pointer to OicSecPdAcl_t structure. */ -void OCDeletePdAclList(OicSecPdAcl_t* pPdAcl); +void OC_CALL OCDeletePdAclList(OicSecPdAcl_t* pPdAcl); #if defined(__WITH_DTLS__) || defined(__WITH_TLS__) /** + * this function sends CRL information to resource. + * + * @param[in] ctx Application context returned in the result callback. + * @param[in] selectedDeviceInfo Selected target device. + * @param[in] crl CRL to provision. + * @param[in] resultCallback callback provided by API user, callback will be called when provisioning + request recieves a response from resource server. + * @return OC_STACK_OK in case of success and other value otherwise. + */ +OCStackResult OC_CALL OCProvisionCRL(void* ctx, const OCProvisionDev_t *selectedDeviceInfo, OicSecCrl_t *crl, + OCProvisionResultCB resultCallback); + +/** * function to provision Trust certificate chain to devices. * * @param[in] ctx Application context returned in the result callback. @@ -613,7 +626,7 @@ void OCDeletePdAclList(OicSecPdAcl_t* pPdAcl); * provisioning request recieves a response from first resource server. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCProvisionTrustCertChain(void *ctx, OicSecCredType_t type, uint16_t credId, +OCStackResult OC_CALL OCProvisionTrustCertChain(void *ctx, OicSecCredType_t type, uint16_t credId, const OCProvisionDev_t *selectedDeviceInfo, OCProvisionResultCB resultCallback); /** @@ -625,7 +638,7 @@ OCStackResult OCProvisionTrustCertChain(void *ctx, OicSecCredType_t type, uint16 * @param[out] credId CredId of saved trust certificate chain in Cred of SVR. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCSaveTrustCertChain(const uint8_t *trustCertChain, size_t chainSize, +OCStackResult OC_CALL OCSaveTrustCertChain(const uint8_t *trustCertChain, size_t chainSize, OicEncodingType_t encodingType, uint16_t *credId); /** @@ -636,7 +649,7 @@ OCStackResult OCSaveTrustCertChain(const uint8_t *trustCertChain, size_t chainSi * @param[out] credId CredId of saved certificate chain in Cred of SVR. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCSaveOwnCertChain(const char* cert, const char* key, uint16_t *credId); +OCStackResult OC_CALL OCSaveOwnCertChain(const char* cert, const char* key, uint16_t *credId); /** * Function to save own role certificate into Cred of SVR. @@ -648,7 +661,7 @@ OCStackResult OCSaveOwnCertChain(const char* cert, const char* key, uint16_t *cr * @note The certificate public key must be the same as public key in the identity * certificate (installed by OCSaveOwnCertChain). */ -OCStackResult OCSaveOwnRoleCert(const char* cert, uint16_t *credId); +OCStackResult OC_CALL OCSaveOwnRoleCert(const char* cert, uint16_t *credId); /** * function to register callback, for getting notification for TrustCertChain change. @@ -656,12 +669,12 @@ OCStackResult OCSaveOwnRoleCert(const char* cert, uint16_t *credId); * @param[in] TrustCertChainChangeCB notifier callback function * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCRegisterTrustCertChainNotifier(void *cb, TrustCertChainChangeCB CB); +OCStackResult OC_CALL OCRegisterTrustCertChainNotifier(void *cb, TrustCertChainChangeCB CB); /** * function to de-register TrustCertChain notification callback. */ -void OCRemoveTrustCertChainNotifier(void); +void OC_CALL OCRemoveTrustCertChainNotifier(void); /** * Function to read Trust certificate chain from SVR. @@ -671,7 +684,7 @@ void OCRemoveTrustCertChainNotifier(void); * @param[out] chainSize Size of trust certificate chain * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCReadTrustCertChain(uint16_t credId, uint8_t **trustCertChain, +OCStackResult OC_CALL OCReadTrustCertChain(uint16_t credId, uint8_t **trustCertChain, size_t *chainSize); /** @@ -683,7 +696,7 @@ OCStackResult OCReadTrustCertChain(uint16_t credId, uint8_t **trustCertChain, * @param[in] ownerType type of owner device (SUPER_OWNER or SUB_OWNER) * @return OC_STACK_OK on success */ -OCStackResult OCSelectOwnershipTransferMethod(const OicSecOxm_t *supportedMethods, +OCStackResult OC_CALL OCSelectOwnershipTransferMethod(const OicSecOxm_t *supportedMethods, size_t numberOfMethods, OicSecOxm_t *selectedMethod, OwnerType_t ownerType); #endif // __WITH_DTLS__ || __WITH_TLS__ diff --git a/resource/csdk/security/provisioning/include/pmutility.h b/resource/csdk/security/provisioning/include/pmutility.h index 3c3ddd5..422ce34 100644 --- a/resource/csdk/security/provisioning/include/pmutility.h +++ b/resource/csdk/security/provisioning/include/pmutility.h @@ -165,10 +165,10 @@ OCProvisionDev_t* PMCloneOCProvisionDev(const OCProvisionDev_t* src); * * @return true on success */ -bool PMGenerateQuery(bool isSecure, - const char* address, uint16_t port, - OCConnectivityType connType, - char* buffer, size_t bufferSize, const char* uri); +bool OC_CALL PMGenerateQuery(bool isSecure, + const char* address, uint16_t port, + OCConnectivityType connType, + char* buffer, size_t bufferSize, const char* uri); /** * Function to print OCProvisionDev_t for debug purpose. diff --git a/resource/csdk/security/provisioning/sample/provisioningclient.c b/resource/csdk/security/provisioning/sample/provisioningclient.c index 04277a7..3853e97 100644 --- a/resource/csdk/security/provisioning/sample/provisioningclient.c +++ b/resource/csdk/security/provisioning/sample/provisioningclient.c @@ -459,7 +459,7 @@ static void updateDoxmForMOTCB(void* ctx, size_t nOfRes, OCProvisionResult_t* ar } #endif //MULTIPLE_OWNER -static void inputPinCB(OicUuid_t deviceId, char *pin, size_t len, void *context) +static void OC_CALL inputPinCB(OicUuid_t deviceId, char *pin, size_t len, void *context) { OC_UNUSED(deviceId); OC_UNUSED(context); @@ -1834,7 +1834,7 @@ static int removeDeviceWithUuid(void) return 0; } -OCStackResult displayNumCB(void * ctx, uint8_t mutualVerifNum[MUTUAL_VERIF_NUM_LEN]) +OCStackResult OC_CALL displayNumCB(void * ctx, uint8_t mutualVerifNum[MUTUAL_VERIF_NUM_LEN]) { OC_UNUSED(ctx); @@ -1853,7 +1853,7 @@ OCStackResult displayNumCB(void * ctx, uint8_t mutualVerifNum[MUTUAL_VERIF_NUM_L return OC_STACK_OK; } -OCStackResult confirmNumCB(void * ctx) +OCStackResult OC_CALL confirmNumCB(void * ctx) { OC_UNUSED(ctx); diff --git a/resource/csdk/security/provisioning/sample/sampleserver_mvjustworks.cpp b/resource/csdk/security/provisioning/sample/sampleserver_mvjustworks.cpp index e35a1e6..e6fdd97 100644 --- a/resource/csdk/security/provisioning/sample/sampleserver_mvjustworks.cpp +++ b/resource/csdk/security/provisioning/sample/sampleserver_mvjustworks.cpp @@ -397,7 +397,7 @@ OCEntityHandlerCb (OCEntityHandlerFlag flag, return ehResult; } -OCStackResult displayNumCB(void *ctx, uint8_t mutualVerifNum[MUTUAL_VERIF_NUM_LEN]) +OCStackResult OC_CALL displayNumCB(void *ctx, uint8_t mutualVerifNum[MUTUAL_VERIF_NUM_LEN]) { OC_UNUSED(ctx); @@ -409,7 +409,7 @@ OCStackResult displayNumCB(void *ctx, uint8_t mutualVerifNum[MUTUAL_VERIF_NUM_LE return OC_STACK_OK; } -OCStackResult confirmNumCB(void *ctx) +OCStackResult OC_CALL confirmNumCB(void *ctx) { OC_UNUSED(ctx); diff --git a/resource/csdk/security/provisioning/sample/sampleserver_randompin.cpp b/resource/csdk/security/provisioning/sample/sampleserver_randompin.cpp index d135f32..6bfb85e 100644 --- a/resource/csdk/security/provisioning/sample/sampleserver_randompin.cpp +++ b/resource/csdk/security/provisioning/sample/sampleserver_randompin.cpp @@ -454,7 +454,7 @@ FILE* server_fopen(const char *path, const char *mode) } } -void DisplayPinCB(char *pin, size_t pinSize, void *context) +void OC_CALL DisplayPinCB(char *pin, size_t pinSize, void *context) { OC_UNUSED(context); @@ -469,7 +469,7 @@ void DisplayPinCB(char *pin, size_t pinSize, void *context) OIC_LOG(INFO, TAG, "============================"); } -void ClosePinDisplayCB(void) +void OC_CALL ClosePinDisplayCB(void) { OIC_LOG(INFO, TAG, "============================"); OIC_LOG(INFO, TAG, " PIN DISPLAY CLOSED."); diff --git a/resource/csdk/security/provisioning/sample/subownerclient.c b/resource/csdk/security/provisioning/sample/subownerclient.c index c397d3d..20dc4cc 100644 --- a/resource/csdk/security/provisioning/sample/subownerclient.c +++ b/resource/csdk/security/provisioning/sample/subownerclient.c @@ -210,7 +210,7 @@ static OCStackApplicationResult LedCB(void *ctx, OCDoHandle UNUSED, OCClientResp return OC_STACK_OK; } -static void inputPinCB(char* pin, size_t len) +static void OC_CALL inputPinCB(char* pin, size_t len) { if(!pin || OXM_RANDOM_PIN_MAX_SIZE>=len) { diff --git a/resource/csdk/security/provisioning/src/ocprovisioningmanager.c b/resource/csdk/security/provisioning/src/ocprovisioningmanager.c index bca59c8..8c197b3 100644 --- a/resource/csdk/security/provisioning/src/ocprovisioningmanager.c +++ b/resource/csdk/security/provisioning/src/ocprovisioningmanager.c @@ -76,12 +76,12 @@ struct ProvPreconfPINCtx * * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCInitPM(const char* dbPath) +OCStackResult OC_CALL OCInitPM(const char* dbPath) { return PDMInit(dbPath); } -OCStackResult OCPDMCleanupForTimeout() +OCStackResult OC_CALL OCPDMCleanupForTimeout() { return PDMDeleteDeviceWithState(PDM_DEVICE_INIT); } @@ -96,8 +96,8 @@ OCStackResult OCPDMCleanupForTimeout() * @param[out] ppFoundDevice OCProvisionDev_t of found device * @return OTM_SUCCESS in case of success and other value otherwise. */ -OCStackResult OCDiscoverSingleDevice(unsigned short timeout, const OicUuid_t* deviceID, - OCProvisionDev_t **ppFoundDevice) +OCStackResult OC_CALL OCDiscoverSingleDevice(unsigned short timeout, const OicUuid_t* deviceID, + OCProvisionDev_t **ppFoundDevice) { if( NULL == ppFoundDevice || NULL != *ppFoundDevice || 0 == timeout || NULL == deviceID) { @@ -119,7 +119,7 @@ OCStackResult OCDiscoverSingleDevice(unsigned short timeout, const OicUuid_t* de * @param[out] ppFoundDevice OCProvisionDev_t of found device. * @return OTM_SUCCESS in case of success and other value otherwise. */ -OCStackResult OCDiscoverSingleDeviceInUnicast(unsigned short timeout, const OicUuid_t* deviceID, +OCStackResult OC_CALL OCDiscoverSingleDeviceInUnicast(unsigned short timeout, const OicUuid_t* deviceID, const char* hostAddress, OCConnectivityType connType, OCProvisionDev_t **ppFoundDevice) { @@ -144,7 +144,7 @@ OCStackResult OCDiscoverSingleDeviceInUnicast(unsigned short timeout, const OicU * @param[out] ppList List of candidate devices to be provisioned * @return OTM_SUCCESS in case of success and other value otherwise. */ -OCStackResult OCDiscoverUnownedDevices(unsigned short timeout, OCProvisionDev_t **ppList) +OCStackResult OC_CALL OCDiscoverUnownedDevices(unsigned short timeout, OCProvisionDev_t **ppList) { if( ppList == NULL || *ppList != NULL || 0 == timeout) { @@ -163,7 +163,7 @@ OCStackResult OCDiscoverUnownedDevices(unsigned short timeout, OCProvisionDev_t * @param[out] ppList List of device owned by provisioning tool. * @return OTM_SUCCESS in case of success and other value otherwise. */ -OCStackResult OCDiscoverOwnedDevices(unsigned short timeout, OCProvisionDev_t **ppList) +OCStackResult OC_CALL OCDiscoverOwnedDevices(unsigned short timeout, OCProvisionDev_t **ppList) { if( ppList == NULL || *ppList != NULL || 0 == timeout) { @@ -186,9 +186,9 @@ OCStackResult OCDiscoverOwnedDevices(unsigned short timeout, OCProvisionDev_t ** * OCDeleteDiscoveredDevices to delete the device. * @return OC_STACK_OK in case of success and other values otherwise. */ -OCStackResult OCDiscoverMultipleOwnerEnabledSingleDevice(unsigned short timeoutSeconds, - const OicUuid_t* deviceID, - OCProvisionDev_t **ppFoundDevice) +OCStackResult OC_CALL OCDiscoverMultipleOwnerEnabledSingleDevice(unsigned short timeoutSeconds, + const OicUuid_t* deviceID, + OCProvisionDev_t **ppFoundDevice) { if ((NULL == ppFoundDevice) || (NULL != *ppFoundDevice) || (0 == timeoutSeconds) || (NULL == deviceID)) { @@ -206,7 +206,7 @@ OCStackResult OCDiscoverMultipleOwnerEnabledSingleDevice(unsigned short timeoutS * @param[out] ppList List of MOT enabled devices. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCDiscoverMultipleOwnerEnabledDevices(unsigned short timeout, OCProvisionDev_t **ppList) +OCStackResult OC_CALL OCDiscoverMultipleOwnerEnabledDevices(unsigned short timeout, OCProvisionDev_t **ppList) { if( ppList == NULL || *ppList != NULL || 0 == timeout) { @@ -224,7 +224,7 @@ OCStackResult OCDiscoverMultipleOwnerEnabledDevices(unsigned short timeout, OCPr * @param[out] ppList List of Multiple Owned devices. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCDiscoverMultipleOwnedDevices(unsigned short timeout, OCProvisionDev_t **ppList) +OCStackResult OC_CALL OCDiscoverMultipleOwnedDevices(unsigned short timeout, OCProvisionDev_t **ppList) { if( ppList == NULL || *ppList != NULL || 0 == timeout) { @@ -242,16 +242,16 @@ OCStackResult OCDiscoverMultipleOwnedDevices(unsigned short timeout, OCProvision * @param[in] preconfigPinLen Byte length of preconfigPin * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCAddPreconfigPin(const OCProvisionDev_t *targetDeviceInfo, - const char *preconfigPin, - size_t preconfigPinLen) +OCStackResult OC_CALL OCAddPreconfigPin(const OCProvisionDev_t *targetDeviceInfo, + const char *preconfigPin, + size_t preconfigPinLen) { return MOTAddPreconfigPIN(targetDeviceInfo, preconfigPin, preconfigPinLen); } -OCStackResult OCDoMultipleOwnershipTransfer(void* ctx, - OCProvisionDev_t *targetDevices, - OCProvisionResultCB resultCallback) +OCStackResult OC_CALL OCDoMultipleOwnershipTransfer(void* ctx, + OCProvisionDev_t *targetDevices, + OCProvisionResultCB resultCallback) { if( NULL == targetDevices ) { @@ -272,7 +272,7 @@ OCStackResult OCDoMultipleOwnershipTransfer(void* ctx, * @param[out] isSubowner Bool indicating whether the caller is a subowner of device * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCIsSubownerOfDevice(OCProvisionDev_t *device, bool *isSubowner) +OCStackResult OC_CALL OCIsSubownerOfDevice(OCProvisionDev_t *device, bool *isSubowner) { if ((NULL == device) || (NULL == isSubowner)) { @@ -290,7 +290,7 @@ OCStackResult OCIsSubownerOfDevice(OCProvisionDev_t *device, bool *isSubowner) * @param[in] Implementation of callback functions for owership transfer. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCSetOwnerTransferCallbackData(OicSecOxm_t oxm, OTMCallbackData_t* callbackData) +OCStackResult OC_CALL OCSetOwnerTransferCallbackData(OicSecOxm_t oxm, OTMCallbackData_t* callbackData) { if(NULL == callbackData) { @@ -308,14 +308,14 @@ OCStackResult OCSetOwnerTransferCallbackData(OicSecOxm_t oxm, OTMCallbackData_t* * * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCSetOxmAllowStatus(const OicSecOxm_t oxm, const bool allowStatus) +OCStackResult OC_CALL OCSetOxmAllowStatus(const OicSecOxm_t oxm, const bool allowStatus) { return OTMSetOxmAllowStatus(oxm, allowStatus); } -OCStackResult OCDoOwnershipTransfer(void* ctx, - OCProvisionDev_t *targetDevices, - OCProvisionResultCB resultCallback) +OCStackResult OC_CALL OCDoOwnershipTransfer(void* ctx, + OCProvisionDev_t *targetDevices, + OCProvisionResultCB resultCallback) { if( NULL == targetDevices ) { @@ -334,7 +334,7 @@ OCStackResult OCDoOwnershipTransfer(void* ctx, * * @param[in] pList Pointer to OCProvisionDev_t which should be deleted. */ -void OCDeleteDiscoveredDevices(OCProvisionDev_t *pList) +void OC_CALL OCDeleteDiscoveredDevices(OCProvisionDev_t *pList) { PMDeleteDeviceList(pList); } @@ -349,8 +349,8 @@ void OCDeleteDiscoveredDevices(OCProvisionDev_t *pList) * request receives a response from resource server. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCProvisionACL(void* ctx, const OCProvisionDev_t *selectedDeviceInfo, OicSecAcl_t *acl, - OCProvisionResultCB resultCallback) +OCStackResult OC_CALL OCProvisionACL(void* ctx, const OCProvisionDev_t *selectedDeviceInfo, OicSecAcl_t *acl, + OCProvisionResultCB resultCallback) { if (NULL == acl) { @@ -390,8 +390,8 @@ OCStackResult OCProvisionACL(void* ctx, const OCProvisionDev_t *selectedDeviceIn * request recieves a response from resource server. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCProvisionACL2(void* ctx, const OCProvisionDev_t *selectedDeviceInfo, OicSecAcl_t *acl, - OCProvisionResultCB resultCallback) +OCStackResult OC_CALL OCProvisionACL2(void* ctx, const OCProvisionDev_t *selectedDeviceInfo, OicSecAcl_t *acl, + OCProvisionResultCB resultCallback) { return SRPProvisionACL(ctx, selectedDeviceInfo, acl, OIC_SEC_ACL_V2, resultCallback); } @@ -402,7 +402,7 @@ OCStackResult OCProvisionACL2(void* ctx, const OCProvisionDev_t *selectedDeviceI * @param acl ACL to be saved in Acl of SVR. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCSaveACL(const OicSecAcl_t* acl) +OCStackResult OC_CALL OCSaveACL(const OicSecAcl_t* acl) { return SRPSaveACL(acl); } @@ -416,8 +416,8 @@ OCStackResult OCSaveACL(const OicSecAcl_t* acl) request recieves a response from resource server. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCGetCredResource(void* ctx, const OCProvisionDev_t *selectedDeviceInfo, - OCProvisionResultCB resultCallback) +OCStackResult OC_CALL OCGetCredResource(void* ctx, const OCProvisionDev_t *selectedDeviceInfo, + OCProvisionResultCB resultCallback) { return SRPGetCredResource(ctx, selectedDeviceInfo, resultCallback); } @@ -431,38 +431,38 @@ OCStackResult OCGetCredResource(void* ctx, const OCProvisionDev_t *selectedDevic request recieves a response from resource server. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCGetACLResource(void* ctx, const OCProvisionDev_t *selectedDeviceInfo, - OCProvisionResultCB resultCallback) +OCStackResult OC_CALL OCGetACLResource(void* ctx, const OCProvisionDev_t *selectedDeviceInfo, + OCProvisionResultCB resultCallback) { return SRPGetACLResource(ctx, selectedDeviceInfo, OIC_SEC_ACL_V1, resultCallback); } -OCStackResult OCGetACL2Resource(void* ctx, const OCProvisionDev_t *selectedDeviceInfo, - OCProvisionResultCB resultCallback) +OCStackResult OC_CALL OCGetACL2Resource(void* ctx, const OCProvisionDev_t *selectedDeviceInfo, + OCProvisionResultCB resultCallback) { return SRPGetACLResource(ctx, selectedDeviceInfo, OIC_SEC_ACL_V2, resultCallback); } -OCStackResult OCGetCSRResource(void* ctx, const OCProvisionDev_t *selectedDeviceInfo, - OCGetCSRResultCB resultCallback) +OCStackResult OC_CALL OCGetCSRResource(void* ctx, const OCProvisionDev_t *selectedDeviceInfo, + OCGetCSRResultCB resultCallback) { return SRPGetCSRResource(ctx, selectedDeviceInfo, resultCallback); } -OCStackResult OCGetRolesResource(void *ctx, const OCProvisionDev_t *selectedDeviceInfo, - OCGetRolesResultCB resultCallback) +OCStackResult OC_CALL OCGetRolesResource(void *ctx, const OCProvisionDev_t *selectedDeviceInfo, + OCGetRolesResultCB resultCallback) { return SRPGetRolesResource(ctx, selectedDeviceInfo, resultCallback); } -OCStackResult OCDeleteRoleCertificateByCredId(void *ctx, const OCProvisionDev_t *selectedDeviceInfo, - OCProvisionResultCB resultCallback, uint32_t credId) +OCStackResult OC_CALL OCDeleteRoleCertificateByCredId(void *ctx, const OCProvisionDev_t *selectedDeviceInfo, + OCProvisionResultCB resultCallback, uint32_t credId) { return SRPDeleteRoleCertificateByCredId(ctx, selectedDeviceInfo, resultCallback, credId); } -OCStackResult OCReadTrustCertChain(uint16_t credId, uint8_t **trustCertChain, - size_t *chainSize) +OCStackResult OC_CALL OCReadTrustCertChain(uint16_t credId, uint8_t **trustCertChain, + size_t *chainSize) { return SRPReadTrustCertChain(credId, trustCertChain, chainSize); } @@ -477,10 +477,10 @@ OCStackResult OCReadTrustCertChain(uint16_t credId, uint8_t **trustCertChain, * provisioning request recieves a response from first resource server. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCProvisionCredentials(void *ctx, OicSecCredType_t type, size_t keySize, - const OCProvisionDev_t *pDev1, - const OCProvisionDev_t *pDev2, - OCProvisionResultCB resultCallback) +OCStackResult OC_CALL OCProvisionCredentials(void *ctx, OicSecCredType_t type, size_t keySize, + const OCProvisionDev_t *pDev1, + const OCProvisionDev_t *pDev2, + OCProvisionResultCB resultCallback) { return SRPProvisionCredentialsDos(ctx, type, keySize, pDev1, pDev2, resultCallback); @@ -503,12 +503,12 @@ OCStackResult OCProvisionCredentials(void *ctx, OicSecCredType_t type, size_t ke * provisioning request receives a response from first resource server. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCProvisionSymmetricRoleCredentials(void *ctx, OicSecCredType_t type, size_t keySize, - const OCProvisionDev_t *pDev1, - const OCProvisionDev_t *pDev2, - const OicSecRole_t *role1, - const OicSecRole_t *role2, - OCProvisionResultCB resultCallback) +OCStackResult OC_CALL OCProvisionSymmetricRoleCredentials(void *ctx, OicSecCredType_t type, size_t keySize, + const OCProvisionDev_t *pDev1, + const OCProvisionDev_t *pDev2, + const OicSecRole_t *role1, + const OicSecRole_t *role2, + OCProvisionResultCB resultCallback) { return SRPProvisionCredentials(ctx, type, keySize, pDev1, pDev2, NULL, role1, role2, resultCallback); } @@ -524,7 +524,7 @@ OCStackResult OCProvisionSymmetricRoleCredentials(void *ctx, OicSecCredType_t ty * provisioning request receives a response from first resource server. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCProvisionCertificate(void *ctx, +OCStackResult OC_CALL OCProvisionCertificate(void *ctx, const OCProvisionDev_t *pDev, const char* pemCert, OCProvisionResultCB resultCallback) @@ -544,7 +544,7 @@ OCStackResult OCProvisionCertificate(void *ctx, request recieves a response from resource server. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCProvisionDirectPairing(void* ctx, const OCProvisionDev_t *selectedDeviceInfo, OicSecPconf_t *pconf, +OCStackResult OC_CALL OCProvisionDirectPairing(void* ctx, const OCProvisionDev_t *selectedDeviceInfo, OicSecPconf_t *pconf, OCProvisionResultCB resultCallback) { return SRPProvisionDirectPairing(ctx, selectedDeviceInfo, pconf, resultCallback); @@ -567,11 +567,11 @@ static void AddPreconfPinOxMCB(void* ctx, size_t nOfRes, OCProvisionResult_t *ar } } -OCStackResult OCProvisionPreconfigPin(void *ctx, - OCProvisionDev_t *targetDeviceInfo, - const char *preconfigPin, - size_t preconfigPinLen, - OCProvisionResultCB resultCallback) +OCStackResult OC_CALL OCProvisionPreconfigPin(void *ctx, + OCProvisionDev_t *targetDeviceInfo, + const char *preconfigPin, + size_t preconfigPinLen, + OCProvisionResultCB resultCallback) { if( NULL == targetDeviceInfo ) { @@ -615,10 +615,10 @@ OCStackResult OCProvisionPreconfigPin(void *ctx, * device unlink is finished. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCUnlinkDevices(void* ctx, - const OCProvisionDev_t* pTargetDev1, - const OCProvisionDev_t* pTargetDev2, - OCProvisionResultCB resultCallback) +OCStackResult OC_CALL OCUnlinkDevices(void* ctx, + const OCProvisionDev_t* pTargetDev1, + const OCProvisionDev_t* pTargetDev2, + OCProvisionResultCB resultCallback) { OIC_LOG(INFO, TAG, "IN OCUnlinkDevices"); OCUuidList_t* idList = NULL; @@ -733,9 +733,9 @@ error: * credential revocation is finished. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCRemoveDevice(void* ctx, unsigned short waitTimeForOwnedDeviceDiscovery, - const OCProvisionDev_t* pTargetDev, - OCProvisionResultCB resultCallback) +OCStackResult OC_CALL OCRemoveDevice(void* ctx, unsigned short waitTimeForOwnedDeviceDiscovery, + const OCProvisionDev_t* pTargetDev, + OCProvisionResultCB resultCallback) { OIC_LOG(INFO, TAG, "IN OCRemoveDevice"); OCStackResult res = OC_STACK_ERROR; @@ -803,7 +803,7 @@ error: * credential revocation is finished. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCRemoveDeviceWithUuid(void* ctx, unsigned short waitTimeForOwnedDeviceDiscovery, +OCStackResult OC_CALL OCRemoveDeviceWithUuid(void* ctx, unsigned short waitTimeForOwnedDeviceDiscovery, const OicUuid_t* pTargetUuid, OCProvisionResultCB resultCallback) { @@ -963,9 +963,9 @@ error: * credential revocation is finished. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCResetDevice(void* ctx, unsigned short waitTimeForOwnedDeviceDiscovery, - const OCProvisionDev_t* pTargetDev, - OCProvisionResultCB resultCallback) +OCStackResult OC_CALL OCResetDevice(void* ctx, unsigned short waitTimeForOwnedDeviceDiscovery, + const OCProvisionDev_t* pTargetDev, + OCProvisionResultCB resultCallback) { OIC_LOG(INFO, TAG, "IN OCResetDevice"); OCStackResult res = OC_STACK_ERROR; @@ -1005,7 +1005,7 @@ OCStackResult OCResetDevice(void* ctx, unsigned short waitTimeForOwnedDeviceDisc * * @return OC_STACK_OK in case of successful reset and other value otherwise. */ -OCStackResult OCResetSVRDB(void) +OCStackResult OC_CALL OCResetSVRDB(void) { return ResetSecureResourceInPS(); } @@ -1015,7 +1015,7 @@ OCStackResult OCResetSVRDB(void) * *@return OC_STACK_OK in case of successful configue and other value otherwise. */ -OCStackResult OCConfigSelfOwnership(void) +OCStackResult OC_CALL OCConfigSelfOwnership(void) { return ConfigSelfOwnership(); } @@ -1206,7 +1206,7 @@ static void ProvisionCredsCB(void* ctx, size_t nOfRes, OCProvisionResult_t *arr, * provisioning request recieves a response from first resource server. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCProvisionPairwiseDevices(void* ctx, OicSecCredType_t type, size_t keySize, +OCStackResult OC_CALL OCProvisionPairwiseDevices(void* ctx, OicSecCredType_t type, size_t keySize, const OCProvisionDev_t *pDev1, OicSecAcl_t *pDev1Acl, const OCProvisionDev_t *pDev2, OicSecAcl_t *pDev2Acl, OCProvisionResultCB resultCallback) @@ -1286,9 +1286,9 @@ OCStackResult OCProvisionPairwiseDevices(void* ctx, OicSecCredType_t type, size_ } -OCStackResult OCGetDevInfoFromNetwork(unsigned short waittime, - OCProvisionDev_t** pOwnedDevList, - OCProvisionDev_t** pUnownedDevList) +OCStackResult OC_CALL OCGetDevInfoFromNetwork(unsigned short waittime, + OCProvisionDev_t** pOwnedDevList, + OCProvisionDev_t** pUnownedDevList) { //TODO will be replaced by more efficient logic if (pOwnedDevList == NULL || *pOwnedDevList != NULL || pUnownedDevList == NULL @@ -1412,18 +1412,18 @@ OCStackResult OCGetDevInfoFromNetwork(unsigned short waittime, return OC_STACK_OK; } -OCStackResult OCGetLinkedStatus(const OicUuid_t* uuidOfDevice, OCUuidList_t** uuidList, - size_t* numOfDevices) +OCStackResult OC_CALL OCGetLinkedStatus(const OicUuid_t* uuidOfDevice, OCUuidList_t** uuidList, + size_t* numOfDevices) { return PDMGetLinkedDevices(uuidOfDevice, uuidList, numOfDevices); } -OCStackResult OCRemoveCredential(const OicUuid_t* subjectUuid) +OCStackResult OC_CALL OCRemoveCredential(const OicUuid_t* subjectUuid) { return RemoveCredential(subjectUuid); } -void OCDeleteUuidList(OCUuidList_t* pList) +void OC_CALL OCDeleteUuidList(OCUuidList_t* pList) { PDMDestoryOicUuidLinkList(pList); } @@ -1433,7 +1433,7 @@ void OCDeleteUuidList(OCUuidList_t* pList) * * @param pAcl Pointer to OicSecAcl_t structure. */ -void OCDeleteACLList(OicSecAcl_t* pAcl) +void OC_CALL OCDeleteACLList(OicSecAcl_t* pAcl) { DeleteACLList(pAcl); } @@ -1443,7 +1443,7 @@ void OCDeleteACLList(OicSecAcl_t* pAcl) * * @param pPdAcl Pointer to OicSecPdAcl_t structure. */ -void OCDeletePdAclList(OicSecPdAcl_t* pPdAcl) +void OC_CALL OCDeletePdAclList(OicSecPdAcl_t* pPdAcl) { FreePdAclList(pPdAcl); } @@ -1458,8 +1458,8 @@ void OCDeletePdAclList(OicSecPdAcl_t* pPdAcl) * POST 'mom' request recieves a response from resource server. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCChangeMOTMode(void *ctx, const OCProvisionDev_t *targetDeviceInfo, - const OicSecMomType_t momType, OCProvisionResultCB resultCallback) +OCStackResult OC_CALL OCChangeMOTMode(void *ctx, const OCProvisionDev_t *targetDeviceInfo, + const OicSecMomType_t momType, OCProvisionResultCB resultCallback) { return MOTChangeMode(ctx, targetDeviceInfo, momType, resultCallback); } @@ -1473,8 +1473,8 @@ OCStackResult OCChangeMOTMode(void *ctx, const OCProvisionDev_t *targetDeviceInf * POST 'oxmsel' request recieves a response from resource server. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCSelectMOTMethod(void *ctx, const OCProvisionDev_t *targetDeviceInfo, - const OicSecOxm_t oxmSelValue, OCProvisionResultCB resultCallback) +OCStackResult OC_CALL OCSelectMOTMethod(void *ctx, const OCProvisionDev_t *targetDeviceInfo, + const OicSecOxm_t oxmSelValue, OCProvisionResultCB resultCallback) { return MOTSelectMOTMethod(ctx, targetDeviceInfo, oxmSelValue, resultCallback); } @@ -1489,7 +1489,7 @@ OCStackResult OCSelectMOTMethod(void *ctx, const OCProvisionDev_t *targetDeviceI * @param[in] ownerType type of owner device (SUPER_OWNER or SUB_OWNER) * @return OC_STACK_OK on success */ -OCStackResult OCSelectOwnershipTransferMethod(const OicSecOxm_t *supportedMethods, +OCStackResult OC_CALL OCSelectOwnershipTransferMethod(const OicSecOxm_t *supportedMethods, size_t numberOfMethods, OicSecOxm_t *selectedMethod, OwnerType_t ownerType) { return OTMSelectOwnershipTransferMethod(supportedMethods, numberOfMethods, @@ -1508,9 +1508,9 @@ OCStackResult OCSelectOwnershipTransferMethod(const OicSecOxm_t *supportedMethod * provisioning request recieves a response from first resource server. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCProvisionTrustCertChain(void *ctx, OicSecCredType_t type, uint16_t credId, - const OCProvisionDev_t *selectedDeviceInfo, - OCProvisionResultCB resultCallback) +OCStackResult OC_CALL OCProvisionTrustCertChain(void *ctx, OicSecCredType_t type, uint16_t credId, + const OCProvisionDev_t *selectedDeviceInfo, + OCProvisionResultCB resultCallback) { return SRPProvisionTrustCertChain(ctx, type, credId, selectedDeviceInfo, resultCallback); @@ -1525,8 +1525,8 @@ OCStackResult OCProvisionTrustCertChain(void *ctx, OicSecCredType_t type, uint16 * @param[out] credId CredId of saved trust certificate chain in Cred of SVR. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCSaveTrustCertChain(const uint8_t *trustCertChain, size_t chainSize, - OicEncodingType_t encodingType, uint16_t *credId) +OCStackResult OC_CALL OCSaveTrustCertChain(const uint8_t *trustCertChain, size_t chainSize, + OicEncodingType_t encodingType, uint16_t *credId) { return SRPSaveTrustCertChain(trustCertChain, chainSize, encodingType, credId); } @@ -1539,7 +1539,7 @@ OCStackResult OCSaveTrustCertChain(const uint8_t *trustCertChain, size_t chainSi * @param[out] credId CredId of saved certificate chain in Cred of SVR. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCSaveOwnCertChain(const char* cert, const char* key, uint16_t *credId) +OCStackResult OC_CALL OCSaveOwnCertChain(const char* cert, const char* key, uint16_t *credId) { OicSecKey_t ownCert = { 0 }; ownCert.data = (uint8_t*) cert; @@ -1564,7 +1564,7 @@ OCStackResult OCSaveOwnCertChain(const char* cert, const char* key, uint16_t *cr * @note The certificate public key must be the same as public key in the identity * certificate (installed by OCSaveOwnCertChain). */ -OCStackResult OCSaveOwnRoleCert(const char* cert, uint16_t *credId) +OCStackResult OC_CALL OCSaveOwnRoleCert(const char* cert, uint16_t *credId) { OicSecKey_t ownCert = { 0 }; ownCert.data = (uint8_t*)cert; @@ -1581,7 +1581,7 @@ OCStackResult OCSaveOwnRoleCert(const char* cert, uint16_t *credId) * @param[in] TrustCertChainChangeCB notification callback fucntion. * @return OC_STACK_OK in case of success and other value otherwise. */ -OCStackResult OCRegisterTrustCertChainNotifier(void *ctx, TrustCertChainChangeCB Callback) +OCStackResult OC_CALL OCRegisterTrustCertChainNotifier(void *ctx, TrustCertChainChangeCB Callback) { return SRPRegisterTrustCertChainNotifier(ctx, Callback); } @@ -1589,7 +1589,7 @@ OCStackResult OCRegisterTrustCertChainNotifier(void *ctx, TrustCertChainChangeCB /** * function to de-register notifier for Trustcertchain change. */ -void OCRemoveTrustCertChainNotifier() +void OC_CALL OCRemoveTrustCertChainNotifier() { SRPRemoveTrustCertChainNotifier(); } diff --git a/resource/csdk/security/provisioning/src/pmutility.c b/resource/csdk/security/provisioning/src/pmutility.c index 01fc615..2b2c37a 100644 --- a/resource/csdk/security/provisioning/src/pmutility.c +++ b/resource/csdk/security/provisioning/src/pmutility.c @@ -547,10 +547,10 @@ OCStackResult PMTimeout(unsigned short waittime, bool waitForStackResponse) return res; } -bool PMGenerateQuery(bool isSecure, - const char* address, uint16_t port, - OCConnectivityType connType, - char* buffer, size_t bufferSize, const char* uri) +bool OC_CALL PMGenerateQuery(bool isSecure, + const char* address, uint16_t port, + OCConnectivityType connType, + char* buffer, size_t bufferSize, const char* uri) { if(!address || !buffer || !uri) { diff --git a/resource/csdk/security/src/occertutility.c b/resource/csdk/security/src/occertutility.c index f296404..06c0ed0 100644 --- a/resource/csdk/security/src/occertutility.c +++ b/resource/csdk/security/src/occertutility.c @@ -137,7 +137,7 @@ exit: return 0; } -OCStackResult OCGenerateRandomSerialNumber(char **serial, size_t *serialLen) +OCStackResult OC_CALL OCGenerateRandomSerialNumber(char **serial, size_t *serialLen) { int ret = 0; OCStackResult res = OC_STACK_ERROR; @@ -187,8 +187,8 @@ exit: return res; } -OCStackResult OCGenerateKeyPair(char **publicKey, size_t *publicKeyLen, - char **privateKey, size_t *privateKeyLen) +OCStackResult OC_CALL OCGenerateKeyPair(char **publicKey, size_t *publicKeyLen, + char **privateKey, size_t *privateKeyLen) { int ret = 0; mbedtls_pk_context keyPair; @@ -464,7 +464,7 @@ exit: return res; } -OCStackResult OCGenerateCACertificate( +OCStackResult OC_CALL OCGenerateCACertificate( const char *subject, const char *subjectPublicKey, const char *issuerCert, @@ -500,7 +500,7 @@ OCStackResult OCGenerateCACertificate( return res; } -OCStackResult OCGenerateIdentityCertificate( +OCStackResult OC_CALL OCGenerateIdentityCertificate( const OicUuid_t *subjectUuid, const char *subjectPublicKey, const char *issuerCert, @@ -555,7 +555,7 @@ OCStackResult OCGenerateIdentityCertificate( return res; } -OCStackResult OCGenerateRoleCertificate( +OCStackResult OC_CALL OCGenerateRoleCertificate( const OicUuid_t *subjectUuid, const char *subjectPublicKey, const char *issuerCert, @@ -686,7 +686,7 @@ static int VerifyCSRSignature(mbedtls_x509_csr* csr) return ret; } -OCStackResult OCVerifyCSRSignature(const char* csr) +OCStackResult OC_CALL OCVerifyCSRSignature(const char* csr) { mbedtls_x509_csr csrObj; @@ -711,7 +711,7 @@ OCStackResult OCVerifyCSRSignature(const char* csr) return OC_STACK_OK; } -OCStackResult OCGetUuidFromCSR(const char* csr, OicUuid_t* uuid) +OCStackResult OC_CALL OCGetUuidFromCSR(const char* csr, OicUuid_t* uuid) { mbedtls_x509_csr csrObj; @@ -751,7 +751,7 @@ OCStackResult OCGetUuidFromCSR(const char* csr, OicUuid_t* uuid) return OC_STACK_OK; } -OCStackResult OCGetPublicKeyFromCSR(const char* csr, char** publicKey) +OCStackResult OC_CALL OCGetPublicKeyFromCSR(const char* csr, char** publicKey) { mbedtls_x509_csr csrObj; @@ -788,7 +788,7 @@ OCStackResult OCGetPublicKeyFromCSR(const char* csr, char** publicKey) return OC_STACK_OK; } -OCStackResult OCConvertDerCSRToPem(const char* derCSR, size_t derCSRLen, char** pemCSR) +OCStackResult OC_CALL OCConvertDerCSRToPem(const char* derCSR, size_t derCSRLen, char** pemCSR) { const char* pemHeader = "-----BEGIN CERTIFICATE REQUEST-----\n"; const char* pemFooter = "-----END CERTIFICATE REQUEST-----\n"; diff --git a/resource/csdk/security/src/ocsecurity.c b/resource/csdk/security/src/ocsecurity.c index c9c4f18..6c455b4 100644 --- a/resource/csdk/security/src/ocsecurity.c +++ b/resource/csdk/security/src/ocsecurity.c @@ -166,7 +166,7 @@ static OCStackApplicationResult OCAssertRolesCBHandler(void *ctx, OCDoHandle UNU return OC_STACK_DELETE_TRANSACTION; } -OCStackResult OCAssertRoles(void *ctx, const OCDevAddr *devAddr, OCAssertRolesCB resultCallback) +OCStackResult OC_CALL OCAssertRoles(void *ctx, const OCDevAddr *devAddr, OCAssertRolesCB resultCallback) { OIC_LOG_V(DEBUG, TAG, "In %s", __func__); diff --git a/resource/csdk/security/src/oxmpincommon.c b/resource/csdk/security/src/oxmpincommon.c index 285dc31..5d42287 100644 --- a/resource/csdk/security/src/oxmpincommon.c +++ b/resource/csdk/security/src/oxmpincommon.c @@ -88,7 +88,7 @@ static bool IsValidPinType(OicSecPinType_t pinType) (UPPERCASE_CHAR_PIN & pinType)); } -OCStackResult SetRandomPinPolicy(size_t pinSize, OicSecPinType_t pinType) +OCStackResult OC_CALL SetRandomPinPolicy(size_t pinSize, OicSecPinType_t pinType) { if(OXM_RANDOM_PIN_MIN_SIZE > pinSize) { @@ -112,7 +112,7 @@ OCStackResult SetRandomPinPolicy(size_t pinSize, OicSecPinType_t pinType) return OC_STACK_OK; } -void SetInputPinCB(InputPinCallback pinCB) +void OC_CALL SetInputPinCB(InputPinCallback pinCB) { if(NULL == pinCB) { @@ -129,7 +129,7 @@ void SetInputPinCB(InputPinCallback pinCB) g_inputPinCallbacks.callback = pinCB; } -OCStackResult SetInputPinWithContextCB(InputPinCallbackWithContext inputPinCB, void* context) +OCStackResult OC_CALL SetInputPinWithContextCB(InputPinCallbackWithContext inputPinCB, void* context) { if (NULL == inputPinCB) { @@ -149,7 +149,7 @@ OCStackResult SetInputPinWithContextCB(InputPinCallbackWithContext inputPinCB, v return OC_STACK_OK; } -void SetGeneratePinCB(GeneratePinCallback pinCB) +void OC_CALL SetGeneratePinCB(GeneratePinCallback pinCB) { if(NULL == pinCB) { @@ -166,7 +166,7 @@ void SetGeneratePinCB(GeneratePinCallback pinCB) g_displayPinCallbacks.callback = pinCB; } -OCStackResult SetDisplayPinWithContextCB(DisplayPinCallbackWithContext displayPinCB, void* context) +OCStackResult OC_CALL SetDisplayPinWithContextCB(DisplayPinCallbackWithContext displayPinCB, void* context) { if (NULL == displayPinCB) { @@ -186,7 +186,7 @@ OCStackResult SetDisplayPinWithContextCB(DisplayPinCallbackWithContext displayPi return OC_STACK_OK; } -void SetClosePinDisplayCB(ClosePinDisplayCallback closeCB) +void OC_CALL SetClosePinDisplayCB(ClosePinDisplayCallback closeCB) { if (NULL == closeCB) { @@ -203,31 +203,31 @@ void SetClosePinDisplayCB(ClosePinDisplayCallback closeCB) g_displayPinCallbacks.closePinDisplayCallback = closeCB; } -void UnsetInputPinCB() +void OC_CALL UnsetInputPinCB() { UnsetInputPinWithContextCB(); } -void UnsetInputPinWithContextCB() +void OC_CALL UnsetInputPinWithContextCB() { g_inputPinCallbacks.callback = NULL; g_inputPinCallbacks.contextCallback = NULL; g_inputPinCallbacks.context = NULL; } -void UnsetGeneratePinCB() +void OC_CALL UnsetGeneratePinCB() { UnsetDisplayPinWithContextCB(); } -void UnsetDisplayPinWithContextCB() +void OC_CALL UnsetDisplayPinWithContextCB() { g_displayPinCallbacks.callback = NULL; g_displayPinCallbacks.contextCallback = NULL; g_displayPinCallbacks.context = NULL; } -void UnsetClosePinDisplayCB() +void OC_CALL UnsetClosePinDisplayCB() { g_displayPinCallbacks.closePinDisplayCallback = NULL; } @@ -285,7 +285,7 @@ static char GenerateRandomPinElement(OicSecPinType_t pinType) return allowedCharacters[OCGetRandomRange(0, curIndex)]; } -OCStackResult GeneratePin(char* pinBuffer, size_t bufferSize) +OCStackResult OC_CALL GeneratePin(char* pinBuffer, size_t bufferSize) { if(!pinBuffer) { @@ -389,7 +389,7 @@ OCStackResult InputPin(OicUuid_t deviceId, char* pinBuffer, size_t bufferSize) } #ifdef MULTIPLE_OWNER -OCStackResult SetPreconfigPin(const char *pinBuffer, size_t pinLength) +OCStackResult OC_CALL SetPreconfigPin(const char *pinBuffer, size_t pinLength) { if(NULL == pinBuffer || OXM_PRECONFIG_PIN_MAX_SIZE < pinLength) { diff --git a/resource/csdk/security/src/oxmverifycommon.c b/resource/csdk/security/src/oxmverifycommon.c index 6660f17..179981b 100755 --- a/resource/csdk/security/src/oxmverifycommon.c +++ b/resource/csdk/security/src/oxmverifycommon.c @@ -33,7 +33,7 @@ static VerifyOptionBitmask_t gVerifyOption = (DISPLAY_NUM | USER_CONFIRM); static DisplayNumContext_t gDisplayNumContext = { .callback = NULL, .context = NULL }; static UserConfirmContext_t gUserConfirmContext = { .callback = NULL, .context = NULL }; -void SetDisplayNumCB(void * ptr, DisplayNumCallback displayNumCB) +void OC_CALL SetDisplayNumCB(void * ptr, DisplayNumCallback displayNumCB) { OIC_LOG(DEBUG, TAG, "IN SetDisplayNumCB"); if (NULL == displayNumCB) @@ -46,7 +46,7 @@ void SetDisplayNumCB(void * ptr, DisplayNumCallback displayNumCB) OIC_LOG(DEBUG, TAG, "OUT SetDisplayNumCB"); } -void* UnsetDisplayNumCB() +void* OC_CALL UnsetDisplayNumCB() { OIC_LOG(DEBUG, TAG, "IN UnsetDisplayNumCB"); void *prevctx = gDisplayNumContext.context; @@ -56,7 +56,7 @@ void* UnsetDisplayNumCB() return prevctx; } -void SetUserConfirmCB(void * ptr, UserConfirmCallback userConfirmCB) +void OC_CALL SetUserConfirmCB(void * ptr, UserConfirmCallback userConfirmCB) { OIC_LOG(DEBUG, TAG, "IN SetUserConfirmCB"); if (NULL == userConfirmCB) @@ -69,7 +69,7 @@ void SetUserConfirmCB(void * ptr, UserConfirmCallback userConfirmCB) OIC_LOG(DEBUG, TAG, "OUT SetUserConfirmCB"); } -void* UnsetUserConfirmCB() +void* OC_CALL UnsetUserConfirmCB() { OIC_LOG(DEBUG, TAG, "IN UnsetUserConfirmCB"); void *prevctx = gUserConfirmContext.context; @@ -79,7 +79,7 @@ void* UnsetUserConfirmCB() return prevctx; } -void SetVerifyOption(VerifyOptionBitmask_t verifyOption) +void OC_CALL SetVerifyOption(VerifyOptionBitmask_t verifyOption) { OIC_LOG(DEBUG, TAG, "IN SetVerifyOption"); gVerifyOption = verifyOption; @@ -87,7 +87,7 @@ void SetVerifyOption(VerifyOptionBitmask_t verifyOption) OIC_LOG(DEBUG, TAG, "OUT SetVerifyOption"); } -OCStackResult VerifyOwnershipTransfer(uint8_t mutualVerifNum [MUTUAL_VERIF_NUM_LEN], +OCStackResult OC_CALL VerifyOwnershipTransfer(uint8_t mutualVerifNum [MUTUAL_VERIF_NUM_LEN], VerifyOptionBitmask_t verifyOption) { OIC_LOG(DEBUG, TAG, "IN VerifyOwnershipTransfer"); diff --git a/resource/csdk/security/src/srmutility.c b/resource/csdk/security/src/srmutility.c index b5a4b6f..53d7739 100644 --- a/resource/csdk/security/src/srmutility.c +++ b/resource/csdk/security/src/srmutility.c @@ -139,7 +139,7 @@ exit: return OC_STACK_NO_MEMORY; } -OCStackResult ConvertStrToUuid(const char* strUuid, OicUuid_t* uuid) +OCStackResult OC_CALL ConvertStrToUuid(const char* strUuid, OicUuid_t* uuid) { bool result = true; size_t strUuidLen = strlen(strUuid); @@ -198,7 +198,7 @@ bool IsNilUuid(const OicUuid_t *uuid) } #if defined(__WITH_DTLS__) || defined (__WITH_TLS__) -OCStackResult SetDeviceIdSeed(const uint8_t* seed, size_t seedSize) +OCStackResult OC_CALL SetDeviceIdSeed(const uint8_t* seed, size_t seedSize) { return SetDoxmDeviceIDSeed(seed, seedSize); } diff --git a/resource/csdk/stack/include/internal/ocendpoint.h b/resource/csdk/stack/include/internal/ocendpoint.h index 00f12d5..983185d 100644 --- a/resource/csdk/stack/include/internal/ocendpoint.h +++ b/resource/csdk/stack/include/internal/ocendpoint.h @@ -97,7 +97,7 @@ * * @return char pointer on success, NULL on failure. */ - char* OCCreateEndpointStringFromCA(const CAEndpoint_t* endpoint); + char* OC_CALL OCCreateEndpointStringFromCA(const CAEndpoint_t* endpoint); /* * This function parse endpoint string from payload. diff --git a/resource/csdk/stack/include/internal/ocresourcehandler.h b/resource/csdk/stack/include/internal/ocresourcehandler.h index 09594fa..9348eac 100644 --- a/resource/csdk/stack/include/internal/ocresourcehandler.h +++ b/resource/csdk/stack/include/internal/ocresourcehandler.h @@ -150,7 +150,7 @@ OCEntityHandlerResult defaultResourceEHandler(OCEntityHandlerFlag flag, * URI. * @return pointer to found resource */ -OCResource *FindResourceByUri(const char* resourceUri); +OCResource * OC_CALL FindResourceByUri(const char* resourceUri); /** * This function checks whether the specified resource URI aligns with a pre-existing diff --git a/resource/csdk/stack/include/internal/ocstackinternal.h b/resource/csdk/stack/include/internal/ocstackinternal.h index 6bbe98f..cf3bb27 100644 --- a/resource/csdk/stack/include/internal/ocstackinternal.h +++ b/resource/csdk/stack/include/internal/ocstackinternal.h @@ -283,9 +283,9 @@ OCStackResult OCChangeResourceProperty(OCResourceProperty * inputProperty, OCResourceProperty resourceProperties, uint8_t enable); #endif -const char *convertTriggerEnumToString(OCPresenceTrigger trigger); +const char *OC_CALL convertTriggerEnumToString(OCPresenceTrigger trigger); -OCPresenceTrigger convertTriggerStringToEnum(const char * triggerStr); +OCPresenceTrigger OC_CALL convertTriggerStringToEnum(const char * triggerStr); void CopyEndpointToDevAddr(const CAEndpoint_t *in, OCDevAddr *out); diff --git a/resource/csdk/stack/include/ocpayload.h b/resource/csdk/stack/include/ocpayload.h index 1312b2c..614a69b 100644 --- a/resource/csdk/stack/include/ocpayload.h +++ b/resource/csdk/stack/include/ocpayload.h @@ -31,6 +31,7 @@ #include #include #include "octypes.h" +#include "platform_features.h" #if defined(__WITH_TLS__) || defined(__WITH_DTLS__) #include "securevirtualresourcetypes.h" @@ -65,35 +66,35 @@ extern "C" typedef struct OCResource OCResource; -void OCPayloadDestroy(OCPayload* payload); +void OC_CALL OCPayloadDestroy(OCPayload* payload); // Representation Payload -OCRepPayload* OCRepPayloadCreate(); +OCRepPayload* OC_CALL OCRepPayloadCreate(); -size_t calcDimTotal(const size_t dimensions[MAX_REP_ARRAY_DEPTH]); +size_t OC_CALL calcDimTotal(const size_t dimensions[MAX_REP_ARRAY_DEPTH]); -OCRepPayload* OCRepPayloadClone(const OCRepPayload* payload); +OCRepPayload* OC_CALL OCRepPayloadClone(const OCRepPayload* payload); -OCRepPayload* OCRepPayloadBatchClone(const OCRepPayload* repPayload); +OCRepPayload* OC_CALL OCRepPayloadBatchClone(const OCRepPayload* repPayload); -void OCRepPayloadAppend(OCRepPayload* parent, OCRepPayload* child); +void OC_CALL OCRepPayloadAppend(OCRepPayload* parent, OCRepPayload* child); -bool OCRepPayloadSetUri(OCRepPayload* payload, const char* uri); +bool OC_CALL OCRepPayloadSetUri(OCRepPayload* payload, const char* uri); -bool OCRepPayloadAddResourceType(OCRepPayload* payload, const char* resourceType); -bool OCRepPayloadAddInterface(OCRepPayload* payload, const char* iface); +bool OC_CALL OCRepPayloadAddResourceType(OCRepPayload* payload, const char* resourceType); +bool OC_CALL OCRepPayloadAddInterface(OCRepPayload* payload, const char* iface); -bool OCRepPayloadAddResourceTypeAsOwner(OCRepPayload* payload, char* resourceType); -bool OCRepPayloadAddInterfaceAsOwner(OCRepPayload* payload, char* iface); +bool OC_CALL OCRepPayloadAddResourceTypeAsOwner(OCRepPayload* payload, char* resourceType); +bool OC_CALL OCRepPayloadAddInterfaceAsOwner(OCRepPayload* payload, char* iface); -bool OCRepPayloadIsNull(const OCRepPayload* payload, const char* name); -bool OCRepPayloadSetNull(OCRepPayload* payload, const char* name); +bool OC_CALL OCRepPayloadIsNull(const OCRepPayload* payload, const char* name); +bool OC_CALL OCRepPayloadSetNull(OCRepPayload* payload, const char* name); -bool OCRepPayloadSetPropInt(OCRepPayload* payload, const char* name, int64_t value); -bool OCRepPayloadGetPropInt(const OCRepPayload* payload, const char* name, int64_t* value); +bool OC_CALL OCRepPayloadSetPropInt(OCRepPayload* payload, const char* name, int64_t value); +bool OC_CALL OCRepPayloadGetPropInt(const OCRepPayload* payload, const char* name, int64_t* value); -bool OCRepPayloadSetPropDouble(OCRepPayload* payload, const char* name, double value); -bool OCRepPayloadGetPropDouble(const OCRepPayload* payload, const char* name, double* value); +bool OC_CALL OCRepPayloadSetPropDouble(OCRepPayload* payload, const char* name, double value); +bool OC_CALL OCRepPayloadGetPropDouble(const OCRepPayload* payload, const char* name, double* value); /** * This function allocates memory for the byte string and sets it in the payload. @@ -104,7 +105,7 @@ bool OCRepPayloadGetPropDouble(const OCRepPayload* payload, const char* name, do * * @return true on success, false upon failure. */ -bool OCRepPayloadSetPropByteString(OCRepPayload* payload, const char* name, OCByteString value); +bool OC_CALL OCRepPayloadSetPropByteString(OCRepPayload* payload, const char* name, OCByteString value); /** * This function sets the byte string in the payload. @@ -115,7 +116,7 @@ bool OCRepPayloadSetPropByteString(OCRepPayload* payload, const char* name, OCBy * * @return true on success, false upon failure. */ -bool OCRepPayloadSetPropByteStringAsOwner(OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadSetPropByteStringAsOwner(OCRepPayload* payload, const char* name, OCByteString* value); /** @@ -129,24 +130,24 @@ bool OCRepPayloadSetPropByteStringAsOwner(OCRepPayload* payload, const char* nam * * @return true on success, false upon failure. */ -bool OCRepPayloadGetPropByteString(const OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadGetPropByteString(const OCRepPayload* payload, const char* name, OCByteString* 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); +bool OC_CALL OCRepPayloadSetPropString(OCRepPayload* payload, const char* name, const char* value); +bool OC_CALL OCRepPayloadSetPropStringAsOwner(OCRepPayload* payload, const char* name, char* value); +bool OC_CALL OCRepPayloadGetPropString(const OCRepPayload* payload, const char* name, char** value); -bool OCRepPayloadSetPropBool(OCRepPayload* payload, const char* name, bool value); -bool OCRepPayloadGetPropBool(const OCRepPayload* payload, const char* name, bool* value); +bool OC_CALL OCRepPayloadSetPropBool(OCRepPayload* payload, const char* name, bool value); +bool OC_CALL OCRepPayloadGetPropBool(const OCRepPayload* payload, const char* name, bool* 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); +bool OC_CALL OCRepPayloadSetPropObject(OCRepPayload* payload, const char* name, const OCRepPayload* value); +bool OC_CALL OCRepPayloadSetPropObjectAsOwner(OCRepPayload* payload, const char* name, OCRepPayload* value); +bool OC_CALL OCRepPayloadGetPropObject(const OCRepPayload* payload, const char* name, OCRepPayload** value); #ifdef __WITH_TLS__ -bool OCRepPayloadSetPropPubDataType(OCRepPayload *payload, const char *name, const OicSecKey_t *value); -bool OCRepPayloadSetPropPubDataTypeAsOwner(OCRepPayload *payload, const char *name, const OicSecKey_t *value); -bool OCRepPayloadGetPropPubDataType(const OCRepPayload *payload, const char *name, OicSecKey_t *value); +bool OC_CALL OCRepPayloadSetPropPubDataType(OCRepPayload *payload, const char *name, const OicSecKey_t *value); +bool OC_CALL OCRepPayloadSetPropPubDataTypeAsOwner(OCRepPayload *payload, const char *name, const OicSecKey_t *value); +bool OC_CALL OCRepPayloadGetPropPubDataType(const OCRepPayload *payload, const char *name, OicSecKey_t *value); #endif /** @@ -159,7 +160,7 @@ bool OCRepPayloadGetPropPubDataType(const OCRepPayload *payload, const char *nam * * @return true on success, false upon failure. */ -bool OCRepPayloadSetByteStringArrayAsOwner(OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadSetByteStringArrayAsOwner(OCRepPayload* payload, const char* name, OCByteString* array, size_t dimensions[MAX_REP_ARRAY_DEPTH]); /** @@ -172,7 +173,7 @@ bool OCRepPayloadSetByteStringArrayAsOwner(OCRepPayload* payload, const char* na * * @return true on success, false upon failure. */ -bool OCRepPayloadSetByteStringArray(OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadSetByteStringArray(OCRepPayload* payload, const char* name, const OCByteString* array, size_t dimensions[MAX_REP_ARRAY_DEPTH]); /** @@ -188,93 +189,93 @@ bool OCRepPayloadSetByteStringArray(OCRepPayload* payload, const char* name, * * @return true on success, false upon failure. */ -bool OCRepPayloadGetByteStringArray(const OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadGetByteStringArray(const OCRepPayload* payload, const char* name, OCByteString** array, size_t dimensions[MAX_REP_ARRAY_DEPTH]); -bool OCRepPayloadSetIntArrayAsOwner(OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadSetIntArrayAsOwner(OCRepPayload* payload, const char* name, int64_t* array, size_t dimensions[MAX_REP_ARRAY_DEPTH]); -bool OCRepPayloadSetIntArray(OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadSetIntArray(OCRepPayload* payload, const char* name, const int64_t* array, size_t dimensions[MAX_REP_ARRAY_DEPTH]); -bool OCRepPayloadGetIntArray(const OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadGetIntArray(const OCRepPayload* payload, const char* name, int64_t** array, size_t dimensions[MAX_REP_ARRAY_DEPTH]); -bool OCRepPayloadSetDoubleArrayAsOwner(OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadSetDoubleArrayAsOwner(OCRepPayload* payload, const char* name, double* array, size_t dimensions[MAX_REP_ARRAY_DEPTH]); -bool OCRepPayloadSetDoubleArray(OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadSetDoubleArray(OCRepPayload* payload, const char* name, const double* array, size_t dimensions[MAX_REP_ARRAY_DEPTH]); -bool OCRepPayloadGetDoubleArray(const OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadGetDoubleArray(const OCRepPayload* payload, const char* name, double** array, size_t dimensions[MAX_REP_ARRAY_DEPTH]); -bool OCRepPayloadSetStringArrayAsOwner(OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadSetStringArrayAsOwner(OCRepPayload* payload, const char* name, char** array, size_t dimensions[MAX_REP_ARRAY_DEPTH]); -bool OCRepPayloadSetStringArray(OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadSetStringArray(OCRepPayload* payload, const char* name, const char** array, size_t dimensions[MAX_REP_ARRAY_DEPTH]); -bool OCRepPayloadGetStringArray(const OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadGetStringArray(const OCRepPayload* payload, const char* name, char*** array, size_t dimensions[MAX_REP_ARRAY_DEPTH]); -bool OCRepPayloadSetBoolArrayAsOwner(OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadSetBoolArrayAsOwner(OCRepPayload* payload, const char* name, bool* array, size_t dimensions[MAX_REP_ARRAY_DEPTH]); -bool OCRepPayloadSetBoolArray(OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadSetBoolArray(OCRepPayload* payload, const char* name, const bool* array, size_t dimensions[MAX_REP_ARRAY_DEPTH]); -bool OCRepPayloadGetBoolArray(const OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadGetBoolArray(const OCRepPayload* payload, const char* name, bool** array, size_t dimensions[MAX_REP_ARRAY_DEPTH]); -bool OCRepPayloadSetPropObjectArrayAsOwner(OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadSetPropObjectArrayAsOwner(OCRepPayload* payload, const char* name, OCRepPayload** array, size_t dimensions[MAX_REP_ARRAY_DEPTH]); -bool OCRepPayloadSetPropObjectArray(OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadSetPropObjectArray(OCRepPayload* payload, const char* name, const OCRepPayload** array, size_t dimensions[MAX_REP_ARRAY_DEPTH]); -bool OCRepPayloadGetPropObjectArray(const OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadGetPropObjectArray(const OCRepPayload* payload, const char* name, OCRepPayload*** array, size_t dimensions[MAX_REP_ARRAY_DEPTH]); -void OCRepPayloadDestroy(OCRepPayload* payload); +void OC_CALL OCRepPayloadDestroy(OCRepPayload* payload); // Discovery Payload -OCDiscoveryPayload* OCDiscoveryPayloadCreate(); +OCDiscoveryPayload* OC_CALL OCDiscoveryPayloadCreate(); -OCSecurityPayload* OCSecurityPayloadCreate(const uint8_t* securityData, size_t size); -void OCSecurityPayloadDestroy(OCSecurityPayload* payload); +OCSecurityPayload* OC_CALL OCSecurityPayloadCreate(const uint8_t* securityData, size_t size); +void OC_CALL OCSecurityPayloadDestroy(OCSecurityPayload* payload); -OCIntrospectionPayload* OCIntrospectionPayloadCreateFromCbor(const uint8_t* cborData, +OCIntrospectionPayload* OC_CALL OCIntrospectionPayloadCreateFromCbor(const uint8_t* cborData, size_t size); -void OCIntrospectionPayloadDestroy(OCIntrospectionPayload* payload); +void OC_CALL OCIntrospectionPayloadDestroy(OCIntrospectionPayload* payload); #ifndef TCP_ADAPTER -void OCDiscoveryPayloadAddResource(OCDiscoveryPayload* payload, const OCResource* res, +void OC_CALL OCDiscoveryPayloadAddResource(OCDiscoveryPayload* payload, const OCResource* res, uint16_t securePort); #else -void OCDiscoveryPayloadAddResource(OCDiscoveryPayload* payload, const OCResource* res, +void OC_CALL OCDiscoveryPayloadAddResource(OCDiscoveryPayload* payload, const OCResource* res, uint16_t securePort, uint16_t tcpPort); #endif -void OCDiscoveryPayloadAddNewResource(OCDiscoveryPayload* payload, +void OC_CALL OCDiscoveryPayloadAddNewResource(OCDiscoveryPayload* payload, OCResourcePayload* res); -bool OCResourcePayloadAddStringLL(OCStringLL **payload, const char* type); +bool OC_CALL OCResourcePayloadAddStringLL(OCStringLL **payload, const char* type); -size_t OCDiscoveryPayloadGetResourceCount(OCDiscoveryPayload* payload); -OCResourcePayload* OCDiscoveryPayloadGetResource(OCDiscoveryPayload* payload, +size_t OC_CALL OCDiscoveryPayloadGetResourceCount(OCDiscoveryPayload* payload); +OCResourcePayload* OC_CALL OCDiscoveryPayloadGetResource(OCDiscoveryPayload* payload, size_t index); -size_t OCEndpointPayloadGetEndpointCount(OCEndpointPayload* payload); -OCEndpointPayload* OCEndpointPayloadGetEndpoint(OCEndpointPayload* payload, +size_t OC_CALL OCEndpointPayloadGetEndpointCount(OCEndpointPayload* payload); +OCEndpointPayload* OC_CALL OCEndpointPayloadGetEndpoint(OCEndpointPayload* payload, size_t index); -void OCResourcePayloadAddNewEndpoint(OCResourcePayload* payload, +void OC_CALL OCResourcePayloadAddNewEndpoint(OCResourcePayload* payload, OCEndpointPayload* endpoint); -void OCDiscoveryEndpointDestroy(OCEndpointPayload* payload); -void OCDiscoveryResourceDestroy(OCResourcePayload* payload); -void OCDiscoveryPayloadDestroy(OCDiscoveryPayload* payload); +void OC_CALL OCDiscoveryEndpointDestroy(OCEndpointPayload* payload); +void OC_CALL OCDiscoveryResourceDestroy(OCResourcePayload* payload); +void OC_CALL OCDiscoveryPayloadDestroy(OCDiscoveryPayload* payload); // Presence Payload -OCPresencePayload* OCPresencePayloadCreate(uint32_t seqNum, uint32_t maxAge, +OCPresencePayload* OC_CALL OCPresencePayloadCreate(uint32_t seqNum, uint32_t maxAge, OCPresenceTrigger trigger, const char* resourceType); -void OCPresencePayloadDestroy(OCPresencePayload* payload); +void OC_CALL OCPresencePayloadDestroy(OCPresencePayload* payload); // Diagnostic Payload -OCDiagnosticPayload* OCDiagnosticPayloadCreate(const char *message); -void OCDiagnosticPayloadDestroy(OCDiagnosticPayload* payload); +OCDiagnosticPayload* OC_CALL OCDiagnosticPayloadCreate(const char *message); +void OC_CALL OCDiagnosticPayloadDestroy(OCDiagnosticPayload* payload); // Helper API -OCStringLL* CloneOCStringLL (OCStringLL* ll); -void OCFreeOCStringLL(OCStringLL* ll); +OCStringLL* OC_CALL CloneOCStringLL (OCStringLL* ll); +void OC_CALL OCFreeOCStringLL(OCStringLL* ll); /** * This function creates a list from a string (with separated contents if several) @@ -282,7 +283,7 @@ void OCFreeOCStringLL(OCStringLL* ll); * @return newly allocated linked list * @note separator is ',' (according to rfc4180, ';' is not valid) **/ -OCStringLL* OCCreateOCStringLL(const char* text); +OCStringLL* OC_CALL OCCreateOCStringLL(const char* text); /** * This function creates a string from a list (with separated contents if several) @@ -290,7 +291,7 @@ OCStringLL* OCCreateOCStringLL(const char* text); * @return newly allocated string. Caller takes ownership and must later free this memory with OICFree. * @note separator is ',' (according to rfc4180) **/ -char* OCCreateString(const OCStringLL* ll); +char* OC_CALL OCCreateString(const OCStringLL* ll); /** * This function copies contents (and allocates if necessary) @@ -298,7 +299,7 @@ char* OCCreateString(const OCStringLL* ll); * @param source existing bytestring * @return true of success false on any errors **/ -bool OCByteStringCopy(OCByteString *dest, const OCByteString *source); +bool OC_CALL OCByteStringCopy(OCByteString *dest, const OCByteString *source); /** * This function creates the payloadValue for links parameter of collection resource. @@ -311,7 +312,7 @@ bool OCByteStringCopy(OCByteString *dest, const OCByteString *source); * * @return ::OC_STACK_OK if successful or else other value. */ -OCStackResult OCLinksPayloadValueCreate(const char *resourceUri, +OCStackResult OC_CALL OCLinksPayloadValueCreate(const char *resourceUri, OCRepPayloadValue **linksRepPayloadValue, OCDevAddr *devAddr); #ifdef __cplusplus diff --git a/resource/csdk/stack/include/ocstack.h b/resource/csdk/stack/include/ocstack.h index 5871a3c..da59c7f 100644 --- a/resource/csdk/stack/include/ocstack.h +++ b/resource/csdk/stack/include/ocstack.h @@ -32,6 +32,8 @@ #include #include "octypes.h" +#include "platform_features.h" + #ifdef __cplusplus extern "C" { #endif // __cplusplus @@ -52,7 +54,7 @@ extern "C" { * * @return ::OC_STACK_OK on success, some other value upon failure. */ -OCStackResult OCInit1(OCMode mode, OCTransportFlags serverFlags, OCTransportFlags clientFlags); +OCStackResult OC_CALL OCInit1(OCMode mode, OCTransportFlags serverFlags, OCTransportFlags clientFlags); /** * This function Initializes the OC Stack. Must be called prior to starting the stack. @@ -64,7 +66,7 @@ OCStackResult OCInit1(OCMode mode, OCTransportFlags serverFlags, OCTransportFlag * * @return ::OC_STACK_OK on success, some other value upon failure. */ -OCStackResult OCInit2(OCMode mode, OCTransportFlags serverFlags, OCTransportFlags clientFlags, +OCStackResult OC_CALL OCInit2(OCMode mode, OCTransportFlags serverFlags, OCTransportFlags clientFlags, OCTransportAdapter transportType); /** @@ -76,7 +78,7 @@ OCStackResult OCInit2(OCMode mode, OCTransportFlags serverFlags, OCTransportFlag * * @return ::OC_STACK_OK on success, some other value upon failure. */ -OCStackResult OCInit(const char *ipAddr, uint16_t port, OCMode mode); +OCStackResult OC_CALL OCInit(const char *ipAddr, uint16_t port, OCMode mode); #ifdef RA_ADAPTER /** @@ -85,7 +87,7 @@ OCStackResult OCInit(const char *ipAddr, uint16_t port, OCMode mode); * * @return ::OC_STACK_OK on success, some other value upon failure. */ -OCStackResult OCSetRAInfo(const OCRAInfo_t *raInfo); +OCStackResult OC_CALL OCSetRAInfo(const OCRAInfo_t *raInfo); #endif /** @@ -98,7 +100,7 @@ OCStackResult OCSetRAInfo(const OCRAInfo_t *raInfo); * * @return ::OC_STACK_OK on success, some other value upon failure. */ -OCStackResult OCStop(); +OCStackResult OC_CALL OCStop(); /** * This function starts responding to multicast /oic/res requests. This can be @@ -107,7 +109,7 @@ OCStackResult OCStop(); * * @return ::OC_STACK_OK on success, some other value upon failure. */ -OCStackResult OCStartMulticastServer(); +OCStackResult OC_CALL OCStartMulticastServer(); /** * This function stops responding to multicast /oic/res requests. This is to be @@ -118,7 +120,7 @@ OCStackResult OCStartMulticastServer(); * * @return ::OC_STACK_OK on success, some other value upon failure. */ -OCStackResult OCStopMulticastServer(); +OCStackResult OC_CALL OCStopMulticastServer(); /** * This function is Called in main loop of OC client or server. @@ -126,7 +128,7 @@ OCStackResult OCStopMulticastServer(); * * @return ::OC_STACK_OK on success, some other value upon failure. */ -OCStackResult OCProcess(); +OCStackResult OC_CALL OCProcess(); /** * This function discovers or Perform requests on a specified resource @@ -164,7 +166,7 @@ OCStackResult OCProcess(); * * @return ::OC_STACK_OK on success, some other value upon failure. */ -OCStackResult OCDoResource(OCDoHandle *handle, +OCStackResult OC_CALL OCDoResource(OCDoHandle *handle, OCMethod method, const char *requestUri, const OCDevAddr *destination, @@ -209,7 +211,7 @@ OCStackResult OCDoResource(OCDoHandle *handle, * * @return ::OC_STACK_OK on success, some other value upon failure. */ -OCStackResult OCDoRequest(OCDoHandle *handle, +OCStackResult OC_CALL OCDoRequest(OCDoHandle *handle, OCMethod method, const char *requestUri, const OCDevAddr *destination, @@ -231,7 +233,7 @@ OCStackResult OCDoRequest(OCDoHandle *handle, * * @return ::OC_STACK_OK on success, some other value upon failure. */ -OCStackResult OCCancel(OCDoHandle handle, +OCStackResult OC_CALL OCCancel(OCDoHandle handle, OCQualityOfService qos, OCHeaderOption * options, uint8_t numOptions); @@ -244,7 +246,7 @@ OCStackResult OCCancel(OCDoHandle handle, * OC_STACK_OK No errors; Success. * OC_STACK_INVALID_PARAM Invalid parameter. */ -OCStackResult OCRegisterPersistentStorageHandler(OCPersistentStorage* persistentStorageHandler); +OCStackResult OC_CALL OCRegisterPersistentStorageHandler(OCPersistentStorage* persistentStorageHandler); #ifdef WITH_PRESENCE /** @@ -263,7 +265,7 @@ OCStackResult OCRegisterPersistentStorageHandler(OCPersistentStorage* persistent * * @return ::OC_STACK_OK on success, some other value upon failure. */ -OCStackResult OCStartPresence(const uint32_t ttl); +OCStackResult OC_CALL OCStartPresence(const uint32_t ttl); /** * When operating in OCServer or OCClientServer mode, this API will stop sending @@ -277,7 +279,7 @@ OCStackResult OCStartPresence(const uint32_t ttl); * @return ::OC_STACK_OK on success, some other value upon failure. */ -OCStackResult OCStopPresence(); +OCStackResult OC_CALL OCStopPresence(); #endif @@ -291,7 +293,7 @@ OCStackResult OCStopPresence(); * * @return ::OC_STACK_OK on success, some other value upon failure. */ -OCStackResult OCSetDefaultDeviceEntityHandler(OCDeviceEntityHandler entityHandler, +OCStackResult OC_CALL OCSetDefaultDeviceEntityHandler(OCDeviceEntityHandler entityHandler, void* callbackParameter); /** @@ -312,7 +314,7 @@ OCStackResult OCSetDefaultDeviceEntityHandler(OCDeviceEntityHandler entityHandle * ::OC_STACK_INVALID_PARAM invalid parameter. * ::OC_STACK_ERROR stack process error. */ -OCStackResult OCSetDeviceInfo(OCDeviceInfo deviceInfo); +OCStackResult OC_CALL OCSetDeviceInfo(OCDeviceInfo deviceInfo); /** * This function sets platform information. @@ -326,7 +328,7 @@ OCStackResult OCSetDeviceInfo(OCDeviceInfo deviceInfo); * ::OC_STACK_INVALID_PARAM invalid parameter. * ::OC_STACK_ERROR stack process error. */ -OCStackResult OCSetPlatformInfo(OCPlatformInfo platformInfo); +OCStackResult OC_CALL OCSetPlatformInfo(OCPlatformInfo platformInfo); /** * This function creates a resource. @@ -345,7 +347,7 @@ OCStackResult OCSetPlatformInfo(OCPlatformInfo platformInfo); * * @return ::OC_STACK_OK on success, some other value upon failure. */ -OCStackResult OCCreateResource(OCResourceHandle *handle, +OCStackResult OC_CALL OCCreateResource(OCResourceHandle *handle, const char *resourceTypeName, const char *resourceInterfaceName, const char *uri, @@ -379,7 +381,7 @@ OCStackResult OCCreateResource(OCResourceHandle *handle, * * @return ::OC_STACK_OK on success, some other value upon failure. */ -OCStackResult OCCreateResourceWithEp(OCResourceHandle *handle, +OCStackResult OC_CALL OCCreateResourceWithEp(OCResourceHandle *handle, const char *resourceTypeName, const char *resourceInterfaceName, const char *uri, @@ -392,7 +394,7 @@ OCStackResult OCCreateResourceWithEp(OCResourceHandle *handle, * * @return Bit combinations of supported OCTpsSchemeFlags. */ -OCTpsSchemeFlags OCGetSupportedEndpointTpsFlags(); +OCTpsSchemeFlags OC_CALL OCGetSupportedEndpointTpsFlags(); /** * This function adds a resource to a collection resource. @@ -402,7 +404,7 @@ OCTpsSchemeFlags OCGetSupportedEndpointTpsFlags(); * * @return ::OC_STACK_OK on success, some other value upon failure. */ -OCStackResult OCBindResource(OCResourceHandle collectionHandle, OCResourceHandle resourceHandle); +OCStackResult OC_CALL OCBindResource(OCResourceHandle collectionHandle, OCResourceHandle resourceHandle); /** * This function removes a resource from a collection resource. @@ -412,7 +414,7 @@ OCStackResult OCBindResource(OCResourceHandle collectionHandle, OCResourceHandle * * @return ::OC_STACK_OK on success, some other value upon failure. */ -OCStackResult OCUnBindResource(OCResourceHandle collectionHandle, OCResourceHandle resourceHandle); +OCStackResult OC_CALL OCUnBindResource(OCResourceHandle collectionHandle, OCResourceHandle resourceHandle); /** * This function binds a resource type to a resource. @@ -422,7 +424,7 @@ OCStackResult OCUnBindResource(OCResourceHandle collectionHandle, OCResourceHand * * @return ::OC_STACK_OK on success, some other value upon failure. */ -OCStackResult OCBindResourceTypeToResource(OCResourceHandle handle, +OCStackResult OC_CALL OCBindResourceTypeToResource(OCResourceHandle handle, const char *resourceTypeName); /** * This function binds a resource interface to a resource. @@ -432,7 +434,7 @@ OCStackResult OCBindResourceTypeToResource(OCResourceHandle handle, * * @return ::OC_STACK_OK on success, some other value upon failure. */ -OCStackResult OCBindResourceInterfaceToResource(OCResourceHandle handle, +OCStackResult OC_CALL OCBindResourceInterfaceToResource(OCResourceHandle handle, const char *resourceInterfaceName); /** @@ -444,7 +446,7 @@ OCStackResult OCBindResourceInterfaceToResource(OCResourceHandle handle, * * @return ::OC_STACK_OK on success, some other value upon failure. */ -OCStackResult OCBindResourceHandler(OCResourceHandle handle, +OCStackResult OC_CALL OCBindResourceHandler(OCResourceHandle handle, OCEntityHandler entityHandler, void *callbackParameter); @@ -455,7 +457,7 @@ OCStackResult OCBindResourceHandler(OCResourceHandle handle, * * @return ::OC_STACK_OK on success, some other value upon failure. */ -OCStackResult OCGetNumberOfResources(uint8_t *numResources); +OCStackResult OC_CALL OCGetNumberOfResources(uint8_t *numResources); /** * This function gets a resource handle by index. @@ -464,7 +466,7 @@ OCStackResult OCGetNumberOfResources(uint8_t *numResources); * * @return Found resource handle or NULL if not found. */ -OCResourceHandle OCGetResourceHandle(uint8_t index); +OCResourceHandle OC_CALL OCGetResourceHandle(uint8_t index); /** * This function deletes resource specified by handle. Deletes resource and all @@ -477,7 +479,7 @@ OCResourceHandle OCGetResourceHandle(uint8_t index); * * @return ::OC_STACK_OK on success, some other value upon failure. */ -OCStackResult OCDeleteResource(OCResourceHandle handle); +OCStackResult OC_CALL OCDeleteResource(OCResourceHandle handle); /** * Get a string representation the server instance ID. @@ -489,7 +491,7 @@ OCStackResult OCDeleteResource(OCResourceHandle handle); * * @return A string representation the server instance ID. */ -const char* OCGetServerInstanceIDString(void); +const char* OC_CALL OCGetServerInstanceIDString(void); /** * This function gets the URI of the resource specified by handle. @@ -498,7 +500,7 @@ const char* OCGetServerInstanceIDString(void); * * @return URI string if resource found or NULL if not found. */ -const char *OCGetResourceUri(OCResourceHandle handle); +const char *OC_CALL OCGetResourceUri(OCResourceHandle handle); /** * This function gets the properties of the resource specified by handle. @@ -510,7 +512,7 @@ const char *OCGetResourceUri(OCResourceHandle handle); * @note that after a resource is created, the OC_ACTIVE property is set for the resource by the * stack. */ -OCResourceProperty OCGetResourceProperties(OCResourceHandle handle); +OCResourceProperty OC_CALL OCGetResourceProperties(OCResourceHandle handle); /** * This function sets the properties of the resource specified by handle. @@ -521,7 +523,7 @@ OCResourceProperty OCGetResourceProperties(OCResourceHandle handle); * * @return ::OC_STACK_OK on success, some other value upon failure. */ -OCStackResult OCSetResourceProperties(OCResourceHandle handle, uint8_t resourceProperties); +OCStackResult OC_CALL OCSetResourceProperties(OCResourceHandle handle, uint8_t resourceProperties); /** * This function removes the properties of the resource specified by handle. @@ -532,7 +534,7 @@ OCStackResult OCSetResourceProperties(OCResourceHandle handle, uint8_t resourceP * * @return ::OC_STACK_OK on success, some other value upon failure. */ -OCStackResult OCClearResourceProperties(OCResourceHandle handle, uint8_t resourceProperties); +OCStackResult OC_CALL OCClearResourceProperties(OCResourceHandle handle, uint8_t resourceProperties); /** * This function gets the number of resource types of the resource. @@ -542,7 +544,7 @@ OCStackResult OCClearResourceProperties(OCResourceHandle handle, uint8_t resourc * * @return ::OC_STACK_OK on success, some other value upon failure. */ -OCStackResult OCGetNumberOfResourceTypes(OCResourceHandle handle, uint8_t *numResourceTypes); +OCStackResult OC_CALL OCGetNumberOfResourceTypes(OCResourceHandle handle, uint8_t *numResourceTypes); /** * This function gets name of resource type of the resource. @@ -552,7 +554,7 @@ OCStackResult OCGetNumberOfResourceTypes(OCResourceHandle handle, uint8_t *numRe * * @return Resource type name if resource found or NULL if resource not found. */ -const char *OCGetResourceTypeName(OCResourceHandle handle, uint8_t index); +const char *OC_CALL OCGetResourceTypeName(OCResourceHandle handle, uint8_t index); /** * This function gets the number of resource interfaces of the resource. @@ -562,7 +564,7 @@ const char *OCGetResourceTypeName(OCResourceHandle handle, uint8_t index); * * @return ::OC_STACK_OK on success, some other value upon failure. */ -OCStackResult OCGetNumberOfResourceInterfaces(OCResourceHandle handle, +OCStackResult OC_CALL OCGetNumberOfResourceInterfaces(OCResourceHandle handle, uint8_t *numResourceInterfaces); /** @@ -573,7 +575,7 @@ OCStackResult OCGetNumberOfResourceInterfaces(OCResourceHandle handle, * * @return Resource interface name if resource found or NULL if resource not found. */ -const char *OCGetResourceInterfaceName(OCResourceHandle handle, uint8_t index); +const char *OC_CALL OCGetResourceInterfaceName(OCResourceHandle handle, uint8_t index); /** * This function gets resource handle from the collection resource by index. @@ -583,7 +585,7 @@ const char *OCGetResourceInterfaceName(OCResourceHandle handle, uint8_t index); * * @return Handle to contained resource if resource found or NULL if resource not found. */ -OCResourceHandle OCGetResourceHandleFromCollection(OCResourceHandle collectionHandle, +OCResourceHandle OC_CALL OCGetResourceHandleFromCollection(OCResourceHandle collectionHandle, uint8_t index); /** @@ -593,7 +595,7 @@ OCResourceHandle OCGetResourceHandleFromCollection(OCResourceHandle collectionHa * * @return Entity handler if resource found or NULL resource not found. */ -OCEntityHandler OCGetResourceHandler(OCResourceHandle handle); +OCEntityHandler OC_CALL OCGetResourceHandler(OCResourceHandle handle); /** * This function notify all registered observers that the resource representation has @@ -605,7 +607,7 @@ OCEntityHandler OCGetResourceHandler(OCResourceHandle handle); * * @return ::OC_STACK_OK on success, some other value upon failure. */ -OCStackResult OCNotifyAllObservers(OCResourceHandle handle, OCQualityOfService qos); +OCStackResult OC_CALL OCNotifyAllObservers(OCResourceHandle handle, OCQualityOfService qos); /** * Notify specific observers with updated value of representation. @@ -624,7 +626,7 @@ OCStackResult OCNotifyAllObservers(OCResourceHandle handle, OCQualityOfService q * * @return ::OC_STACK_OK on success, some other value upon failure. */ -OCStackResult OCNotifyListOfObservers (OCResourceHandle handle, +OCStackResult OC_CALL OCNotifyListOfObservers (OCResourceHandle handle, OCObservationId *obsIdList, uint8_t numberOfIds, const OCRepPayload *payload, @@ -639,7 +641,7 @@ OCStackResult OCNotifyListOfObservers (OCResourceHandle handle, * * @return ::OC_STACK_OK on success, some other value upon failure. */ -OCStackResult OCDoResponse(OCEntityHandlerResponse *response); +OCStackResult OC_CALL OCDoResponse(OCEntityHandlerResponse *response); //#ifdef DIRECT_PAIRING /** @@ -651,7 +653,7 @@ OCStackResult OCDoResponse(OCEntityHandlerResponse *response); * client before returning the list of devices. * @return OCDirectPairingDev_t pointer in case of success and NULL otherwise. */ -const OCDPDev_t* OCDiscoverDirectPairingDevices(unsigned short waittime); +const OCDPDev_t* OC_CALL OCDiscoverDirectPairingDevices(unsigned short waittime); /** * The function is responsible for return of paired device list via direct-pairing. It will list @@ -660,7 +662,7 @@ const OCDPDev_t* OCDiscoverDirectPairingDevices(unsigned short waittime); * * @return OCDirectPairingDev_t pointer in case of success and NULL otherwise. */ -const OCDPDev_t* OCGetDirectPairedDevices(); +const OCDPDev_t* OC_CALL OCGetDirectPairedDevices(); /** * The function is responsible for establishment of direct-pairing. It will proceed mode negotiation @@ -673,7 +675,7 @@ 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. */ -OCStackResult OCDoDirectPairing(void *ctx, OCDPDev_t* peer, OCPrm_t pmSel, char *pinNumber, +OCStackResult OC_CALL OCDoDirectPairing(void *ctx, OCDPDev_t* peer, OCPrm_t pmSel, char *pinNumber, OCDirectPairingCB resultCallback); //#endif // DIRECT_PAIRING @@ -682,7 +684,7 @@ OCStackResult OCDoDirectPairing(void *ctx, OCDPDev_t* peer, OCPrm_t pmSel, char * * @param uri NULL terminated resource uri for CoAP-HTTP Proxy. */ -OCStackResult OCSetProxyURI(const char *uri); +OCStackResult OC_CALL OCSetProxyURI(const char *uri); #if defined(RD_CLIENT) || defined(RD_SERVER) /** @@ -693,7 +695,7 @@ OCStackResult OCSetProxyURI(const char *uri); * * @return ::OC_STACK_OK on success, some other value upon failure. */ -OCStackResult OCBindResourceInsToResource(OCResourceHandle handle, int64_t ins); +OCStackResult OC_CALL OCBindResourceInsToResource(OCResourceHandle handle, int64_t ins); /** * This function gets the resource unique id for a resource. @@ -703,7 +705,7 @@ OCStackResult OCBindResourceInsToResource(OCResourceHandle handle, int64_t ins); * * @return Ins if resource found or 0 resource not found. */ -OCStackResult OCGetResourceIns(OCResourceHandle handle, int64_t *ins); +OCStackResult OC_CALL OCGetResourceIns(OCResourceHandle handle, int64_t *ins); #ifdef RD_SERVER /** @@ -712,14 +714,14 @@ OCStackResult OCGetResourceIns(OCResourceHandle handle, int64_t *ins); * * @return ::OC_STACK_OK on success, some other value upon failure. */ -OCStackResult OCRDDatabaseSetStorageFilename(const char *filename); +OCStackResult OC_CALL OCRDDatabaseSetStorageFilename(const char *filename); /** * Returns the filename to be used for database persistent storage. * * @return the filename */ -const char *OCRDDatabaseGetStorageFilename(); +const char *OC_CALL OCRDDatabaseGetStorageFilename(); /** * Search the RD database for queries. @@ -731,7 +733,7 @@ const char *OCRDDatabaseGetStorageFilename(); * * @return ::OC_STACK_OK in case of success or else other value. */ -OCStackResult OCRDDatabaseDiscoveryPayloadCreate(const char *interfaceType, +OCStackResult OC_CALL OCRDDatabaseDiscoveryPayloadCreate(const char *interfaceType, const char *resourceType, OCDiscoveryPayload **discPayload); #endif // RD_SERVER @@ -744,7 +746,7 @@ OCStackResult OCRDDatabaseDiscoveryPayloadCreate(const char *interfaceType, * * @return Found resource handle or NULL if not found. */ -OCResourceHandle OCGetResourceHandleAtUri(const char *uri); +OCResourceHandle OC_CALL OCGetResourceHandleAtUri(const char *uri); /** * Add a header option to the given header option array. @@ -757,7 +759,7 @@ OCResourceHandle OCGetResourceHandleAtUri(const char *uri); * * @return ::OC_STACK_OK on success and other value otherwise. */ -OCStackResult OCSetHeaderOption(OCHeaderOption* ocHdrOpt, +OCStackResult OC_CALL OCSetHeaderOption(OCHeaderOption* ocHdrOpt, size_t* numOptions, uint16_t optionID, void* optionData, @@ -775,7 +777,7 @@ OCStackResult OCSetHeaderOption(OCHeaderOption* ocHdrOpt, * * @return ::OC_STACK_OK on success and other value otherwise. */ -OCStackResult OCGetHeaderOption(OCHeaderOption* ocHdrOpt, +OCStackResult OC_CALL OCGetHeaderOption(OCHeaderOption* ocHdrOpt, size_t numOptions, uint16_t optionID, void* optionData, @@ -788,7 +790,7 @@ OCStackResult OCGetHeaderOption(OCHeaderOption* ocHdrOpt, * @param deviceId pointer. * @return Returns ::OC_STACK_OK if success. */ -OCStackResult OCGetDeviceId(OCUUIdentity *deviceId); +OCStackResult OC_CALL OCGetDeviceId(OCUUIdentity *deviceId); /** * sets the deviceId of the client @@ -796,7 +798,7 @@ OCStackResult OCGetDeviceId(OCUUIdentity *deviceId); * @param deviceId pointer. * @return Returns ::OC_STACK_OK if success. */ -OCStackResult OCSetDeviceId(const OCUUIdentity *deviceId); +OCStackResult OC_CALL OCSetDeviceId(const OCUUIdentity *deviceId); /** * Gets the bool state of "isOwned" property on the doxm resource. @@ -804,7 +806,7 @@ OCStackResult OCSetDeviceId(const OCUUIdentity *deviceId); * @param isOwned a pointer to be assigned to isOwned property * @return Returns ::OC_STACK_OK if success. */ -OCStackResult OCGetDeviceOwnedState(bool *isOwned); +OCStackResult OC_CALL OCGetDeviceOwnedState(bool *isOwned); /** * Encode an address string to match RFC 6874. @@ -816,7 +818,7 @@ OCStackResult OCGetDeviceOwnedState(bool *isOwned); * * @return ::OC_STACK_OK on success and other value otherwise. */ -OCStackResult OCEncodeAddressForRFC6874(char* outputAddress, +OCStackResult OC_CALL OCEncodeAddressForRFC6874(char* outputAddress, size_t outputSize, const char* inputAddress); @@ -832,7 +834,7 @@ OCStackResult OCEncodeAddressForRFC6874(char* outputAddress, * * @return ::OC_STACK_OK on success and other value otherwise. */ -OCStackResult OCDecodeAddressForRFC6874(char* outputAddress, +OCStackResult OC_CALL OCDecodeAddressForRFC6874(char* outputAddress, size_t outputSize, const char* inputAddress, const char* end); @@ -852,7 +854,7 @@ OCStackResult OCDecodeAddressForRFC6874(char* outputAddress, * * @return ::OC_STACK_OK on success and other value otherwise. */ -OCStackResult OCSetPropertyValue(OCPayloadType type, const char *propName, const void *value); +OCStackResult OC_CALL OCSetPropertyValue(OCPayloadType type, const char *propName, const void *value); /** * Get the value of /oic/d and /oic/p properties. This function is a generic function that gets the @@ -871,7 +873,7 @@ OCStackResult OCSetPropertyValue(OCPayloadType type, const char *propName, const * * @return ::OC_STACK_OK on success and other value otherwise. */ -OCStackResult OCGetPropertyValue(OCPayloadType type, const char *propName, void **value); +OCStackResult OC_CALL OCGetPropertyValue(OCPayloadType type, const char *propName, void **value); /** * Get the registered persistent storage handler. All modules must use this to obtain access to @@ -879,7 +881,7 @@ OCStackResult OCGetPropertyValue(OCPayloadType type, const char *propName, void * * @return pointer to OCPersistentStorage structure on success and NULL otherwise. */ -OCPersistentStorage *OCGetPersistentStorageHandler(); +OCPersistentStorage *OC_CALL OCGetPersistentStorageHandler(); /** * This function return link local zone id related from ifindex. @@ -889,7 +891,7 @@ OCPersistentStorage *OCGetPersistentStorageHandler(); * zoneId using OICFree() when it returned CA_STATUS_OK. * @return ::OC_STACK_OK if successful. */ -OCStackResult OCGetLinkLocalZoneId(uint32_t ifindex, char **zoneId); +OCStackResult OC_CALL OCGetLinkLocalZoneId(uint32_t ifindex, char **zoneId); /** * Select the cipher suite for dtls handshake. @@ -909,7 +911,7 @@ OCStackResult OCGetLinkLocalZoneId(uint32_t ifindex, char **zoneId); * * @return ::OC_STACK_OK if successful. */ -OCStackResult OCSelectCipherSuite(uint16_t cipher, OCTransportAdapter adapterType); +OCStackResult OC_CALL OCSelectCipherSuite(uint16_t cipher, OCTransportAdapter adapterType); /** * Return the scope level of a given IP address. @@ -919,7 +921,7 @@ OCStackResult OCSelectCipherSuite(uint16_t cipher, OCTransportAdapter adapterTyp * * @return ::OC_STACK_OK if successful. */ -OCStackResult OCGetIpv6AddrScope(const char *addr, OCTransportFlags *scope); +OCStackResult OC_CALL OCGetIpv6AddrScope(const char *addr, OCTransportFlags *scope); #ifdef __cplusplus } diff --git a/resource/csdk/stack/include/payload_logging.h b/resource/csdk/stack/include/payload_logging.h index 2df6f45..a801524 100644 --- a/resource/csdk/stack/include/payload_logging.h +++ b/resource/csdk/stack/include/payload_logging.h @@ -49,8 +49,8 @@ extern "C" #define OIC_LOG_PAYLOAD(level, payload) OCPayloadLog((level),(payload)) #define UUID_SIZE (16) -const char *convertTriggerEnumToString(OCPresenceTrigger trigger); -OCPresenceTrigger convertTriggerStringToEnum(const char * triggerStr); +const char *OC_CALL convertTriggerEnumToString(OCPresenceTrigger trigger); +OCPresenceTrigger OC_CALL convertTriggerStringToEnum(const char * triggerStr); INLINE_API void OCPayloadLogRep(LogLevel level, OCRepPayload* payload); diff --git a/resource/csdk/stack/src/ocendpoint.c b/resource/csdk/stack/src/ocendpoint.c index d70d41a..a829fd0 100644 --- a/resource/csdk/stack/src/ocendpoint.c +++ b/resource/csdk/stack/src/ocendpoint.c @@ -282,7 +282,7 @@ exit: return NULL; } -char* OCCreateEndpointStringFromCA(const CAEndpoint_t* endpoint) +char* OC_CALL OCCreateEndpointStringFromCA(const CAEndpoint_t* endpoint) { if (!endpoint || 0 == strlen(endpoint->addr)) { diff --git a/resource/csdk/stack/src/ocpayload.c b/resource/csdk/stack/src/ocpayload.c index a0582fd..6012f90 100644 --- a/resource/csdk/stack/src/ocpayload.c +++ b/resource/csdk/stack/src/ocpayload.c @@ -41,7 +41,7 @@ static void OCFreeRepPayloadValueContents(OCRepPayloadValue* val); -void OCPayloadDestroy(OCPayload* payload) +void OC_CALL OCPayloadDestroy(OCPayload* payload) { if (!payload) { @@ -75,7 +75,7 @@ void OCPayloadDestroy(OCPayload* payload) } } -OCRepPayload* OCRepPayloadCreate() +OCRepPayload* OC_CALL OCRepPayloadCreate() { OCRepPayload* payload = (OCRepPayload*)OICCalloc(1, sizeof(OCRepPayload)); @@ -89,7 +89,7 @@ OCRepPayload* OCRepPayloadCreate() return payload; } -void OCRepPayloadAppend(OCRepPayload* parent, OCRepPayload* child) +void OC_CALL OCRepPayloadAppend(OCRepPayload* parent, OCRepPayload* child) { if (!parent) { @@ -105,7 +105,7 @@ void OCRepPayloadAppend(OCRepPayload* parent, OCRepPayload* child) child->next = NULL; } -static OCRepPayloadValue* OCRepPayloadFindValue(const OCRepPayload* payload, const char* name) +static OCRepPayloadValue* OC_CALL OCRepPayloadFindValue(const OCRepPayload* payload, const char* name) { if (!payload || !name) { @@ -125,7 +125,7 @@ static OCRepPayloadValue* OCRepPayloadFindValue(const OCRepPayload* payload, con return NULL; } -static void OCCopyPropertyValueArray(OCRepPayloadValue* dest, OCRepPayloadValue* source) +static void OC_CALL OCCopyPropertyValueArray(OCRepPayloadValue* dest, OCRepPayloadValue* source) { if (!dest || !source) { @@ -192,7 +192,7 @@ exit: return; } -static void OCCopyPropertyValue (OCRepPayloadValue *dest, OCRepPayloadValue *source) +static void OC_CALL OCCopyPropertyValue (OCRepPayloadValue *dest, OCRepPayloadValue *source) { if (!source || !dest) { @@ -288,7 +288,7 @@ static void OCFreeRepPayloadValueContents(OCRepPayloadValue* val) } } -static void OCFreeRepPayloadValue(OCRepPayloadValue* val) +static void OC_CALL OCFreeRepPayloadValue(OCRepPayloadValue* val) { if (!val) { @@ -300,7 +300,7 @@ static void OCFreeRepPayloadValue(OCRepPayloadValue* val) OCFreeRepPayloadValue(val->next); OICFree(val); } -static OCRepPayloadValue* OCRepPayloadValueClone (OCRepPayloadValue* source) +static OCRepPayloadValue* OC_CALL OCRepPayloadValueClone (OCRepPayloadValue* source) { if (!source) { @@ -342,7 +342,7 @@ static OCRepPayloadValue* OCRepPayloadValueClone (OCRepPayloadValue* source) return headOfClone; } -static OCRepPayloadValue* OCRepPayloadFindAndSetValue(OCRepPayload* payload, const char* name, +static OCRepPayloadValue* OC_CALL OCRepPayloadFindAndSetValue(OCRepPayload* payload, const char* name, OCRepPayloadPropType type) { if (!payload || !name) @@ -402,12 +402,12 @@ static OCRepPayloadValue* OCRepPayloadFindAndSetValue(OCRepPayload* payload, con return NULL; } -bool OCRepPayloadAddResourceType(OCRepPayload* payload, const char* resourceType) +bool OC_CALL OCRepPayloadAddResourceType(OCRepPayload* payload, const char* resourceType) { return OCRepPayloadAddResourceTypeAsOwner(payload, OICStrdup(resourceType)); } -bool OCRepPayloadAddResourceTypeAsOwner(OCRepPayload* payload, char* resourceType) +bool OC_CALL OCRepPayloadAddResourceTypeAsOwner(OCRepPayload* payload, char* resourceType) { if (!payload || !resourceType) { @@ -443,12 +443,12 @@ bool OCRepPayloadAddResourceTypeAsOwner(OCRepPayload* payload, char* resourceTyp } } -bool OCRepPayloadAddInterface(OCRepPayload* payload, const char* iface) +bool OC_CALL OCRepPayloadAddInterface(OCRepPayload* payload, const char* iface) { return OCRepPayloadAddInterfaceAsOwner(payload, OICStrdup(iface)); } -bool OCRepPayloadAddInterfaceAsOwner(OCRepPayload* payload, char* iface) +bool OC_CALL OCRepPayloadAddInterfaceAsOwner(OCRepPayload* payload, char* iface) { if (!payload || !iface) { @@ -483,7 +483,7 @@ bool OCRepPayloadAddInterfaceAsOwner(OCRepPayload* payload, char* iface) } } -bool OCRepPayloadSetUri(OCRepPayload* payload, const char* uri) +bool OC_CALL OCRepPayloadSetUri(OCRepPayload* payload, const char* uri) { if (!payload) { @@ -494,7 +494,7 @@ bool OCRepPayloadSetUri(OCRepPayload* payload, const char* uri) return payload->uri != NULL; } -bool OCRepPayloadIsNull(const OCRepPayload* payload, const char* name) +bool OC_CALL OCRepPayloadIsNull(const OCRepPayload* payload, const char* name) { OCRepPayloadValue* val = OCRepPayloadFindValue(payload, name); @@ -506,7 +506,7 @@ bool OCRepPayloadIsNull(const OCRepPayload* payload, const char* name) return val->type == OCREP_PROP_NULL; } -static bool OCRepPayloadSetProp(OCRepPayload* payload, const char* name, +static bool OC_CALL OCRepPayloadSetProp(OCRepPayload* payload, const char* name, void* value, OCRepPayloadPropType type) { OCRepPayloadValue* val = OCRepPayloadFindAndSetValue(payload, name, type); @@ -544,18 +544,18 @@ static bool OCRepPayloadSetProp(OCRepPayload* payload, const char* name, return true; } -bool OCRepPayloadSetNull(OCRepPayload* payload, const char* name) +bool OC_CALL OCRepPayloadSetNull(OCRepPayload* payload, const char* name) { return OCRepPayloadSetProp(payload, name, NULL, OCREP_PROP_NULL); } -bool OCRepPayloadSetPropInt(OCRepPayload* payload, +bool OC_CALL OCRepPayloadSetPropInt(OCRepPayload* payload, const char* name, int64_t value) { return OCRepPayloadSetProp(payload, name, &value, OCREP_PROP_INT); } -bool OCRepPayloadGetPropInt(const OCRepPayload* payload, const char* name, int64_t* value) +bool OC_CALL OCRepPayloadGetPropInt(const OCRepPayload* payload, const char* name, int64_t* value) { OCRepPayloadValue* val = OCRepPayloadFindValue(payload, name); @@ -568,13 +568,13 @@ bool OCRepPayloadGetPropInt(const OCRepPayload* payload, const char* name, int64 return true; } -bool OCRepPayloadSetPropDouble(OCRepPayload* payload, +bool OC_CALL OCRepPayloadSetPropDouble(OCRepPayload* payload, const char* name, double value) { return OCRepPayloadSetProp(payload, name, &value, OCREP_PROP_DOUBLE); } -bool OCRepPayloadGetPropDouble(const OCRepPayload* payload, const char* name, double* value) +bool OC_CALL OCRepPayloadGetPropDouble(const OCRepPayload* payload, const char* name, double* value) { OCRepPayloadValue* val = OCRepPayloadFindValue(payload, name); @@ -601,7 +601,7 @@ bool OCRepPayloadGetPropDouble(const OCRepPayload* payload, const char* name, do return false; } -bool OCRepPayloadSetPropString(OCRepPayload* payload, const char* name, const char* value) +bool OC_CALL OCRepPayloadSetPropString(OCRepPayload* payload, const char* name, const char* value) { char* temp = OICStrdup(value); bool b = OCRepPayloadSetPropStringAsOwner(payload, name, temp); @@ -613,12 +613,12 @@ bool OCRepPayloadSetPropString(OCRepPayload* payload, const char* name, const ch return b; } -bool OCRepPayloadSetPropStringAsOwner(OCRepPayload* payload, const char* name, char* value) +bool OC_CALL OCRepPayloadSetPropStringAsOwner(OCRepPayload* payload, const char* name, char* value) { return OCRepPayloadSetProp(payload, name, value, OCREP_PROP_STRING); } -bool OCRepPayloadGetPropString(const OCRepPayload* payload, const char* name, char** value) +bool OC_CALL OCRepPayloadGetPropString(const OCRepPayload* payload, const char* name, char** value) { OCRepPayloadValue* val = OCRepPayloadFindValue(payload, name); @@ -631,7 +631,7 @@ bool OCRepPayloadGetPropString(const OCRepPayload* payload, const char* name, ch return *value != NULL; } -bool OCRepPayloadSetPropByteString(OCRepPayload* payload, const char* name, OCByteString value) +bool OC_CALL OCRepPayloadSetPropByteString(OCRepPayload* payload, const char* name, OCByteString value) { if (!value.bytes || !value.len) { @@ -652,12 +652,12 @@ bool OCRepPayloadSetPropByteString(OCRepPayload* payload, const char* name, OCBy return b; } -bool OCRepPayloadSetPropByteStringAsOwner(OCRepPayload* payload, const char* name, OCByteString* value) +bool OC_CALL OCRepPayloadSetPropByteStringAsOwner(OCRepPayload* payload, const char* name, OCByteString* value) { return OCRepPayloadSetProp(payload, name, value, OCREP_PROP_BYTE_STRING); } -bool OCRepPayloadGetPropByteString(const OCRepPayload* payload, const char* name, OCByteString* value) +bool OC_CALL OCRepPayloadGetPropByteString(const OCRepPayload* payload, const char* name, OCByteString* value) { OCRepPayloadValue* val = OCRepPayloadFindValue(payload, name); @@ -682,13 +682,13 @@ bool OCRepPayloadGetPropByteString(const OCRepPayload* payload, const char* name return true; } -bool OCRepPayloadSetPropBool(OCRepPayload* payload, +bool OC_CALL OCRepPayloadSetPropBool(OCRepPayload* payload, const char* name, bool value) { return OCRepPayloadSetProp(payload, name, &value, OCREP_PROP_BOOL); } -bool OCRepPayloadGetPropBool(const OCRepPayload* payload, const char* name, bool* value) +bool OC_CALL OCRepPayloadGetPropBool(const OCRepPayload* payload, const char* name, bool* value) { OCRepPayloadValue* val = OCRepPayloadFindValue(payload, name); @@ -719,8 +719,8 @@ static char *getStringFromEncodingType(OicEncodingType_t type) return OICStrdup(encoding); } -bool OCRepPayloadSetPropPubDataTypeAsOwner(OCRepPayload *payload, const char *name, - const OicSecKey_t *value) +bool OC_CALL OCRepPayloadSetPropPubDataTypeAsOwner(OCRepPayload *payload, const char *name, + const OicSecKey_t *value) { if (!payload || !name || !value) { @@ -772,8 +772,8 @@ bool OCRepPayloadSetPropPubDataTypeAsOwner(OCRepPayload *payload, const char *na return true; } -bool OCRepPayloadSetPropPubDataType(OCRepPayload *payload, const char *name, - const OicSecKey_t *value) +bool OC_CALL OCRepPayloadSetPropPubDataType(OCRepPayload *payload, const char *name, + const OicSecKey_t *value) { return OCRepPayloadSetPropPubDataTypeAsOwner(payload, name, value); } @@ -798,7 +798,7 @@ static OicEncodingType_t getEncodingTypeFromString(char *encoding) return type; } -bool OCRepPayloadGetPropPubDataType(const OCRepPayload *payload, const char *name, OicSecKey_t *value) +bool OC_CALL OCRepPayloadGetPropPubDataType(const OCRepPayload *payload, const char *name, OicSecKey_t *value) { OCRepPayload *heplerPayload = NULL; char *encoding = NULL; @@ -848,7 +848,7 @@ bool OCRepPayloadGetPropPubDataType(const OCRepPayload *payload, const char *nam } #endif -bool OCRepPayloadSetPropObject(OCRepPayload* payload, const char* name, const OCRepPayload* value) +bool OC_CALL OCRepPayloadSetPropObject(OCRepPayload* payload, const char* name, const OCRepPayload* value) { OCRepPayload* temp = OCRepPayloadClone(value); bool b = OCRepPayloadSetPropObjectAsOwner(payload, name, temp); @@ -860,12 +860,12 @@ bool OCRepPayloadSetPropObject(OCRepPayload* payload, const char* name, const OC return b; } -bool OCRepPayloadSetPropObjectAsOwner(OCRepPayload* payload, const char* name, OCRepPayload* value) +bool OC_CALL OCRepPayloadSetPropObjectAsOwner(OCRepPayload* payload, const char* name, OCRepPayload* value) { return OCRepPayloadSetProp(payload, name, value, OCREP_PROP_OBJECT); } -bool OCRepPayloadGetPropObject(const OCRepPayload* payload, const char* name, OCRepPayload** value) +bool OC_CALL OCRepPayloadGetPropObject(const OCRepPayload* payload, const char* name, OCRepPayload** value) { OCRepPayloadValue* val = OCRepPayloadFindValue(payload, name); @@ -878,7 +878,7 @@ bool OCRepPayloadGetPropObject(const OCRepPayload* payload, const char* name, OC return *value != NULL; } -size_t calcDimTotal(const size_t dimensions[MAX_REP_ARRAY_DEPTH]) +size_t OC_CALL calcDimTotal(const size_t dimensions[MAX_REP_ARRAY_DEPTH]) { if (dimensions[0] == 0) { @@ -894,7 +894,7 @@ size_t calcDimTotal(const size_t dimensions[MAX_REP_ARRAY_DEPTH]) } -bool OCRepPayloadSetByteStringArrayAsOwner(OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadSetByteStringArrayAsOwner(OCRepPayload* payload, const char* name, OCByteString* array, size_t dimensions[MAX_REP_ARRAY_DEPTH]) { OCRepPayloadValue* val = OCRepPayloadFindAndSetValue(payload, name, OCREP_PROP_ARRAY); @@ -911,7 +911,7 @@ bool OCRepPayloadSetByteStringArrayAsOwner(OCRepPayload* payload, const char* na return true; } -bool OCRepPayloadSetByteStringArray(OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadSetByteStringArray(OCRepPayload* payload, const char* name, const OCByteString* array, size_t dimensions[MAX_REP_ARRAY_DEPTH]) { if (!array) @@ -962,7 +962,7 @@ bool OCRepPayloadSetByteStringArray(OCRepPayload* payload, const char* name, return b; } -bool OCRepPayloadGetByteStringArray(const OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadGetByteStringArray(const OCRepPayload* payload, const char* name, OCByteString** array, size_t dimensions[MAX_REP_ARRAY_DEPTH]) { OCRepPayloadValue* val = OCRepPayloadFindValue(payload, name); @@ -1010,7 +1010,7 @@ bool OCRepPayloadGetByteStringArray(const OCRepPayload* payload, const char* nam } -bool OCRepPayloadSetIntArrayAsOwner(OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadSetIntArrayAsOwner(OCRepPayload* payload, const char* name, int64_t* array, size_t dimensions[MAX_REP_ARRAY_DEPTH]) { OCRepPayloadValue* val = OCRepPayloadFindAndSetValue(payload, name, OCREP_PROP_ARRAY); @@ -1027,7 +1027,7 @@ bool OCRepPayloadSetIntArrayAsOwner(OCRepPayload* payload, const char* name, return true; } -bool OCRepPayloadSetIntArray(OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadSetIntArray(OCRepPayload* payload, const char* name, const int64_t* array, size_t dimensions[MAX_REP_ARRAY_DEPTH]) { size_t dimTotal = calcDimTotal(dimensions); @@ -1054,7 +1054,7 @@ bool OCRepPayloadSetIntArray(OCRepPayload* payload, const char* name, return b; } -bool OCRepPayloadGetIntArray(const OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadGetIntArray(const OCRepPayload* payload, const char* name, int64_t** array, size_t dimensions[MAX_REP_ARRAY_DEPTH]) { OCRepPayloadValue* val = OCRepPayloadFindValue(payload, name); @@ -1081,7 +1081,7 @@ bool OCRepPayloadGetIntArray(const OCRepPayload* payload, const char* name, return true; } -bool OCRepPayloadSetDoubleArrayAsOwner(OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadSetDoubleArrayAsOwner(OCRepPayload* payload, const char* name, double* array, size_t dimensions[MAX_REP_ARRAY_DEPTH]) { OCRepPayloadValue* val = OCRepPayloadFindAndSetValue(payload, name, OCREP_PROP_ARRAY); @@ -1097,7 +1097,7 @@ bool OCRepPayloadSetDoubleArrayAsOwner(OCRepPayload* payload, const char* name, return true; } -bool OCRepPayloadSetDoubleArray(OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadSetDoubleArray(OCRepPayload* payload, const char* name, const double* array, size_t dimensions[MAX_REP_ARRAY_DEPTH]) { size_t dimTotal = calcDimTotal(dimensions); @@ -1123,7 +1123,7 @@ bool OCRepPayloadSetDoubleArray(OCRepPayload* payload, const char* name, return b; } -bool OCRepPayloadGetDoubleArray(const OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadGetDoubleArray(const OCRepPayload* payload, const char* name, double** array, size_t dimensions[MAX_REP_ARRAY_DEPTH]) { OCRepPayloadValue* val = OCRepPayloadFindValue(payload, name); @@ -1171,7 +1171,7 @@ bool OCRepPayloadGetDoubleArray(const OCRepPayload* payload, const char* name, return true; } -bool OCRepPayloadSetStringArrayAsOwner(OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadSetStringArrayAsOwner(OCRepPayload* payload, const char* name, char** array, size_t dimensions[MAX_REP_ARRAY_DEPTH]) { OCRepPayloadValue* val = OCRepPayloadFindAndSetValue(payload, name, OCREP_PROP_ARRAY); @@ -1187,7 +1187,7 @@ bool OCRepPayloadSetStringArrayAsOwner(OCRepPayload* payload, const char* name, return true; } -bool OCRepPayloadSetStringArray(OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadSetStringArray(OCRepPayload* payload, const char* name, const char** array, size_t dimensions[MAX_REP_ARRAY_DEPTH]) { size_t dimTotal = calcDimTotal(dimensions); @@ -1221,7 +1221,7 @@ bool OCRepPayloadSetStringArray(OCRepPayload* payload, const char* name, return b; } -bool OCRepPayloadGetStringArray(const OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadGetStringArray(const OCRepPayload* payload, const char* name, char*** array, size_t dimensions[MAX_REP_ARRAY_DEPTH]) { OCRepPayloadValue* val = OCRepPayloadFindValue(payload, name); @@ -1254,7 +1254,7 @@ bool OCRepPayloadGetStringArray(const OCRepPayload* payload, const char* name, } -bool OCRepPayloadSetBoolArrayAsOwner(OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadSetBoolArrayAsOwner(OCRepPayload* payload, const char* name, bool* array, size_t dimensions[MAX_REP_ARRAY_DEPTH]) { @@ -1271,7 +1271,7 @@ bool OCRepPayloadSetBoolArrayAsOwner(OCRepPayload* payload, const char* name, return true; } -bool OCRepPayloadSetBoolArray(OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadSetBoolArray(OCRepPayload* payload, const char* name, const bool* array, size_t dimensions[MAX_REP_ARRAY_DEPTH]) { size_t dimTotal = calcDimTotal(dimensions); @@ -1298,7 +1298,7 @@ bool OCRepPayloadSetBoolArray(OCRepPayload* payload, const char* name, return b; } -bool OCRepPayloadGetBoolArray(const OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadGetBoolArray(const OCRepPayload* payload, const char* name, bool** array, size_t dimensions[MAX_REP_ARRAY_DEPTH]) { OCRepPayloadValue* val = OCRepPayloadFindValue(payload, name); @@ -1325,7 +1325,7 @@ bool OCRepPayloadGetBoolArray(const OCRepPayload* payload, const char* name, return true; } -bool OCRepPayloadSetPropObjectArrayAsOwner(OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadSetPropObjectArrayAsOwner(OCRepPayload* payload, const char* name, OCRepPayload** array, size_t dimensions[MAX_REP_ARRAY_DEPTH]) { OCRepPayloadValue* val = OCRepPayloadFindAndSetValue(payload, name, OCREP_PROP_ARRAY); @@ -1342,7 +1342,7 @@ bool OCRepPayloadSetPropObjectArrayAsOwner(OCRepPayload* payload, const char* na return true; } -bool OCRepPayloadSetPropObjectArray(OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadSetPropObjectArray(OCRepPayload* payload, const char* name, const OCRepPayload** array, size_t dimensions[MAX_REP_ARRAY_DEPTH]) { size_t dimTotal = calcDimTotal(dimensions); @@ -1376,7 +1376,7 @@ bool OCRepPayloadSetPropObjectArray(OCRepPayload* payload, const char* name, return b; } -bool OCRepPayloadGetPropObjectArray(const OCRepPayload* payload, const char* name, +bool OC_CALL OCRepPayloadGetPropObjectArray(const OCRepPayload* payload, const char* name, OCRepPayload*** array, size_t dimensions[MAX_REP_ARRAY_DEPTH]) { OCRepPayloadValue* val = OCRepPayloadFindValue(payload, name); @@ -1408,7 +1408,7 @@ bool OCRepPayloadGetPropObjectArray(const OCRepPayload* payload, const char* nam return true; } -void OCFreeOCStringLL(OCStringLL* ll) +void OC_CALL OCFreeOCStringLL(OCStringLL* ll) { if (!ll) { @@ -1420,7 +1420,7 @@ void OCFreeOCStringLL(OCStringLL* ll) OICFree(ll); } -OCStringLL* CloneOCStringLL (OCStringLL* ll) +OCStringLL* OC_CALL CloneOCStringLL (OCStringLL* ll) { if (!ll) { @@ -1456,7 +1456,7 @@ OCStringLL* CloneOCStringLL (OCStringLL* ll) return headOfClone; } -OCStringLL* OCCreateOCStringLL(const char* text) +OCStringLL* OC_CALL OCCreateOCStringLL(const char* text) { char *token = NULL; char *head = NULL; @@ -1502,7 +1502,7 @@ exit: return NULL; } -char* OCCreateString(const OCStringLL* ll) +char* OC_CALL OCCreateString(const OCStringLL* ll) { if (!ll) { @@ -1552,7 +1552,7 @@ char* OCCreateString(const OCStringLL* ll) return str; } -bool OCByteStringCopy(OCByteString* dest, const OCByteString* source) +bool OC_CALL OCByteStringCopy(OCByteString* dest, const OCByteString* source) { VERIFY_PARAM_NON_NULL(TAG, source, "Bad input"); @@ -1582,7 +1582,7 @@ exit: return false; } -OCRepPayload* OCRepPayloadClone (const OCRepPayload* payload) +OCRepPayload* OC_CALL OCRepPayloadClone (const OCRepPayload* payload) { if (!payload) { @@ -1604,7 +1604,7 @@ OCRepPayload* OCRepPayloadClone (const OCRepPayload* payload) return clone; } -OCRepPayload* OCRepPayloadBatchClone(const OCRepPayload* repPayload) +OCRepPayload* OC_CALL OCRepPayloadBatchClone(const OCRepPayload* repPayload) { OCRepPayload *newPayload = OCRepPayloadCreate(); if (!newPayload) @@ -1628,7 +1628,7 @@ OCRepPayload* OCRepPayloadBatchClone(const OCRepPayload* repPayload) return newPayload; } -void OCRepPayloadDestroy(OCRepPayload* payload) +void OC_CALL OCRepPayloadDestroy(OCRepPayload* payload) { if (!payload) { @@ -1643,7 +1643,7 @@ void OCRepPayloadDestroy(OCRepPayload* payload) OICFree(payload); } -OCDiscoveryPayload* OCDiscoveryPayloadCreate() +OCDiscoveryPayload* OC_CALL OCDiscoveryPayloadCreate() { OCDiscoveryPayload* payload = (OCDiscoveryPayload*)OICCalloc(1, sizeof(OCDiscoveryPayload)); @@ -1657,7 +1657,7 @@ OCDiscoveryPayload* OCDiscoveryPayloadCreate() return payload; } -OCSecurityPayload* OCSecurityPayloadCreate(const uint8_t* securityData, size_t size) +OCSecurityPayload* OC_CALL OCSecurityPayloadCreate(const uint8_t* securityData, size_t size) { OCSecurityPayload* payload = (OCSecurityPayload*)OICCalloc(1, sizeof(OCSecurityPayload)); @@ -1679,7 +1679,7 @@ OCSecurityPayload* OCSecurityPayloadCreate(const uint8_t* securityData, size_t s return payload; } -void OCSecurityPayloadDestroy(OCSecurityPayload* payload) +void OC_CALL OCSecurityPayloadDestroy(OCSecurityPayload* payload) { if (!payload) { @@ -1691,7 +1691,7 @@ void OCSecurityPayloadDestroy(OCSecurityPayload* payload) OICFree(payload); } -OCIntrospectionPayload* OCIntrospectionPayloadCreateFromCbor(const uint8_t* cborData, +OCIntrospectionPayload* OC_CALL OCIntrospectionPayloadCreateFromCbor(const uint8_t* cborData, size_t size) { OCIntrospectionPayload* payload = NULL; @@ -1714,7 +1714,7 @@ OCIntrospectionPayload* OCIntrospectionPayloadCreateFromCbor(const uint8_t* cbor return payload; } -void OCIntrospectionPayloadDestroy(OCIntrospectionPayload* payload) +void OC_CALL OCIntrospectionPayloadDestroy(OCIntrospectionPayload* payload) { if (!payload) { @@ -1725,7 +1725,7 @@ void OCIntrospectionPayloadDestroy(OCIntrospectionPayload* payload) OICFree(payload); } -size_t OCDiscoveryPayloadGetResourceCount(OCDiscoveryPayload* payload) +size_t OC_CALL OCDiscoveryPayloadGetResourceCount(OCDiscoveryPayload* payload) { size_t i = 0; OCResourcePayload* p = payload->resources; @@ -1737,7 +1737,7 @@ size_t OCDiscoveryPayloadGetResourceCount(OCDiscoveryPayload* payload) return i; } -OCResourcePayload* OCDiscoveryPayloadGetResource(OCDiscoveryPayload* payload, size_t index) +OCResourcePayload* OC_CALL OCDiscoveryPayloadGetResource(OCDiscoveryPayload* payload, size_t index) { size_t i = 0; OCResourcePayload* p = payload->resources; @@ -1753,7 +1753,7 @@ OCResourcePayload* OCDiscoveryPayloadGetResource(OCDiscoveryPayload* payload, si return NULL; } -size_t OCEndpointPayloadGetEndpointCount(OCEndpointPayload* payload) +size_t OC_CALL OCEndpointPayloadGetEndpointCount(OCEndpointPayload* payload) { size_t i = 0; OCEndpointPayload* ep = payload; @@ -1765,7 +1765,7 @@ size_t OCEndpointPayloadGetEndpointCount(OCEndpointPayload* payload) return i; } -OCEndpointPayload* OCEndpointPayloadGetEndpoint(OCEndpointPayload* payload, size_t index) +OCEndpointPayload* OC_CALL OCEndpointPayloadGetEndpoint(OCEndpointPayload* payload, size_t index) { size_t i = 0; OCEndpointPayload* ep = payload; @@ -1781,7 +1781,7 @@ OCEndpointPayload* OCEndpointPayloadGetEndpoint(OCEndpointPayload* payload, size return NULL; } -void OCResourcePayloadAddNewEndpoint(OCResourcePayload* payload, OCEndpointPayload* endpoint) +void OC_CALL OCResourcePayloadAddNewEndpoint(OCResourcePayload* payload, OCEndpointPayload* endpoint) { if (!payload) { @@ -2025,14 +2025,14 @@ static OCResourcePayload* OCCopyResource(const OCResource* res, uint16_t secureP } #ifndef TCP_ADAPTER -void OCDiscoveryPayloadAddResource(OCDiscoveryPayload* payload, const OCResource* res, - uint16_t securePort) +void OC_CALL OCDiscoveryPayloadAddResource(OCDiscoveryPayload* payload, const OCResource* res, + uint16_t securePort) { OCDiscoveryPayloadAddNewResource(payload, OCCopyResource(res, securePort, NULL, 0, NULL)); } #else -void OCDiscoveryPayloadAddResource(OCDiscoveryPayload* payload, const OCResource* res, - uint16_t securePort, uint16_t tcpPort) +void OC_CALL OCDiscoveryPayloadAddResource(OCDiscoveryPayload* payload, const OCResource* res, + uint16_t securePort, uint16_t tcpPort) { OCDiscoveryPayloadAddNewResource(payload, OCCopyResource(res, securePort, NULL, 0, NULL, tcpPort)); @@ -2041,8 +2041,8 @@ void OCDiscoveryPayloadAddResource(OCDiscoveryPayload* payload, const OCResource #ifndef TCP_ADAPTER void OCDiscoveryPayloadAddResourceWithEps(OCDiscoveryPayload* payload, const OCResource* res, - uint16_t securePort, void *networkInfo, size_t infoSize, - const OCDevAddr *devAddr) + uint16_t securePort, void *networkInfo, size_t infoSize, + const OCDevAddr *devAddr) { OCDiscoveryPayloadAddNewResource(payload, OCCopyResource(res, securePort, (CAEndpoint_t *)networkInfo, @@ -2050,8 +2050,8 @@ void OCDiscoveryPayloadAddResourceWithEps(OCDiscoveryPayload* payload, const OCR } #else void OCDiscoveryPayloadAddResourceWithEps(OCDiscoveryPayload* payload, const OCResource* res, - uint16_t securePort, void *networkInfo, size_t infoSize, - const OCDevAddr *devAddr, uint16_t tcpPort) + uint16_t securePort, void *networkInfo, size_t infoSize, + const OCDevAddr *devAddr, uint16_t tcpPort) { OCDiscoveryPayloadAddNewResource(payload, OCCopyResource(res, securePort, (CAEndpoint_t *)networkInfo, @@ -2059,7 +2059,7 @@ void OCDiscoveryPayloadAddResourceWithEps(OCDiscoveryPayload* payload, const OCR } #endif -bool OCResourcePayloadAddStringLL(OCStringLL **stringLL, const char *value) +bool OC_CALL OCResourcePayloadAddStringLL(OCStringLL **stringLL, const char *value) { char *dup = NULL; VERIFY_PARAM_NON_NULL(TAG, value, "Invalid Parameters"); @@ -2090,7 +2090,7 @@ exit: return false; } -void OCDiscoveryPayloadAddNewResource(OCDiscoveryPayload* payload, OCResourcePayload* res) +void OC_CALL OCDiscoveryPayloadAddNewResource(OCDiscoveryPayload* payload, OCResourcePayload* res) { if (!payload) { @@ -2112,7 +2112,7 @@ void OCDiscoveryPayloadAddNewResource(OCDiscoveryPayload* payload, OCResourcePay } } -void OCDiscoveryEndpointDestroy(OCEndpointPayload* payload) +void OC_CALL OCDiscoveryEndpointDestroy(OCEndpointPayload* payload) { if (!payload) { @@ -2125,7 +2125,7 @@ void OCDiscoveryEndpointDestroy(OCEndpointPayload* payload) OICFree(payload); } -void OCDiscoveryResourceDestroy(OCResourcePayload* payload) +void OC_CALL OCDiscoveryResourceDestroy(OCResourcePayload* payload) { if (!payload) { @@ -2142,7 +2142,7 @@ void OCDiscoveryResourceDestroy(OCResourcePayload* payload) OICFree(payload); } -void OCDiscoveryPayloadDestroy(OCDiscoveryPayload* payload) +void OC_CALL OCDiscoveryPayloadDestroy(OCDiscoveryPayload* payload) { if (!payload) { @@ -2157,7 +2157,7 @@ void OCDiscoveryPayloadDestroy(OCDiscoveryPayload* payload) OICFree(payload); } -OCPresencePayload* OCPresencePayloadCreate(uint32_t seqNum, uint32_t maxAge, +OCPresencePayload* OC_CALL OCPresencePayloadCreate(uint32_t seqNum, uint32_t maxAge, OCPresenceTrigger trigger, const char* resourceType) { OCPresencePayload* payload = (OCPresencePayload*)OICCalloc(1, sizeof(OCPresencePayload)); @@ -2174,7 +2174,7 @@ OCPresencePayload* OCPresencePayloadCreate(uint32_t seqNum, uint32_t maxAge, return payload; } -void OCPresencePayloadDestroy(OCPresencePayload* payload) +void OC_CALL OCPresencePayloadDestroy(OCPresencePayload* payload) { if (!payload) { @@ -2184,7 +2184,7 @@ void OCPresencePayloadDestroy(OCPresencePayload* payload) OICFree(payload); } -OCDiagnosticPayload* OCDiagnosticPayloadCreate(const char* message) +OCDiagnosticPayload* OC_CALL OCDiagnosticPayloadCreate(const char* message) { if (!message) { @@ -2202,7 +2202,7 @@ OCDiagnosticPayload* OCDiagnosticPayloadCreate(const char* message) return payload; } -void OCDiagnosticPayloadDestroy(OCDiagnosticPayload* payload) +void OC_CALL OCDiagnosticPayloadDestroy(OCDiagnosticPayload* payload) { if (!payload) { @@ -2212,7 +2212,7 @@ void OCDiagnosticPayloadDestroy(OCDiagnosticPayload* payload) OICFree(payload); } -OCStackResult OCLinksPayloadValueCreate(const char* resourceUri, OCRepPayloadValue** linksRepPayloadValue, +OCStackResult OC_CALL OCLinksPayloadValueCreate(const char* resourceUri, OCRepPayloadValue** linksRepPayloadValue, OCDevAddr* devAddr) { OIC_LOG(DEBUG, TAG, "OCLinksPayloadValueCreate"); diff --git a/resource/csdk/stack/src/ocresource.c b/resource/csdk/stack/src/ocresource.c index a338eae..7338d02 100755 --- a/resource/csdk/stack/src/ocresource.c +++ b/resource/csdk/stack/src/ocresource.c @@ -1297,7 +1297,7 @@ OCStackResult BuildVirtualResourceResponse(const OCResource *resourcePtr, return OC_STACK_OK; } -OCResource *FindResourceByUri(const char* resourceUri) +OCResource *OC_CALL FindResourceByUri(const char* resourceUri) { if(!resourceUri) { @@ -2251,7 +2251,7 @@ ProcessRequest(ResourceHandling resHandling, OCResource *resource, OCServerReque return ret; } -OCStackResult OCSetPlatformInfo(OCPlatformInfo info) +OCStackResult OC_CALL OCSetPlatformInfo(OCPlatformInfo info) { OCResource *resource = NULL; if (!info.platformID || !info.manufacturerName) @@ -2314,7 +2314,7 @@ exit: return OC_STACK_INVALID_PARAM; } -OCStackResult OCSetDeviceInfo(OCDeviceInfo info) +OCStackResult OC_CALL OCSetDeviceInfo(OCDeviceInfo info) { OCResource *resource = FindResourceByUri(OC_RSRVD_DEVICE_URI); if (!resource) @@ -2365,7 +2365,7 @@ exit: return OC_STACK_ERROR; } -OCStackResult OCGetAttribute(const OCResource *resource, const char *attribute, void **value) +OCStackResult OC_CALL OCGetAttribute(const OCResource *resource, const char *attribute, void **value) { if (!resource || !attribute) { @@ -2423,7 +2423,7 @@ OCStackResult OCGetAttribute(const OCResource *resource, const char *attribute, return OC_STACK_NO_RESOURCE; } -OCStackResult OCGetPropertyValue(OCPayloadType type, const char *prop, void **value) +OCStackResult OC_CALL OCGetPropertyValue(OCPayloadType type, const char *prop, void **value) { if (!prop) { @@ -2588,7 +2588,7 @@ static OCStackResult IsDatabaseUpdateNeeded(const char *attribute, const void *v return result; } -OCStackResult OCSetAttribute(OCResource *resource, const char *attribute, const void *value) +OCStackResult OC_CALL OCSetAttribute(OCResource *resource, const char *attribute, const void *value) { bool updateDatabase = false; @@ -2606,7 +2606,7 @@ OCStackResult OCSetAttribute(OCResource *resource, const char *attribute, const return SetAttributeInternal(resource, attribute, value, updateDatabase); } -OCStackResult OCSetPropertyValue(OCPayloadType type, const char *prop, const void *value) +OCStackResult OC_CALL OCSetPropertyValue(OCPayloadType type, const char *prop, const void *value) { if (!prop || !value) { diff --git a/resource/csdk/stack/src/ocstack.c b/resource/csdk/stack/src/ocstack.c index 984158d..a003c25 100755 --- a/resource/csdk/stack/src/ocstack.c +++ b/resource/csdk/stack/src/ocstack.c @@ -1014,7 +1014,7 @@ static OCStackResult ResetPresenceTTL(ClientCB *cbNode, uint32_t maxAgeSeconds) return OC_STACK_OK; } -const char *convertTriggerEnumToString(OCPresenceTrigger trigger) +const char *OC_CALL convertTriggerEnumToString(OCPresenceTrigger trigger) { if (trigger == OC_PRESENCE_TRIGGER_CREATE) { @@ -1030,7 +1030,7 @@ const char *convertTriggerEnumToString(OCPresenceTrigger trigger) } } -OCPresenceTrigger convertTriggerStringToEnum(const char * triggerStr) +OCPresenceTrigger OC_CALL convertTriggerStringToEnum(const char * triggerStr) { if(!triggerStr) { @@ -1050,9 +1050,9 @@ OCPresenceTrigger convertTriggerStringToEnum(const char * triggerStr) } } -OCStackResult OCEncodeAddressForRFC6874(char *outputAddress, - size_t outputSize, - const char *inputAddress) +OCStackResult OC_CALL OCEncodeAddressForRFC6874(char *outputAddress, + size_t outputSize, + const char *inputAddress) { VERIFY_NON_NULL(inputAddress, FATAL, OC_STACK_INVALID_PARAM); VERIFY_NON_NULL(outputAddress, FATAL, OC_STACK_INVALID_PARAM); @@ -1119,10 +1119,10 @@ OCStackResult OCEncodeAddressForRFC6874(char *outputAddress, return OC_STACK_OK; } -OCStackResult OCDecodeAddressForRFC6874(char *outputAddress, - size_t outputSize, - const char *inputAddress, - const char *end) +OCStackResult OC_CALL OCDecodeAddressForRFC6874(char *outputAddress, + size_t outputSize, + const char *inputAddress, + const char *end) { VERIFY_NON_NULL(inputAddress, FATAL, OC_STACK_INVALID_PARAM); VERIFY_NON_NULL(outputAddress, FATAL, OC_STACK_INVALID_PARAM); @@ -1490,7 +1490,7 @@ OCStackResult OCMapZoneIdToLinkLocalEndpoint(OCDiscoveryPayload *payload, uint32 } #endif -void OCHandleResponse(const CAEndpoint_t* endPoint, const CAResponseInfo_t* responseInfo) +void OC_CALL OCHandleResponse(const CAEndpoint_t* endPoint, const CAResponseInfo_t* responseInfo) { OIC_LOG(DEBUG, TAG, "Enter OCHandleResponse"); OIC_TRACE_MARK(%s:OCHandleResponse:%s, TAG, responseInfo->info.resourceUri); @@ -2632,7 +2632,7 @@ void HandleCARequests(const CAEndpoint_t* endPoint, const CARequestInfo_t* reque // Public APIs //----------------------------------------------------------------------------- #ifdef RA_ADAPTER -OCStackResult OCSetRAInfo(const OCRAInfo_t *raInfo) +OCStackResult OC_CALL OCSetRAInfo(const OCRAInfo_t *raInfo) { if (!raInfo || !raInfo->username || @@ -2649,21 +2649,21 @@ OCStackResult OCSetRAInfo(const OCRAInfo_t *raInfo) } #endif -OCStackResult OCInit(const char *ipAddr, uint16_t port, OCMode mode) +OCStackResult OC_CALL OCInit(const char *ipAddr, uint16_t port, OCMode mode) { (void) ipAddr; (void) port; return OCInit1(mode, OC_DEFAULT_FLAGS, OC_DEFAULT_FLAGS); } -OCStackResult OCInit1(OCMode mode, OCTransportFlags serverFlags, OCTransportFlags clientFlags) +OCStackResult OC_CALL OCInit1(OCMode mode, OCTransportFlags serverFlags, OCTransportFlags clientFlags) { OIC_LOG(DEBUG, TAG, "call OCInit1"); return OCInit2(mode, serverFlags, clientFlags, OC_DEFAULT_ADAPTER); } -OCStackResult OCInit2(OCMode mode, OCTransportFlags serverFlags, OCTransportFlags clientFlags, - OCTransportAdapter transportType) +OCStackResult OC_CALL OCInit2(OCMode mode, OCTransportFlags serverFlags, OCTransportFlags clientFlags, + OCTransportAdapter transportType) { OIC_LOG(INFO, TAG, "Entering OCInit2"); @@ -2847,7 +2847,7 @@ exit: return result; } -OCStackResult OCStop() +OCStackResult OC_CALL OCStop() { OIC_LOG(INFO, TAG, "Entering OCStop"); @@ -2930,7 +2930,7 @@ OCStackResult OCDeInitializeInternal() return OC_STACK_OK; } -OCStackResult OCStartMulticastServer() +OCStackResult OC_CALL OCStartMulticastServer() { if(stackState != OC_STACK_INITIALIZED) { @@ -2941,7 +2941,7 @@ OCStackResult OCStartMulticastServer() return OC_STACK_OK; } -OCStackResult OCStopMulticastServer() +OCStackResult OC_CALL OCStopMulticastServer() { g_multicastServerStopped = true; return OC_STACK_OK; @@ -3213,16 +3213,16 @@ static OCStackResult OCPreparePresence(CAEndpoint_t *endpoint, * Discover or Perform requests on a specified resource * Deprecated: use OCDoRequest instead */ -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 OC_CALL OCDoResource(OCDoHandle *handle, + OCMethod method, + const char *requestUri, + const OCDevAddr *destination, + OCPayload* payload, + OCConnectivityType connectivityType, + OCQualityOfService qos, + OCCallbackData *cbData, + OCHeaderOption *options, + uint8_t numOptions) { OIC_TRACE_BEGIN(%s:OCDoRequest, TAG); OCStackResult ret = OCDoRequest(handle, method, requestUri,destination, payload, @@ -3254,16 +3254,16 @@ static void assertRolesCB(void* ctx, bool hasError) /** * Discover or Perform requests on a specified resource */ -OCStackResult OCDoRequest(OCDoHandle *handle, - OCMethod method, - const char *requestUri, - const OCDevAddr *destination, - OCPayload* payload, - OCConnectivityType connectivityType, - OCQualityOfService qos, - OCCallbackData *cbData, - OCHeaderOption *options, - uint8_t numOptions) +OCStackResult OC_CALL OCDoRequest(OCDoHandle *handle, + OCMethod method, + const char *requestUri, + const OCDevAddr *destination, + OCPayload* payload, + OCConnectivityType connectivityType, + OCQualityOfService qos, + OCCallbackData *cbData, + OCHeaderOption *options, + uint8_t numOptions) { OIC_LOG(INFO, TAG, "Entering OCDoResource"); @@ -3702,7 +3702,7 @@ exit: return result; } -OCStackResult OCCancel(OCDoHandle handle, OCQualityOfService qos, OCHeaderOption * options, +OCStackResult OC_CALL OCCancel(OCDoHandle handle, OCQualityOfService qos, OCHeaderOption * options, uint8_t numOptions) { /* @@ -3808,7 +3808,7 @@ OCStackResult OCCancel(OCDoHandle handle, OCQualityOfService qos, OCHeaderOption * OC_STACK_OK - No errors; Success * OC_STACK_INVALID_PARAM - Invalid parameter */ -OCStackResult OCRegisterPersistentStorageHandler(OCPersistentStorage* persistentStorageHandler) +OCStackResult OC_CALL OCRegisterPersistentStorageHandler(OCPersistentStorage* persistentStorageHandler) { OIC_LOG(INFO, TAG, "RegisterPersistentStorageHandler !!"); if(persistentStorageHandler) @@ -3827,7 +3827,7 @@ OCStackResult OCRegisterPersistentStorageHandler(OCPersistentStorage* persistent return OC_STACK_OK; } -OCPersistentStorage *OCGetPersistentStorageHandler() +OCPersistentStorage *OC_CALL OCGetPersistentStorageHandler() { return g_PersistentStorageHandler; } @@ -3930,7 +3930,7 @@ exit: } #endif // WITH_PRESENCE -OCStackResult OCProcess() +OCStackResult OC_CALL OCProcess() { if (stackState == OC_STACK_UNINITIALIZED) { @@ -3953,7 +3953,7 @@ OCStackResult OCProcess() } #ifdef WITH_PRESENCE -OCStackResult OCStartPresence(const uint32_t ttl) +OCStackResult OC_CALL OCStartPresence(const uint32_t ttl) { OIC_LOG(INFO, TAG, "Entering OCStartPresence"); uint8_t tokenLength = CA_MAX_TOKEN_LEN; @@ -4006,7 +4006,7 @@ OCStackResult OCStartPresence(const uint32_t ttl) OC_PRESENCE_TRIGGER_CREATE); } -OCStackResult OCStopPresence() +OCStackResult OC_CALL OCStopPresence() { OIC_LOG(INFO, TAG, "Entering OCStopPresence"); OCStackResult result = OC_STACK_ERROR; @@ -4032,8 +4032,8 @@ OCStackResult OCStopPresence() } #endif -OCStackResult OCSetDefaultDeviceEntityHandler(OCDeviceEntityHandler entityHandler, - void* callbackParameter) +OCStackResult OC_CALL OCSetDefaultDeviceEntityHandler(OCDeviceEntityHandler entityHandler, + void* callbackParameter) { defaultDeviceHandler = entityHandler; defaultDeviceHandlerCallbackParameter = callbackParameter; @@ -4041,12 +4041,12 @@ OCStackResult OCSetDefaultDeviceEntityHandler(OCDeviceEntityHandler entityHandle return OC_STACK_OK; } -OCTpsSchemeFlags OCGetSupportedEndpointTpsFlags() +OCTpsSchemeFlags OC_CALL OCGetSupportedEndpointTpsFlags() { return OCGetSupportedTpsFlags(); } -OCStackResult OCCreateResource(OCResourceHandle *handle, +OCStackResult OC_CALL OCCreateResource(OCResourceHandle *handle, const char *resourceTypeName, const char *resourceInterfaceName, const char *uri, OCEntityHandler entityHandler, @@ -4062,7 +4062,7 @@ OCStackResult OCCreateResource(OCResourceHandle *handle, OC_ALL); } -OCStackResult OCCreateResourceWithEp(OCResourceHandle *handle, +OCStackResult OC_CALL OCCreateResourceWithEp(OCResourceHandle *handle, const char *resourceTypeName, const char *resourceInterfaceName, const char *uri, OCEntityHandler entityHandler, @@ -4249,7 +4249,7 @@ exit: return result; } -OCStackResult OCBindResource( +OCStackResult OC_CALL OCBindResource( OCResourceHandle collectionHandle, OCResourceHandle resourceHandle) { OCResource *resource = NULL; @@ -4320,7 +4320,7 @@ OCStackResult OCBindResource( return OC_STACK_OK; } -OCStackResult OCUnBindResource( +OCStackResult OC_CALL OCUnBindResource( OCResourceHandle collectionHandle, OCResourceHandle resourceHandle) { OCResource *resource = NULL; @@ -4576,7 +4576,7 @@ OCStackResult BindTpsTypeToResource(OCResource* resource, return result; } -OCStackResult OCBindResourceTypeToResource(OCResourceHandle handle, +OCStackResult OC_CALL OCBindResourceTypeToResource(OCResourceHandle handle, const char *resourceTypeName) { @@ -4603,7 +4603,7 @@ OCStackResult OCBindResourceTypeToResource(OCResourceHandle handle, return result; } -OCStackResult OCBindResourceInterfaceToResource(OCResourceHandle handle, +OCStackResult OC_CALL OCBindResourceInterfaceToResource(OCResourceHandle handle, const char *resourceInterfaceName) { @@ -4630,7 +4630,7 @@ OCStackResult OCBindResourceInterfaceToResource(OCResourceHandle handle, return result; } -OCStackResult OCGetNumberOfResources(uint8_t *numResources) +OCStackResult OC_CALL OCGetNumberOfResources(uint8_t *numResources) { OCResource *pointer = headResource; @@ -4644,7 +4644,7 @@ OCStackResult OCGetNumberOfResources(uint8_t *numResources) return OC_STACK_OK; } -OCResourceHandle OCGetResourceHandle(uint8_t index) +OCResourceHandle OC_CALL OCGetResourceHandle(uint8_t index) { OCResource *pointer = headResource; @@ -4655,7 +4655,7 @@ OCResourceHandle OCGetResourceHandle(uint8_t index) return (OCResourceHandle) pointer; } -OCStackResult OCDeleteResource(OCResourceHandle handle) +OCStackResult OC_CALL OCDeleteResource(OCResourceHandle handle) { if (!handle) { @@ -4679,7 +4679,7 @@ OCStackResult OCDeleteResource(OCResourceHandle handle) return OC_STACK_OK; } -const char *OCGetResourceUri(OCResourceHandle handle) +const char *OC_CALL OCGetResourceUri(OCResourceHandle handle) { OCResource *resource = NULL; @@ -4691,7 +4691,7 @@ const char *OCGetResourceUri(OCResourceHandle handle) return (const char *) NULL; } -OCResourceProperty OCGetResourceProperties(OCResourceHandle handle) +OCResourceProperty OC_CALL OCGetResourceProperties(OCResourceHandle handle) { OCResource *resource = NULL; @@ -4703,7 +4703,7 @@ OCResourceProperty OCGetResourceProperties(OCResourceHandle handle) return (OCResourceProperty)-1; } -OCStackResult OCSetResourceProperties(OCResourceHandle handle, uint8_t resourceProperties) +OCStackResult OC_CALL OCSetResourceProperties(OCResourceHandle handle, uint8_t resourceProperties) { OCResource *resource = NULL; @@ -4717,7 +4717,7 @@ OCStackResult OCSetResourceProperties(OCResourceHandle handle, uint8_t resourceP return OC_STACK_OK; } -OCStackResult OCClearResourceProperties(OCResourceHandle handle, uint8_t resourceProperties) +OCStackResult OC_CALL OCClearResourceProperties(OCResourceHandle handle, uint8_t resourceProperties) { OCResource *resource = NULL; @@ -4731,7 +4731,7 @@ OCStackResult OCClearResourceProperties(OCResourceHandle handle, uint8_t resourc return OC_STACK_OK; } -OCStackResult OCGetNumberOfResourceTypes(OCResourceHandle handle, +OCStackResult OC_CALL OCGetNumberOfResourceTypes(OCResourceHandle handle, uint8_t *numResourceTypes) { OCResource *resource = NULL; @@ -4755,7 +4755,7 @@ OCStackResult OCGetNumberOfResourceTypes(OCResourceHandle handle, return OC_STACK_OK; } -const char *OCGetResourceTypeName(OCResourceHandle handle, uint8_t index) +const char *OC_CALL OCGetResourceTypeName(OCResourceHandle handle, uint8_t index) { OCResourceType *resourceType = NULL; @@ -4767,7 +4767,7 @@ const char *OCGetResourceTypeName(OCResourceHandle handle, uint8_t index) return (const char *) NULL; } -OCStackResult OCGetNumberOfResourceInterfaces(OCResourceHandle handle, +OCStackResult OC_CALL OCGetNumberOfResourceInterfaces(OCResourceHandle handle, uint8_t *numResourceInterfaces) { OCResourceInterface *pointer = NULL; @@ -4790,7 +4790,7 @@ OCStackResult OCGetNumberOfResourceInterfaces(OCResourceHandle handle, return OC_STACK_OK; } -const char *OCGetResourceInterfaceName(OCResourceHandle handle, uint8_t index) +const char *OC_CALL OCGetResourceInterfaceName(OCResourceHandle handle, uint8_t index) { OCResourceInterface *resourceInterface = NULL; @@ -4802,7 +4802,7 @@ const char *OCGetResourceInterfaceName(OCResourceHandle handle, uint8_t index) return (const char *) NULL; } -OCResourceHandle OCGetResourceHandleFromCollection(OCResourceHandle collectionHandle, +OCResourceHandle OC_CALL OCGetResourceHandleFromCollection(OCResourceHandle collectionHandle, uint8_t index) { OCResource *resource = NULL; @@ -4832,7 +4832,7 @@ OCResourceHandle OCGetResourceHandleFromCollection(OCResourceHandle collectionHa return NULL; } -OCStackResult OCBindResourceHandler(OCResourceHandle handle, +OCStackResult OC_CALL OCBindResourceHandler(OCResourceHandle handle, OCEntityHandler entityHandler, void* callbackParam) { @@ -4864,7 +4864,7 @@ OCStackResult OCBindResourceHandler(OCResourceHandle handle, return OC_STACK_OK; } -OCEntityHandler OCGetResourceHandler(OCResourceHandle handle) +OCEntityHandler OC_CALL OCGetResourceHandler(OCResourceHandle handle) { OCResource *resource = NULL; @@ -4936,7 +4936,7 @@ OCStackResult SendStopNotification() } #endif // WITH_PRESENCE -OCStackResult OCNotifyAllObservers(OCResourceHandle handle, OCQualityOfService qos) +OCStackResult OC_CALL OCNotifyAllObservers(OCResourceHandle handle, OCQualityOfService qos) { OCResource *resPtr = NULL; OCStackResult result = OC_STACK_ERROR; @@ -4975,11 +4975,11 @@ OCStackResult OCNotifyAllObservers(OCResourceHandle handle, OCQualityOfService q } OCStackResult -OCNotifyListOfObservers (OCResourceHandle handle, - OCObservationId *obsIdList, - uint8_t numberOfIds, - const OCRepPayload *payload, - OCQualityOfService qos) +OC_CALL OCNotifyListOfObservers (OCResourceHandle handle, + OCObservationId *obsIdList, + uint8_t numberOfIds, + const OCRepPayload *payload, + OCQualityOfService qos) { OIC_LOG(INFO, TAG, "Entering OCNotifyListOfObservers"); @@ -5004,7 +5004,7 @@ OCNotifyListOfObservers (OCResourceHandle handle, payload, maxAge, qos)); } -OCStackResult OCDoResponse(OCEntityHandlerResponse *ehResponse) +OCStackResult OC_CALL OCDoResponse(OCEntityHandlerResponse *ehResponse) { OIC_TRACE_BEGIN(%s:OCDoResponse, TAG); OCStackResult result = OC_STACK_ERROR; @@ -5030,7 +5030,7 @@ OCStackResult OCDoResponse(OCEntityHandlerResponse *ehResponse) } //#ifdef DIRECT_PAIRING -const OCDPDev_t* OCDiscoverDirectPairingDevices(unsigned short waittime) +const OCDPDev_t* OC_CALL OCDiscoverDirectPairingDevices(unsigned short waittime) { OIC_LOG(INFO, TAG, "Start OCDiscoverDirectPairingDevices"); if(OC_STACK_OK != DPDeviceDiscovery(waittime)) @@ -5042,13 +5042,13 @@ const OCDPDev_t* OCDiscoverDirectPairingDevices(unsigned short waittime) return (const OCDPDev_t*)DPGetDiscoveredDevices(); } -const OCDPDev_t* OCGetDirectPairedDevices() +const OCDPDev_t* OC_CALL OCGetDirectPairedDevices() { return (const OCDPDev_t*)DPGetPairedDevices(); } -OCStackResult OCDoDirectPairing(void *ctx, OCDPDev_t* peer, OCPrm_t pmSel, char *pinNumber, - OCDirectPairingCB resultCallback) +OCStackResult OC_CALL OCDoDirectPairing(void *ctx, OCDPDev_t* peer, OCPrm_t pmSel, char *pinNumber, + OCDirectPairingCB resultCallback) { OIC_LOG(INFO, TAG, "Start OCDoDirectPairing"); if(NULL == peer || NULL == pinNumber) @@ -5730,7 +5730,7 @@ OCStackResult getQueryFromUri(const char * uri, char** query, char ** uriWithout return OC_STACK_NO_MEMORY; } -static const OicUuid_t* OCGetServerInstanceID(void) +static const OicUuid_t* OC_CALL OCGetServerInstanceID(void) { static bool generated = false; static OicUuid_t sid; @@ -5748,7 +5748,7 @@ static const OicUuid_t* OCGetServerInstanceID(void) return &sid; } -const char* OCGetServerInstanceIDString(void) +const char* OC_CALL OCGetServerInstanceIDString(void) { static bool generated = false; static char sidStr[UUID_STRING_SIZE]; @@ -5872,13 +5872,13 @@ bool OCResultToSuccess(OCStackResult ocResult) } } -OCStackResult OCSetProxyURI(const char *uri) +OCStackResult OC_CALL OCSetProxyURI(const char *uri) { return CAResultToOCResult(CASetProxyUri(uri)); } #if defined(RD_CLIENT) || defined(RD_SERVER) -OCStackResult OCBindResourceInsToResource(OCResourceHandle handle, int64_t ins) +OCStackResult OC_CALL OCBindResourceInsToResource(OCResourceHandle handle, int64_t ins) { VERIFY_NON_NULL(handle, ERROR, OC_STACK_INVALID_PARAM); @@ -5897,7 +5897,7 @@ OCStackResult OCBindResourceInsToResource(OCResourceHandle handle, int64_t ins) } OCStackResult OCUpdateResourceInsWithResponse(const char *requestUri, - const OCClientResponse *response) + const OCClientResponse *response) { // Validate input parameters VERIFY_NON_NULL(requestUri, ERROR, OC_STACK_INVALID_PARAM); @@ -6021,7 +6021,7 @@ OCStackResult OCUpdateResourceInsWithResponse(const char *requestUri, return OC_STACK_OK; } -OCStackResult OCGetResourceIns(OCResourceHandle handle, int64_t* ins) +OCStackResult OC_CALL OCGetResourceIns(OCResourceHandle handle, int64_t* ins) { OCResource *resource = NULL; @@ -6038,7 +6038,7 @@ OCStackResult OCGetResourceIns(OCResourceHandle handle, int64_t* ins) } #endif // RD_CLIENT || RD_SERVER -OCResourceHandle OCGetResourceHandleAtUri(const char *uri) +OCResourceHandle OC_CALL OCGetResourceHandleAtUri(const char *uri) { if (!uri) { @@ -6085,8 +6085,8 @@ static OCStackResult SetHeaderOption(CAHeaderOption_t *caHdrOpt, size_t numOptio return OC_STACK_OK; } -OCStackResult OCSetHeaderOption(OCHeaderOption* ocHdrOpt, size_t* numOptions, uint16_t optionID, - void* optionData, size_t optionDataLength) +OCStackResult OC_CALL OCSetHeaderOption(OCHeaderOption* ocHdrOpt, size_t* numOptions, uint16_t optionID, + void* optionData, size_t optionDataLength) { if (!ocHdrOpt) { @@ -6124,9 +6124,9 @@ OCStackResult OCSetHeaderOption(OCHeaderOption* ocHdrOpt, size_t* numOptions, ui return OC_STACK_OK; } -OCStackResult OCGetHeaderOption(OCHeaderOption* ocHdrOpt, size_t numOptions, - uint16_t optionID, void* optionData, size_t optionDataLength, - uint16_t* receivedDataLength) +OCStackResult OC_CALL OCGetHeaderOption(OCHeaderOption* ocHdrOpt, size_t numOptions, + uint16_t optionID, void* optionData, size_t optionDataLength, + uint16_t* receivedDataLength) { if (!ocHdrOpt || !numOptions) { @@ -6199,7 +6199,7 @@ void OCDefaultConnectionStateChangedHandler(const CAEndpoint_t *info, bool isCon } } -OCStackResult OCGetDeviceId(OCUUIdentity *deviceId) +OCStackResult OC_CALL OCGetDeviceId(OCUUIdentity *deviceId) { OicUuid_t oicUuid; OCStackResult ret = OC_STACK_ERROR; @@ -6216,7 +6216,7 @@ OCStackResult OCGetDeviceId(OCUUIdentity *deviceId) return ret; } -OCStackResult OCSetDeviceId(const OCUUIdentity *deviceId) +OCStackResult OC_CALL OCSetDeviceId(const OCUUIdentity *deviceId) { OicUuid_t oicUuid; OCStackResult ret = OC_STACK_ERROR; @@ -6230,7 +6230,7 @@ OCStackResult OCSetDeviceId(const OCUUIdentity *deviceId) return ret; } -OCStackResult OCGetDeviceOwnedState(bool *isOwned) +OCStackResult OC_CALL OCGetDeviceOwnedState(bool *isOwned) { bool isDeviceOwned = true; OCStackResult ret = OC_STACK_ERROR; @@ -6248,13 +6248,13 @@ OCStackResult OCGetDeviceOwnedState(bool *isOwned) } #ifdef IP_ADAPTER -OCStackResult OCGetLinkLocalZoneId(uint32_t ifindex, char **zoneId) +OCStackResult OC_CALL OCGetLinkLocalZoneId(uint32_t ifindex, char **zoneId) { return CAResultToOCResult(CAGetLinkLocalZoneId(ifindex, zoneId)); } #endif -OCStackResult OCSelectCipherSuite(uint16_t cipher, OCTransportAdapter adapterType) +OCStackResult OC_CALL OCSelectCipherSuite(uint16_t cipher, OCTransportAdapter adapterType) { // OCTransportAdapter and CATransportAdapter_t are using the same bits for each transport. OC_STATIC_ASSERT((unsigned int)OC_ADAPTER_IP == (unsigned int)CA_ADAPTER_IP, @@ -6285,7 +6285,7 @@ OCStackResult OCSelectCipherSuite(uint16_t cipher, OCTransportAdapter adapterTyp return CAResultToOCResult(CASelectCipherSuite(cipher, (CATransportAdapter_t)adapterType)); } -OCStackResult OCGetIpv6AddrScope(const char *addr, OCTransportFlags *scope) +OCStackResult OC_CALL OCGetIpv6AddrScope(const char *addr, OCTransportFlags *scope) { // OCTransportFlags and CATransportFlags_t are using the same bits for each scope. OC_STATIC_ASSERT((unsigned int)OC_SCOPE_INTERFACE == (unsigned int)CA_SCOPE_INTERFACE, diff --git a/resource/csdk/stack/src/oicresourcedirectory.c b/resource/csdk/stack/src/oicresourcedirectory.c index ab7fa0f..92945fb 100644 --- a/resource/csdk/stack/src/oicresourcedirectory.c +++ b/resource/csdk/stack/src/oicresourcedirectory.c @@ -77,7 +77,7 @@ if (SQLITE_OK != (arg)) \ goto exit; \ } -OCStackResult OCRDDatabaseSetStorageFilename(const char *filename) +OCStackResult OC_CALL OCRDDatabaseSetStorageFilename(const char *filename) { if (!filename) { @@ -88,7 +88,7 @@ OCStackResult OCRDDatabaseSetStorageFilename(const char *filename) return OC_STACK_OK; } -const char *OCRDDatabaseGetStorageFilename() +const char *OC_CALL OCRDDatabaseGetStorageFilename() { return gRDPath; } @@ -364,7 +364,7 @@ exit: return result; } -OCStackResult OCRDDatabaseDiscoveryPayloadCreate(const char *interfaceType, +OCStackResult OC_CALL OCRDDatabaseDiscoveryPayloadCreate(const char *interfaceType, const char *resourceType, OCDiscoveryPayload **payload) { diff --git a/resource/include/OCProvisioningManager.hpp b/resource/include/OCProvisioningManager.hpp index 62d0782..7fdb50b 100644 --- a/resource/include/OCProvisioningManager.hpp +++ b/resource/include/OCProvisioningManager.hpp @@ -164,7 +164,7 @@ namespace OC * * @return OC_STACK_OK in case of success and other value otherwise. */ - static OCStackResult displayNumCallbackWrapper(void* ctx, + static OCStackResult OC_CALL displayNumCallbackWrapper(void* ctx, uint8_t verifNum[MUTUAL_VERIF_NUM_LEN]); /** @@ -172,7 +172,7 @@ namespace OC * * @return OC_STACK_OK in case of success and other value otherwise. */ - static OCStackResult confirmUserCallbackWrapper(void* ctx); + static OCStackResult OC_CALL confirmUserCallbackWrapper(void* ctx); /** * Notifier wrapper for trustCertChain change. diff --git a/resource/oc_logger/c/oc_console_logger.c b/resource/oc_logger/c/oc_console_logger.c index 5e2015b..9a88457 100644 --- a/resource/oc_logger/c/oc_console_logger.c +++ b/resource/oc_logger/c/oc_console_logger.c @@ -29,7 +29,7 @@ typedef struct FILE *out; } oc_console_logger_ctx; -oc_log_ctx_t *oc_make_console_logger() +oc_log_ctx_t *OC_CALL oc_make_console_logger() { return oc_log_make_ctx( NULL, diff --git a/resource/oc_logger/c/oc_logger.c b/resource/oc_logger/c/oc_logger.c index 77df219..3855336 100644 --- a/resource/oc_logger/c/oc_logger.c +++ b/resource/oc_logger/c/oc_logger.c @@ -24,7 +24,7 @@ #include #include -oc_log_ctx_t *oc_log_make_ctx( +oc_log_ctx_t *OC_CALL oc_log_make_ctx( void* world, const oc_log_level level, oc_log_init_t init, @@ -79,7 +79,7 @@ oc_log_ctx_t *oc_log_make_ctx( return log_ctx; } -void oc_log_destroy(oc_log_ctx_t *ctx) +void OC_CALL oc_log_destroy(oc_log_ctx_t *ctx) { if(!ctx) { @@ -106,7 +106,7 @@ int oc_log_init(oc_log_ctx_t *ctx, void *world) return ctx->init(ctx, world); } -void oc_log_flush(oc_log_ctx_t *ctx) +void OC_CALL oc_log_flush(oc_log_ctx_t *ctx) { if(!ctx) { @@ -115,7 +115,7 @@ void oc_log_flush(oc_log_ctx_t *ctx) ctx->flush(ctx); } -void oc_log_set_level(oc_log_ctx_t *ctx, const oc_log_level loglevel) +void OC_CALL oc_log_set_level(oc_log_ctx_t *ctx, const oc_log_level loglevel) { if(!ctx) { @@ -124,7 +124,7 @@ void oc_log_set_level(oc_log_ctx_t *ctx, const oc_log_level loglevel) ctx->set_level(ctx, loglevel); } -size_t oc_log_write(oc_log_ctx_t *ctx, const char *msg) +size_t OC_CALL oc_log_write(oc_log_ctx_t *ctx, const char *msg) { if(!ctx) { @@ -134,7 +134,7 @@ size_t oc_log_write(oc_log_ctx_t *ctx, const char *msg) return oc_log_write_level(ctx, ctx->log_level, msg); } -size_t oc_log_write_level(oc_log_ctx_t *ctx, const oc_log_level loglevel, const char *msg) +size_t OC_CALL oc_log_write_level(oc_log_ctx_t *ctx, const oc_log_level loglevel, const char *msg) { if(!ctx) { @@ -147,7 +147,7 @@ size_t oc_log_write_level(oc_log_ctx_t *ctx, const oc_log_level loglevel, const return ctx->write_level(ctx, loglevel, msg); } -int oc_log_set_module(oc_log_ctx_t *ctx, const char *module_name) +int OC_CALL oc_log_set_module(oc_log_ctx_t *ctx, const char *module_name) { char *mn = NULL; diff --git a/resource/oc_logger/cpp/oc_ostream_logger.cpp b/resource/oc_logger/cpp/oc_ostream_logger.cpp index 270a4c1..76ec05c 100644 --- a/resource/oc_logger/cpp/oc_ostream_logger.cpp +++ b/resource/oc_logger/cpp/oc_ostream_logger.cpp @@ -47,7 +47,7 @@ struct oc_ostream_logger_ctx } // namespace /* Courtesy-function: */ -oc_log_ctx_t *oc_make_ostream_logger() +oc_log_ctx_t *OC_CALL oc_make_ostream_logger() { return oc_log_make_ctx( nullptr, diff --git a/resource/oc_logger/include/oc_console_logger.h b/resource/oc_logger/include/oc_console_logger.h index b8b738f..f276d48 100644 --- a/resource/oc_logger/include/oc_console_logger.h +++ b/resource/oc_logger/include/oc_console_logger.h @@ -27,7 +27,7 @@ extern "C" { #endif -oc_log_ctx_t *oc_make_console_logger(); +oc_log_ctx_t *OC_CALL oc_make_console_logger(); int oc_console_logger_init(oc_log_ctx_t *ctx, void *world); void oc_console_logger_destroy(oc_log_ctx_t *ctx); diff --git a/resource/oc_logger/include/oc_logger.h b/resource/oc_logger/include/oc_logger.h index 9fd3878..3d5a446 100644 --- a/resource/oc_logger/include/oc_logger.h +++ b/resource/oc_logger/include/oc_logger.h @@ -22,13 +22,14 @@ #define OC_LOGGER_H_ #include "oc_logger_types.h" +#include "platform_features.h" #ifdef __cplusplus extern "C" { #endif /* Basic interface: */ -oc_log_ctx_t *oc_log_make_ctx( +oc_log_ctx_t * OC_CALL oc_log_make_ctx( void* world, const oc_log_level level, oc_log_init_t init, @@ -39,13 +40,13 @@ oc_log_ctx_t *oc_log_make_ctx( oc_log_set_module_t set_module ); -void oc_log_destroy(oc_log_ctx_t *ctx); +void OC_CALL oc_log_destroy(oc_log_ctx_t *ctx); -void oc_log_flush(oc_log_ctx_t *ctx); -void oc_log_set_level(oc_log_ctx_t *ctx, const oc_log_level ll); -size_t oc_log_write(oc_log_ctx_t *ctx, const char *msg); -size_t oc_log_write_level(oc_log_ctx_t *ctx, const oc_log_level ll, const char *msg); -int oc_log_set_module(oc_log_ctx_t *ctx, const char *module_name); +void OC_CALL oc_log_flush(oc_log_ctx_t *ctx); +void OC_CALL oc_log_set_level(oc_log_ctx_t *ctx, const oc_log_level ll); +size_t OC_CALL oc_log_write(oc_log_ctx_t *ctx, const char *msg); +size_t OC_CALL oc_log_write_level(oc_log_ctx_t *ctx, const oc_log_level ll, const char *msg); +int OC_CALL oc_log_set_module(oc_log_ctx_t *ctx, const char *module_name); #ifdef __cplusplus } // extern "C" diff --git a/resource/oc_logger/include/targets/oc_console_logger.h b/resource/oc_logger/include/targets/oc_console_logger.h index b8b738f..f276d48 100644 --- a/resource/oc_logger/include/targets/oc_console_logger.h +++ b/resource/oc_logger/include/targets/oc_console_logger.h @@ -27,7 +27,7 @@ extern "C" { #endif -oc_log_ctx_t *oc_make_console_logger(); +oc_log_ctx_t *OC_CALL oc_make_console_logger(); int oc_console_logger_init(oc_log_ctx_t *ctx, void *world); void oc_console_logger_destroy(oc_log_ctx_t *ctx); diff --git a/resource/oc_logger/include/targets/oc_ostream_logger.h b/resource/oc_logger/include/targets/oc_ostream_logger.h index 2fa7930..f838c2f 100644 --- a/resource/oc_logger/include/targets/oc_ostream_logger.h +++ b/resource/oc_logger/include/targets/oc_ostream_logger.h @@ -28,7 +28,7 @@ extern "C" { #endif -oc_log_ctx_t *oc_make_ostream_logger(); +oc_log_ctx_t *OC_CALL oc_make_ostream_logger(); int oc_ostream_log_init(oc_log_ctx_t *ctx, void *world); void oc_ostream_log_destroy(oc_log_ctx_t *ctx); diff --git a/resource/provisioning/src/OCProvisioningManager.cpp b/resource/provisioning/src/OCProvisioningManager.cpp index 5711c91..5f1153d 100644 --- a/resource/provisioning/src/OCProvisioningManager.cpp +++ b/resource/provisioning/src/OCProvisioningManager.cpp @@ -445,7 +445,7 @@ namespace OC return result; } - static void inputPinCallbackWrapper(OicUuid_t deviceId, char* pinBuffer, size_t pinBufferSize, void* context) + static void OC_CALL inputPinCallbackWrapper(OicUuid_t deviceId, char* pinBuffer, size_t pinBufferSize, void* context) { (static_cast(context))->callback(deviceId, pinBuffer, pinBufferSize); } @@ -647,7 +647,7 @@ namespace OC return result; } - static void displayPinCallbackWrapper(char* pinData, size_t pinDataSize, void* context) + static void OC_CALL displayPinCallbackWrapper(char* pinData, size_t pinDataSize, void* context) { (static_cast(context))->callback(pinData, pinDataSize); } @@ -795,7 +795,7 @@ namespace OC return result; } - OCStackResult OCSecure::displayNumCallbackWrapper(void* ctx, + OCStackResult OC_CALL OCSecure::displayNumCallbackWrapper(void* ctx, uint8_t verifNum[MUTUAL_VERIF_NUM_LEN]) { uint8_t *number = NULL; @@ -872,7 +872,7 @@ namespace OC return result; } - OCStackResult OCSecure::confirmUserCallbackWrapper(void* ctx) + OCStackResult OC_CALL OCSecure::confirmUserCallbackWrapper(void* ctx) { UserConfirmNumContext* context = static_cast(ctx); if (!context) -- 2.7.4